mirror of
https://github.com/slendidev/lunar.git
synced 2025-12-08 10:29:52 +02:00
32
shaders/triangle_mesh.vert
Normal file
32
shaders/triangle_mesh.vert
Normal file
@@ -0,0 +1,32 @@
|
||||
#version 450
|
||||
#extension GL_EXT_buffer_reference : require
|
||||
|
||||
layout (location = 0) out vec3 out_color;
|
||||
layout (location = 1) out vec3 out_uv;
|
||||
|
||||
struct Vertex {
|
||||
vec3 position;
|
||||
float uv_x;
|
||||
vec3 normal;
|
||||
float uv_y;
|
||||
vec4 color;
|
||||
};
|
||||
|
||||
layout(buffer_reference, std430) readonly buffer VertexBuffer{
|
||||
Vertex vertices[];
|
||||
};
|
||||
|
||||
layout(push_constant) uniform constants {
|
||||
mat4 world_matrix;
|
||||
VertexBuffer vertex_buffer;
|
||||
} PushConstants;
|
||||
|
||||
void main() {
|
||||
Vertex v = PushConstants.vertex_buffer.vertices[gl_VertexIndex];
|
||||
|
||||
gl_Position = PushConstants.world_matrix * vec4(v.position, 1.0f);
|
||||
out_color = v.color.xyz;
|
||||
out_uv.x = v.uv_x;
|
||||
out_uv.y = v.uv_y;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user