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

📄 视区和裁剪viewports and clipping.htm

📁 此文件是微软MSDN中d3d部分资料的翻译文件
💻 HTM
📖 第 1 页 / 共 4 页
字号:
lang=EN-US>0.0到1.0),在这之间的场景会被渲染。<o:p></o:p></SPAN></SPAN></P>
<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">本节讨论裁剪,即几何流水线的最后一步。讨论被分为以下主题。<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l0 level1 lfo2; mso-list-change: &#61623;SGuy 20030510T1452"><![if !supportLists]><SPAN 
lang=EN-US 
style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-language: ZH-CN; mso-fareast-font-family: Symbol; mso-bidi-font-size: 12.0pt"><SPAN 
style="mso-list: Ignore">·<SPAN 
style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></SPAN></SPAN><![endif]><U><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
href="http://www.gesoftfactory.com/developer/VnC.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></P>
<P class=MsoNormal 
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l0 level1 lfo2; mso-list-change: &#61623;SGuy 20030510T1452"><![if !supportLists]><SPAN 
lang=EN-US 
style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-language: ZH-CN; mso-fareast-font-family: Symbol; mso-bidi-font-size: 12.0pt"><SPAN 
style="mso-list: Ignore">·<SPAN 
style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></SPAN></SPAN><![endif]><U><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
href="http://www.gesoftfactory.com/developer/VnC.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></P>
<P class=MsoNormal 
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l0 level1 lfo2; mso-list-change: &#61623;SGuy 20030510T1452"><![if !supportLists]><SPAN 
lang=EN-US 
style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-language: ZH-CN; mso-fareast-font-family: Symbol; mso-bidi-font-size: 12.0pt"><SPAN 
style="mso-list: Ignore">·<SPAN 
style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></SPAN></SPAN><![endif]><U><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
href="http://www.gesoftfactory.com/developer/VnC.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></P>
<P class=MsoNormal 
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l0 level1 lfo2; mso-list-change: &#61623;SGuy 20030510T1452"><![if !supportLists]><SPAN 
lang=EN-US 
style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-language: ZH-CN; mso-fareast-font-family: Symbol; mso-bidi-font-size: 12.0pt"><SPAN 
style="mso-list: Ignore">·<SPAN 
style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></SPAN></SPAN><![endif]><U><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
href="http://www.gesoftfactory.com/developer/VnC.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></P>
<P class=MsoNormal 
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l0 level1 lfo2; mso-list-change: &#61623;SGuy 20030510T1452"><![if !supportLists]><SPAN 
lang=EN-US 
style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-language: ZH-CN; mso-fareast-font-family: Symbol; mso-bidi-font-size: 12.0pt"><SPAN 
style="mso-list: Ignore">·<SPAN 
style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></SPAN></SPAN><![endif]><U><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
href="http://www.gesoftfactory.com/developer/VnC.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></P>
<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">Direct3D通过给设备设置一系列的视区参数来实现裁剪。<o:p></o:p></SPAN></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; 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 lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">C++应用程序通过使用<U>D3DVIEWPORT9</U>结构定义视区矩形。<B 
style="mso-bidi-font-weight: normal">D3DVIEWPORT9</B>结构要配合以下<U>IDirect3DDevice9</U>接口暴露的视区操作方法一起使用。<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l3 level1 lfo3; mso-list-change: &#61623;SGuy 20030510T1452"><![if !supportLists]><SPAN 
lang=EN-US 
style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-language: ZH-CN; mso-fareast-font-family: Symbol; mso-bidi-font-size: 12.0pt"><SPAN 
style="mso-list: Ignore">·<SPAN 
style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></SPAN></SPAN><![endif]><U><SPAN lang=EN-US 
style="COLOR: blue; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">IDirect3DDevice9::GetViewport</SPAN></U><SPAN 
lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"> 
<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l3 level1 lfo3; mso-list-change: &#61623;SGuy 20030510T1452"><![if !supportLists]><SPAN 
lang=EN-US 
style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-language: ZH-CN; mso-fareast-font-family: Symbol; mso-bidi-font-size: 12.0pt"><SPAN 
style="mso-list: Ignore">·<SPAN 
style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></SPAN></SPAN><![endif]><U><SPAN lang=EN-US 
style="COLOR: blue; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">IDirect3DDevice9::SetViewport</SPAN></U><SPAN 
lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">D3DVIEWPORT9</SPAN></B><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">结构包含的四个成员——<B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>X</SPAN></B>,<B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>Y</SPAN></B>,<B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>Width</SPAN></B>和<B 
style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>Height</SPAN></B>——定义了渲染目标表面中的一块区域,场景将被渲染在该区域中。这些值对应于目标矩形,或视区矩形,如下图所示。<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<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"><!--[if gte vml 1]><v:shapetype 
id=_x0000_t75 coordsize = "21600,21600" o:preferrelative = "t" o:spt = "75" 
filled = "f" stroked = "f" path = " m@4@5 l@4@11@9@11@9@5 xe"><v:stroke 
joinstyle = "miter"></v:stroke><v:formulas><v:f eqn = 
"if lineDrawn pixelLineWidth 0 "></v:f><v:f eqn = "sum @0 1 0 "></v:f><v:f eqn = 
"sum 0 0 @1 "></v:f><v:f eqn = "prod @2 1 2 "></v:f><v:f eqn = 
"prod @3 21600 pixelWidth "></v:f><v:f eqn = 
"prod @3 21600 pixelHeight "></v:f><v:f eqn = "sum @0 0 1 "></v:f><v:f eqn = 
"prod @6 1 2 "></v:f><v:f eqn = "prod @7 21600 pixelWidth "></v:f><v:f eqn = 
"sum @8 21600 0 "></v:f><v:f eqn = "prod @7 21600 pixelHeight "></v:f><v:f eqn = 
"sum @10 21600 0 "></v:f></v:formulas><v:path o:extrusionok = "f" 
gradientshapeok = "t" o:connecttype = "rect"></v:path><o:lock aspectratio="t" 
v:ext="edit"></o:lock></v:shapetype><v:shape id=_x0000_i1043 
style="WIDTH: 188.25pt; HEIGHT: 117pt" type = "#_x0000_t75" coordsize = 
"21600,21600"><v:imagedata o:title="destrect" src = 
"VnC_files/image001.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=251 height=156
src="VnC_files/image001.gif" v:shapes="_x0000_i1043"><![endif]><o:p></o:p></SPAN></P>
<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">应用程序给<B 
style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>D3DVIEWPORT9</SPAN></B>结构的<B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>X</SPAN></B>,<B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>Y</SPAN></B>,<B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>Width</SPAN></B>和<B 
style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>Height</SPAN></B>成员指定的值是屏幕坐标,相对于渲染目标表面的左上角。该结构定义了两个附加成员(<B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>MinZ</SPAN></B>和<B 
style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>MaxZ</SPAN></B>),指出在这个深度范围内的场景会被渲染。<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<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;假设视区裁剪体在X方向上从-1.0到1.0,在Y方向上从1.0到-1.0。过去,这些是应用程序最常使用的设定。在投影变换过程中,应用程序可以在裁剪前调整纵横比。这项任务被涵盖在<U>投影变换</U>一节中。<o:p></o:p></SPAN></P>
<P class=MsoNormal><B style="mso-bidi-font-weight: normal"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">注意<SPAN 
lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp; 
</SPAN>D3DVIEWPORT9</SPAN></SPAN></B><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">结构的<B 
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>MinZ</SPAN></B>和<B 
style="mso-bidi-font-weight: normal"><SPAN 
lang=EN-US>MaxZ</SPAN></B>成员指出在这个深度范围内的场景会被渲染,它们不用于裁剪。大多数应用程序把这两个成员设置为<SPAN 
lang=EN-US>0.0和1.0,使系统能渲染深度缓存中全部范围的深度值。在一些情况下,应用程序可以通过使用其它的深度范围实现特殊效果。例如,要在游戏中显示提示(heads-up 
display),应用程序可以将两个值都设为0.0,强制系统渲染场景中最前面的物体,或者也可以将它们都设为1.0,渲染总是在最后面的物体。<o:p></o:p></SPAN></SPAN></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; 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">视棱锥是场景中的三维区域,相对于视区的摄像机。区域的形状会影响到建模如何从摄像机空间投影到屏幕。最普通的投影类型,透视投影,是造成离摄像机近的物体显得比远处物体大的原因。对于透视变换,视棱锥可以被想象成一个金字塔,摄像机被放在顶端。这个金字塔分别被前后裁剪平面截取。金字塔中部位于前后裁剪平面之间的区域就是视棱锥。物体只有在这个区域中时才是可见的。<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></P>

⌨️ 快捷键说明

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