aboutsummaryrefslogtreecommitdiff
path: root/Demos/Pong/Main.hs
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2024-12-30 20:59:27 -0800
committer3gg <3gg@shellblade.net>2024-12-30 20:59:27 -0800
commite2b76464e847e5c656e6adf6d8e07a054756cda0 (patch)
treea38fe19bc4086e34b59e56e84550725794b2736a /Demos/Pong/Main.hs
parentf1939232bec72fffede16a55119bc7c4fb3057cf (diff)
Use bounding volume in other places.
Diffstat (limited to 'Demos/Pong/Main.hs')
-rw-r--r--Demos/Pong/Main.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Demos/Pong/Main.hs b/Demos/Pong/Main.hs
index df90020..b93325d 100644
--- a/Demos/Pong/Main.hs
+++ b/Demos/Pong/Main.hs
@@ -9,6 +9,7 @@ import Spear.Math.Matrix4 as Matrix4 hiding (position)
9import Spear.Math.Spatial 9import Spear.Math.Spatial
10import Spear.Math.Spatial2 10import Spear.Math.Spatial2
11import Spear.Math.Vector 11import Spear.Math.Vector
12import Spear.Physics.Collision
12import Spear.Render.Core.Pipeline 13import Spear.Render.Core.Pipeline
13import Spear.Render.Core.State 14import Spear.Render.Core.State
14import Spear.Render.Immediate 15import Spear.Render.Immediate
@@ -101,11 +102,9 @@ renderBackground =
101 ,vec2 pmin pmax)] 102 ,vec2 pmin pmax)]
102 103
103renderGO :: GameObject -> Game ImmRenderState () 104renderGO :: GameObject -> Game ImmRenderState ()
104renderGO go = do 105renderGO go =
105 let (AABB2 (Vector2 xmin ymin) (Vector2 xmax ymax)) = aabb go 106 let (AABB2Volume (AABB2 (Vector2 xmin ymin) (Vector2 xmax ymax))) = boundingVolume go
106 (Vector2 xcenter ycenter) = position go 107 in
107 immPreservingMatrix $ do
108 immTranslate (vec3 xcenter ycenter 0)
109 immDrawQuads2d [ 108 immDrawQuads2d [
110 (vec2 xmin ymin 109 (vec2 xmin ymin
111 ,vec2 xmax ymin 110 ,vec2 xmax ymin