﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-Every Day's Gain-随笔分类-Misc</title><link>http://www.cnitblog.com/Larry.Zhao/category/833.html</link><description>Larry.Zhao's Coding Diary</description><language>zh-cn</language><lastBuildDate>Wed, 05 Oct 2011 05:26:49 GMT</lastBuildDate><pubDate>Wed, 05 Oct 2011 05:26:49 GMT</pubDate><ttl>60</ttl><item><title>匈牙利命名规范</title><link>http://www.cnitblog.com/Larry.Zhao/archive/2005/09/23/2843.html</link><dc:creator>Larry.Zhao's Coding Diary</dc:creator><author>Larry.Zhao's Coding Diary</author><pubDate>Fri, 23 Sep 2005 01:07:00 GMT</pubDate><guid>http://www.cnitblog.com/Larry.Zhao/archive/2005/09/23/2843.html</guid><wfw:comment>http://www.cnitblog.com/Larry.Zhao/comments/2843.html</wfw:comment><comments>http://www.cnitblog.com/Larry.Zhao/archive/2005/09/23/2843.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/Larry.Zhao/comments/commentRss/2843.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/Larry.Zhao/services/trackbacks/2843.html</trackback:ping><description><![CDATA[<DIV class=postbody>
<P>几年以前,Charles Simonyi(他后来成为微软的著名程序员)设计了一种以前缀为基础的命名方法,这种方法后来称为"匈牙利表示法"以记念他.他的思想是根据每个标识符所代表的含义给它一个前缀.微软后来采用了这个思想,给每个标识符一个前缀以说明它的数据类型.因此,整型变量的前缀是n,长整型变量是nl,字符型数组变量是ca,以及字符串(以空类型结尾的字符数组)以sz为前缀.这些名字可能会非常古怪.比如说:lpszFoo表示"Foo"是一个指向以空字符为结尾的字符串的长整型指针.</P>
<P>&nbsp;</P>
<P>这种方法的优点是使人能够通过变量的名字来辨别变量的类型,而不比去查找它的定义.遗憾的是,这种方法不仅使变量名字非常绕口,而且使改变变量类型的工作变得十分艰巨.在Windows3.1中,整型变量为16为宽.如果我们在开始时采用了一个整型变量,但是在通过30---40个函数的计算之后,发现采用整型变量宽度不够,这时我们不仅要改变这个变量的类型,而且要改变这个变量在这30--40个函数中的名字.</P>
<P>&nbsp;</P>
<P>因为不切实际,除了一些顽固的Windows程序员外已经没有人再使用"匈牙利表示法"了.毫无疑问,在某种场合它依然存在,但大部分人现在已经抛弃它了.一般而言,输入前缀是一种糟糕的想法,因为它把变量于其类型紧紧地绑在了一起.</P>
<P>对于30行以下的函数，匈牙利方法一般有优势。</P>
<P>尤其是对界面编程，有优势。</P>
<P>但对于有强烈的算法要求、尤其是有很多抽象类型的C++程序，匈牙利方法简直是一个灾难。</P>
<P>看你用在什么地方。</P>
<P>现在有了很好的IDE工具,如:VC,SourceInsight等.</P>
<P>选中变量,会自动提示告诉你它的声明和定义,这样</P>
<P>匈牙利命名法就没有很大的必要了.</P>
<P>无非就是为了程序可读性较好.</P>
<P>实际上良好的代码书写习惯比强制使用匈牙利命名法更重要.</P>
<P>系统性。整体性。可读性。分类要清楚。要有注释！</P>
<P>&nbsp;</P>
<P>匈牙利命名法是微软推广的一种关于变量、函数、对象、前缀、宏定义等各种类型的符号的命名规范。匈牙利命名法的主要思想是：在变量和函数名中加入前缀以增进人们对程序的理解。它是由微软内部的一个匈牙利人发起使用的，结果它在微软内部逐渐流行起来，并且推广给了全世界的Windows开发人员。下面将介绍匈牙利命名法，后面的例子里也会尽量遵守它和上面的代码风格。还是那句话，并不是要求所有的读者都要去遵守，但是希望读者作为一个现代的软件开发人员都去遵守它。</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Array&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 颜色(参考)值</P>
<P>cx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Count of x (Short)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x的集合(短整数)</P>
<P>dw&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DWORD&nbsp;&nbsp; (unsigned long)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 双字(无符号长整数)</P>
<P>f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flags&nbsp;&nbsp; (usually multiple bit values)&nbsp;&nbsp; 标志(一般是有多位的数值)</P>
<P>fn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Function&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 函数</P>
<P>g_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; global&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 全局的</P>
<P>h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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igned int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 无符号整数</P>
<P>ul&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Unsigned long (ULONG)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 无符号长整数</P>
<P>w&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WORD (unsigned short)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 无符号短整数</P>
<P>x,y&nbsp;&nbsp;&nbsp;&nbsp; x, y coordinates (short)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 坐标值/短整数</P>
<P>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 空</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>有关项目的全局变量用g_开始，类成员变量用m_，局部变量若函数较大则可考虑用l_用以显示说明其是局部变量。</P>
<P>&nbsp;</P>
<P>前缀&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 类型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 例子</P>
<P>g_&nbsp;&nbsp;&nbsp; 全局变量&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_Servers</P>
<P>C&nbsp;&nbsp;&nbsp;&nbsp; 类或者结构体&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CDocument，CPrintInfo</P>
<P>m_&nbsp;&nbsp; 成员变量&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pDoc，m_nCustomers</P>
<P>&nbsp;</P>
<P>VC常用前缀列表：</P>
<P>&nbsp;</P>
<P>前缀&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 类型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 描述&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 例子</P>
<P>ch&nbsp;&nbsp;&nbsp; char 8位字符&nbsp;&nbsp;&nbsp; chGrade</P>
<P>ch&nbsp;&nbsp;&nbsp; TCHAR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 16位UNICODE类型字符&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chName</P>
<P>b&nbsp;&nbsp;&nbsp;&nbsp; BOOL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 布尔变量&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bEnabled</P>
<P>n&nbsp;&nbsp;&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp; 整型（其大小由操作系统决定）&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nLength</P>
<P>n&nbsp;&nbsp;&nbsp;&nbsp; UINT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 无符号整型（其大小由操作系统决定）&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nLength</P>
<P>w&nbsp;&nbsp;&nbsp; WORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 16位无符号整型&nbsp;&nbsp;&nbsp; wPos</P>
<P>l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LONG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32位有符号整型&nbsp;&nbsp;&nbsp; lOffset</P>
<P>dw&nbsp;&nbsp; DWORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32位无符号整型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwRange</P>
<P>p&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ambient memory model pointer 内存模块指针，指针变量&nbsp;&nbsp;&nbsp; pDoc</P>
<P>lp&nbsp;&nbsp;&nbsp;&nbsp; FAR*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 长指针&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lpDoc</P>
<P>lpsz&nbsp; LPSTR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32位字符串指针&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lpszName</P>
<P>lpsz&nbsp; LPCSTR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32位常量字符串指针&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lpszName</P>
<P>lpsz&nbsp; LPCTSTR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32位UNICODE类型常量指针&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lpszName</P>
<P>h&nbsp;&nbsp;&nbsp;&nbsp; handle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Windows对象句柄&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hWnd</P>
<P>lpfn&nbsp; (*fn)()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 回调函数指针 Callback Far pointer to CALLBACK function&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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&nbsp;&nbsp;&nbsp; CStatic*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pStatic; </P>
<P>HWND&nbsp;&nbsp;&nbsp; hCtl;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CButton*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pBtn;</P>
<P>HWND&nbsp;&nbsp;&nbsp; hCtl;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CEdit*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pEdit; </P>
<P>HWND&nbsp;&nbsp;&nbsp; hCtl;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CListBox*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pListBox;</P>
<P>HWND&nbsp;&nbsp;&nbsp; hCtl;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CComboBox*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pComboBox;</P></DIV><img src ="http://www.cnitblog.com/Larry.Zhao/aggbug/2843.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/Larry.Zhao/" target="_blank">Larry.Zhao's Coding Diary</a> 2005-09-23 09:07 <a href="http://www.cnitblog.com/Larry.Zhao/archive/2005/09/23/2843.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>有關3D方面的關鍵詞摘要</title><link>http://www.cnitblog.com/Larry.Zhao/archive/2005/09/20/2760.html</link><dc:creator>Larry.Zhao's Coding Diary</dc:creator><author>Larry.Zhao's Coding Diary</author><pubDate>Tue, 20 Sep 2005 00:09:00 GMT</pubDate><guid>http://www.cnitblog.com/Larry.Zhao/archive/2005/09/20/2760.html</guid><wfw:comment>http://www.cnitblog.com/Larry.Zhao/comments/2760.html</wfw:comment><comments>http://www.cnitblog.com/Larry.Zhao/archive/2005/09/20/2760.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/Larry.Zhao/comments/commentRss/2760.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/Larry.Zhao/services/trackbacks/2760.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">深度缓冲</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">(</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">又称</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Z-buffer)</FONT></SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">的作用是确保多边形能够正确地显示在它们本来的深度（相对于摄像机）上。深度缓冲能确定哪个对象在另一个对象的前面，正确的将被渲染。</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">COM</FONT></SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-language: ZH-CN"> </SPAN><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: SimSun; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">就是</SPAN><SPAN lang=ZH-CN style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"><FONT face="Times New Roman"> </FONT></SPAN></FONT><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Component Object Model, </FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">组件对象模型</SPAN></B><SPAN lang=ZH-CN style="FONT-SIZE: 10pt; FONT-FAMILY: 新細明體; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-fareast-language: ZH-CN">。</SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">COM</FONT></SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-language: ZH-CN"> </SPAN><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">接口和</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">C++</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">的抽象类相似（但不一样），就像抽象类没有与之相关的实际代码一样，</SPAN></FONT><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">COM</FONT></SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">描述了一套符号和语法而非实现过程。</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Page Flipping </FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">（页翻动）</SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">我们把要显示的物体通通绘制到一个不可见的页上，我们称这个页为“后缓冲区”。绘制完后，快速的把它翻动到可见的“前缓冲区”上，并重复这个过程。当用户正在观看新绘制的可见页（前缓冲区）时，程序要降下一幅要显示的东西绘制到“后缓冲区”上。快速而连续的重复次过程，用户就会看到像电影一样连续的图像了。</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Devices </FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">（设备）</SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">就是你的</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">3D</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">卡。</SPAN><SPAN lang=ZH-CN style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman"> </FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">你得创建一个接口来代表设备，然后使用那个接口来绘制东西。</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Game Loop </FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">（游戏循环）</SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">游戏循环是一段代码，在游戏退出之前循环执行的代码。这段代码在每次循环中都要：在屏幕上绘制物体（或场景人物随便什么）、处理游戏的逻辑过程（如：物体的移动、人工智能等等）、处理</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">Windows</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">的消息等等。</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Vertices (</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">顶点</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">)</FONT></SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-language: ZH-CN"> </SPAN><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">顶点就是</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">3D</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">空间中的一个点。</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">3D Primitives</FONT></SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">就是设备所支持的原始的类型。它包括：<SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">Point Lists(</FONT></SPAN>点列)、<FONT size=2><FONT face=Verdana><SPAN lang=EN-GB>Line Lists(</SPAN></FONT></FONT>线列)、<FONT size=2><FONT face=Verdana><SPAN lang=EN-GB>Line Strips</SPAN><SPAN lang=EN-GB style="mso-fareast-language: ZH-CN"> </SPAN></FONT></FONT>(线带)、<FONT size=2><FONT face=Verdana><SPAN lang=EN-GB>Triangle Lists(</SPAN></FONT></FONT>三角形列)、<FONT size=2><FONT face=Verdana><SPAN lang=EN-GB>Triangle Strips(</SPAN></FONT></FONT>三角形带)</SPAN><SPAN lang=ZH-CN style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman"> </FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">和</SPAN><SPAN lang=ZH-CN style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman"> </FONT><FONT face=Verdana><FONT size=2><SPAN lang=EN-GB>Triangle Fans(</SPAN></FONT></FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">三角扇形)。使用</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">3D primitive </FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">完成上述的图形是很方便的。以后我们会用</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">3D primitive </FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">来绘制图形。</SPAN></FONT><FONT size=2><FONT face=Verdana><SPAN lang=EN-GB style="mso-fareast-language: ZH-CN"> 
<P></P></SPAN></FONT></FONT>
<P></P><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">
<P></P></SPAN>
<P></P>
<H1 style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><FONT size=2><FONT face=Verdana><SPAN lang=EN-GB style="mso-fareast-language: ZH-CN">
<P></P></SPAN></FONT></FONT></H1>
<H1 style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><FONT size=2><SPAN lang=EN-GB style="FONT-FAMILY: SimSun; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana"></SPAN></FONT></H1>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"><FONT size=2><SHAPE id=_x0000_i1027 style="WIDTH: 255pt; HEIGHT: 45.75pt" o:borderrightcolor="this" o:borderbottomcolor="this" o:borderleftcolor="this" o:bordertopcolor="this" type="#_x0000_t75"><IMAGEDATA o:title="002_7" src="file:///C:\DOCUME~1\andy\LOCALS~1\Temp\msohtml1\01\clip_image005.png"></IMAGEDATA><BORDERTOP type="single" width="4"></BORDERTOP><BORDERLEFT type="single" width="4"></BORDERLEFT><BORDERBOTTOM type="single" width="4"></BORDERBOTTOM><BORDERRIGHT type="single" width="4"></BORDERRIGHT></SHAPE>
<P></P></FONT></SPAN>
<P></P><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">
<P></P></SPAN>
<P></P>
<H1 style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-language: ZH-CN">
<P></P></SPAN>
<P></P><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Flexible Vertex Format (FVF) <SPAN style="mso-spacerun: yes">&nbsp;&nbsp;</SPAN>(</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">灵活顶点格式</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">)</FONT></SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">是用来描述顶点属性的一种格式，而这种格式是可以由我们自定义的，所以称它为“灵活顶点格式”。至此，我们至少知道了顶点有三种属性：</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">x</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">值、</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">y</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">值和</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">z</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">值。其实顶点还可以有其他属性，例如颜色与亮度</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> </H1>
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Vertex Buffers (</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">顶点缓冲</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">)</FONT></SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">顶点缓冲就是一块用于保存顶点的内存缓冲区。</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">Backface Culling (</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">背面拣选</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體"><FONT face="Times New Roman">)</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-language: ZH-CN"> </SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">所有的三角形面，面向我们的面将会被渲染出来（可见），否则将不被渲染（不可见，被拣选出来了）。</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">垂直回扫周期</SPAN></B><SPAN lang=ZH-CN style="FONT-SIZE: 10pt; FONT-FAMILY: 新細明體; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-font-size: 12.0pt">或</SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">屏幕空白周期</SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">当电子束从上至下完成了屏幕上的每一行水平回扫后，会被暂时关闭，回到屏幕的左上角；此过程所需的时间</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN; mso-fareast-font-family: SimSun"> 
<P></P></SPAN></FONT>
<P></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">纹理</SPAN></B><FONT size=3><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">就是</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">3D</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">图形中的</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"><FONT face="Times New Roman">2D</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 新細明體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN">贴图（位图），能应用到三角形（或一定数目的三角形）上，用来增加真实感</SPAN><SPAN lang=EN-US style="mso-fareast-language: ZH-CN"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><STRONG><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none">Materials </SPAN><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">（材质）</SPAN></STRONG><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">用于描述对象（三角形）的反光性能，使它看起来有没有光泽和带有什么颜色。</SPAN><SPAN lang=EN-US style="FONT-WEIGHT: normal; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><STRONG><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none">Diffuse Reflection </SPAN><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">（漫反射）</SPAN></STRONG><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">物体的漫反射颜色，能使物体看起来是什么颜色。</SPAN><SPAN lang=EN-GB style="FONT-WEIGHT: normal; FONT-SIZE: 10pt; TEXT-DECORATION: none; mso-bidi-font-weight: bold; mso-fareast-language: ZH-CN; mso-bidi-font-size: 12.0pt; text-underline: none"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><STRONG><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none">Ambient Reflection </SPAN><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">（环境反射）</SPAN></STRONG><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">这也是一个颜色值，用于描述对象反射环境光的数量。你甚至可以指定它根本不反射环境光，这意味着它将不可见，除非接收到其它类型的光。</SPAN><SPAN lang=EN-US style="FONT-WEIGHT: normal; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none"><STRONG>Specular Reflection and Power</STRONG></SPAN><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">镜面反射的值，可以用镜面反射和高光强度设置对象，使它看起来发亮。</SPAN><SPAN lang=EN-US style="FONT-WEIGHT: normal; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><STRONG><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none">Emission </SPAN><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">（放射）</SPAN></STRONG><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">使物体自发光，但不会影响到场景内的其它物体。</SPAN><SPAN lang=EN-US style="FONT-WEIGHT: normal; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><STRONG><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none">Normals </SPAN><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">（法线）</SPAN></STRONG><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">法线是垂直于三角形面的一个向量，它的方向是由三角形的顶点定义顺序所决定的。</SPAN><SPAN lang=EN-US style="FONT-WEIGHT: normal; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><STRONG><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-fareast-font-family: 標楷體; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none">Index Buffer</SPAN><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">（索引缓冲）</SPAN></STRONG><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">索引缓冲就是内存中的一块用于索引顶点的区域。</SPAN><SPAN lang=EN-US style="FONT-WEIGHT: normal; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'"><STRONG>缓冲数据</STRONG></SPAN><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">就是在专用的缓冲区中存储的输入设备的数据</SPAN><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: SimSun; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">。</SPAN><SPAN lang=EN-GB style="FONT-SIZE: 10pt; mso-bidi-font-weight: bold; mso-fareast-language: ZH-CN; mso-bidi-font-size: 12.0pt"> 
<P></P></SPAN></FONT>
<P></P>
<P class=TutorialTitle style="MARGIN: 0cm 0cm 0pt"><SPAN lang=ZH-CN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 標楷體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'"><STRONG>即时数据</STRONG></SPAN><FONT size=3><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: 新細明體; TEXT-DECORATION: none; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">就是指设备当前的状态</SPAN><SPAN lang=ZH-CN style="FONT-WEIGHT: normal; FONT-FAMILY: SimSun; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none; mso-bidi-font-family: 'Times New Roman'">。</SPAN></FONT><SPAN lang=EN-US style="FONT-WEIGHT: normal; FONT-FAMILY: 'Times New Roman'; TEXT-DECORATION: none; mso-fareast-language: ZH-CN; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; text-underline: none"> </SPAN></P><img src ="http://www.cnitblog.com/Larry.Zhao/aggbug/2760.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/Larry.Zhao/" target="_blank">Larry.Zhao's Coding Diary</a> 2005-09-20 08:09 <a href="http://www.cnitblog.com/Larry.Zhao/archive/2005/09/20/2760.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>