mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
41 lines
1.2 KiB
Text
41 lines
1.2 KiB
Text
|
#version 300 es
|
||
|
|
||
|
#define gl_Vertex _glesVertex
|
||
|
in vec4 _glesVertex;
|
||
|
#define gl_MultiTexCoord0 _glesMultiTexCoord0
|
||
|
in vec4 _glesMultiTexCoord0;
|
||
|
float xll_saturate_f( float x) {
|
||
|
return clamp( x, 0.0, 1.0);
|
||
|
}
|
||
|
struct VertexOutputShadowCaster {
|
||
|
highp vec4 pos;
|
||
|
mediump vec2 tex;
|
||
|
};
|
||
|
struct VertexInput {
|
||
|
highp vec4 vertex;
|
||
|
mediump vec4 uv0;
|
||
|
};
|
||
|
uniform highp vec4 unity_LightShadowBias;
|
||
|
uniform highp mat4 glstate_matrix_mvp;
|
||
|
VertexOutputShadowCaster vertShadowCaster( in VertexInput v ) {
|
||
|
VertexOutputShadowCaster o;
|
||
|
o.pos = (glstate_matrix_mvp * v.vertex);
|
||
|
o.pos.z += xll_saturate_f((unity_LightShadowBias.x / o.pos.w));
|
||
|
highp float clamped = max( o.pos.z, (o.pos.w * -1.0));
|
||
|
o.pos.z = mix( o.pos.z, clamped, unity_LightShadowBias.y);
|
||
|
o.tex.xy = v.uv0.xy;
|
||
|
return o;
|
||
|
}
|
||
|
out mediump vec2 xlv_TEXCOORD1;
|
||
|
void main() {
|
||
|
VertexOutputShadowCaster xl_retval;
|
||
|
VertexInput xlt_v;
|
||
|
xlt_v.vertex = vec4(gl_Vertex);
|
||
|
xlt_v.uv0 = vec4(gl_MultiTexCoord0);
|
||
|
xl_retval = vertShadowCaster( xlt_v);
|
||
|
gl_Position = vec4(xl_retval.pos);
|
||
|
|
||
|
// Was producing missing precision cast on Metal, _bl_o.xlv_TEXCOORD1 = _bl_i._glesMultiTexCoord0.xy
|
||
|
xlv_TEXCOORD1 = vec2(xl_retval.tex);
|
||
|
}
|