mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 19:15:37 -05:00
48 lines
1 KiB
Text
48 lines
1 KiB
Text
|
vec4 xll_tex2Dlod(sampler2D s, vec4 coord) {
|
||
|
return texture2DLod( s, coord.xy, coord.w);
|
||
|
}
|
||
|
struct v2f_vertex_lit {
|
||
|
vec2 uv;
|
||
|
vec4 diff;
|
||
|
vec4 spec;
|
||
|
};
|
||
|
struct v2f_img {
|
||
|
vec4 pos;
|
||
|
vec2 uv;
|
||
|
};
|
||
|
struct appdata_img {
|
||
|
vec4 vertex;
|
||
|
vec2 texcoord;
|
||
|
};
|
||
|
struct v2f {
|
||
|
vec4 pos;
|
||
|
vec2 uv;
|
||
|
};
|
||
|
struct appdata_base {
|
||
|
vec4 vertex;
|
||
|
vec3 normal;
|
||
|
vec4 texcoord;
|
||
|
};
|
||
|
uniform sampler2D _CameraDepthTexture;
|
||
|
|
||
|
v2f vert( in appdata_base v );
|
||
|
v2f vert( in appdata_base v ) {
|
||
|
float tex;
|
||
|
v2f o;
|
||
|
tex = xll_tex2Dlod( _CameraDepthTexture, vec4( v.texcoord.xy , 0.000000, 0.000000)).x ;
|
||
|
v.vertex.y += ((1.00000 - float( tex)) * 3.00000);
|
||
|
o.pos = ( gl_ModelViewProjectionMatrix * v.vertex );
|
||
|
o.uv = v.texcoord.xy ;
|
||
|
return o;
|
||
|
}
|
||
|
void main() {
|
||
|
v2f xl_retval;
|
||
|
appdata_base xlt_v;
|
||
|
xlt_v.vertex = vec4( gl_Vertex);
|
||
|
xlt_v.normal = vec3( gl_Normal);
|
||
|
xlt_v.texcoord = vec4( gl_MultiTexCoord0);
|
||
|
xl_retval = vert( xlt_v);
|
||
|
gl_Position = vec4( xl_retval.pos);
|
||
|
gl_TexCoord[0] = vec4( xl_retval.uv, 0.0, 0.0);
|
||
|
}
|