summaryrefslogtreecommitdiff
path: root/vk-cube/vk-cube-vs.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'vk-cube/vk-cube-vs.glsl')
-rw-r--r--vk-cube/vk-cube-vs.glsl12
1 files changed, 11 insertions, 1 deletions
diff --git a/vk-cube/vk-cube-vs.glsl b/vk-cube/vk-cube-vs.glsl
index e3b83d7..eb51557 100644
--- a/vk-cube/vk-cube-vs.glsl
+++ b/vk-cube/vk-cube-vs.glsl
@@ -6,7 +6,7 @@
// $ glslc -o vk-cube-vs.spv -fshader-stage=vertex vk-cube-vs.glsl
//
// Changelog:
-// ??/??/????: Initial release
+// 5/31/2026: Initial release
//
// License:
// Copyright (c) 2026 Hunter Kvalevog
@@ -21,12 +21,22 @@
layout (binding = 0) uniform UBO
{
mat4 mvp;
+ mat4 model;
};
layout (location = 0) in vec3 v_p;
+layout (location = 1) in vec3 v_c;
+layout (location = 2) in vec3 v_n;
+
+layout (location = 0) out vec3 f_c;
+layout (location = 1) out vec3 f_n;
+layout (location = 2) out vec3 f_p;
void main()
{
+ f_c = v_c;
+ f_n = mat3(model) * v_n;
+ f_p = (model * vec4(v_p, 1.0f)).xyz;
gl_Position = mvp * vec4(v_p, 1.0f);
}