module Language.Mecha.OpenGL
( vertex3
, normal3
, color3
, scale3
, translate3
, rotate3
) where
import Graphics.Rendering.OpenGL
vertex3 x y z = vertex $ Vertex3 (toFloat x) (toFloat y) (toFloat z)
normal3 x y z = normal $ Normal3 (toFloat x) (toFloat y) (toFloat z)
color3 r g b = color $ Color3 (toFloat r) (toFloat g) (toFloat b)
scale3 x y z = scale (toFloat x) (toFloat y) (toFloat z)
translate3 x y z = translate $ Vector3 (toFloat x) (toFloat y) (toFloat z)
rotate3 angle x y z = rotate (toFloat $ angle * 180 / pi) $ Vector3 (toFloat x) (toFloat y) (toFloat z)
toFloat :: (Real a, Floating a) => a -> GLfloat
toFloat = realToFrac