如何向我的演员/ShapeDesc PhysX.net添加纹理

如何向我的演员/ShapeDesc PhysX.net添加纹理,.net,xna,textures,physx,.net,Xna,Textures,Physx,如何将纹理添加到PhysX.net中的Actors/ShapeDesc 我正在使用XNA和PhysX.NET 我已经设置好了场景和一切,一切正常,但我的游戏引擎在线框模式下看起来不太好,你知道我的意思 再次感谢你 // Add some boxes to the scene for (int x = 0; x < 20; x++) { for (int y = 0; y < 20; y++) { BoxShapeDescription boxShape

如何将纹理添加到PhysX.net中的Actors/ShapeDesc

我正在使用XNA和PhysX.NET

我已经设置好了场景和一切,一切正常,但我的游戏引擎在线框模式下看起来不太好,你知道我的意思

再次感谢你

// Add some boxes to the scene
for (int x = 0; x < 20; x++)
{
    for (int y = 0; y < 20; y++)
    {
        BoxShapeDescription boxShapeDesc = new BoxShapeDescription(2, 8, 3);

        ActorDescription actorDesc = new ActorDescription()
        {
            Name = String.Format("Box {0}", x),
            BodyDescription = new BodyDescription(10.0f),
            GlobalPose = StillDesign.PhysX.MathPrimitives.Matrix.Translation(y*2, 20 + 8 * x, 0),
            Shapes = { boxShapeDesc }

        };

        Actor actor = this.Scene.CreateActor(actorDesc);
    }
}
和<代码>Int32ToColor():

// TODO: Add your drawing code here
DebugRenderable data = this.Scene.GetDebugRenderable();
foreach (EffectPass ep in visEff.CurrentTechnique.Passes)
{
    ep.Apply(); //Veeery simple now!
    if (data.LineCount > 0)
    {
        DebugLine[] lines = data.GetDebugLines();

        VertexPositionColor[] vertices = new VertexPositionColor[data.LineCount * 2];
        for (int x = 0; x < data.LineCount; x++)
        {
            DebugLine line = lines[x];

            vertices[x * 2 + 0] = new VertexPositionColor(new Vector3(line.Point0.X, line.Point0.Y, line.Point0.Z), Int32ToColor(line.Color));
            vertices[x * 2 + 1] = new VertexPositionColor(new Vector3(line.Point1.X, line.Point1.Y, line.Point1.Z), Int32ToColor(line.Color));
        }

        GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, vertices, 0, lines.Length);
    }

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

        VertexPositionColor[] vertices = new VertexPositionColor[data.TriangleCount * 3];
        for (int x = 0; x < data.TriangleCount; x++)
        {
            DebugTriangle triangle = triangles[x];                 

            vertices[x * 3 + 0] = new VertexPositionColor(new Vector3(triangle.Point0.X, triangle.Point0.Y, triangle.Point0.Z), Int32ToColor(triangle.Color));
            vertices[x * 3 + 1] = new VertexPositionColor(new Vector3(triangle.Point1.X, triangle.Point1.Y, triangle.Point1.Z), Int32ToColor(triangle.Color));
            vertices[x * 3 + 2] = new VertexPositionColor(new Vector3(triangle.Point2.X, triangle.Point2.Y, triangle.Point2.Z), Int32ToColor(triangle.Color));
        }

        GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, vertices, 0, triangles.Length);
    }
}
public static Color Int32ToColor( int color )
{
    byte a = (byte)( ( color & 0xFF000000 ) >> 32 );
    byte r = (byte)( ( color & 0x00FF0000 ) >> 16 );
    byte g = (byte)( ( color & 0x0000FF00 ) >> 8 );
    byte b = (byte)( ( color & 0x000000FF ) >> 0 );

    return new Color( r, g, b, a );
}