variable 'o' used without having been completely initialized Compiling Vertex program
阿新 • • 發佈:2018-02-11
spa for vertex bject nbsp tput 修改 unit exc V = mul(unity_WorldToObject, float4(V,1));
o.NdotV.x = saturate(dot(v.normal, normalize(V)));
return o;
} UNITY_TRANSFER_FOG(o,o.vertex);
float3 V = WorldSpaceViewDir(v.vertex);
V = mul(unity_WorldToObject, float4(V,1));
o.NdotV.x = saturate(dot(v.normal, normalize(V)));
return o;
}
variable ‘o‘ used without having been completely initialized Compiling Vertex program
v2f vert (appdata_base v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
float3 V = WorldSpaceViewDir(v.vertex);
o.NdotV.x = saturate(dot(v.normal, normalize(V)));
return o;
}
使用宏初始化 v2f 即可 UNITY_INITIALIZE_OUTPUT
修改為
v2f vert (appdata_base v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f,o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
float3 V = WorldSpaceViewDir(v.vertex);
V = mul(unity_WorldToObject, float4(V,1));
o.NdotV.x = saturate(dot(v.normal, normalize(V)));
return o;
}
variable 'o' used without having been completely initialized Compiling Vertex program