|
|
|
|
|
|
float2 uv : TEXCOORD0; |
|
|
|
}; |
|
|
|
|
|
|
|
float4 MetaVertexPosition(float4 vertex, float2 uv1, float2 uv2, float4 lightmapST, float4 dynlightmapST) |
|
|
|
float4 MetaVertexPosition(float4 vertex, float2 uv1, float2 uv2, float4 lightmapST) |
|
|
|
{ |
|
|
|
if (unity_MetaVertexControl.x) |
|
|
|
{ |
|
|
|
|
|
|
vertex.z = vertex.z > 0 ? 1.0e-4f : 0.0f; |
|
|
|
} |
|
|
|
if (unity_MetaVertexControl.y) |
|
|
|
{ |
|
|
|
vertex.xy = uv2 * dynlightmapST.xy + dynlightmapST.zw; |
|
|
|
// OpenGL right now needs to actually use incoming vertex position, |
|
|
|
// so use it in a very dummy way |
|
|
|
vertex.z = vertex.z > 0 ? 1.0e-4f : 0.0f; |
|
|
|
vertex.z = vertex.z > 0 ? REAL_MIN : 0.0f; |
|
|
|
} |
|
|
|
return TransformWorldToHClip(vertex.xyz); // Need to transfer from world to clip compared to legacy |
|
|
|
} |
|
|
|
|
|
|
MetaVertexOuput LightweightVertexMeta(MetaVertexInput v) |
|
|
|
{ |
|
|
|
MetaVertexOuput o; |
|
|
|
o.pos = MetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); |
|
|
|
o.uv = TRANSFORM_TEX(v.uv0, _MainTex); |
|
|
|
o.pos = MetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST); |
|
|
|
o.uv = TransformMainTextureCoord(v.uv0); |
|
|
|
return o; |
|
|
|
} |
|
|
|
|
|
|
|