//================================================================== // 投影テクスチャ影用にモデルを光源からレンダリングするエフェクト //================================================================== //================================================================== // 定数 //================================================================== cbuffer cbSetUpModelData { matrix g_matrix_wvp; // モデル→プロジェクション } cbuffer cbSetUpNodeData { matrix g_matrix_model; // モデリング座標 } //================================================================== // シェーダーの入力 //================================================================== // 頂点シェーダーの入力 struct VS_INPUT { float4 m_position : POSITION; // 座標 float3 m_normal: NORMAL; // 法線 float3 m_tangent: TANGENT; // 接線 float3 m_binormal: BINORMAL; // 接線 float4 m_color: COLOR; // 色 float2 m_uv: TEXCOORD; // UV }; // ピクセルシェーダーの入力 struct PS_INPUT { float4 m_position : SV_POSITION; // 頂点座標 float4 m_color : COLOR; // 頂点カラー }; //================================================================== // シェーダー //================================================================== // 頂点シェーダー PS_INPUT VS( VS_INPUT input ) { // 出力 PS_INPUT output = (PS_INPUT)0; //--- // 頂点座標 // 頂点座標(入力) float4 vtx = input.m_position; vtx.w = 1.0f; // 念のため // 姿勢×カメラ変換 output.m_position = mul(mul( vtx, g_matrix_model ), g_matrix_wvp); //--- // 頂点カラー output.m_color = ( input.m_color ); return output; } // ピクセルシェーダー float4 PS( PS_INPUT input) : SV_TARGET { return float4(0,0,0,1); } // ブレンドステート // テクニック(通常) technique10 { pass P0{ SetVertexShader( CompileShader( vs_4_0, VS() ) ); SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_4_0, PS() ) ); } }