示例#1
0
 public unsafe void SetWorld(WorldMatrixHandle world)
 {
     if (world.Source == (Matrix4x4 *)0)
     {
         var id = Matrix4x4.Identity;
         if (worldPosition != -1)
         {
             shader.SetMatrix(worldPosition, ref id);
         }
         if (normalMatrixPosition != -1)
         {
             shader.SetMatrix(normalMatrixPosition, ref id);
         }
     }
     else if (world.ID == ulong.MaxValue || shader.UserTag != world.ID)
     {
         shader.UserTag = world.ID;
         if (worldPosition != -1)
         {
             shader.SetMatrix(worldPosition, (IntPtr)world.Source);
         }
         if (normalMatrixPosition != -1)
         {
             shader.SetMatrix(normalMatrixPosition, (IntPtr)(&world.Source[1]));
         }
     }
 }
        unsafe void RenderSurs(ICamera cam)
        {
            var mat     = wireframeMaterial3db.Render;
            var world   = GetModelMatrix();
            var whandle = new WorldMatrixHandle()
            {
                ID     = (ulong)Environment.TickCount,
                Source = &world,
            };

            rstate.Cull       = false;
            rstate.DepthWrite = false;
            var bm = ((BasicMaterial)mat);

            bm.Oc                = 1;
            bm.OcEnabled         = true;
            rstate.PolygonOffset = new Vector2(1, 1);
            foreach (var mdl in surs)
            {
                if (mdl.Hardpoint && !surShowHps)
                {
                    continue;
                }
                if (!mdl.Hardpoint && !surShowHull)
                {
                    continue;
                }
                mat.Camera = cam;
                mat.World  = whandle;
                mat.Use(rstate, new VertexPositionColor(), ref Lighting.Empty);
                foreach (var dc in mdl.Draws)
                {
                    mdl.Vertices.Draw(PrimitiveTypes.TriangleList, dc.BaseVertex, dc.Start, dc.Count);
                }
            }
            rstate.PolygonOffset = new Vector2(0, 0);
            bm.OcEnabled         = false;
            rstate.DepthWrite    = true;
            rstate.Cull          = true;
        }
示例#3
0
 public void DrawBuffer(DfmSkinning skinning, CommandBuffer buffer, VertexBuffer vbo, WorldMatrixHandle world, Lighting lights, Material overrideMat)
 {
     buffer.AddCommand(
         (overrideMat ?? Material).Render,
         null,
         world,
         lights,
         vbo,
         PrimitiveTypes.TriangleStrip,
         0,
         StartIndex,
         TriangleStripIndices.Length - 2,
         SortLayers.OPAQUE,
         0,
         skinning
         );
 }