好多实用的 shader 都是 2.x 的,3.x 的根本用不了,没有 shader语法基础,有啥办法能转成 3.x 的吗?
我发个 2.x 的,有木有热心老哥帮忙改一改
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
blendState:
targets:- blend: true
rasterizerState:
cullMode: none
properties:
texture: { value: white }
time: { value: 0 }
speed: { value: 0.002 }
}%
- blend: true
- vert: vs
CCProgram vs %{
precision highp float;
#include
in vec3 a_position;
in mediump vec2 a_uv0;
out mediump vec2 v_uv0;
in vec4 a_color;
out vec4 v_color;
void main () {
gl_Position = cc_matViewProj * vec4(a_position, 1);
v_uv0 = a_uv0;
v_color = a_color;
}
}%
CCProgram fs %{
precision highp float;
uniform Time {
float time;
};
uniform SPEED {
float speed;
};
uniform sampler2D texture;
in mediump vec2 v_uv0;
in vec4 v_color;
void main () {
vec2 uv = v_uv0.xy;
uv.x += time * speed;
uv.x = fract(uv.x);
vec4 color = texture2D(texture, uv);
gl_FragColor = color;
}
}%
不仅2.x的shader3.x用不了,很多3.x的shader,升级3.x版本后也用不了。

