-
Creator 版本:3.3.2
-
目标平台:Chrome
自己写了一个颜色渐变的Effect,编辑器里看效果是对的,但是到Chrome上预览效果不太对,请问是我哪里写的有问题吗,不太会
CCEffect %{
techniques:
- name: opaque
passes:
- vert: vs:vert
frag: fs:frag
properties: &props
beginColor: { value: [1, 1, 1, 1], editor: { type: color } }
endColor: { value: [1, 1, 1, 1], editor: { type: color } }
}%
CCProgram vs %{
precision highp float;
#include <cc-global>
in vec3 a_position;
in vec2 a_texCoord;
out vec4 color;
out vec2 v_uv;
vec4 vert () {
vec4 pos = vec4(a_position, 1);
pos = cc_matViewProj * pos;
v_uv = a_texCoord;
return pos;
}
}%
CCProgram fs %{
precision highp float;
#include <output>
in vec2 v_uv;
uniform Constant {
vec4 beginColor;
vec4 endColor;
};
vec4 frag () {
vec4 col = vec4(1,1,1,1);
col.r = beginColor.r + (endColor.r - beginColor.r)*v_uv.y;
col.g = beginColor.g + (endColor.g - beginColor.g)*v_uv.y;
col.b = beginColor.b + (endColor.b - beginColor.b)*v_uv.y;
return CCFragOutput(col);
}
}%





