techkaczynski.dev / code

summaryrefslogtreecommitdiff
path: root/res/sdr/mdl_lit.vs
diff options
context:
space:
mode:
authortech kaczynski <tk@techkaczynski.dev>2026-09-22 22:38:57 +1000
committertech kaczynski <tk@techkaczynski.dev>2026-09-22 22:38:57 +1000
commit08cb8d6a585dd552b69a488d9db1be123f01467a (patch)
tree77d50ce30bbc102b08486929ba654b5bef70af43 /res/sdr/mdl_lit.vs
initial commit.
Diffstat (limited to 'res/sdr/mdl_lit.vs')
-rw-r--r--res/sdr/mdl_lit.vs28
1 files changed, 28 insertions, 0 deletions
diff --git a/res/sdr/mdl_lit.vs b/res/sdr/mdl_lit.vs
new file mode 100644
index 0000000..eb13a28
--- /dev/null
+++ b/res/sdr/mdl_lit.vs
@@ -0,0 +1,28 @@
+#version 330
+
+in vec3 vertexPosition;
+in vec2 vertexTexCoord;
+in vec3 vertexNormal;
+in vec4 vertexColor;
+
+uniform mat4 mvp;
+uniform mat4 matNormal;
+
+out vec2 frag_texcoord;
+out vec4 frag_colour;
+out vec3 frag_world_normal;
+
+void
+main() {
+ frag_texcoord = vertexTexCoord;
+ frag_colour = vertexColor;
+
+ /*
+ * Do not necessarily normalize here. Interpolation changes the
+ * length, so the fragment shader must normalize it regardless.
+ */
+ frag_world_normal =
+ (matNormal * vec4(vertexNormal, 0.0)).xyz;
+
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}