Buffer binding ‘CCLocal’ at set 2 binding 0 is not bounded
shader一直报这个错误
CCEffect %{
techniques:
-
name: opaque
passes:
-
vert: unlit-vs:vert
frag: unlit-fs:frag
properties: &props
color: { value: [1, 1, 1, 1], inspector: { type: color } }
tilingOffset: { value: [1, 1, 0, 0] }
mainTexture: { value: grey }
center: { value: [0.5, 0.5], inspector: { displayName: “水波中心” } }
_WaveStrength: { value: 0.01, inspector: { displayName: “增强” } }
_WaveFactor: { value: 50, inspector: { displayName: “水波因子” } }
_TimeScale: { value: 10, inspector: { displayName: “速度” } }
-
-
name: transparent
passes:
-
vert: unlit-vs:vert
frag: unlit-fs:frag
blendState:
targets:
-
blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendSrcAlpha: src_alpha
blendDstAlpha: one_minus_src_alpha
properties: *props
-
-
}%
CCProgram unlit-vs %{
precision mediump float;
#include
#include
#include
#if USE_VERTEX_COLOR
in vec4 a_color;
out vec4 v_color;
#endif
#if USE_TEXTURE
out vec2 v_uv;
uniform TexCoords {
vec4 tilingOffset;
};
#endif
highp vec4 vert () {
vec4 position;
CCVertInput(position);
highp mat4 matWorld;
CCGetWorldMatrix(matWorld);
highp vec4 pos = cc_matProj * (cc_matView * matWorld) * position;
#if USE_TEXTURE
v_uv = a_texCoord;
#if FLIP_UV
v_uv.y = 1.0 - v_uv.y;
#endif
v_uv = v_uv * tilingOffset.xy + tilingOffset.zw;
#endif
#if USE_VERTEX_COLOR
v_color = a_color;
#endif
return pos;
}
}%
CCProgram unlit-fs %{
precision mediump float;
#include
#if USE_TEXTURE
in vec2 v_uv;
uniform sampler2D mainTexture;
uniform Tex {
vec2 center;
float _WaveStrength;
float _WaveFactor;
float _TimeScale;
};
#endif
#if USE_COLOR
uniform Constant {
vec4 color;
};
#endif
#if USE_VERTEX_COLOR
in vec4 v_color;
#endif
vec4 frag () {
vec4 o = vec4(1, 1, 1, 1);
#if USE_TEXTURE
vec2 uvDir = normalize(v_uv - center);
float dis = distance(v_uv, center);
vec2 uv = v_uv + _WaveStrength * uvDir * sin(cc_time.x * _TimeScale + dis * _WaveFactor);
o *= texture(mainTexture, uv);
#endif
#if USE_COLOR
o *= color;
#endif
#if USE_VERTEX_COLOR
o *= v_color;
#endif
return CCFragOutput(o);
}
}%