public void Render()
        {
            if (!Enabled)
            {
                return;
            }

            lineManager.ClearAllLines();

            var data = physXScene.GetDebugRenderable();


            if (data.PointCount > 0)
            {
                DebugPoint[] points = data.GetDebugPoints();

                for (int x = 0; x < data.LineCount; x++)
                {
                    lineManager.AddCenteredBox(points[x].Point.dx(), 0.01f, Int32ToColor(points[x].Color).dx());
                }
            }

            if (data.LineCount > 0)
            {
                DebugLine[] lines = data.GetDebugLines();

                for (int x = 0; x < data.LineCount; x++)
                {
                    DebugLine line = lines[x];

                    Color4 color4 = Int32ToColor(line.Color).dx();
                    color4.Alpha = 255; // Fix alpha
                    lineManager.AddLine(line.Point0.dx(), line.Point1.dx(), color4);
                }
            }

            if (data.TriangleCount > 0)
            {
                DebugTriangle[] triangles = data.GetDebugTriangles();

                for (int x = 0; x < data.TriangleCount; x++)
                {
                    DebugTriangle triangle = triangles[x];

                    lineManager.AddTriangle(triangle.Point0.dx(), triangle.Point1.dx(), triangle.Point2.dx(), Int32ToColor(triangle.Color).dx());
                }
            }

            game.LineManager3D.Render(lineManager, game.Camera);
        }
Ejemplo n.º 2
0
 private void renderWireframe(ObjImporter importer, LineManager3DLines lines, Color col, Vector3 offset)
 {
     for (int i = 0; i < importer.Groups.Count; i++)
     {
         for (int j = 0; j < importer.Groups[i].SubObjects.Count; j++)
         {
             for (int k = 0; k < importer.Groups[i].SubObjects[j].Faces.Count; k++)
             {
                 lines.AddTriangle(
                     importer.Vertices[
                         importer.Groups[i].SubObjects[j].Faces[k].V1.Position] + offset,
                     importer.Vertices[
                         importer.Groups[i].SubObjects[j].Faces[k].V2.Position] + offset,
                     importer.Vertices[
                         importer.Groups[i].SubObjects[j].Faces[k].V3.Position] + offset,
                     col);
             }
         }
     }
 }