impl: 3D Rendering
This commit is contained in:
parent
dbf9544e80
commit
70176bb86a
18 changed files with 862 additions and 185 deletions
|
|
@ -1,10 +1,26 @@
|
|||
#version 450
|
||||
vec2 positions[3] = vec2[](
|
||||
vec2(0.0, -0.5),
|
||||
vec2(0.5, 0.5),
|
||||
vec2(-0.5, 0.5)
|
||||
);
|
||||
|
||||
// Matches Vertex struct attribute descriptions
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec3 inColor;
|
||||
// layout(location = 2) in vec2 inTexCoord; // If you add texture coords
|
||||
|
||||
// Matches UniformBufferObject struct and descriptor set layout binding
|
||||
layout(binding = 0) uniform UniformBufferObject {
|
||||
mat4 model;
|
||||
mat4 view;
|
||||
mat4 proj;
|
||||
} ubo;
|
||||
|
||||
// Output to fragment shader
|
||||
layout(location = 0) out vec3 fragColor;
|
||||
// layout(location = 1) out vec2 fragTexCoord; // If you add texture coords
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
|
||||
// Transform position: Model -> World -> View -> Clip space
|
||||
gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0);
|
||||
|
||||
// Pass color (and other attributes) through
|
||||
fragColor = inColor;
|
||||
// fragTexCoord = inTexCoord;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue