summaryrefslogtreecommitdiff
path: root/data/shaders/pbr-vert.glsl
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-05-07 09:49:57 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-05-07 09:49:57 -0400
commite142166c3e2d6f567ed0d4e4c414fa510271260f (patch)
tree3692fc871d6d46ae53d702d7bb1b0f538255c48b /data/shaders/pbr-vert.glsl
parenta5170a38e87b8ba4d6043e180e95f92927c8e467 (diff)
graphics: pbr: Extract shader code to separate files.
Diffstat (limited to 'data/shaders/pbr-vert.glsl')
-rw-r--r--data/shaders/pbr-vert.glsl39
1 files changed, 39 insertions, 0 deletions
diff --git a/data/shaders/pbr-vert.glsl b/data/shaders/pbr-vert.glsl
new file mode 100644
index 0000000..f622988
--- /dev/null
+++ b/data/shaders/pbr-vert.glsl
@@ -0,0 +1,39 @@
+// -*- mode: c -*-
+
+#ifdef GLSL330
+layout (location = 0) in vec3 position;
+layout (location = 1) in vec2 texcoord0;
+layout (location = 2) in vec2 texcoord1;
+layout (location = 3) in vec4 color0;
+#elif defined(GLSL130)
+in vec3 position;
+in vec2 texcoord0;
+in vec2 texcoord1;
+in vec4 color0;
+#elif defined(GLSL120)
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
+attribute vec4 color0;
+#endif
+
+#ifdef GLSL120
+varying vec2 fragTexcoord0;
+varying vec2 fragTexcoord1;
+varying vec4 fragColor0;
+#else
+out vec2 fragTexcoord0;
+out vec2 fragTexcoord1;
+out vec4 fragColor0;
+#endif
+
+uniform mat4 model;
+uniform mat4 view;
+uniform mat4 projection;
+
+void main(void) {
+ fragTexcoord0 = texcoord0;
+ fragTexcoord1 = texcoord1;
+ fragColor0 = color0;
+ gl_Position = projection * view * model * vec4(position.xyz, 1.0);
+}