;; this is similar to gluPerspective
;; but fills a suitable PROJECTION matrix
(bind-func fill_projection_matrix
(lambda (mat:float* fovy aspect near far)
(let ((top (* near (tanf fovy)))
(right (* top aspect))
(left (* -1.0 right))
(bottom (* -1.0 top)))
(pfill! mat
(/ near right) 0.0 0.0 0.0
0.0 (/ near top) 0.0 0.0
0.0 0.0 (/ (+ (* -1.0 far) near) (- far near)) -1.0
0.0 0.0 (/ (* -2.0 far near) (- far near)) 0.0)
void)))