aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Spear.lkshw4
-rw-r--r--Spear/Scene/GameObject.hs11
2 files changed, 9 insertions, 6 deletions
diff --git a/Spear.lkshw b/Spear.lkshw
index 3c4b807..d50242a 100644
--- a/Spear.lkshw
+++ b/Spear.lkshw
@@ -1,10 +1,10 @@
1Version of workspace file format: 1Version of workspace file format:
2 1 2 1
3Time of storage: 3Time of storage:
4 "Wed Aug 29 13:08:08 CEST 2012" 4 "Wed Aug 29 13:16:24 CEST 2012"
5Name of the workspace: 5Name of the workspace:
6 "Spear" 6 "Spear"
7File paths of contained packages: 7File paths of contained packages:
8 ["demos/simple-scene/simple-scene.cabal","Spear.cabal"] 8 ["demos/simple-scene/simple-scene.cabal","Spear.cabal"]
9Maybe file path of an active package: 9Maybe file path of an active package:
10 Just "demos/simple-scene/simple-scene.cabal" \ No newline at end of file 10 Just "Spear.cabal" \ No newline at end of file
diff --git a/Spear/Scene/GameObject.hs b/Spear/Scene/GameObject.hs
index 0fcdd4f..8a445a7 100644
--- a/Spear/Scene/GameObject.hs
+++ b/Spear/Scene/GameObject.hs
@@ -17,6 +17,7 @@ where
17 17
18import Spear.Collision.Collision 18import Spear.Collision.Collision
19import Spear.Collision.Collisioner as Col 19import Spear.Collision.Collisioner as Col
20import Spear.GLSL.Management
20import Spear.GLSL.Uniform 21import Spear.GLSL.Uniform
21import Spear.Math.AABB 22import Spear.Math.AABB
22import qualified Spear.Math.Camera as Cam 23import qualified Spear.Math.Camera as Cam
@@ -148,8 +149,8 @@ goRender sprog aprog cam go =
148 mat = S2.transform go 149 mat = S2.transform go
149 style = gameStyle go 150 style = gameStyle go
150 in case renderer go of 151 in case renderer go of
151 Left smr -> goRender' style spu mat cam (SM.bind spu smr) (SM.render spu smr) 152 Left smr -> goRender' style sprog spu mat cam (SM.bind spu smr) (SM.render spu smr)
152 Right amr -> goRender' style apu mat cam (AM.bind apu amr) (AM.render apu amr) 153 Right amr -> goRender' style aprog apu mat cam (AM.bind apu amr) (AM.render apu amr)
153 154
154 155
155type Bind = IO () 156type Bind = IO ()
@@ -157,21 +158,23 @@ type Bind = IO ()
157type Render = IO () 158type Render = IO ()
158 159
159 160
160goRender' :: ProgramUniforms u 161goRender' :: (ProgramUniforms u, Program p)
161 => GameStyle 162 => GameStyle
163 -> p
162 -> u 164 -> u
163 -> M3.Matrix3 165 -> M3.Matrix3
164 -> Cam.Camera 166 -> Cam.Camera
165 -> Bind 167 -> Bind
166 -> Render 168 -> Render
167 -> IO () 169 -> IO ()
168goRender' style uniforms model cam bindRenderer render = 170goRender' style prog uniforms model cam bindRenderer render =
169 let view = M4.inverseTransform $ Cam.transform cam 171 let view = M4.inverseTransform $ Cam.transform cam
170 modelview = case style of 172 modelview = case style of
171 RPG -> view * rpgTransform 0 model 173 RPG -> view * rpgTransform 0 model
172 PLT -> view * pltTransform model 174 PLT -> view * pltTransform model
173 normalmat = fastNormalMatrix modelview 175 normalmat = fastNormalMatrix modelview
174 in do 176 in do
177 useProgram . program $ prog
175 uniformMat4 (projLoc uniforms) $ Cam.projection cam 178 uniformMat4 (projLoc uniforms) $ Cam.projection cam
176 uniformMat4 (modelviewLoc uniforms) modelview 179 uniformMat4 (modelviewLoc uniforms) modelview
177 uniformMat3 (normalmatLoc uniforms) normalmat 180 uniformMat3 (normalmatLoc uniforms) normalmat