示例#1
0
 public void AddCommand(RenderMaterial material, MaterialAnim anim, WorldMatrixHandle world, Lighting lights, VertexBuffer buffer, PrimitiveTypes primitive, int baseVertex, int start, int count, int layer, float z = 0, DfmSkinning skinning = null)
 {
     if (material.IsTransparent)
     {
         Transparents[transparentCommand++] = new RenderCommand()
         {
             Source       = material,
             MaterialAnim = anim,
             Lights       = lights,
             Buffer       = buffer,
             BaseVertex   = baseVertex,
             Start        = start,
             Count        = count,
             Primitive    = primitive,
             CmdType      = RenderCmdType.Material,
             World        = world,
             SortLayer    = layer,
             Z            = z
         };
     }
     else
     {
         if (skinning != null)
         {
             material.Bones        = BonesBuffer;
             material.BufferOffset = skinning.BufferOffset;
         }
         else
         {
             material.Bones = null;
         }
         material.MaterialAnim = anim;
         material.World        = world;
         material.Use(rstate, buffer.VertexType, ref lights);
         buffer.Draw(primitive, baseVertex, start, count);
         if (material.DoubleSided)
         {
             material.FlipNormals = true;
             material.UpdateFlipNormals();
             rstate.CullFace = CullFaces.Front;
             buffer.Draw(primitive, baseVertex, start, count);
             rstate.CullFace      = CullFaces.Back;
             material.FlipNormals = false;
         }
     }
 }
示例#2
0
 public void AddCommand(RenderMaterial material, MaterialAnim anim, WorldMatrixHandle world, Lighting lights, VertexBuffer buffer, PrimitiveTypes primitive, int baseVertex, int start, int count, int layer, float z = 0, DfmSkinning skinning = null)
 {
     if (material.IsTransparent)
     {
         Transparents[transparentCommand++] = new RenderCommand()
         {
             Key          = RenderCommand.MakeKey(RenderType.Transparent, material.Key, layer, z, 0),
             Source       = material,
             MaterialAnim = anim,
             Lights       = lights,
             Buffer       = buffer,
             BaseVertex   = baseVertex,
             Start        = start,
             Count        = count,
             Primitive    = primitive,
             CmdType      = RenderCmdType.Material,
             World        = world,
         };
     }
     else
     {
         if (skinning != null)
         {
             material.Bones        = BonesBuffer;
             material.BufferOffset = skinning.BufferOffset;
         }
         else
         {
             material.Bones = null;
         }
         material.MaterialAnim = anim;
         material.World        = world;
         material.Use(rstate, buffer.VertexType, ref lights);
         if (material.DoubleSided)
         {
             rstate.Cull = false;
         }
         buffer.Draw(primitive, baseVertex, start, count);
         if (material.DoubleSided)
         {
             rstate.Cull = true;
         }
     }
 }