码迷,mamicode.com
首页 > 其他好文 > 详细

variable 'o' used without having been completely initialized Compiling Vertex program

时间:2018-02-11 12:24:30      阅读:339      评论:0      收藏:0      [点我收藏+]

标签:object   arch   reads   mpi   oat   sea   put   use   for   

 

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);
V = mul(unity_WorldToObject, float4(V,1));
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);
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

标签:object   arch   reads   mpi   oat   sea   put   use   for   

原文地址:https://www.cnblogs.com/rexzhao/p/8440779.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!