FroggyGreen
29b7e4b50b
Set up uniform buffers for the camera. The camera still lacks a proper controller on the lisp side, but you can create the matrix data in lisp. The projection matrices use the "reverse-z" trick. When setting up depth buffering in the (near) future, this needs to be considered.
27 lines
535 B
GLSL
27 lines
535 B
GLSL
#version 460
|
|
|
|
// vertex geometry data
|
|
layout(location = 0) in vec2 inPos;
|
|
|
|
// instance data
|
|
layout(location = 1) in vec3 inInstancePos;
|
|
layout(location = 2) in vec3 inInstanceScale;
|
|
layout(location = 3) in vec4 inInstanceColor;
|
|
|
|
layout(location = 0) out vec4 fragColor;
|
|
|
|
layout(binding = 0) uniform Camera
|
|
{
|
|
mat4 view;
|
|
mat4 perspective;
|
|
mat4 orthographic;
|
|
|
|
} camera;
|
|
|
|
void main()
|
|
{
|
|
vec3 pos = vec3(inPos, 0.0) * inInstanceScale + inInstancePos;
|
|
gl_Position = camera.orthographic * vec4(pos, 1.0);
|
|
fragColor = inInstanceColor;
|
|
}
|