Remove unnecessary uniforms
This commit is contained in:
+28
-5
@@ -1,5 +1,6 @@
|
||||
module MatrixHelper
|
||||
( perspectiveMatrix
|
||||
, isoMatrix
|
||||
) where
|
||||
import Geometry
|
||||
|
||||
@@ -25,11 +26,6 @@ perspectiveMatrix rot zoom (tranx,trany) (winx,winy) (viewFromx,viewFromy) =
|
||||
(V4 (sin rot) (cos rot) 0 0)
|
||||
(V4 0 0 1 0)
|
||||
(V4 0 0 0 1)
|
||||
--tranMat3 = Linear.Matrix.transpose $
|
||||
-- V4 (V4 1 0 0 0)
|
||||
-- (V4 0 1 0 0)
|
||||
-- (V4 0 0 1 0)
|
||||
-- (V4 (-tranx) (-trany) 0 1)
|
||||
tranMat2 = Linear.Matrix.transpose $
|
||||
V4 (V4 1 0 0 0)
|
||||
(V4 0 1 0 0)
|
||||
@@ -48,3 +44,30 @@ perspectiveMatrix rot zoom (tranx,trany) (winx,winy) (viewFromx,viewFromy) =
|
||||
wmat = scalMat !*! rotMat !*! tranMat2 !*! perMat !*! tranMat1
|
||||
vToL (V4 a b c d) = [a,b,c,d]
|
||||
in concatMap vToL $ vToL wmat
|
||||
{- | A matrix that gives a top down view with no perspective. -}
|
||||
isoMatrix
|
||||
:: Float -- ^ Rotation
|
||||
-> Float -- ^ Zoom
|
||||
-> Point2 -- ^ Translation
|
||||
-> Point2 -- ^ Window size
|
||||
-> Point2 -- ^ View froms
|
||||
-> [GLfloat]
|
||||
isoMatrix rot czoom (tranx,trany) (winx,winy) _ =
|
||||
let scalMat = Linear.Matrix.transpose $
|
||||
V4 (V4 (2*czoom/winx) 0 0 (0::GLfloat))
|
||||
(V4 0 (2*czoom/winy) 0 0)
|
||||
(V4 0 0 1 0)
|
||||
(V4 0 0 0 1)
|
||||
rotMat = Linear.Matrix.transpose $
|
||||
V4 (V4 (cos rot) (sin (-rot)) 0 0)
|
||||
(V4 (sin rot) (cos rot) 0 0)
|
||||
(V4 0 0 1 0)
|
||||
(V4 0 0 0 1)
|
||||
tranMat = Linear.Matrix.transpose $
|
||||
V4 (V4 1 0 0 0)
|
||||
(V4 0 1 0 0)
|
||||
(V4 0 0 1 0)
|
||||
(V4 (-tranx) (-trany) 0 1)
|
||||
wmat = scalMat !*! rotMat !*! tranMat
|
||||
vToL (V4 a b c d) = [a,b,c,d]
|
||||
in concatMap vToL $ vToL wmat
|
||||
|
||||
Reference in New Issue
Block a user