// ワールドビュー射影変換行列宣言 float4x4 matWorldViewProj; texture gTexture : TEXTURE0; //テクスチャのサンプリング方法 sampler tex0 = sampler_state { Texture = ; MinFilter = NONE; MagFilter = NONE; MipFilter = NONE; AddressU = Clamp; AddressV = Clamp; }; float4 gRed = {1.0f,0.0f,0.0f,1.0f}; //頂点シェーダの出力出力定義 struct VS_OUTPUT { float4 Pos : POSITION; float4 Diffuse : COLOR0; float2 TexUV : TEXCOORD0; }; // ピクセルシェーダー入力 struct PS_INPUT { float4 Col : COLOR0; float2 TexUV : TEXCOORD0; }; // 頂点シェーダ VS_OUTPUT BasicTransform( float4 lPos : POSITION, float4 aDiffuse : COLOR0, float2 vTexCoord0 : TEXCOORD0 ) { VS_OUTPUT Out; Out.Pos = mul(lPos, matWorldViewProj); Out.TexUV = vTexCoord0; Out.Diffuse = aDiffuse; return Out; } // ピクセルシェーダ float4 TexPixelShader(PS_INPUT In) : COLOR0 { return gRed * tex2D(tex0, In.TexUV); } // ピクセルシェーダ(モノクロ化) float4 TexPixelShaderMono(VS_OUTPUT In) : COLOR0 { float4 Out; float4 color = tex2D(tex0, In.TexUV ) * In.Diffuse; float4 tomono = float4(0.298912, 0.586611, 0.114478, 0.0); Out = dot(color, tomono); Out.w = color.w; return Out; } technique BasicTec { pass P0 { VertexShader = compile vs_2_0 BasicTransform(); PixelShader = compile ps_2_0 TexPixelShader(); } pass P1 { VertexShader = compile vs_2_0 BasicTransform(); PixelShader = compile ps_2_0 TexPixelShaderMono(); } }