mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
43 lines
941 B
Text
43 lines
941 B
Text
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;
|
|
vec4 uv[4];
|
|
};
|
|
uniform vec4 _Color;
|
|
uniform sampler2D _MainTex;
|
|
vec4 frag( in v2f i );
|
|
vec4 frag( in v2f i ) {
|
|
vec4 c;
|
|
c = texture2D( _MainTex, i.uv[ 0 ].xy );
|
|
c += texture2D( _MainTex, i.uv[ 1 ].xy );
|
|
c += texture2D( _MainTex, i.uv[ 2 ].xy );
|
|
c += texture2D( _MainTex, i.uv[ 3 ].xy );
|
|
c /= 4.00000;
|
|
c.xyz *= _Color.xyz ;
|
|
c.xyz *= (c.w + _Color.w );
|
|
c.w = 0.000000;
|
|
return c;
|
|
}
|
|
void main() {
|
|
vec4 xl_retval;
|
|
v2f xlt_i;
|
|
xlt_i.pos = vec4(0.0);
|
|
xlt_i.uv[0] = vec4( gl_TexCoord[0]);
|
|
xlt_i.uv[1] = vec4( gl_TexCoord[1]);
|
|
xlt_i.uv[2] = vec4( gl_TexCoord[2]);
|
|
xlt_i.uv[3] = vec4( gl_TexCoord[3]);
|
|
xl_retval = frag( xlt_i);
|
|
gl_FragData[0] = vec4( xl_retval);
|
|
}
|