📄 可编程数据流模型 (programmable stream model).htm
字号:
style="mso-spacerun: yes"> </SPAN>0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 0</SPAN>, 28,
D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,<SPAN
style="mso-spacerun: yes"> </SPAN>1 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 1</SPAN>, 0,
D3DDECLTYPE_FLOAT2,<SPAN style="mso-spacerun: yes">
</SPAN>D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 2</SPAN>, 0,
D3DDECLTYPE_FLOAT2,<SPAN style="mso-spacerun: yes">
</SPAN>D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN>D3DDECL_<SPAN
class=GramE>END()</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">};<o:p></o:p></SPAN></P>
<P class=MsoNormal
style="TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan"
align=left><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">现在创建顶点声明对象,如下所示:<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></P><PRE><SPAN lang=EN-US style="FONT-SIZE: 10pt">LPDIRECT3DVERTEXDECLARATION9 <SPAN class=SpellE>m_pVertexDeclaration</SPAN>;<o:p></o:p></SPAN></PRE><PRE><SPAN lang=EN-US style="FONT-SIZE: 10pt">g_d3dDevice-><SPAN class=SpellE><SPAN class=GramE>CreateVertexDeclaration</SPAN></SPAN><SPAN class=GramE>(</SPAN> dwDecl3, <SPAN class=SpellE>m_pVertexDeclaration</SPAN> );<o:p></o:p></SPAN></PRE>
<H2>组合的示例</H2>
<H3>一个数据流,只使用漫反射色</H3>
<P>只用漫反射色渲染的顶点声明和数据流设置看起来会如下所示:</P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">D3DVERTEXELEMENT9
dwDecl3[] = <o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 0</SPAN>,
0,<SPAN style="mso-spacerun: yes"> </SPAN>D3DDECLTYPE_FLOAT3,<SPAN
style="mso-spacerun: yes"> </SPAN>D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_POSITION, 0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 0</SPAN>, 12,
D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,<SPAN
style="mso-spacerun: yes"> </SPAN>0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 0</SPAN>, 28,
D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,<SPAN
style="mso-spacerun: yes"> </SPAN>1 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN>D3DDECL_<SPAN
class=GramE>END()</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">};<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">m_pd3dDevice-><SPAN
class=SpellE><SPAN class=GramE>SetStreamSource</SPAN></SPAN><SPAN
class=GramE>(</SPAN> 0, m_pVBVertexShader0, 0, <SPAN
class=SpellE>sizeof</SPAN>(CUSTOMVERTEX) );<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">m_pd3dDevice-><SPAN
class=SpellE><SPAN class=GramE>SetStreamSource</SPAN></SPAN><SPAN
class=GramE>(</SPAN> 1, NULL, 0, 0);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">m_pd3dDevice-><SPAN
class=SpellE><SPAN class=GramE>SetStreamSource</SPAN></SPAN><SPAN
class=GramE>(</SPAN> 2, NULL, 0, 0);</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal
style="TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan; mso-outline-level: 3"
align=left><B><SPAN
style="FONT-SIZE: 13.5pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">两个数据流,使用颜色和纹理<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></B></P>
<P class=MsoNormal
style="TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan"
align=left><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">使用单纹理进行渲染的顶点声明和数据流设置看起来会如下所示:<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">D3DVERTEXELEMENT9
dwDecl3[] = <o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 0</SPAN>,
0,<SPAN style="mso-spacerun: yes"> </SPAN>D3DDECLTYPE_FLOAT3,<SPAN
style="mso-spacerun: yes"> </SPAN>D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_POSITION, 0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 0</SPAN>, 12,
D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,<SPAN
style="mso-spacerun: yes"> </SPAN>0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 0</SPAN>, 28,
D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,<SPAN
style="mso-spacerun: yes"> </SPAN>1 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=GramE><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">{
1</SPAN></SPAN><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">,
0, D3DDECLTYPE_FLOAT2,<SPAN style="mso-spacerun: yes">
</SPAN>D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN style="mso-tab-count: 1"> </SPAN><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">D3DDECL_<SPAN
class=GramE>END()</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">};<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">m_pd3dDevice-><SPAN
class=SpellE><SPAN class=GramE>SetStreamSource</SPAN></SPAN><SPAN
class=GramE>(</SPAN> 0, <SPAN class=SpellE>m_pVBPosColor</SPAN>, 0, <SPAN
class=SpellE>sizeof</SPAN>(POSCOLORVERTEX) );<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">m_pd3dDevice-><SPAN
class=SpellE><SPAN class=GramE>SetStreamSource</SPAN></SPAN><SPAN
class=GramE>(</SPAN> 1, m_pVBTexC0, 0, <SPAN
class=SpellE>sizeof</SPAN>(TEXC0VERTEX) );<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">m_pd3dDevice-><SPAN
class=SpellE><SPAN class=GramE>SetStreamSource</SPAN></SPAN><SPAN
class=GramE>(</SPAN> 2, NULL, 0, 0);<o:p></o:p></SPAN></P>
<P class=MsoNormal
style="TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan; mso-outline-level: 3"
align=left><B><SPAN
style="FONT-SIZE: 13.5pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">三个数据流,使用颜色和两张纹理<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></B></P>
<P class=MsoNormal
style="TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan"
align=left><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">使用两张纹理进行多重纹理渲染的顶点声明和数据流设置看起来会如下所示。<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">D3DVERTEXELEMENT9
<SPAN class=GramE>dwDecl3[</SPAN>] = <o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>{ 0</SPAN>,
0,<SPAN style="mso-spacerun: yes"> </SPAN>D3DDECLTYPE_FLOAT3,<SPAN
style="mso-spacerun: yes"> </SPAN>D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_POSITION, 0 },<o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-ALIGN: left; mso-pagination: widow-orphan"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><SPAN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -