English | Italian | Spanish | French | Japanese
TOC: Of Effects and Shaders
Next: Manipulating Colors
替换程序片中的Template节点,按照EX9.Effect.Template 这个页面中的说明,我们通常是先复制一个新的Template节点。把这个重新复制的节点连接到程序片当中去,然后通过右键单击这个节点打开编码器。用下面的代码替换替换templates中已有的代码,因为这个代码十分简单,以至于我们不需要去考虑暂时我们不需要用到的顶点着色的部分。
//texture texture Tex <string uiname="Texture";>; sampler Samp = sampler_state //sampler for doing the texture-lookup { Texture = (Tex); //apply a texture to the sampler MipFilter = LINEAR; //sampler states MinFilter = LINEAR; MagFilter = LINEAR; }; //the data structure: "vertexshader to pixelshader" //used as output data with the VS function //and as input data with the PS function struct vs2ps { float4 Pos : POSITION; float2 TexCd : TEXCOORD0; }; float4 PS(vs2ps In): COLOR { return 1; } technique TSimpleShader { pass P0 { VertexShader = null; PixelShader = compile ps_2_0 PS(); } }
按下CTRL+S保存和编译这些代码。没有错误提示。如果有错误提示,那么你在确认一下你真的拷贝了所有的代码,你的代码视图里看到的内容和上面这张图上现实的是一样的。
anonymous user login
~4d ago
~11d ago
~11d ago
~12d ago
~25d ago
~1mth ago
~1mth ago
~1mth ago
~1mth ago
~2mth ago