diff options
-rw-r--r-- | Spear.lkshs | 12 | ||||
-rw-r--r-- | Spear.lkshw | 4 | ||||
-rw-r--r-- | Spear/Assets/Model/MD2/MD2_load.c | 6 | ||||
-rw-r--r-- | Spear/Math/Matrix4.hs | 31 | ||||
-rw-r--r-- | Spear/Math/Vector3.hs | 6 |
5 files changed, 30 insertions, 29 deletions
diff --git a/Spear.lkshs b/Spear.lkshs index a5674ae..541f4ef 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 Jul 31 01:00:21 CEST 2012" | 4 | "Wed Aug 1 13:16:07 CEST 2012" |
5 | Layout: VerticalP (TerminalP {paneGroups = fromList [], paneTabs = Just TopP, currentPage = 0, 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}) 290) 199)], paneTabs = Just BottomP, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) 701) 953 | 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}) 315) 217)], paneTabs = Just BottomP, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) (TerminalP {paneGroups = fromList [], paneTabs = Nothing, currentPage = 0, detachedId = Nothing, detachedSize = Nothing}) 759) 953 |
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/GameMessage.hs" 295)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/demos/simple-scene/GameObject.hs" 5019)),[SplitP LeftP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/demos/simple-scene/GameState.hs" 265)),[SplitP LeftP]),(Just (InfoSt (InfoState Nothing)),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP BottomP,SplitP BottomP]),(Just (LogSt LogState),[SplitP RightP,SplitP BottomP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Math/Matrix4.hs" 8726)),[SplitP LeftP]),(Just (ModulesSt (ModulesState 286 (PackageScope False,False) (Just (ModuleName ["Spear","Math","Camera"]),Nothing) (ExpanderState {packageExp = ([],[]), packageExpNoBlack = ([[0,4],[0]],[]), 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/Math/Vector3.hs" 3534)),[SplitP LeftP]),(Just (WorkspaceSt WorkspaceState),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP TopP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/demos/simple-scene/main.hs" 3944)),[SplitP LeftP])] | 6 | Population: [(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Collision/Collision.hs" 61)),[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" 3739)),[SplitP LeftP]),(Just (InfoSt (InfoState Nothing)),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP BottomP,SplitP BottomP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Scene/Loader.hs" 12935)),[SplitP LeftP]),(Just (LogSt LogState),[SplitP RightP,SplitP BottomP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/Spear/Math/Matrix4.hs" 14139)),[SplitP LeftP]),(Just (ModulesSt (ModulesState 286 (PackageScope False,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/Math/Vector3.hs" 3515)),[SplitP LeftP]),(Just (WorkspaceSt WorkspaceState),[SplitP RightP,SplitP TopP,GroupP "Browser",SplitP TopP]),(Just (BufferSt (BufferState "/home/jeanne/programming/haskell/Spear/demos/simple-scene/main.hs" 789)),[SplitP LeftP])] |
7 | Window size: (1796,979) | 7 | Window size: (1796,979) |
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 "GameMessage.hs" | 11 | Active pane: Just "GameObject.hs" |
12 | Toolbar visible: | 12 | Toolbar visible: |
13 | True | 13 | True |
14 | FindbarState: (False,FindState {entryStr = "", entryHist = ["asd","MouseButton"], replaceStr = "MouseProperty", replaceHist = [], caseSensitive = False, entireWord = False, wrapAround = False, regex = False, lineNr = 1}) | 14 | FindbarState: (False,FindState {entryStr = "asd", entryHist = ["col","forward","asd","MouseButton"], replaceStr = "row", 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/Collision/Collision.hs","/home/jeanne/programming/haskell/Spear/Spear/Math/Camera.hs","/home/jeanne/programming/haskell/Spear/Spear/Math/Entity.hs","/home/jeanne/programming/haskell/Spear/Spear/Scene/Scene.hs","/home/jeanne/programming/haskell/Spear/Spear/Math/Spatial.hs","/home/jeanne/programming/haskell/Spear/Spear/Assets/Image/BMP/BMP_load.c","/home/jeanne/programming/haskell/Spear/Spear/Assets/Model/OBJ/OBJ_load.cc","/home/jeanne/programming/haskell/Spear/Spear/Assets/Model.hsc","/home/jeanne/programming/haskell/Spear/Spear/Assets/Model/MD2/MD2_load.c","/home/jeanne/programming/haskell/Spear/Spear/Assets/Model/Model.h","/home/jeanne/programming/haskell/Spear/demos/simple-scene/OgroAnimation.hs","/home/jeanne/programming/haskell/Spear/Spear/App/Input.hs"] | 16 | ["/home/jeanne/programming/haskell/Spear/demos/simple-scene/simple.scene","/home/jeanne/programming/haskell/Spear/Spear/Assets/Model/Model.c","/home/jeanne/programming/haskell/Spear/demos/simple-scene/GameMessage.hs","/home/jeanne/programming/haskell/Spear/demos/simple-scene/GameState.hs","/home/jeanne/programming/haskell/Spear/Spear/Collision/Collision.hs","/home/jeanne/programming/haskell/Spear/Spear/Math/Camera.hs","/home/jeanne/programming/haskell/Spear/Spear/Math/Entity.hs","/home/jeanne/programming/haskell/Spear/Spear/Scene/Scene.hs","/home/jeanne/programming/haskell/Spear/Spear/Math/Spatial.hs","/home/jeanne/programming/haskell/Spear/Spear/Assets/Image/BMP/BMP_load.c","/home/jeanne/programming/haskell/Spear/Spear/Assets/Model/OBJ/OBJ_load.cc","/home/jeanne/programming/haskell/Spear/Spear/Assets/Model.hsc"] |
17 | Recently opened workspaces: | 17 | Recently opened workspaces: |
18 | ["/home/jeanne/programming/haskell/Spear/Spear.lkshw","/home/jeanne/leksah.lkshw"] \ No newline at end of file | 18 | ["/home/jeanne/programming/haskell/Spear/Spear.lkshw","/home/jeanne/leksah.lkshw"] \ No newline at end of file |
diff --git a/Spear.lkshw b/Spear.lkshw index 47ee51d..aed85a0 100644 --- a/Spear.lkshw +++ b/Spear.lkshw | |||
@@ -1,10 +1,10 @@ | |||
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 | "Tue Jul 31 00:59:07 CEST 2012" | 4 | "Tue Jul 31 20:32:45 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: |
8 | ["demos/simple-scene/simple-scene.cabal","Spear.cabal"] | 8 | ["demos/simple-scene/simple-scene.cabal","Spear.cabal"] |
9 | Maybe file path of an active package: | 9 | Maybe file path of an active package: |
10 | Just "Spear.cabal" \ No newline at end of file | 10 | Just "demos/simple-scene/simple-scene.cabal" \ No newline at end of file |
diff --git a/Spear/Assets/Model/MD2/MD2_load.c b/Spear/Assets/Model/MD2/MD2_load.c index 238bc9a..c25cda8 100644 --- a/Spear/Assets/Model/MD2/MD2_load.c +++ b/Spear/Assets/Model/MD2/MD2_load.c | |||
@@ -451,7 +451,7 @@ Model_error_code MD2_load (const char* filename, char clockwise, char left_hande | |||
451 | currentAnimation->start = start; | 451 | currentAnimation->start = start; |
452 | currentAnimation->end = header->numFrames-1; | 452 | currentAnimation->end = header->numFrames-1; |
453 | 453 | ||
454 | printf ("finished loading model %s\n", filename); | 454 | /*printf ("finished loading model %s\n", filename); |
455 | printf ("numAnimations: %u\n", numAnimations); | 455 | printf ("numAnimations: %u\n", numAnimations); |
456 | printf ("animations: %p\n", animations); | 456 | printf ("animations: %p\n", animations); |
457 | 457 | ||
@@ -461,8 +461,8 @@ Model_error_code MD2_load (const char* filename, char clockwise, char left_hande | |||
461 | printf ("Animation %d, name: %s, start: %d, end %d\n", | 461 | printf ("Animation %d, name: %s, start: %d, end %d\n", |
462 | i, currentAnimation->name, currentAnimation->start, currentAnimation->end); | 462 | i, currentAnimation->name, currentAnimation->start, currentAnimation->end); |
463 | currentAnimation++; | 463 | currentAnimation++; |
464 | } | 464 | }*/ |
465 | 465 | ||
466 | model->vertices = vertices; | 466 | model->vertices = vertices; |
467 | model->normals = normals; | 467 | model->normals = normals; |
468 | model->texCoords = texCoords; | 468 | model->texCoords = texCoords; |
diff --git a/Spear/Math/Matrix4.hs b/Spear/Math/Matrix4.hs index a86dc84..2176e99 100644 --- a/Spear/Math/Matrix4.hs +++ b/Spear/Math/Matrix4.hs | |||
@@ -195,18 +195,16 @@ transform right up fwd pos = mat4 | |||
195 | 195 | ||
196 | 196 | ||
197 | -- | Build a transformation 'Matrix4' defined by the given position and target. | 197 | -- | Build a transformation 'Matrix4' defined by the given position and target. |
198 | -- | ||
199 | -- This function is essentially like gluLookAt. | ||
200 | lookAt :: Vector3 -- ^ Eye position. | 198 | lookAt :: Vector3 -- ^ Eye position. |
201 | -> Vector3 -- ^ Target point. | 199 | -> Vector3 -- ^ Target point. |
202 | -> Vector3 -- ^ Up vector. | ||
203 | -> Matrix4 | 200 | -> Matrix4 |
204 | 201 | ||
205 | lookAt pos target up = | 202 | lookAt pos target = |
206 | let fwd = Vector3.normalise $ target - pos | 203 | let fwd = Vector3.normalise $ target - pos |
207 | r = fwd `cross` up | 204 | r = fwd `cross` Vector3.unitY |
205 | u = r `cross` fwd | ||
208 | in | 206 | in |
209 | transform r up (-fwd) pos | 207 | transform r u (-fwd) pos |
210 | 208 | ||
211 | 209 | ||
212 | -- | Zip two matrices together with the specified function. | 210 | -- | Zip two matrices together with the specified function. |
@@ -412,15 +410,18 @@ transpose m = mat4 | |||
412 | 410 | ||
413 | -- | Invert the given transformation matrix. | 411 | -- | Invert the given transformation matrix. |
414 | inverseTransform :: Matrix4 -> Matrix4 | 412 | inverseTransform :: Matrix4 -> Matrix4 |
415 | inverseTransform mat = mat4fromVec u v w p where | 413 | inverseTransform mat = mat4fromVec u v w p where |
416 | u = vec4 (Vector4.x $ col0 mat) (Vector4.y $ col0 mat) (Vector4.z $ col0 mat) 0 | 414 | v0 = row0 mat |
417 | v = vec4 (Vector4.x $ col1 mat) (Vector4.y $ col1 mat) (Vector4.z $ col1 mat) 0 | 415 | v1 = row1 mat |
418 | w = vec4 (Vector4.x $ col2 mat) (Vector4.y $ col2 mat) (Vector4.z $ col2 mat) 0 | 416 | v2 = row2 mat |
419 | p = vec4 tdotu tdotv tdotw 1 | 417 | u = vec4 (Vector4.x v0) (Vector4.y v0) (Vector4.z v0) 0 |
420 | t = -(col3 mat) | 418 | v = vec4 (Vector4.x v1) (Vector4.y v1) (Vector4.z v1) 0 |
421 | tdotu = t `Vector4.dot` u | 419 | w = vec4 (Vector4.x v2) (Vector4.y v2) (Vector4.z v2) 0 |
422 | tdotv = t `Vector4.dot` v | 420 | p = vec4 tdotu tdotv tdotw 1 |
423 | tdotw = t `Vector4.dot` w | 421 | t = -(col3 mat) |
422 | tdotu = t `Vector4.dot` col0 mat | ||
423 | tdotv = t `Vector4.dot` col1 mat | ||
424 | tdotw = t `Vector4.dot` col2 mat | ||
424 | 425 | ||
425 | 426 | ||
426 | -- | Invert the given matrix. | 427 | -- | Invert the given matrix. |
diff --git a/Spear/Math/Vector3.hs b/Spear/Math/Vector3.hs index fad6e01..b10fd16 100644 --- a/Spear/Math/Vector3.hs +++ b/Spear/Math/Vector3.hs | |||
@@ -140,9 +140,9 @@ orbit center radius anglex angley = | |||
140 | sy = sin ay | 140 | sy = sin ay |
141 | cx = cos ax | 141 | cx = cos ax |
142 | cy = cos ay | 142 | cy = cos ay |
143 | px = (x center) + radius*cy*sx | 143 | px = x center + radius*cy*sx |
144 | py = (y center) + radius*sy | 144 | py = y center + radius*sy |
145 | pz = (z center) + radius*cx*cy | 145 | pz = z center + radius*cx*cy |
146 | in | 146 | in |
147 | vec3 px py pz | 147 | vec3 px py pz |
148 | 148 | ||