-1

如何将此代码部分从 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);
    }
4

1 回答 1

1

Microsoft 在一系列 MSDN 文章和代码示例中强调了这些差异。

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

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

文章

PS:您的回答可能被否决了,因为您没有专门遇到麻烦并询问具体问题?

于 2013-04-12T12:24:03.840 回答