From fdb76efb868e43b00e30e3c426c6fedbe7f33ded Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Wed, 29 Aug 2012 10:44:21 +0200 Subject: Changed name of unit vectors to lowercase --- Spear/Math/Matrix4.hs | 11 ++--------- Spear/Math/Spatial3.hs | 2 +- Spear/Math/Vector3.hs | 18 +++++++++--------- Spear/Scene/Loader.hs | 4 ++-- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/Spear/Math/Matrix4.hs b/Spear/Math/Matrix4.hs index 82dc9d5..45a8171 100644 --- a/Spear/Math/Matrix4.hs +++ b/Spear/Math/Matrix4.hs @@ -201,7 +201,7 @@ lookAt :: Vector3 -- ^ Eye position. lookAt pos target = let fwd = Vector3.normalise $ target - pos - r = fwd `cross` Vector3.unitY + r = fwd `cross` Vector3.unity u = r `cross` fwd in transform r u (-fwd) pos @@ -422,14 +422,7 @@ inverseTransform mat = mat4fromVec u v w p where tdotu = t `Vector4.dot` col0 mat tdotv = t `Vector4.dot` col1 mat tdotw = t `Vector4.dot` col2 mat - - --- | Invert the given matrix. -{-inverse :: Matrix4 -> Matrix4 -inverse mat = mat4 i0 i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 - where - i0 = -} - + -- | Transform the given vector in 3D space with the given matrix. mul :: Float -> Matrix4 -> Vector3 -> Vector3 diff --git a/Spear/Math/Spatial3.hs b/Spear/Math/Spatial3.hs index 9f9812f..0ee680f 100644 --- a/Spear/Math/Spatial3.hs +++ b/Spear/Math/Spatial3.hs @@ -57,7 +57,7 @@ class Spatial3 s where lookAt pt s = let position = pos s fwd = normalise $ pt - position - r = fwd `cross` unitY + r = fwd `cross` unity u = r `cross` fwd in setTransform (M.transform r u (-fwd) position) s diff --git a/Spear/Math/Vector3.hs b/Spear/Math/Vector3.hs index 0d559c3..79cdcdd 100644 --- a/Spear/Math/Vector3.hs +++ b/Spear/Math/Vector3.hs @@ -6,9 +6,9 @@ module Spear.Math.Vector3 , y , z -- * Construction -, unitX -, unitY -, unitZ +, unitx +, unity +, unitz , zero , fromList , vec3 @@ -99,18 +99,18 @@ z (Vector3 _ _ az) = az -- | Unit vector along the X axis. -unitX :: Vector3 -unitX = Vector3 1 0 0 +unitx :: Vector3 +unitx = Vector3 1 0 0 -- | Unit vector along the Y axis. -unitY :: Vector3 -unitY = Vector3 0 1 0 +unity :: Vector3 +unity = Vector3 0 1 0 -- | Unit vector along the Z axis. -unitZ :: Vector3 -unitZ = Vector3 0 0 1 +unitz :: Vector3 +unitz = Vector3 0 0 1 -- | Zero vector. diff --git a/Spear/Scene/Loader.hs b/Spear/Scene/Loader.hs index 64e81f1..c34d2e6 100644 --- a/Spear/Scene/Loader.hs +++ b/Spear/Scene/Loader.hs @@ -351,9 +351,9 @@ newObject' newGO sceneRes nid props = do vectors :: Maybe Vector3 -> (Vector3, Vector3, Vector3) vectors forward = case forward of - Nothing -> (V3.unitX, V3.unitY, V3.unitZ) + Nothing -> (V3.unitx, V3.unity, V3.unitz) Just f -> - let r = f `cross` V3.unitY + let r = f `cross` V3.unity u = r `cross` f in (r, u, f) -- cgit v1.2.3