diff options
| author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-19 21:21:17 -0500 |
|---|---|---|
| committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-19 21:21:17 -0500 |
| commit | a58decb97126c6fdcd2b5895cd29f143e8b9381f (patch) | |
| tree | 063d4a7225d4e7a99577a8df5f1720d123c57142 /public/gl/shader | |
| parent | fix projection (diff) | |
| download | webgl-main.tar.gz webgl-main.tar.bz2 webgl-main.zip | |
Diffstat (limited to '')
| -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) |