summaryrefslogtreecommitdiff
path: root/public/gl/shader
diff options
context:
space:
mode:
Diffstat (limited to 'public/gl/shader')
-rw-r--r--public/gl/shader/SimpleShader.js34
1 files changed, 34 insertions, 0 deletions
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