mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
96 lines
2 KiB
Text
96 lines
2 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
vec4 uv;
|
|
vec3 ray;
|
|
};
|
|
struct appdata {
|
|
vec4 vertex;
|
|
vec3 normal;
|
|
};
|
|
uniform vec4 _ProjectionParams;
|
|
uniform mat4 glstate_matrix_modelview0;
|
|
uniform mat4 glstate_matrix_mvp;
|
|
varying vec4 xlv_TEXCOORD0;
|
|
varying vec3 xlv_TEXCOORD1;
|
|
vec4 ComputeScreenPos (
|
|
in vec4 pos_1
|
|
)
|
|
{
|
|
vec4 o_2;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = (pos_1 * 0.5);
|
|
o_2 = tmpvar_3;
|
|
vec2 tmpvar_4;
|
|
tmpvar_4.x = o_2.x;
|
|
tmpvar_4.y = (o_2.y * _ProjectionParams.x);
|
|
vec2 tmpvar_5;
|
|
tmpvar_5 = (tmpvar_4 + o_2.w);
|
|
o_2.xy = tmpvar_5.xy.xy;
|
|
vec2 tmpvar_6;
|
|
tmpvar_6 = pos_1.zw;
|
|
o_2.zw = tmpvar_6.xxxy.zw;
|
|
return o_2;
|
|
}
|
|
|
|
v2f xlat_main (
|
|
in appdata v_7
|
|
)
|
|
{
|
|
v2f o_8;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = (glstate_matrix_mvp * v_7.vertex);
|
|
o_8.pos = tmpvar_9;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = ComputeScreenPos (o_8.pos);
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = tmpvar_10;
|
|
o_8.uv = tmpvar_11;
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = ((glstate_matrix_modelview0 * v_7.vertex).xyz * vec3(-1.0, -1.0, 1.0));
|
|
o_8.ray = tmpvar_12;
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = vec3(float((v_7.normal.z != 0.0)));
|
|
vec3 tmpvar_14;
|
|
tmpvar_14 = mix (o_8.ray, v_7.normal, tmpvar_13);
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = tmpvar_14;
|
|
o_8.ray = tmpvar_15;
|
|
return o_8;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata xlt_v_16;
|
|
v2f xl_retval_17;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_19;
|
|
tmpvar_19 = tmpvar_18;
|
|
xlt_v_16.vertex = tmpvar_19;
|
|
vec3 tmpvar_20;
|
|
tmpvar_20 = gl_Normal.xyz;
|
|
vec3 tmpvar_21;
|
|
tmpvar_21 = tmpvar_20;
|
|
xlt_v_16.normal = tmpvar_21;
|
|
v2f tmpvar_22;
|
|
tmpvar_22 = xlat_main (xlt_v_16);
|
|
v2f tmpvar_23;
|
|
tmpvar_23 = tmpvar_22;
|
|
xl_retval_17 = tmpvar_23;
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = xl_retval_17.pos.xyzw;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25 = tmpvar_24;
|
|
gl_Position = tmpvar_25;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = xl_retval_17.uv.xyzw;
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
xlv_TEXCOORD0 = tmpvar_27;
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = xl_retval_17.ray.xyz;
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = tmpvar_28;
|
|
xlv_TEXCOORD1 = tmpvar_29;
|
|
}
|
|
|