mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
104 lines
2.1 KiB
Text
104 lines
2.1 KiB
Text
struct v2f {
|
|
vec4 vertex;
|
|
vec4 color;
|
|
vec3 texcoord;
|
|
};
|
|
struct appdata_t {
|
|
vec4 vertex;
|
|
vec4 color;
|
|
vec3 normal;
|
|
};
|
|
uniform vec4 unity_Scale;
|
|
uniform vec3 _WorldSpaceCameraPos;
|
|
uniform mat4 _World2Object;
|
|
vec3 ObjSpaceViewDir (
|
|
in vec4 v
|
|
)
|
|
{
|
|
vec3 objSpaceCameraPos;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1.w = 1.0;
|
|
tmpvar_1.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
|
vec3 tmpvar_2;
|
|
tmpvar_2 = ((_World2Object * tmpvar_1).xyz * unity_Scale.w);
|
|
objSpaceCameraPos = tmpvar_2;
|
|
return (objSpaceCameraPos - v.xyz);
|
|
}
|
|
|
|
v2f vert (
|
|
in appdata_t v
|
|
)
|
|
{
|
|
vec3 viewDir;
|
|
v2f o;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = (gl_ModelViewProjectionMatrix * v.vertex);
|
|
o.vertex = tmpvar_1;
|
|
vec3 tmpvar_2;
|
|
tmpvar_2 = ObjSpaceViewDir (v.vertex);
|
|
vec3 tmpvar_3;
|
|
tmpvar_3 = normalize (tmpvar_2);
|
|
vec3 tmpvar_4;
|
|
tmpvar_4 = -(tmpvar_3);
|
|
viewDir = tmpvar_4;
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = reflect (viewDir, v.normal);
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = tmpvar_5;
|
|
o.texcoord = tmpvar_6;
|
|
vec4 tmpvar_7;
|
|
tmpvar_7.w = 0.0;
|
|
tmpvar_7.xyz = o.texcoord.xyz;
|
|
vec3 tmpvar_8;
|
|
tmpvar_8 = (gl_ModelViewMatrix * tmpvar_7).xyz;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = tmpvar_8;
|
|
o.texcoord = tmpvar_9;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = v.color;
|
|
o.color = tmpvar_10;
|
|
return o;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_t xlt_v;
|
|
v2f xl_retval;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_2;
|
|
tmpvar_2 = tmpvar_1;
|
|
xlt_v.vertex = tmpvar_2;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = gl_Color.xyzw;
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = tmpvar_3;
|
|
xlt_v.color = tmpvar_4;
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = gl_Normal.xyz;
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = tmpvar_5;
|
|
xlt_v.normal = tmpvar_6;
|
|
v2f tmpvar_7;
|
|
tmpvar_7 = vert (xlt_v);
|
|
v2f tmpvar_8;
|
|
tmpvar_8 = tmpvar_7;
|
|
xl_retval = tmpvar_8;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = xl_retval.vertex.xyzw;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = tmpvar_9;
|
|
gl_Position = tmpvar_10;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = xl_retval.color.xyzw;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = tmpvar_11;
|
|
gl_FrontColor = tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13.w = 0.0;
|
|
tmpvar_13.xyz = xl_retval.texcoord.xyz;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = tmpvar_13;
|
|
gl_TexCoord[0] = tmpvar_14;
|
|
}
|
|
|