mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
104 lines
2.2 KiB
Text
104 lines
2.2 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_1
|
|
)
|
|
{
|
|
vec3 objSpaceCameraPos_2;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3.w = 1.0;
|
|
tmpvar_3.xyz = _WorldSpaceCameraPos.xyz.xyz;
|
|
vec3 tmpvar_4;
|
|
tmpvar_4 = ((_World2Object * tmpvar_3).xyz * unity_Scale.w);
|
|
objSpaceCameraPos_2 = tmpvar_4;
|
|
return (objSpaceCameraPos_2 - v_1.xyz);
|
|
}
|
|
|
|
v2f vert (
|
|
in appdata_t v_5
|
|
)
|
|
{
|
|
vec3 viewDir_6;
|
|
v2f o_7;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = (gl_ModelViewProjectionMatrix * v_5.vertex);
|
|
o_7.vertex = tmpvar_8;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = ObjSpaceViewDir (v_5.vertex);
|
|
vec3 tmpvar_10;
|
|
tmpvar_10 = normalize (tmpvar_9);
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = -(tmpvar_10);
|
|
viewDir_6 = tmpvar_11;
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = reflect (viewDir_6, v_5.normal);
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = tmpvar_12;
|
|
o_7.texcoord = tmpvar_13;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14.w = 0.0;
|
|
tmpvar_14.xyz = o_7.texcoord.xyz;
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = (gl_ModelViewMatrix * tmpvar_14).xyz;
|
|
vec3 tmpvar_16;
|
|
tmpvar_16 = tmpvar_15;
|
|
o_7.texcoord = tmpvar_16;
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = v_5.color;
|
|
o_7.color = tmpvar_17;
|
|
return o_7;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_t xlt_v_18;
|
|
v2f xl_retval_19;
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = tmpvar_20;
|
|
xlt_v_18.vertex = tmpvar_21;
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = gl_Color.xyzw;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23 = tmpvar_22;
|
|
xlt_v_18.color = tmpvar_23;
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = gl_Normal.xyz;
|
|
vec3 tmpvar_25;
|
|
tmpvar_25 = tmpvar_24;
|
|
xlt_v_18.normal = tmpvar_25;
|
|
v2f tmpvar_26;
|
|
tmpvar_26 = vert (xlt_v_18);
|
|
v2f tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
xl_retval_19 = tmpvar_27;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = xl_retval_19.vertex.xyzw;
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = tmpvar_28;
|
|
gl_Position = tmpvar_29;
|
|
vec4 tmpvar_30;
|
|
tmpvar_30 = xl_retval_19.color.xyzw;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = tmpvar_30;
|
|
gl_FrontColor = tmpvar_31;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32.w = 0.0;
|
|
tmpvar_32.xyz = xl_retval_19.texcoord.xyz;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
gl_TexCoord[0] = tmpvar_33;
|
|
}
|
|
|