⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 几何体.htm

📁 此文件是微软MSDN中d3d部分资料的翻译文件
💻 HTM
📖 第 1 页 / 共 5 页
字号:
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
</style>
<![endif]--></HEAD>
<BODY lang=ZH-CN style="TEXT-JUSTIFY-TRIM: punctuation; tab-interval: 21.0pt" 
vLink=purple link=blue>
<DIV class=Section1 style="LAYOUT-GRID:  15.6pt none">
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 1"><B><SPAN 
style="FONT-SIZE: 24pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 18.0pt; mso-fareast-language: ZH-CN">几何体<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></B></P>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">
<HR align=center width="100%" SIZE=1>
</SPAN></DIV>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">Microsoft&reg; 
Direct3D&reg;支持几种处理几何体的高级抽象。它们被分为以下主题。<o:p></o:p></SPAN></P>
<UL type=disc>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l1 level1 lfo3"><U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#顶点缓存">顶点缓存</A></SPAN></U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 

  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l1 level1 lfo3"><U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#索引缓存">索引缓存</A><o:p></o:p></SPAN></U> 
  </LI></UL>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">
<HR align=center width="100%" SIZE=1>
</SPAN></DIV>
<H1><A name=顶点缓存>顶点缓存</A></H1><SPAN style="mso-bookmark: 顶点缓存"></SPAN>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US 
style="mso-fareast-language: ZH-CN">
<HR align=center width="100%" SIZE=1>
</SPAN></DIV>
<P>顶点缓存,由<U><SPAN 
lang=EN-US>IDirect3DVertexBuffer9</SPAN></U>接口表示,是包含顶点数据的内存缓冲区。顶点缓存可以包含任何顶点类型——经过变换的或未经变换的,经过光照处理或未经光照处理的——它们可以使用<U><SPAN 
lang=EN-US>IDirect3DDevice9</SPAN></U>接口的渲染方法进行渲染。应用程序可以在顶点缓存中处理顶点,执行诸如变换、光照或生成裁剪标志的操作。变换操作总是被执行。</P>
<P>顶点缓存的灵活性使之成为重用经过变换的几何体的完美中转站。可以创建单个顶点缓存,在其中执行变换、光照和裁剪操作,并根据需要在场景中多次渲染该建模,即使在这之间渲染状态变了,无需重新进行变换。这在渲染使用多重纹理的建模时非常有用:几何体只被变换一次,然后可以根据需要渲染各个部分,如果有必要,期间可以改变纹理。顶点被处理后渲染状态的改变会在下一次顶点被处理时生效。</P>
<UL type=disc>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l18 level1 lfo6"><U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#描述"><SPAN 
  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">描述</SPAN></A></SPAN></U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l18 level1 lfo6"><U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#内存池及用途"><SPAN 
  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">内存池及使用</SPAN></A><o:p></o:p></SPAN></U> 
  </LI></UL>
<H2><A name=描述>描述</A></H2><SPAN style="mso-bookmark: 描述"></SPAN>
<P>顶点缓存由它的能力描述:是否只能存在于系统内存中,是否只能用于写操作,以及所能包含的顶点的类型和数量。所有这些特性都保存在<U><SPAN 
lang=EN-US>D3DVERTEXBUFFER_DESC</SPAN></U>结构中。</P>
<P>为了表明是一个顶点缓存,<B style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>Format</SPAN></B>成员要被设为<SPAN lang=EN-US>D3DFMT_VERTEXDATA。<B 
style="mso-bidi-font-weight: normal">Type</B>成员表示顶点缓存的资源类型。<B 
style="mso-bidi-font-weight: normal">Usage</B>成员包含了综合能力标志。D3DUSAGE_SOFTWAREPROCESSING标志表示顶点缓存被用于软件顶点处理。D3DUSAGE_WRITEONLY标志表示顶点缓存只用于写操作。这使驱动程序可以自由地将顶点数据放到最合适的内存位置并进行快速处理和渲染。如果没有使用D3DUSAGE_WRITEONLY标志,驱动程序不太可能将数据放在读操作效率很低的地方。这牺牲了一些处理时间和渲染速度。如果没有指定该标志,那么系统会假定应用程序将对顶点缓存中的数据执行读写操作。</SPAN></P>
<P><B style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>Pool</SPAN></B>成员指定为顶点缓存分配内存的类型。<SPAN 
lang=EN-US>D3DPOOL_SYSTEMMEM标志指示系统在系统内存中创建顶点缓存。</SPAN></P>
<P><B style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>Size</SPAN></B>成员存储了顶点缓存数据的大小,以字节为单位。<B 
style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>FVF</SPAN></B>成员包含了<U><SPAN 
lang=EN-US>D3DFVF</SPAN></U>的组合,用来识别缓存包含顶点的类型。</P>
<H2><A name=内存池及用途>内存池及用途</A></H2><SPAN style="mso-bookmark: 内存池及用途"></SPAN>
<P>应用程序可以使用<U><SPAN 
lang=EN-US>IDirect3DDevice9::CreateVertexBuffer</SPAN></U>方法创建顶点缓存,该方法接收池(内存类型)和用途参数。<B 
style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>IDirect3DDevice9::CreateVertexBuffer</SPAN></B>也可以用一个指定的<SPAN 
lang=EN-US>FVF码创建顶点缓存,以用于固定功能顶点处理或作为顶点处理的输出。更多细节,请参阅<U>FVF顶点缓存</U>。</SPAN></P>
<P>当在设备上启用了混合模式或软件顶点处理(<SPAN lang=EN-US>D3DCREATE_MIXED_VERTEXPROCESSING / 
D3DCREATE_SOFTWARE_VERTEXPROCESSING)时,可以设置D3DUSAGE_SOFTWAREPROCESSING标志。在混合模式中,要进行软件顶点处理的缓存必须设置D3DUSAGE_SOFTWAREPRECESSING标志,但在使用硬件顶点处理(D3DCREATE_HARDWARE_VERTEXPROCESSING)时,为了得到尽可能好的性能,不应设置该标志。但是,当一个缓存要同时进行硬件和软件顶点处理时,设置D3DUSAGE_SOFTWAREPROCESSING是唯一的选择。和软件设备一样,混合设备也可以使用D3DUSAGE_SOFTWAREPROCESSING。</SPAN></P>
<P>即使顶点处理是用硬件完成的,通过指定<SPAN 
lang=EN-US>D3DPOOL_SYSTEMMEM,把顶点和索引缓存强制分配到系统内存中也是可以的。当驱动程序将这些缓存放在AGP内存中时,这种方法可以避免大量的页面锁定内存。</SPAN></P>
<P>本节介绍了一些概念,这些概念是理解顶点缓存以及在<SPAN lang=EN-US>Microsoft&reg; 
Direct3D&reg;应用程序中使用顶点缓存所必需了解的。信息被分为以下部分。</SPAN></P>
<UL type=disc>
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l19 level1 lfo9"><U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#创建顶点缓存"><SPAN 
  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">创建顶点缓存</SPAN></A></SPAN></U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l19 level1 lfo9"><U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#存取顶点缓存的内容"><SPAN 
  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">存取顶点缓存的内容</SPAN></A></SPAN></U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l19 level1 lfo9"><U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#用顶点缓存进行渲染"><SPAN 
  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用顶点缓存进行渲染</SPAN></A></SPAN></U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l19 level1 lfo9"><U><SPAN 
  lang=EN-US style="FONT-FAMILY: 宋体; mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#FVF顶点缓存">FVF顶点缓存</A></SPAN></U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l19 level1 lfo9"><U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#固定功能顶点处理"><SPAN 
  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">固定功能顶点处理</SPAN></A></SPAN></U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l19 level1 lfo9"><U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#可编程顶点处理"><SPAN 
  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可编程顶点处理</SPAN></A></SPAN></U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 
  <LI class=MsoNormal 
  style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l19 level1 lfo9"><U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/OG.htm#设备类型与顶点处理的要求"><SPAN 
  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设备类型与顶点处理的要求</SPAN></A></SPAN></U><SPAN 
  lang=EN-US style="mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> </LI></UL>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US 
style="mso-fareast-language: ZH-CN">
<HR align=center width="100%" SIZE=1>
</SPAN></DIV>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 1"><A 
name=创建顶点缓存><B><SPAN 
style="FONT-SIZE: 24pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 18.0pt; mso-fareast-language: ZH-CN">创建顶点缓存<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></B></A></P><SPAN 
style="mso-bookmark: 创建顶点缓存"></SPAN>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">
<HR align=center width="100%" SIZE=1>
</SPAN></DIV>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">应用程序应该通过调用<U><SPAN 
lang=EN-US>IDirect3DDevice9::CreateVertexBuffer</SPAN></U>方法创建一个顶点缓存对象,该方法接收五个参数。第一个参数指定缓存的长度,以字节为单位。可以用<B 
style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>sizeof</SPAN></B>操作符确定某一顶点格式的大小。考虑以下自定义顶点格式。<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -