Nimbin[12]?Games / Entropie / entropie/assets/shaders/figure.vert

Entropie git · main

Entropie festival game; first steps

sdl c game entropie cmake · first commit 2026-10-10 · last commit 2026-11-02 (19 hours ago) · synced 10 hours ago

C 88.5% Markdown 9.1% GLSL 2.3%
git clone https://git.christianimmanuel.de/games/Entropie.gitwget https://git.christianimmanuel.de/games/Entropie/archive/Entropie.tar.gz
entropie/assets/shaders/figure.vert 871 B · 20 lines raw
// Card for a 2D painted figure: a quad facing the viewer (the camera in the
// scene pass, the light in the shadow pass) that covers the body. The body
// itself is traced per pixel in figure.frag.

uniform mat4 viewProj;    // camera or light view-projection
uniform vec3 cardCenter;  // world space
uniform vec3 cardU;       // card axes, perpendicular to the view direction
uniform vec3 cardV;
uniform vec2 cardMin;     // bounds along cardU / cardV in meters
uniform vec2 cardMax;

out vec3 CardWorld;

void main() {
    const vec2 corners[6] = vec2[](vec2(0.0, 0.0), vec2(1.0, 0.0), vec2(1.0, 1.0),
                                   vec2(0.0, 0.0), vec2(1.0, 1.0), vec2(0.0, 1.0));
    vec2 local  = mix(cardMin, cardMax, corners[gl_VertexID]);
    CardWorld   = cardCenter + cardU * local.x + cardV * local.y;
    gl_Position = viewProj * vec4(CardWorld, 1.0);
}