<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>中文 &#187; aawolf</title>
	<atom:link href="http://software.intel.com/zh-cn/blogs/author/aawolf/feed/" rel="self" type="application/rss+xml" />
	<link>http://software.intel.com/zh-cn/blogs</link>
	<description></description>
	<lastBuildDate>Mon, 28 May 2012 13:40:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Windows Phone XNA 4.0 3D 游戏开发</title>
		<link>http://software.intel.com/zh-cn/blogs/2010/12/16/windows-phone-xna-40-3d/</link>
		<comments>http://software.intel.com/zh-cn/blogs/2010/12/16/windows-phone-xna-40-3d/#comments</comments>
		<pubDate>Thu, 16 Dec 2010 11:01:27 +0000</pubDate>
		<dc:creator>aawolf</dc:creator>
				<category><![CDATA[博客征文专栏]]></category>
		<category><![CDATA[游戏]]></category>

		<guid isPermaLink="false">http://software.intel.com/zh-cn/blogs/2010/12/16/windows-phone-xna-40-3d/</guid>
		<description><![CDATA[程序代码编译环境Visual Stuido 2010, Windows Phone 7 SDK, XNA 4.0 Game Studio, 下载链接： http://files.cnblogs.com/aawolf/XNA_aawolf_3D.rar 今天有点空余时间，在看Windows Phone 7的开发。看到Silverlight for phone和XNA 4.0的开发文章已经有了不少，而且质量很高。我就来说说XNA 4.0的3D开发这个领域吧，正好跟目前的工作有些关系，而且XNA 4.0的3D类库设计的非常好，比iPhone和Android的OpenGLES类库高出一个档次。以后学习3D开发，用XNA类库也是个不错的选择，而且Windows Phone模拟器对3D的支持也非常好。唯一的遗憾是，Windows Phone不支持C++的3D开发。 如果做过Zune上XNA 3.1开发的朋友可能会记得，在XNA 3.1中是不支持3D开发的，XNA 4.0中加入的3D支持类，主要包含在Microsoft.Xna.Framework.Graphics命名空间中。如果XNA 4.0中的3D概念与OpenGLES十分相似，我们可以找到很多相对应的函数、方法等，某种意义上，XNA 4.0的3D支持是对OpenGLES 2.0的封装。 一.一个简单的3D程序 我们就从一个简单的3D程序开始吧，这个程序的原来介绍在下面这个链接里。 http://msdn.microsoft.com/en-us/library/bb203926.aspx 不过移植到Windows Phone 7上时，还是遇到了一些小问题，有的是文档的问题，有的是接口变化。如何在Visual Studio 2010里创建XNA 4.0的工程就不多说了，大家可以参考我写的《Windows Phone开发工具初体验》，链接如下： http://www.cnblogs.com/aawolf/archive/2010/08/28/1811438.html XNA 4.0的程序是派生自Microsoft.Xna.Framework.Game的类，开发者需要重载Game的四个方法：Initialize（初始化）、LoadContent（加载内容）、UnloadContent（卸载内容）、Update（更新）和Draw（绘制）等方法。 首先，我们在Game1类中加入所需要的一些私有变量： Matrix worldMatrix; Matrix viewMatrix; Matrix projectionMatrix; VertexPositionNormalTexture[] cubeVertices; VertexDeclaration vertexDeclaration; VertexBuffer [...]]]></description>
			<content:encoded><![CDATA[<p>程序代码编译环境Visual Stuido 2010, Windows Phone 7 SDK, XNA 4.0 Game Studio, 下载链接：</p>
<p>http://files.cnblogs.com/aawolf/XNA_aawolf_3D.rar</p>
<p>今天有点空余时间，在看Windows Phone 7的开发。看到Silverlight for phone和XNA 4.0的开发文章已经有了不少，而且质量很高。我就来说说XNA 4.0的3D开发这个领域吧，正好跟目前的工作有些关系，而且XNA 4.0的3D类库设计的非常好，比iPhone和Android的OpenGLES类库高出一个档次。以后学习3D开发，用XNA类库也是个不错的选择，而且Windows Phone模拟器对3D的支持也非常好。唯一的遗憾是，Windows Phone不支持C++的3D开发。</p>
<p>如果做过Zune上XNA 3.1开发的朋友可能会记得，在XNA 3.1中是不支持3D开发的，XNA 4.0中加入的3D支持类，主要包含在Microsoft.Xna.Framework.Graphics命名空间中。如果XNA 4.0中的3D概念与OpenGLES十分相似，我们可以找到很多相对应的函数、方法等，某种意义上，XNA 4.0的3D支持是对OpenGLES 2.0的封装。</p>
<p>一.一个简单的3D程序</p>
<p>我们就从一个简单的3D程序开始吧，这个程序的原来介绍在下面这个链接里。</p>
<p>http://msdn.microsoft.com/en-us/library/bb203926.aspx</p>
<p>不过移植到Windows Phone 7上时，还是遇到了一些小问题，有的是文档的问题，有的是接口变化。如何在Visual Studio 2010里创建XNA 4.0的工程就不多说了，大家可以参考我写的《Windows Phone开发工具初体验》，链接如下：</p>
<p>http://www.cnblogs.com/aawolf/archive/2010/08/28/1811438.html</p>
<p>XNA 4.0的程序是派生自Microsoft.Xna.Framework.Game的类，开发者需要重载Game的四个方法：Initialize（初始化）、LoadContent（加载内容）、UnloadContent（卸载内容）、Update（更新）和Draw（绘制）等方法。</p>
<p>首先，我们在Game1类中加入所需要的一些私有变量：</p>
<p>Matrix worldMatrix;</p>
<p>Matrix viewMatrix;</p>
<p>Matrix projectionMatrix;</p>
<p>VertexPositionNormalTexture[] cubeVertices;</p>
<p>VertexDeclaration vertexDeclaration;</p>
<p>VertexBuffer vertexBuffer;</p>
<p>BasicEffect basicEffect;</p>
<p>Martrix 的中文名叫“矩阵”，还有个翻译叫“黑客帝国”……扯远了，什么是矩阵？我们就不解释了，只要知道矩阵是一切3D线性变化的基础就可以了。我们不知道矩阵是什么，却身处其中。在Game1类中用了三个矩阵：worldMatrix用来描述世界坐标系；viewMatrix用来描述摄影机坐标系；projectionMatrix用来描述投影坐标系。这些都是3D图形学的概念，不解释了。</p>
<p>另外两个重要的变量是vertexBuffer和basicEffect。vertexBuffer包含了一系列的向量，这些向量构成了我们要显示的正方体的各个顶点；basicEffect用来描述一个基础的渲染效果，其中描述了坐标系、颜色和灯光等基本的要素，这些要素是3D图形显示的基础。</p>
<p>接下来创建一个叫InitMatrices的方法，对各个坐标系进行初始化，记得，这个InitMatrices的函数是我们自己创建的，代码如下：</p>
<p>private void InitMatrices()</p>
<p>{</p>
<p>// Initialize the world, view, and projection matrices.</p>
<p>float tilt = MathHelper.ToRadians(0); // 0 degree angle</p>
<p>// Use the world matrix to tilt the cube along x and y axes.</p>
<p>worldMatrix = Matrix.CreateRotationX(tilt) * Matrix.CreateRotationY(tilt);</p>
<p>viewMatrix = Matrix.CreateLookAt(new Vector3(5, 5, 5), Vector3.Zero, Vector3.Up);</p>
<p>projectionMatrix = Matrix.CreatePerspectiveFieldOfView(</p>
<p>MathHelper.ToRadians(45), // 45 degree angle</p>
<p>(float)GraphicsDevice.Viewport.Width /</p>
<p>(float)GraphicsDevice.Viewport.Height,</p>
<p>1.0f, 100.0f);</p>
<p>}</p>
<p>算了，不解释了，大家知道这段代码在干什么就好了。接下来，创建一个叫做InitEffect的函数中，对basicEffect进行初始化，代码如下：</p>
<p>private void InitEffect()</p>
<p>{</p>
<p>// Initialize BasicEffect with transformation and light values</p>
<p>basicEffect = new BasicEffect(graphics.GraphicsDevice);</p>
<p>basicEffect.World = worldMatrix;</p>
<p>basicEffect.View = viewMatrix;</p>
<p>basicEffect.Projection = projectionMatrix;</p>
<p>// primitive color</p>
<p>basicEffect.AmbientLightColor = new Vector3(0.1f, 0.1f, 0.1f);</p>
<p>basicEffect.DiffuseColor = new Vector3(1.0f, 1.0f, 1.0f);</p>
<p>basicEffect.SpecularColor = new Vector3(0.25f, 0.25f, 0.25f);</p>
<p>basicEffect.SpecularPower = 5.0f;</p>
<p>basicEffect.Alpha = 1.0f;</p>
<p>basicEffect.LightingEnabled = true;</p>
<p>if (basicEffect.LightingEnabled)</p>
<p>{</p>
<p>basicEffect.DirectionalLight0.Enabled = true; // enable each light individually</p>
<p>if (basicEffect.DirectionalLight0.Enabled)</p>
<p>{</p>
<p>// x direction</p>
<p>basicEffect.DirectionalLight0.DiffuseColor = new Vector3(1, 0, 0); // range is 0 to 1</p>
<p>basicEffect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(-1, 0, 0));</p>
<p>// points from the light to the origin of the scene</p>
<p>basicEffect.DirectionalLight0.SpecularColor = Vector3.One;</p>
<p>}</p>
<p>basicEffect.DirectionalLight1.Enabled = true;</p>
<p>if (basicEffect.DirectionalLight1.Enabled)</p>
<p>{</p>
<p>// y direction</p>
<p>basicEffect.DirectionalLight1.DiffuseColor = new Vector3(0, 0.75f, 0);</p>
<p>basicEffect.DirectionalLight1.Direction = Vector3.Normalize(new Vector3(0, -1, 0));</p>
<p>basicEffect.DirectionalLight1.SpecularColor = Vector3.One;</p>
<p>}</p>
<p>basicEffect.DirectionalLight2.Enabled = true;</p>
<p>if (basicEffect.DirectionalLight2.Enabled)</p>
<p>{</p>
<p>// z direction</p>
<p>basicEffect.DirectionalLight2.DiffuseColor = new Vector3(0, 0, 0.5f);</p>
<p>basicEffect.DirectionalLight2.Direction = Vector3.Normalize(new Vector3(0, 0, -1));</p>
<p>basicEffect.DirectionalLight2.SpecularColor = Vector3.One;</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>然后要对vertexDeclaration、cubeVertices和vertexBuffer变量进行初始化，我们将这部分代码放在InitVertexBuffer函数中：</p>
<p>private void InitVertexBuffer()</p>
<p>{</p>
<p>// Create a vertex declaration for the type VertexPositionNormalTexture</p>
<p>vertexDeclaration = new VertexDeclaration(new VertexElement[]</p>
<p>{</p>
<p>new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),</p>
<p>new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),</p>
<p>new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0)</p>
<p>}</p>
<p>);</p>
<p>// Create the per vertex data</p>
<p>cubeVertices = new VertexPositionNormalTexture[36];</p>
<p>Vector3 topLeftFront = new Vector3(-1.0f, 1.0f, 1.0f);</p>
<p>Vector3 bottomLeftFront = new Vector3(-1.0f, -1.0f, 1.0f);</p>
<p>Vector3 topRightFront = new Vector3(1.0f, 1.0f, 1.0f);</p>
<p>Vector3 bottomRightFront = new Vector3(1.0f, -1.0f, 1.0f);</p>
<p>Vector3 topLeftBack = new Vector3(-1.0f, 1.0f, -1.0f);</p>
<p>Vector3 topRightBack = new Vector3(1.0f, 1.0f, -1.0f);</p>
<p>Vector3 bottomLeftBack = new Vector3(-1.0f, -1.0f, -1.0f);</p>
<p>Vector3 bottomRightBack = new Vector3(1.0f, -1.0f, -1.0f);</p>
<p>Vector2 textureTopLeft = new Vector2(0.0f, 0.0f);</p>
<p>Vector2 textureTopRight = new Vector2(1.0f, 0.0f);</p>
<p>Vector2 textureBottomLeft = new Vector2(0.0f, 1.0f);</p>
<p>Vector2 textureBottomRight = new Vector2(1.0f, 1.0f);</p>
<p>Vector3 frontNormal = new Vector3(0.0f, 0.0f, 1.0f);</p>
<p>Vector3 backNormal = new Vector3(0.0f, 0.0f, -1.0f);</p>
<p>Vector3 topNormal = new Vector3(0.0f, 1.0f, 0.0f);</p>
<p>Vector3 bottomNormal = new Vector3(0.0f, -1.0f, 0.0f);</p>
<p>Vector3 leftNormal = new Vector3(-1.0f, 0.0f, 0.0f);</p>
<p>Vector3 rightNormal = new Vector3(1.0f, 0.0f, 0.0f);</p>
<p>// Front face.</p>
<p>cubeVertices[0] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topLeftFront, frontNormal, textureTopLeft);</p>
<p>cubeVertices[1] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftFront, frontNormal, textureBottomLeft);</p>
<p>cubeVertices[2] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightFront, frontNormal, textureTopRight);</p>
<p>cubeVertices[3] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftFront, frontNormal, textureBottomLeft);</p>
<p>cubeVertices[4] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomRightFront, frontNormal, textureBottomRight);</p>
<p>cubeVertices[5] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightFront, frontNormal, textureTopRight);</p>
<p>// Back face.</p>
<p>cubeVertices[6] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topLeftBack, backNormal, textureTopRight);</p>
<p>cubeVertices[7] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightBack, backNormal, textureTopLeft);</p>
<p>cubeVertices[8] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftBack, backNormal, textureBottomRight);</p>
<p>cubeVertices[9] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftBack, backNormal, textureBottomRight);</p>
<p>cubeVertices[10] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightBack, backNormal, textureTopLeft);</p>
<p>cubeVertices[11] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomRightBack, backNormal, textureBottomLeft);</p>
<p>// Top face.</p>
<p>cubeVertices[12] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topLeftFront, topNormal, textureBottomLeft);</p>
<p>cubeVertices[13] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightBack, topNormal, textureTopRight);</p>
<p>cubeVertices[14] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topLeftBack, topNormal, textureTopLeft);</p>
<p>cubeVertices[15] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topLeftFront, topNormal, textureBottomLeft);</p>
<p>cubeVertices[16] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightFront, topNormal, textureBottomRight);</p>
<p>cubeVertices[17] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightBack, topNormal, textureTopRight);</p>
<p>// Bottom face.</p>
<p>cubeVertices[18] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftFront, bottomNormal, textureTopLeft);</p>
<p>cubeVertices[19] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftBack, bottomNormal, textureBottomLeft);</p>
<p>cubeVertices[20] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomRightBack, bottomNormal, textureBottomRight);</p>
<p>cubeVertices[21] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftFront, bottomNormal, textureTopLeft);</p>
<p>cubeVertices[22] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomRightBack, bottomNormal, textureBottomRight);</p>
<p>cubeVertices[23] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomRightFront, bottomNormal, textureTopRight);</p>
<p>// Left face.</p>
<p>cubeVertices[24] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topLeftFront, leftNormal, textureTopRight);</p>
<p>cubeVertices[25] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftBack, leftNormal, textureBottomLeft);</p>
<p>cubeVertices[26] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftFront, leftNormal, textureBottomRight);</p>
<p>cubeVertices[27] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topLeftBack, leftNormal, textureTopLeft);</p>
<p>cubeVertices[28] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomLeftBack, leftNormal, textureBottomLeft);</p>
<p>cubeVertices[29] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topLeftFront, leftNormal, textureTopRight);</p>
<p>// Right face.</p>
<p>cubeVertices[30] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightFront, rightNormal, textureTopLeft);</p>
<p>cubeVertices[31] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomRightFront, rightNormal, textureBottomLeft);</p>
<p>cubeVertices[32] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomRightBack, rightNormal, textureBottomRight);</p>
<p>cubeVertices[33] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightBack, rightNormal, textureTopRight);</p>
<p>cubeVertices[34] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>topRightFront, rightNormal, textureTopLeft);</p>
<p>cubeVertices[35] =</p>
<p>new VertexPositionNormalTexture(</p>
<p>bottomRightBack, rightNormal, textureBottomRight);</p>
<p>vertexBuffer = new VertexBuffer(</p>
<p>graphics.GraphicsDevice,</p>
<p>typeof(VertexPositionNormalTexture),</p>
<p>cubeVertices.Length,</p>
<p>BufferUsage.None</p>
<p>);</p>
<p>vertexBuffer.SetData(cubeVertices);</p>
<p>}</p>
<p>请原谅我把36个顶点的代码都贴出来了，如果不贴出来，肯定会有人不补全，然后就看不到完整的正方体了。</p>
<p>这里就要说到第一个错误点了：文章中没有列出所有36个顶点的定义，不过示例代码UseBasicEffect中列出了；另一个问题是VertexBuffer的构造函数发生了变化，原文和示例代码中的VertexBuffer构造函数是这样的：</p>
<p>vertexBuffer = new VertexBuffer(</p>
<p>graphics.GraphicsDevice,</p>
<p>VertexPositionNormalTexture.SizeInBytes * cubeVertices.Length,</p>
<p>BufferUsage.None</p>
<p>);</p>
<p>而正确的写法应该是：</p>
<p>vertexBuffer = new VertexBuffer(</p>
<p>graphics.GraphicsDevice,</p>
<p>typeof(VertexPositionNormalTexture),</p>
<p>cubeVertices.Length,</p>
<p>BufferUsage.None</p>
<p>);</p>
<p>VertexBuffer增加了一个Type类型的参数（第二个），我们必须传入一个IVertexType接口的派生类型，构造函数会用类型和顶点列表的长度计算VertexBuffer的size，这显然比上边的实现好了许多。</p>
<p>分别实现了这三个初始化函数后，我们要在真正的初始化函数Initialize里调用这三个函数，注意Initialize函数不是自己添加的，在Game1类中本来就有：</p>
<p>protected override void Initialize()</p>
<p>{</p>
<p>InitMatrices();</p>
<p>InitEffect();</p>
<p>InitVertexBuffer();</p>
<p>base.Initialize();</p>
<p>}</p>
<p>好了，我们在Draw函数里增加绘制方法：</p>
<p>protected override void Draw(GameTime gameTime)</p>
<p>{</p>
<p>GraphicsDevice.Clear(Color.CornflowerBlue);</p>
<p>// TODO: Add your drawing code here</p>
<p>RasterizerState rasterizerState1 = new RasterizerState();</p>
<p>rasterizerState1.CullMode = CullMode.None;</p>
<p>graphics.GraphicsDevice.RasterizerState = rasterizerState1;</p>
<p>GraphicsDevice.SetVertexBuffer(vertexBuffer);</p>
<p>foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)</p>
<p>{</p>
<p>pass.Apply();</p>
<p>graphics.GraphicsDevice.DrawPrimitives(</p>
<p>PrimitiveType.TriangleList,</p>
<p>0,</p>
<p>36</p>
<p>);</p>
<p>}</p>
<p>base.Draw(gameTime);</p>
<p>}</p>
<p>这里包含了第二个错误点，原文没有下面这句（上文高亮标出）：</p>
<p>GraphicsDevice.SetVertexBuffer(vertexBuffer);</p>
<p>如果没有SetVertexBuffer的调用，程序在运行时会遇到下面的异常：</p>
<p>An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.Graphics.dll</p>
<p>Additional information: A valid vertex buffer (and a valid index buffer if you are using indexed primitives) must be set on the device before any draw operations may be performed.<br />
<a href="http://software.intel.com/zh-cn/blogs/wordpress/wp-content/uploads/2010/12/0_1283015526cSS3.gif"><img class="alignnone size-full wp-image-400006594" src="http://software.intel.com/zh-cn/blogs/wordpress/wp-content/uploads/2010/12/0_1283015526cSS3.gif" alt="" width="468" height="211" /></a></p>
<p>原文的调用方式和UseBasicEffect的实现方式完全不同，所以大家要注意一下。毕竟是Beta版，很多文档还没有最后完成。</p>
<p>好了，到这里，其实我们编译运行该程序的话，就可以看到绘制出的立方体来了。但是，我还想再加点——让立方体旋转起来。</p>
<p>在Update函数中增加下面两句（高亮显示）：</p>
<p>protected override void Update(GameTime gameTime)</p>
<p>{</p>
<p>// Allows the game to exit</p>
<p>if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)</p>
<p>this.Exit();</p>
<p>// TODO: Add your update logic here</p>
<p>Matrix matrix = Matrix.CreateRotationX(0.1f);</p>
<p>basicEffect.World = basicEffect.World * matrix;</p>
<p>base.Update(gameTime);</p>
<p>}<br />
<a href="http://software.intel.com/zh-cn/blogs/wordpress/wp-content/uploads/2010/12/0_1283015527iAK2.gif"><img class="alignnone size-full wp-image-400006595" src="http://software.intel.com/zh-cn/blogs/wordpress/wp-content/uploads/2010/12/0_1283015527iAK2.gif" alt="" width="277" height="514" /></a></p>
<p>我们创建了一个沿X轴旋转0.1度的矩阵，与basicEffect中的世界坐标系相乘，就可以使我们绘制出来的立方体每次Update时，都沿着X轴旋转0.1f度。因为角度是float型，千万别忘了0.1f之后的那个f。<br />
好了，程序最后的样子就是这样的。在第一篇文章里，我留了很多问题，比如3D的基本概念、坐标系、灯光、材质、旋转，希望在后边能够比较从容地解释这些知识。我现在唯一的希望是，不要等到六个月后才有时间再写第二篇……</p>
]]></content:encoded>
			<wfw:commentRss>http://software.intel.com/zh-cn/blogs/2010/12/16/windows-phone-xna-40-3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

