C# Class Indiefreaks.Xna.Rendering.Instancing.InstanceFactory

The InstanceFactory is responsible of creating and maintaining InstanceEntity instances
Inheritance: IDisposable
Afficher le fichier Open project: Indiefreaks/igf Class Usage Examples

Méthodes publiques

Méthode Description
CreateInstance ( string name, Matrix transform ) : InstanceEntity

Create one unique instance of the mesh

CreateInstances ( string names, Matrix transforms ) : Indiefreaks.Xna.Rendering.Instancing.InstanceEntity[]

Creates an array of instances of the mesh

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Méthodes protégées

Méthode Description
InstanceFactory ( GraphicsDevice graphicsDevice, IInstanceSource source, Effect shader ) : System

Creates a new instance of the class

The provided shader should be either LightingEffect or DeferredObjectEffect and set is Skinned property to true

Private Methods

Méthode Description
AddGeometry ( int instancetransformindex ) : bool

Add the required Geometry for hardware instancing

BuildGeometry ( ) : void

Builds the Geometry into the required VertexBuffer and IndexBuffer

ClearGraphicsResources ( bool totally ) : void

Clear the VertexBuffer and IndexBuffer

ClearIntermediateData ( ) : void

Clear the IntermediateData used to build geometry

CreateNewSceneObject ( ) : SceneObject

Creates a new SceneObject to host up to 75 instances

GetSceneObject ( ) : SceneObject

Retrieves the best SceneObject to add a new instance

Method Details

CreateInstance() public méthode

Create one unique instance of the mesh
public CreateInstance ( string name, Matrix transform ) : InstanceEntity
name string The name of the instance
transform Matrix The Matrix containing the instance World position/rotation/scale
Résultat InstanceEntity

CreateInstances() public méthode

Creates an array of instances of the mesh
public CreateInstances ( string names, Matrix transforms ) : Indiefreaks.Xna.Rendering.Instancing.InstanceEntity[]
names string The names array for all the instances to be created
transforms Matrix The World matrix array for all the instances to be created
Résultat Indiefreaks.Xna.Rendering.Instancing.InstanceEntity[]

Dispose() public méthode

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Résultat void

InstanceFactory() protected méthode

Creates a new instance of the class
The provided shader should be either LightingEffect or DeferredObjectEffect and set is Skinned property to true
protected InstanceFactory ( GraphicsDevice graphicsDevice, IInstanceSource source, Effect shader ) : System
graphicsDevice GraphicsDevice The GraphicsDevice instance
source IInstanceSource The mesh data information used to create instances
shader Microsoft.Xna.Framework.Graphics.Effect The shader shared accross all instances
Résultat System