diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-29 13:45:26 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-29 13:45:26 +0200 |
commit | 96ffab821c88238e0217dcfa0584f188d1a82ca5 (patch) | |
tree | 2ad5575301849f717eced125bd7d808c4cf02400 | |
parent | a2946c79640a9e811db2b976ba6401da9fe1b88e (diff) |
Render now calls useProgram
-rw-r--r-- | Spear.lkshw | 4 | ||||
-rw-r--r-- | Spear/Scene/GameObject.hs | 11 |
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 @@ | |||
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 29 13:08:08 CEST 2012" | 4 | "Wed Aug 29 13:16:24 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 "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 | ||
18 | import Spear.Collision.Collision | 18 | import Spear.Collision.Collision |
19 | import Spear.Collision.Collisioner as Col | 19 | import Spear.Collision.Collisioner as Col |
20 | import Spear.GLSL.Management | ||
20 | import Spear.GLSL.Uniform | 21 | import Spear.GLSL.Uniform |
21 | import Spear.Math.AABB | 22 | import Spear.Math.AABB |
22 | import qualified Spear.Math.Camera as Cam | 23 | import 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 | ||
155 | type Bind = IO () | 156 | type Bind = IO () |
@@ -157,21 +158,23 @@ type Bind = IO () | |||
157 | type Render = IO () | 158 | type Render = IO () |
158 | 159 | ||
159 | 160 | ||
160 | goRender' :: ProgramUniforms u | 161 | goRender' :: (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 () |
168 | goRender' style uniforms model cam bindRenderer render = | 170 | goRender' 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 |