SOF/renderer/shaders/grid-selector.vert
FroggyGreen 1a7b86f6d1 View mode and Chez Scheme rewrite
All of the common lisp code was translated into Chez Scheme. A grid
coordinate system was added; with the 'v' key one can toggle a grid
selector which may be manipulated with vi keys or the numpad.

Currently, when moving the selector there is an issue. The selector is
moved by updating one of two vertex buffers (one is for geometry, one is
for mesh instances). I plan on the second one to be static in the long
run, this is a 'quick and dirty solution'. Uniform buffers will
eventually be implemented. Right now, everything works with a bit of
error message spam.
2024-06-28 00:36:03 -05:00

27 lines
547 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.perspective * camera.view * vec4(pos, 1.0);
fragColor = inInstanceColor;
}