从XNA3.1到xna4.0的转换
本文关键字:转换 xna4 XNA3 | 更新日期: 2023-09-27 18:08:55
如何将此代码部分从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);
}
Microsoft在MSDN的一系列文章和代码示例中强调了这些差异。
你也可以使用这里提供的备忘单:
http://nelxon.com/resources/xna-3-1-to-xna-4-0-cheatsheet.php 文章:
- 转换3D XNA 3.0游戏到XNA 4.0 -一个例子
- XNA开发中心
PS:你的回答可能被否决了,因为你没有具体地遇到麻烦并询问具体问题?