从XNA3.1转换为XNA 4.0

时间:2013-04-12 12:14:16

标签: c# xna xna-4.0 xna-3.0

如何将此代码部件从XNA 3.1转换为XNA 4.0 如果有人知道请帮助。

public ModelLightMesh(Viewer3D viewer, Vector3 position, float radius, Color color, float u0, float v0, float u1, float v1)
    {
        var verticies = new[] {
            new VertexPositionColorTexture(new Vector3(position.X - radius, position.Y + radius, position.Z), color, new Vector2(u1, v0)),
            new VertexPositionColorTexture(new Vector3(position.X + radius, position.Y + radius, position.Z), color, new Vector2(u0, v0)),
            new VertexPositionColorTexture(new Vector3(position.X + radius, position.Y - radius, position.Z), color, new Vector2(u0, v1)),
            new VertexPositionColorTexture(new Vector3(position.X - radius, position.Y - radius, position.Z), color, new Vector2(u1, v1)),
        };
        VertexDeclaration = new VertexDeclaration(viewer.GraphicsDevice, VertexPositionColorTexture.VertexElements);
        VertexBuffer = new VertexBuffer(viewer.GraphicsDevice, VertexPositionColorTexture.SizeInBytes * verticies.Length, BufferUsage.WriteOnly);
        VertexBuffer.SetData(verticies);
    }

1 个答案:

答案 0 :(得分:1)

Microsoft强调了一系列MSDN文章与代码示例的差异。

您也可以使用此处提供的备忘单:

http://nelxon.com/resources/xna-3-1-to-xna-4-0-cheatsheet.php

<强>文章

PS:您的回答可能已被低估,因为您没有特别遇到麻烦并询问具体问题?