2012-04-03 23:30:07 -04:00
|
|
|
struct v2f {
|
|
|
|
highp vec4 pos;
|
|
|
|
highp vec4 uv;
|
|
|
|
highp vec3 ray;
|
|
|
|
};
|
|
|
|
struct appdata {
|
|
|
|
highp vec4 vertex;
|
|
|
|
highp vec3 normal;
|
|
|
|
};
|
|
|
|
uniform highp vec4 _ProjectionParams;
|
|
|
|
uniform highp mat4 glstate_matrix_modelview0;
|
|
|
|
uniform highp mat4 glstate_matrix_mvp;
|
|
|
|
highp vec4 ComputeScreenPos( in highp vec4 pos );
|
|
|
|
v2f xlat_main( in appdata v );
|
|
|
|
highp vec4 ComputeScreenPos( in highp vec4 pos ) {
|
|
|
|
highp vec4 o;
|
|
|
|
o = (pos * 0.500000);
|
|
|
|
o.xy = (vec2( o.x , (o.y * _ProjectionParams.x )) + o.w );
|
|
|
|
o.zw = pos.zw ;
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
v2f xlat_main( in appdata v ) {
|
|
|
|
v2f o;
|
|
|
|
o.pos = ( glstate_matrix_mvp * v.vertex );
|
|
|
|
o.uv = ComputeScreenPos( o.pos);
|
2014-02-11 02:06:13 -05:00
|
|
|
o.ray = (( glstate_matrix_modelview0 * v.vertex ).xyz * vec3( -1.00000, -1.00000, 1.00000));
|
2012-04-03 23:30:07 -04:00
|
|
|
o.ray = mix( o.ray, v.normal, vec3( float( (v.normal.z != 0.000000) )));
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
varying highp vec4 xlv_TEXCOORD0;
|
|
|
|
varying highp vec3 xlv_TEXCOORD1;
|
|
|
|
void main() {
|
|
|
|
v2f xl_retval;
|
|
|
|
appdata xlt_v;
|
2014-02-11 02:06:13 -05:00
|
|
|
xlt_v.vertex = vec4( gl_Vertex);
|
|
|
|
xlt_v.normal = vec3( gl_Normal);
|
2012-04-03 23:30:07 -04:00
|
|
|
xl_retval = xlat_main( xlt_v);
|
2014-02-11 02:06:13 -05:00
|
|
|
gl_Position = vec4( xl_retval.pos);
|
|
|
|
xlv_TEXCOORD0 = vec4( xl_retval.uv);
|
|
|
|
xlv_TEXCOORD1 = vec3( xl_retval.ray);
|
2012-04-03 23:30:07 -04:00
|
|
|
}
|