From f70007d58b8c135b7ea79a273b6772a37a541e11 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Thu, 19 Jan 2023 14:32:58 -0500 Subject: changes --- public/gl/shader/SimpleShader.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 public/gl/shader/SimpleShader.js (limited to 'public/gl/shader') diff --git a/public/gl/shader/SimpleShader.js b/public/gl/shader/SimpleShader.js new file mode 100644 index 0000000..715aa60 --- /dev/null +++ b/public/gl/shader/SimpleShader.js @@ -0,0 +1,34 @@ +import { Shader } from '../core/Shader.js' + +export const SimpleShader = () => { + + const VertexCode = ` + precision mediump float; + + attribute vec3 position; + attribute vec3 color; + + uniform mat4 proj; + uniform mat4 view; + uniform mat4 tran; + + varying vec3 color_pass; + + void main() { + color_pass = color; + gl_Position = proj * view * tran * vec4(position, 1.0); + } + ` + + const FragmentCode = ` + precision mediump float; + + varying vec3 color_pass; + + void main() { + gl_FragColor = vec4(color_pass, 1.0); + } + ` + return new Shader(VertexCode, FragmentCode) + +} \ No newline at end of file -- cgit v1.2.3-freya