mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
29 lines
658 B
Text
29 lines
658 B
Text
struct v2f {
|
|
highp vec2 uv;
|
|
highp vec3 nl;
|
|
};
|
|
uniform sampler2D _MainTex;
|
|
uniform highp vec4 _TerrainTreeLightColors[4];
|
|
lowp vec4 xlat_main (in v2f i) {
|
|
lowp vec4 col = texture2D( _MainTex, i.uv);
|
|
mediump vec3 light = vec3(0.0);
|
|
if(col.x >= 0.0) {
|
|
for (float j = 0.0; (j < i.uv.x); (j++)) {
|
|
light += col.xyz;
|
|
}
|
|
}
|
|
if(col.x >= 1.0) {
|
|
float j = i.uv.y;
|
|
j *= sin(j);
|
|
light += col.xyz*j;
|
|
}
|
|
return vec4(light, 1.0);
|
|
}
|
|
varying highp vec2 xlv_uv;
|
|
varying highp vec3 xlv_nl;
|
|
void main() {
|
|
v2f i;
|
|
i.uv = xlv_uv;
|
|
i.nl = xlv_nl;
|
|
gl_FragData[0] = xlat_main(i);
|
|
}
|