diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-08 15:16:52 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-08 15:16:52 +0200 |
commit | ca8179a93e2c5ac0caa168c1da57e36f654182d9 (patch) | |
tree | f13833b89ccdccb2be057e16f2fc3b6acce78465 | |
parent | 4c819b5353df3c5d7c990f40089592ef58f194d3 (diff) |
Model transformVerts and transformNormals are now two separate functions
-rw-r--r-- | Spear.lkshs | 10 | ||||
-rw-r--r-- | Spear.lkshw | 2 | ||||
-rw-r--r-- | Spear/Assets/Model.hsc | 62 | ||||
-rw-r--r-- | Spear/Assets/Model/Model.c | 19 | ||||
-rw-r--r-- | Spear/Assets/Model/Model.h | 9 | ||||
-rw-r--r-- | Spear/Scene/Loader.hs | 21 |
6 files changed, 76 insertions, 47 deletions
diff --git a/Spear.lkshs b/Spear.lkshs index 26a1ff6..a3f492f 100644 --- a/Spear.lkshs +++ b/Spear.lkshs | |||
@@ -1,18 +1,18 @@ | |||
1 | Version of session file format: | 1 | Version of session file format: |
2 | 1 | 2 | 1 |
3 | Time of storage: | 3 | Time of storage: |
4 | "Tue Aug 7 23:33:12 CEST 2012" | 4 | "Wed Aug 8 13:25:10 CEST 2012" |
5 | Layout: VerticalP (TerminalP {paneGroups = fromList [], paneTabs = Just TopP, currentPage = 2, detachedId = Nothing, detachedSize = Nothing}) (HorizontalP (TerminalP {paneGroups = fromList [("Browser",HorizontalP (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) (HorizontalP (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) 263) 197)], paneTabs = Just BottomP, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) 691) 954 | 5 | Layout: VerticalP (TerminalP {paneGroups = fromList [], paneTabs = Just TopP, currentPage = 1, detachedId = Nothing, detachedSize = Nothing}) (HorizontalP (TerminalP {paneGroups = fromList [("Browser",HorizontalP (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) (HorizontalP (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) 273) 205)], paneTabs = Just BottomP, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) 716) 954 |
6 | Population: [(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Collision/Collision.hs" 75)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Collision/Collisioner.hs" 551)),[SplitP LeftP]),(Just (ErrorsSt ErrorsState),[SplitP RightP,SplitP TopP]),(Just (FilesSt FilesState),[SplitP RightP,SplitP TopP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/demos/simple-scene/GameObject.hs" 3124)),[SplitP LeftP]),(Just (InfoSt (InfoState Nothing)),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP BottomP,SplitP BottomP]),(Just (LogSt LogState),[SplitP RightP,SplitP BottomP]),(Just (ModulesSt (ModulesState 286 (SystemScope,False) (Nothing,Nothing) (ExpanderState {packageExp = ([],[]), packageExpNoBlack = ([],[]), packageDExp = ([],[]), packageDExpNoBlack = ([],[]), workspaceExp = ([],[]), workspaceExpNoBlack = ([],[]), workspaceDExp = ([],[]), workspaceDExpNoBlack = ([],[]), systemExp = ([],[]), systemExpNoBlack = ([],[])}))),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP BottomP,SplitP TopP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Physics.hs" 207)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Physics/Rigid.hs" 2175)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Math/Spatial.hs" 0)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Physics/Types.hs" 194)),[SplitP LeftP]),(Just (WorkspaceSt WorkspaceState),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP TopP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Physics/World.hs" 3782)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/demos/simple-scene/main.hs" 1603)),[SplitP LeftP])] | 6 | Population: [(Just (ErrorsSt ErrorsState),[SplitP RightP,SplitP TopP]),(Just (FilesSt FilesState),[SplitP RightP,SplitP TopP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/demos/simple-scene/GameObject.hs" 3129)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/IDStore.hs" 186)),[SplitP LeftP]),(Just (InfoSt (InfoState Nothing)),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP BottomP,SplitP BottomP]),(Just (LogSt LogState),[SplitP RightP,SplitP BottomP]),(Just (ModulesSt (ModulesState 286 (PackageScope False,False) (Nothing,Nothing) (ExpanderState {packageExp = ([],[]), packageExpNoBlack = ([],[]), packageDExp = ([],[]), packageDExpNoBlack = ([],[]), workspaceExp = ([],[]), workspaceExpNoBlack = ([[5]],[]), workspaceDExp = ([],[]), workspaceDExpNoBlack = ([],[]), systemExp = ([],[]), systemExpNoBlack = ([],[])}))),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP BottomP,SplitP TopP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Physics.hs" 207)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Physics/Rigid.hs" 2175)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Math/Spatial.hs" 0)),[SplitP LeftP]),(Just (WorkspaceSt WorkspaceState),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP TopP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Physics/World.hs" 3781)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/demos/simple-scene/main.hs" 1603)),[SplitP LeftP])] |
7 | Window size: (1841,964) | 7 | Window size: (1841,964) |
8 | Completion size: | 8 | Completion size: |
9 | (750,400) | 9 | (750,400) |
10 | Workspace: Just "/home/jeanne/programming/haskell/Spear/Spear.lkshw" | 10 | Workspace: Just "/home/jeanne/programming/haskell/Spear/Spear.lkshw" |
11 | Active pane: Just "GameObject.hs" | 11 | Active pane: Just "IDStore.hs" |
12 | Toolbar visible: | 12 | Toolbar visible: |
13 | True | 13 | True |
14 | FindbarState: (False,FindState {entryStr = "asd", entryHist = ["gravity","asdad","rotSpeed","azimuth","mandatory","mandao","col","forward","MouseButton"], replaceStr = "mandatory'", replaceHist = [], caseSensitive = False, entireWord = False, wrapAround = False, regex = False, lineNr = 1}) | 14 | FindbarState: (False,FindState {entryStr = "asd", entryHist = ["gravity","asdad","rotSpeed","azimuth","mandatory","mandao","col","forward","MouseButton"], replaceStr = "mandatory'", replaceHist = [], caseSensitive = False, entireWord = False, wrapAround = False, regex = False, lineNr = 1}) |
15 | Recently opened files: | 15 | Recently opened files: |
16 | ["/home/jeanne/programming/haskell/Spear/Spear/App/Input.hs"] | 16 | ["/home/jeanne/programming/haskell/Spear/demos/simple-scene/Spear/IDStore.hs","/home/jeanne/programming/haskell/Spear/Spear/Physics/Types.hs","/home/jeanne/programming/haskell/Spear/Spear/Collision/Collision.hs","/home/jeanne/programming/haskell/Spear/Spear/Collision/Collisioner.hs","/home/jeanne/programming/haskell/Spear/Spear/App/Input.hs"] |
17 | Recently opened workspaces: | 17 | Recently opened workspaces: |
18 | ["/home/jeanne/leksah.lkshw"] \ No newline at end of file | 18 | ["/home/jeanne/leksah.lkshw"] \ No newline at end of file |
diff --git a/Spear.lkshw b/Spear.lkshw index ef77439..cc572e4 100644 --- a/Spear.lkshw +++ b/Spear.lkshw | |||
@@ -1,7 +1,7 @@ | |||
1 | Version of workspace file format: | 1 | Version of workspace file format: |
2 | 1 | 2 | 1 |
3 | Time of storage: | 3 | Time of storage: |
4 | "Wed Aug 8 12:06:13 CEST 2012" | 4 | "Wed Aug 8 15:15:08 CEST 2012" |
5 | Name of the workspace: | 5 | Name of the workspace: |
6 | "Spear" | 6 | "Spear" |
7 | File paths of contained packages: | 7 | File paths of contained packages: |
diff --git a/Spear/Assets/Model.hsc b/Spear/Assets/Model.hsc index 5fd2db3..9e718c7 100644 --- a/Spear/Assets/Model.hsc +++ b/Spear/Assets/Model.hsc | |||
@@ -29,7 +29,8 @@ module Spear.Assets.Model | |||
29 | , animationByName | 29 | , animationByName |
30 | , numAnimations | 30 | , numAnimations |
31 | -- * Manipulation | 31 | -- * Manipulation |
32 | , transform | 32 | , transformVerts |
33 | , transformNormals | ||
33 | , toGround | 34 | , toGround |
34 | ) | 35 | ) |
35 | where | 36 | where |
@@ -232,72 +233,72 @@ fromCAnimation (CAnimation cname start end) = | |||
232 | Animation (B.unpack cname) (fromIntegral start) (fromIntegral end) | 233 | Animation (B.unpack cname) (fromIntegral start) (fromIntegral end) |
233 | 234 | ||
234 | 235 | ||
235 | -- | Release the given 'Model'. | 236 | -- | Release the model. |
236 | releaseModel :: Model -> Setup () | 237 | releaseModel :: Model -> Setup () |
237 | releaseModel = release . rkey | 238 | releaseModel = release . rkey |
238 | 239 | ||
239 | 240 | ||
240 | -- | Free the given 'CModel'. | 241 | -- | Free the C model. |
241 | freeModel :: CModel -> IO () | 242 | freeModel :: CModel -> IO () |
242 | freeModel model = Foreign.with model model_free | 243 | freeModel model = Foreign.with model model_free |
243 | 244 | ||
244 | 245 | ||
245 | -- | Return 'True' if the given 'Model' is animated, 'False' otherwise. | 246 | -- | Return 'True' if the model is animated, 'False' otherwise. |
246 | animated :: Model -> Bool | 247 | animated :: Model -> Bool |
247 | animated = (>1) . numFrames | 248 | animated = (>1) . numFrames |
248 | 249 | ||
249 | 250 | ||
250 | -- | Return the given 'Model's vertices. | 251 | -- | Return the model's vertices. |
251 | vertices :: Model -> Ptr Vec3 | 252 | vertices :: Model -> Ptr Vec3 |
252 | vertices = cVerts . modelData | 253 | vertices = cVerts . modelData |
253 | 254 | ||
254 | 255 | ||
255 | -- | Return the given 'Model's normals. | 256 | -- | Return the model's normals. |
256 | normals :: Model -> Ptr Vec3 | 257 | normals :: Model -> Ptr Vec3 |
257 | normals = cNormals . modelData | 258 | normals = cNormals . modelData |
258 | 259 | ||
259 | 260 | ||
260 | -- | Return the given 'Model's texCoords. | 261 | -- | Return the model's texCoords. |
261 | texCoords :: Model -> Ptr TexCoord | 262 | texCoords :: Model -> Ptr TexCoord |
262 | texCoords = cTexCoords . modelData | 263 | texCoords = cTexCoords . modelData |
263 | 264 | ||
264 | 265 | ||
265 | -- | Return the given 'Model's triangles. | 266 | -- | Return the model's triangles. |
266 | triangles :: Model -> Ptr Triangle | 267 | triangles :: Model -> Ptr Triangle |
267 | triangles = cTris . modelData | 268 | triangles = cTris . modelData |
268 | 269 | ||
269 | 270 | ||
270 | -- | Return the given 'Model's skins. | 271 | -- | Return the model's skins. |
271 | skins :: Model -> Ptr Skin | 272 | skins :: Model -> Ptr Skin |
272 | skins = cSkins . modelData | 273 | skins = cSkins . modelData |
273 | 274 | ||
274 | 275 | ||
275 | -- | Return the given 'Model's number of frames. | 276 | -- | Return the model's number of frames. |
276 | numFrames :: Model -> Int | 277 | numFrames :: Model -> Int |
277 | numFrames = fromIntegral . cnFrames . modelData | 278 | numFrames = fromIntegral . cnFrames . modelData |
278 | 279 | ||
279 | 280 | ||
280 | -- | Return the given 'Model's number of vertices. | 281 | -- | Return the model's number of vertices. |
281 | numVertices :: Model -> Int | 282 | numVertices :: Model -> Int |
282 | numVertices = fromIntegral . cnVerts . modelData | 283 | numVertices = fromIntegral . cnVerts . modelData |
283 | 284 | ||
284 | 285 | ||
285 | -- | Return the given 'Model's number of triangles. | 286 | -- | Return the model's number of triangles. |
286 | numTriangles :: Model -> Int | 287 | numTriangles :: Model -> Int |
287 | numTriangles = fromIntegral . cnTris . modelData | 288 | numTriangles = fromIntegral . cnTris . modelData |
288 | 289 | ||
289 | 290 | ||
290 | -- | Return the given 'Model's number of texture coordinates. | 291 | -- | Return the model's number of texture coordinates. |
291 | numTexCoords :: Model -> Int | 292 | numTexCoords :: Model -> Int |
292 | numTexCoords = fromIntegral . cnTexCoords . modelData | 293 | numTexCoords = fromIntegral . cnTexCoords . modelData |
293 | 294 | ||
294 | 295 | ||
295 | -- | Return the given 'Model's number of skins. | 296 | -- | Return the model's number of skins. |
296 | numSkins :: Model -> Int | 297 | numSkins :: Model -> Int |
297 | numSkins = fromIntegral . cnSkins . modelData | 298 | numSkins = fromIntegral . cnSkins . modelData |
298 | 299 | ||
299 | 300 | ||
300 | -- | Return the underlying 'CModel'. | 301 | -- | Return the underlying C model. |
301 | cmodel :: Model -> CModel | 302 | cmodel :: Model -> CModel |
302 | cmodel = modelData | 303 | cmodel = modelData |
303 | 304 | ||
@@ -312,27 +313,38 @@ animationByName :: Model -> String -> Maybe Animation | |||
312 | animationByName model anim = V.find ((==) anim . name) $ mAnimations model | 313 | animationByName model anim = V.find ((==) anim . name) $ mAnimations model |
313 | 314 | ||
314 | 315 | ||
315 | -- | Return the number of animations in the given 'Model'. | 316 | -- | Return the number of animations of the given model. |
316 | numAnimations :: Model -> Int | 317 | numAnimations :: Model -> Int |
317 | numAnimations = V.length . mAnimations | 318 | numAnimations = V.length . mAnimations |
318 | 319 | ||
319 | 320 | ||
320 | -- | Transform the given 'Model's vertices with the given matrix. | 321 | -- | Transform the model's vertices with the given matrix. |
321 | transform :: M4.Matrix4 -> Model -> IO () | 322 | transformVerts :: M4.Matrix4 -> Model -> IO () |
322 | transform mat (Model model _ _) = | 323 | transformVerts mat (Model model _ _) = |
323 | allocaBytes (16*sizeFloat) $ \matPtr -> | 324 | allocaBytes (16*sizeFloat) $ \matPtr -> |
324 | allocaBytes (9*sizeFloat) $ \normalPtr -> | ||
325 | with model $ \modelPtr -> do | 325 | with model $ \modelPtr -> do |
326 | poke matPtr mat | 326 | poke matPtr mat |
327 | poke normalPtr $ fastNormalMatrix mat | 327 | model_transform_vertices modelPtr matPtr |
328 | model_transform modelPtr matPtr normalPtr | ||
329 | 328 | ||
330 | 329 | ||
331 | foreign import ccall "Model.h model_transform" | 330 | -- | Transform the model's normals with the given matrix. |
332 | model_transform :: Ptr CModel -> Ptr M4.Matrix4 -> Ptr M3.Matrix3 -> IO () | 331 | transformNormals :: M3.Matrix3 -> Model -> IO () |
332 | transformNormals mat (Model model _ _) = | ||
333 | allocaBytes (9*sizeFloat) $ \normalPtr -> | ||
334 | with model $ \modelPtr -> do | ||
335 | poke normalPtr mat | ||
336 | model_transform_normals modelPtr normalPtr | ||
337 | |||
338 | |||
339 | foreign import ccall "Model.h model_transform_vertices" | ||
340 | model_transform_vertices :: Ptr CModel -> Ptr M4.Matrix4 -> IO () | ||
341 | |||
342 | |||
343 | foreign import ccall "Model.h model_transform_normals" | ||
344 | model_transform_normals :: Ptr CModel -> Ptr M3.Matrix3 -> IO () | ||
333 | 345 | ||
334 | 346 | ||
335 | -- | Transform the given 'Model' such that its lowest point has y = 0. | 347 | -- | Transform the model such that its lowest point has y = 0. |
336 | toGround :: Model -> IO () | 348 | toGround :: Model -> IO () |
337 | toGround (Model model _ _) = with model model_to_ground | 349 | toGround (Model model _ _) = with model model_to_ground |
338 | 350 | ||
diff --git a/Spear/Assets/Model/Model.c b/Spear/Assets/Model/Model.c index 837dd93..f6b2f1f 100644 --- a/Spear/Assets/Model/Model.c +++ b/Spear/Assets/Model/Model.c | |||
@@ -56,19 +56,28 @@ static void mul_normal (float m[9], vec3* n) | |||
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | void model_transform (Model* model, float mat[16], float normal[9]) | 59 | void model_transform_vertices (Model* model, float mat[16]) |
60 | { | 60 | { |
61 | unsigned i = 0; | 61 | unsigned i = 0; |
62 | unsigned j = model->numVertices * model->numFrames; | 62 | unsigned j = model->numVertices * model->numFrames; |
63 | vec3* v = model->vertices; | 63 | vec3* v = model->vertices; |
64 | vec3* n = model->normals; | ||
65 | 64 | ||
66 | for (; i < j; ++i) | 65 | for (; i < j; ++i, ++v) |
67 | { | 66 | { |
68 | mul (mat, v); | 67 | mul (mat, v); |
68 | } | ||
69 | } | ||
70 | |||
71 | |||
72 | void model_transform_normals (Model* model, float normal[9]) | ||
73 | { | ||
74 | unsigned i = 0; | ||
75 | unsigned j = model->numVertices * model->numFrames; | ||
76 | vec3* n = model->normals; | ||
77 | |||
78 | for (; i < j; ++i, ++n) | ||
79 | { | ||
69 | mul_normal (normal, n); | 80 | mul_normal (normal, n); |
70 | v++; | ||
71 | n++; | ||
72 | } | 81 | } |
73 | } | 82 | } |
74 | 83 | ||
diff --git a/Spear/Assets/Model/Model.h b/Spear/Assets/Model/Model.h index 34c6444..84be6aa 100644 --- a/Spear/Assets/Model/Model.h +++ b/Spear/Assets/Model/Model.h | |||
@@ -69,10 +69,13 @@ extern "C" { | |||
69 | /// The 'model' pointer itself is not freed. | 69 | /// The 'model' pointer itself is not freed. |
70 | void model_free (Model* model); | 70 | void model_free (Model* model); |
71 | 71 | ||
72 | /// Transform the given Model's vertices by the given matrix. | 72 | /// Transform the Model's vertices by the given matrix. |
73 | void model_transform (Model* model, float mat[16], float normal[9]); | 73 | void model_transform_verts (Model* model, float mat[16]); |
74 | 74 | ||
75 | /// Translate the given Model such that its lowest point has y = 0. | 75 | /// Transform the Model's normals by the given matrix. |
76 | void model_transform_normals (Model* model, float normal[9]); | ||
77 | |||
78 | /// Translate the Model such that its lowest point has y = 0. | ||
76 | void model_to_ground (Model* model); | 79 | void model_to_ground (Model* model); |
77 | 80 | ||
78 | #ifdef __cplusplus | 81 | #ifdef __cplusplus |
diff --git a/Spear/Scene/Loader.hs b/Spear/Scene/Loader.hs index 6001bdb..06e0aa9 100644 --- a/Spear/Scene/Loader.hs +++ b/Spear/Scene/Loader.hs | |||
@@ -20,6 +20,7 @@ where | |||
20 | import Spear.Assets.Model as Model | 20 | import Spear.Assets.Model as Model |
21 | import qualified Spear.GLSL as GLSL | 21 | import qualified Spear.GLSL as GLSL |
22 | import Spear.Math.Matrix4 as M4 | 22 | import Spear.Math.Matrix4 as M4 |
23 | import Spear.Math.MatrixUtils (fastNormalMatrix) | ||
23 | import Spear.Math.Vector3 as V3 | 24 | import Spear.Math.Vector3 as V3 |
24 | import Spear.Math.Vector4 | 25 | import Spear.Math.Vector4 |
25 | import Spear.Render.AnimatedModel | 26 | import Spear.Render.AnimatedModel |
@@ -192,20 +193,24 @@ loadModel' file rotation scale = do | |||
192 | Just rot -> setupIO $ rotateModel model rot | 193 | Just rot -> setupIO $ rotateModel model rot |
193 | Nothing -> return () | 194 | Nothing -> return () |
194 | case scale of | 195 | case scale of |
195 | Just s -> setupIO $ Model.transform (scalev s) model | 196 | Just s -> setupIO $ Model.transformVerts (scalev s) model |
196 | Nothing -> return () | 197 | Nothing -> return () |
197 | setupIO $ toGround model | 198 | setupIO $ toGround model |
198 | return model | 199 | return model |
199 | 200 | ||
200 | 201 | ||
201 | rotateModel :: Model -> Rotation -> IO () | 202 | rotateModel :: Model -> Rotation -> IO () |
202 | rotateModel model (Rotation x y z order) = case order of | 203 | rotateModel model (Rotation x y z order) = |
203 | XYZ -> Model.transform (rotZ z * rotY y * rotX x) model | 204 | let mat = case order of |
204 | XZY -> Model.transform (rotY y * rotZ z * rotX x) model | 205 | XYZ -> rotZ z * rotY y * rotX x |
205 | YXZ -> Model.transform (rotZ z * rotX x * rotY y) model | 206 | XZY -> rotY y * rotZ z * rotX x |
206 | YZX -> Model.transform (rotX x * rotZ z * rotY y) model | 207 | YXZ -> rotZ z * rotX x * rotY y |
207 | ZXY -> Model.transform (rotY y * rotX x * rotZ z) model | 208 | YZX -> rotX x * rotZ z * rotY y |
208 | ZYX -> Model.transform (rotX x * rotY y * rotZ z) model | 209 | ZXY -> rotY y * rotX x * rotZ z |
210 | ZYX -> rotX x * rotY y * rotZ z | ||
211 | normalMat = fastNormalMatrix mat | ||
212 | in | ||
213 | Model.transformVerts mat model >> Model.transformNormals normalMat model | ||
209 | 214 | ||
210 | 215 | ||
211 | loadTexture :: FilePath -> Loader GLSL.Texture | 216 | loadTexture :: FilePath -> Loader GLSL.Texture |