;;;; rlgl's matrix stack, declared for Flan. (import rlgl "vendor:rlgl") ;;;; qualifies it as rlgl/… ;;;; ;;;; rlgl is raylib's layer over OpenGL, and every raylib draw goes through ;;;; it. The stack is how a draw is moved without moving its arguments: push, ;;;; transform, draw, pop, and everything drawn in between is transformed. ;;;; raylib's own begin-mode-2d and begin-mode-3d load a matrix onto the same ;;;; stack. ;;;; ;;;; Each call needs a window and a GL context, so none of this runs headless. ;;;; ;;;; The names drop rlgl's `rl` prefix, which the package alias already says, ;;;; and the `f` suffix, which says the arguments are floats — the signature ;;;; says that. ;; Save the current matrix, so the transforms after it can be undone. declare-c(push-matrix, [], "rlPushMatrix") ;; Restore the matrix the last push-matrix saved. declare-c(pop-matrix, [], "rlPopMatrix") ;; Replace the current matrix with the identity. declare-c(load-identity, [], "rlLoadIdentity") ;; Multiply the current matrix by a translation. declare-c(translate, [x f32 y f32 z f32], "rlTranslatef") ;; Multiply the current matrix by a rotation of `angle` degrees about the axis ;; (x, y, z). declare-c(rotate, [angle f32 x f32 y f32 z f32], "rlRotatef") ;; Multiply the current matrix by a scale along each axis. declare-c(scale, [x f32 y f32 z f32], "rlScalef")