diff options
Diffstat (limited to 'public/gl/shader')
| -rw-r--r-- | public/gl/shader/SimpleShader.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/public/gl/shader/SimpleShader.js b/public/gl/shader/SimpleShader.js index 715aa60..3bca731 100644 --- a/public/gl/shader/SimpleShader.js +++ b/public/gl/shader/SimpleShader.js @@ -6,16 +6,17 @@ export const SimpleShader = () => { precision mediump float; attribute vec3 position; - attribute vec3 color; - + attribute vec3 normal; + attribute vec3 uv; + uniform mat4 proj; uniform mat4 view; uniform mat4 tran; - - varying vec3 color_pass; + + varying vec3 color; void main() { - color_pass = color; + color.xyz = (position.xyz + 1.0) / 2.0; gl_Position = proj * view * tran * vec4(position, 1.0); } ` @@ -23,10 +24,10 @@ export const SimpleShader = () => { const FragmentCode = ` precision mediump float; - varying vec3 color_pass; + varying vec3 color; void main() { - gl_FragColor = vec4(color_pass, 1.0); + gl_FragColor = vec4(color, 1.0); } ` return new Shader(VertexCode, FragmentCode) |