Entropie git · main
Entropie festival game; first steps
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.gzentropie/assets/shaders/figure.vert 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);
}