标签:ntc oat ec2 osi texture xtu code div ref
uniform mat4 viewProj;
#ifdef use2DPos
attribute vec2 a_position;
#else
attribute vec3 a_position;
#endif
attribute lowp vec4 a_color;
#ifdef useModel
uniform mat4 model;
#endif
#ifdef useTexture
attribute mediump vec2 a_uv0;
varying mediump vec2 uv0;
#endif
#ifndef useColor
varying lowp vec4 v_fragmentColor;
#endif
void main ()
{
mat4 mvp;
#ifdef useModel
mvp = viewProj * model;
#else
mvp = viewProj;
#endif
#ifdef use2DPos
vec4 pos = mvp * vec4(a_position, 0, 1);
#else
vec4 pos = mvp * vec4(a_position, 1);
#endif
#ifndef useColor
v_fragmentColor = a_color;
#endif
#ifdef useTexture
uv0 = a_uv0;
#endif
gl_Position = pos;
}
#ifdef useTexture
uniform sampler2D texture;
varying mediump vec2 uv0;
#endif
#ifdef alphaTest
uniform lowp float alphaThreshold;
#endif
#ifdef useColor
uniform lowp vec4 color;
#else
varying lowp vec4 v_fragmentColor;
#endif
void main () {
#ifdef useColor
vec4 o = color;
#else
vec4 o = v_fragmentColor;
#endif
#ifdef useTexture
o *= texture2D(texture, uv0);
#endif
#ifdef alphaTest
if (o.a <= alphaThreshold)
discard;
#endif
gl_FragColor = o;
}
标签:ntc oat ec2 osi texture xtu code div ref
原文地址:https://www.cnblogs.com/daihanlong/p/10447773.html