summaryrefslogtreecommitdiff
path: root/assets/shaders/vert.vert
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders/vert.vert')
-rw-r--r--assets/shaders/vert.vert32
1 files changed, 32 insertions, 0 deletions
diff --git a/assets/shaders/vert.vert b/assets/shaders/vert.vert
new file mode 100644
index 0000000..f3e7cf2
--- /dev/null
+++ b/assets/shaders/vert.vert
@@ -0,0 +1,32 @@
+#version 450
+
+layout(binding = 0) uniform UniformBufferObject {
+ mat4 model;
+ mat4 view;
+ mat4 proj;
+} ubo;
+
+// vertex
+layout(location = 0) in vec4 inColor;
+layout(location = 1) in vec3 inPosition;
+layout(location = 2) in vec3 inNorm;
+layout(location = 3) in vec2 inTexCoord;
+
+// instance
+layout(location = 4) in mat4 instPosRotScale;
+layout(location = 8) in float textureIndex;
+
+// output
+layout(location = 0) out vec3 fragColor;
+layout(location = 1) out vec3 fragTexCoord;
+
+void main() {
+ gl_Position =
+ ubo.proj *
+ ubo.view *
+ ubo.model *
+ instPosRotScale *
+ vec4(inPosition, 1.0);
+ fragColor = inColor;
+ fragTexCoord = vec3(inTexCoord, textureIndex);
+}