コード例 #1
0
 public void AddCommand(Shader shader, ShaderAction setup, Action <RenderContext> cleanup, WorldMatrixHandle world, RenderUserData user, VertexBuffer buffer, PrimitiveTypes primitive, int start, int count, bool transparent, int layer, float z = 0, int renIndex = 0)
 {
     if (transparent)
     {
         Transparents[transparentCommand++] = new RenderCommand()
         {
             Key         = RenderCommand.MakeKey(RenderType.Transparent, 0, layer, z, renIndex),
             Source      = shader,
             ShaderSetup = setup,
             World       = world,
             UserData    = user,
             Cleanup     = cleanup,
             Buffer      = buffer,
             Start       = start,
             Count       = count,
             Primitive   = primitive,
             CmdType     = RenderCmdType.Shader,
             BaseVertex  = -1,
         };
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
コード例 #2
0
 public void AddCommand(Billboards billboards, int hash, int index, int sortLayer, float z)
 {
     Transparents[transparentCommand++] = new RenderCommand()
     {
         Key     = RenderCommand.MakeKey(RenderType.Transparent, 0, sortLayer, z, 0),
         CmdType = RenderCmdType.Billboard,
         Source  = billboards,
         Hash    = hash,
         Index   = index,
     };
 }
コード例 #3
0
 //TODO: Implement MaterialAnim for asteroids
 public unsafe void AddCommandFade(RenderMaterial material, WorldMatrixHandle world, Lighting lights, VertexBuffer buffer, PrimitiveTypes primitive, int start, int count, int layer, Vector2 fadeParams, float z = 0)
 {
     Transparents[transparentCommand++] = new RenderCommand()
     {
         Key          = RenderCommand.MakeKey(RenderType.Transparent, material.Key, layer, z, 0),
         Source       = material,
         MaterialAnim = null,
         Lights       = lights,
         Buffer       = buffer,
         Start        = start,
         Count        = count,
         Primitive    = primitive,
         CmdType      = RenderCmdType.MaterialFade,
         BaseVertex   = *(int *)(&fadeParams.X),
         Index        = *(int *)(&fadeParams.Y),
         World        = world,
     };
 }
コード例 #4
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;
         }
     }
 }