]> gitweb.factorcode.org Git - factor.git/commitdiff
opengl: adding some gl-scale math functions.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 28 Dec 2021 20:13:37 +0000 (12:13 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 28 Dec 2021 20:13:37 +0000 (12:13 -0800)
basis/opengl/opengl.factor

index 170b94fa2daaeb2b68d3bb7bc59976fdfc995514..ff2b36c50af1986e651742e1e7ea85652b110c03 100644 (file)
@@ -3,9 +3,9 @@
 ! Portions copyright (C) 2008 Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.data assocs colors
-combinators.smart continuations init io kernel math math.parser
-namespaces opengl.gl sequences sequences.generalizations
-specialized-arrays system words ;
+combinators.smart continuations init io kernel math
+math.functions math.parser namespaces opengl.gl sequences
+sequences.generalizations specialized-arrays system words ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 SPECIALIZED-ARRAY: uint
@@ -228,6 +228,15 @@ MACRO: set-draw-buffers ( buffers -- quot )
 : gl-unscale ( m -- n )
     gl-scale-factor get-global [ / ] when* ; inline
 
+: gl-floor ( m -- n )
+    gl-scale floor gl-unscale ; inline
+
+: gl-ceiling ( m -- n )
+    gl-scale ceiling gl-unscale ; inline
+
+: gl-round ( m -- n )
+    gl-scale round gl-unscale ; inline
+
 : fix-coordinates ( point1 point2 -- x1 y1 x2 y2 )
     [ first2 [ gl-scale >fixnum ] bi@ ] bi@ ;