Esempio n. 1
0
 public InstancedModelRenderData( InstancedModel model )
 {
     this.model = model;
       this.model.SetInstancingTechnique( InstancingTechnique.HardwareInstancing,
                                  StaticInstanceVertex.VertexElements );
       instances = new StaticInstanceVertex[MaxInstances];
       vertexBuffer = new WritableVertexBuffer( ZombieCraft.Instance.GraphicsDevice,
                                        typeof( StaticInstanceVertex ),
                                        MaxInstances, 3 );
       instanceCount = 0;
 }
Esempio n. 2
0
        internal InstancedModelPart( InstancedModel owner, ContentReader input,
            GraphicsDevice graphicsDevice)
        {
            this.owner = owner;

              indexCount = input.ReadInt32();
              vertexCount = input.ReadInt32();
              vertexStride = input.ReadInt32();

              vertexDeclaration = input.ReadObject<VertexDeclaration>();
              vertexBuffer = input.ReadObject<VertexBuffer>();
              indexBuffer = input.ReadObject<IndexBuffer>();

              input.ReadSharedResource<Effect>( delegate( Effect value )
              {
            Effect = value;
            effectVertexCountParam = Effect.Parameters["VertexCount"];
            effectViewParam = Effect.Parameters["View"];
            effectProjectionParam = Effect.Parameters["Projection"];
            effectEyeParam = Effect.Parameters["EyePosition"];
              } );

              originalVertexDeclaration = vertexDeclaration.GetVertexElements();
        }
Esempio n. 3
0
 public static InstanceTransformRef GetInstanceRef( InstancedModel model )
 {
     if ( !instancedModels.ContainsKey( model ) )
     instancedModels.Add( model, new InstancedModelRenderData( model ) );
       return instancedModels[model].AddInstance();
 }