📄 顶点声明.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0045)http://www.gesoftfactory.com/developer/VD.htm -->
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD><TITLE>顶点声明</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content=Word.Document name=ProgId>
<META content="MSHTML 6.00.2900.3314" name=GENERATOR>
<META content="Microsoft Word 10" name=Originator><LINK
href="VD_files/filelist.xml" rel=File-List><LINK href="VD_files/editdata.mso"
rel=Edit-Time-Data><!--[if !mso]>
<STYLE>v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
w\:* {
BEHAVIOR: url(#default#VML)
}
.shape {
BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]--><!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>SGuy</o:Author>
<o:LastAuthor>SGuy</o:LastAuthor>
<o:Revision>3</o:Revision>
<o:TotalTime>0</o:TotalTime>
<o:Created>2003-06-01T14:29:00Z</o:Created>
<o:LastSaved>2003-06-08T10:14:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Words>1742</o:Words>
<o:Characters>9934</o:Characters>
<o:Company>G.E.Studio</o:Company>
<o:Lines>82</o:Lines>
<o:Paragraphs>23</o:Paragraphs>
<o:CharactersWithSpaces>11653</o:CharactersWithSpaces>
<o:Version>10.3501</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:DontDisplayPageBoundaries/>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:PunctuationKerning/>
<w:DrawingGridVerticalSpacing>7.8 pt</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:AdjustLineHeightInTable/>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:UseFELayout/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<STYLE>@font-face {
font-family: 宋体;
}
@font-face {
font-family: @宋体;
}
@page {mso-page-border-surround-header: no; mso-page-border-surround-footer: no; }
@page Section1 {size: 595.3pt 841.9pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin: 36.0pt; mso-footer-margin: 36.0pt; mso-paper-source: 0; layout-grid: 15.6pt; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体
}
H2 {
FONT-WEIGHT: bold; FONT-SIZE: 18pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: 宋体; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2; mso-bidi-font-family: 宋体; mso-pagination: widow-orphan
}
H3 {
FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 13pt 0cm; LINE-HEIGHT: 172%; FONT-FAMILY: "Times New Roman"; mso-outline-level: 3; mso-fareast-language: EN-US; mso-pagination: widow-orphan lines-together; mso-style-next: Normal
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
P {
FONT-SIZE: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: 宋体; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-bidi-font-family: 宋体; mso-pagination: widow-orphan
}
SPAN.SpellE {
mso-style-name: ""; mso-spl-e: yes
}
DIV.Section1 {
page: Section1
}
OL {
MARGIN-BOTTOM: 0cm
}
UL {
MARGIN-BOTTOM: 0cm
}
</STYLE>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
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";}
</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"><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>DMA)以及图形流水线的</SPAN></SPAN><SPAN class=SpellE><SPAN lang=EN-US
style="FONT-FAMILY: 宋体; mso-fareast-language: ZH-CN">tessellator</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">引擎进行编程的一种方法。顶点声明简要地表示了数据的布局及</SPAN><SPAN
class=SpellE><SPAN lang=EN-US
style="FONT-FAMILY: 宋体; mso-fareast-language: ZH-CN">tessellator</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">操作。为了解决<SPAN
lang=EN-US>Microsoft® DirectX®
8.x中顶点声明的复杂性和可扩展性,9.0版引入了用来表示顶点数据流的新格式。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">顶点着色器和顶点声明不再是在<SPAN
class=SpellE><SPAN
lang=EN-US>CreateVertexShader</SPAN></SPAN>的时候绑定在一起。对着色器的验证已经被分成两部分,一部分在顶点着色器创建时执行,另一部分在<SPAN
class=SpellE><SPAN
lang=EN-US>DrawPrimitive</SPAN></SPAN>时执行。顶点着色器和顶点声明都由相应的对象表示。<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
class=SpellE><SPAN lang=EN-US
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">Decls</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">不再用<SPAN
lang=EN-US>DWORD流表示。它们现在用一个<B
style="mso-bidi-font-weight: normal">D3DVERTEXELEMENT9</B>结构的数组表示。数组中的每个元素描述一个顶点元素。<o:p></o:p></SPAN></SPAN></P>
<P>另外,为了解决<SPAN lang=EN-US>API的可用性问题,9.0版增加了一个与<SPAN
class=SpellE>SetVertexDeclaration</SPAN>调用等价的<SPAN
class=SpellE>SetFVF</SPAN>调用。这是一个有用的函数,当调用这个函数时,新的FVF会取代当前的顶点声明,反之亦然。如果驱动程序是DirectX
8.0之前的版本(<SPAN
class=SpellE>NumStream</SPAN>为0),那么对于那些不能被转换成弹性顶点格式(FVF)的顶点声明,<SPAN
class=SpellE>SetVertexDeclaration</SPAN>可能会失败并返回错误码。<SPAN
class=SpellE>SetFVF</SPAN>既能用于固定功能顶点流水线,又能用于可编程顶点流水线。在内部,系统会根据<U><A
href="http://www.gesoftfactory.com/developer/VD.htm#把FVF映射到DirectX90的Decl">把FVF映射到DirectX
9.0中的Decl</A></U>中定义的规则,把FVF码转换为顶点着色器声明。在编写顶点着色器函数中的DCL命令时,应该紧记这一点。因为这个转换的关系,所有后面的讨论将仅限于顶点声明。<o:p></o:p></SPAN></P>
<H2><SPAN lang=EN-US>D3DVERTEXELEMENT9结构</SPAN></H2>
<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>D3DVERTEXELEMENT9结构中的域以及说明。<o:p></o:p></SPAN></SPAN></P>
<UL type=disc>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l22 level1 lfo2; tab-stops: list 36.0pt"><SPAN
lang=EN-US
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">Stream(数据流)
- 数据流的编号,当前域会从该编号的数据流中读取。<o:p></o:p></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l22 level1 lfo2; tab-stops: list 36.0pt"><SPAN
lang=EN-US
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">Offset(偏移量)
- 偏移量,表示当前域从哪里开始读取,以字节为单位。<o:p></o:p></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l22 level1 lfo2; tab-stops: list 36.0pt"><SPAN
lang=EN-US
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">Type(类型)
-
输入数据的类型,以及数据在传入顶点着色器的寄存器时如何转换格式,也就是,float1,float2,short2n等等。输出的类型由方法决定,有些方法有隐式的输入类型。<o:p></o:p></SPAN>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -