Skip to content
Browse files

Fixes texture orientation for (eq :y-axis :up)

1 parent 31f9c50 commit e76e9bd3bfafb7107ec886de8675e551d71066b1 @vydd committed
Showing with 4 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +1 −1 src/drawing.lisp
  3. +2 −0 src/environment.lisp
View
1 .gitignore
@@ -5,3 +5,4 @@
\#*
*~
scratchpad.lisp
+todo.org
View
2 src/drawing.lisp
@@ -96,7 +96,7 @@
do (setf (cffi:mem-aref buffer-pointer :float idx) (coerce-float x)
(cffi:mem-aref buffer-pointer :float (+ idx 1)) (coerce-float y)
(cffi:mem-aref buffer-pointer :float (+ idx 2)) (coerce-float tx)
- (cffi:mem-aref buffer-pointer :float (+ idx 3)) (coerce-float ty)
+ (cffi:mem-aref buffer-pointer :float (+ idx 3)) (coerce-float (* ty (env-y-axis-sgn *env*)))
(cffi:mem-aref buffer-pointer :uint8 (* 4 (+ idx 4))) (aref color 0)
(cffi:mem-aref buffer-pointer :uint8 (+ (* 4 (+ idx 4)) 1)) (aref color 1)
(cffi:mem-aref buffer-pointer :uint8 (+ (* 4 (+ idx 4)) 2)) (aref color 2)
View
2 src/environment.lisp
@@ -29,6 +29,7 @@
(model-matrix (sb-cga:identity-matrix))
(view-matrix nil)
(matrix-stack nil)
+ (y-axis-sgn +1)
(vao nil)
(buffer-position 0)
;; Typography
@@ -58,6 +59,7 @@
(env-view-matrix env) (if (eq y-axis :down)
(kit.glm:ortho-matrix 0 width height 0 -1 1)
(kit.glm:ortho-matrix 0 width 0 height -1 1))
+ (env-y-axis-sgn env) (if (eq y-axis :down) +1 -1)
(env-vao env) (make-instance 'kit.gl.vao:vao :type 'sketch-vao)
(env-white-pixel-texture env) (make-white-pixel-texture)
(env-white-color-vector env) #(255 255 255 255)

0 comments on commit e76e9bd

Please sign in to comment.
Something went wrong with that request. Please try again.