刚开始就卡住了。
shader 如下,编辑器和浏览器中显示效果不一样。
浏览器中的 v_uv0 的范围是 [0, 0.1]
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
blendState:
targets:
- blend: true
rasterizerState:
cullMode: none
properties:
}%
CCProgram vs %{
precision highp float;
#include <cc-global>
in vec3 a_position;
in vec2 a_uv0;
out vec2 v_uv0;
void main () {
vec4 pos = vec4(a_position, 1);
pos = cc_matViewProj * pos;
v_uv0 = a_uv0;
gl_Position = pos;
}
}%
// 片元着色器
CCProgram fs %{
precision highp float;
in vec4 v_color;
in vec2 v_uv0;
void main () {
vec3 color = vec3(0.0, 1.0, 0.0);
if (v_uv0.x > 0.05) {
discard;
}
vec4 o = vec4(color, 1.0);
gl_FragColor = o;
}
}%
编辑器:
浏览器: