I have a simple shader with a property for a color that can be modified in the properties window on a material. Check the code sample and the image for a reference.
How can I make an array of colors? I want to be able to specify any number of colors in an array on a material’s properties window.
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
blendState:
targets:
- blend: true
rasterizerState:
cullMode: none
properties:
texture: { value: white }
alphaThreshold: { value: 0.5 }
color: { value: [1, 1, 1, 1], editor: { type: color }}
}%
CCProgram vs %{
// ...
}%
CCProgram fs %{
precision highp float;
#include <alpha-test>
#include <texture>
in vec4 v_color;
#if USE_TEXTURE
in vec2 v_uv0;
uniform sampler2D texture;
#endif
uniform Data
{
vec4 color;
};
void main()
{
vec4 o = vec4(1, 1, 1, 1);
#if USE_TEXTURE
CCTexture(texture, v_uv0, o);
#endif
o *= v_color;
ALPHA_TEST(o);
gl_FragColor = o;
}
}%