{ "name" : "VecWColor", "ubo" : [ "UBOTransform", "UBOModel", "UBOWorld" ], "options" : { "modelMatrix":true }, "uniforms" : [ { "name":"u_colorAry", "type":"vec3" } ] }<\shader> [ { "name":"VecWColor", "options" : { "depthTest":true, "blend":false }, "uniforms":[ { "name":"u_colorAry", "type":"rgb", "value": ["ff0000","00ff00","0000ff","555555","999999","dddddd","000000","ff7f7f","ff8c00","ffff00"] } ]}, { "name":"MatGridFloor", "options" : { "depthTest":true, "blend":false }, "uniforms":[ { "name":"u_colorAry", "type":"rgb", "value": ["e6e6e6","ff9999","66ff66"] } ] }, { "name":"MatGridFloorDark", "options" : { "depthTest":true, "blend":false }, "uniforms":[ { "name":"u_colorAry", "type":"rgb", "value": ["555555","bb5555","118811"] } ] } ]<\materials> #version 300 es layout(location=0) in vec4 a_position; uniform UBOTransform{ mat4 projViewMatrix; vec3 cameraPos; float globalTime; vec2 screenSize; }; uniform UBOWorld{ vec4 rotation; vec3 position; vec3 scale; } model; uniform UBOModel{ mat4 modelMatrix; mat3 normalMatrix; }; uniform vec3 u_colorAry[20]; out vec3 v_color; vec3 vecQuatRotation(vec4 q, vec3 v){ return v + cross(2.0 * q.xyz, cross(q.xyz, v) + q.w * v); } void main(void){ vec3 pos = vecQuatRotation(model.rotation, a_position.xyz * model.scale) + model.position; v_color = u_colorAry[ int(a_position.w) ]; gl_PointSize = 10.0; //gl_Position = projViewMatrix * modelMatrix * vec4(a_position.xyz, 1.0); gl_Position = projViewMatrix * vec4(pos, 1.0); } <\vertex> #version 300 es precision mediump float; in vec3 v_color; out vec4 oFragColor; void main(void){ oFragColor = vec4(v_color, 1.0); } <\fragment>