BEPUphysicsDrawer.Models.DisplayTriangle.GetShapeMeshData C# (CSharp) Метод

GetShapeMeshData() публичный статический Метод

public static GetShapeMeshData ( EntityCollidable collidable, List vertices, List indices ) : void
collidable BEPUphysics.BroadPhaseEntries.MobileCollidables.EntityCollidable
vertices List
indices List
Результат void
        public static void GetShapeMeshData(EntityCollidable collidable, List<VertexPositionNormalTexture> vertices, List<ushort> indices)
        {
            var triangleShape = collidable.Shape as TriangleShape;
            if(triangleShape == null)
                throw new ArgumentException("Wrong shape type.");
            Vector3 normal = triangleShape.GetLocalNormal();
            vertices.Add(new VertexPositionNormalTexture(triangleShape.VertexA, -normal, new Vector2(0, 0)));
            vertices.Add(new VertexPositionNormalTexture(triangleShape.VertexB, -normal, new Vector2(0, 1)));
            vertices.Add(new VertexPositionNormalTexture(triangleShape.VertexC, -normal, new Vector2(1, 0)));

            vertices.Add(new VertexPositionNormalTexture(triangleShape.VertexA, normal, new Vector2(0, 0)));
            vertices.Add(new VertexPositionNormalTexture(triangleShape.VertexB, normal, new Vector2(0, 1)));
            vertices.Add(new VertexPositionNormalTexture(triangleShape.VertexC, normal, new Vector2(1, 0)));

            indices.Add(0);
            indices.Add(1);
            indices.Add(2);

            indices.Add(3);
            indices.Add(5);
            indices.Add(4);
        }
    }
DisplayTriangle