8,305
社区成员
发帖
与我相关
我的任务
分享
// 部分代码省略。
vector g_LightDirection;
VS_OUTPUT Main( VS_INPUT input )
{
VS_OUTPUT output = (VS_OUTPUT)0;
// 每次在shader中对全局变量赋值的时候就会报错。难道说全局变量不可以在shader代码中赋值?
g_LightDirection.w = 0.0f;
g_LightDirection = mul( g_LightDirection, g_ViewMatrix );
input.normal.w = 0.0f;
input.normal = mul( input.normal, g_ViewMatrix );
return output;
}