aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Spear/Render/AnimatedModel.hs12
-rw-r--r--Spear/Render/StaticModel.hs10
2 files changed, 11 insertions, 11 deletions
diff --git a/Spear/Render/AnimatedModel.hs b/Spear/Render/AnimatedModel.hs
index 20ec4d1..76e9e7f 100644
--- a/Spear/Render/AnimatedModel.hs
+++ b/Spear/Render/AnimatedModel.hs
@@ -102,7 +102,7 @@ instance Ord AnimatedModelRenderer where
102 m1 < m2 = modelResource m1 < modelResource m2 102 m1 < m2 = modelResource m1 < modelResource m2
103 103
104 104
105-- | Create an 'AnimatedModelResource' from the given 'Model'. 105-- | Create an model resource from the given model.
106animatedModelResource :: AnimatedProgramChannels 106animatedModelResource :: AnimatedProgramChannels
107 -> Material 107 -> Material
108 -> Texture 108 -> Texture
@@ -150,18 +150,18 @@ animatedModelResource
150 material texture boxes rkey 150 material texture boxes rkey
151 151
152 152
153-- | Release the given 'AnimatedModelResource'. 153-- | Release the given model resource.
154release :: AnimatedModelResource -> Setup () 154release :: AnimatedModelResource -> Setup ()
155release = Setup.release . rkey 155release = Setup.release . rkey
156 156
157 157
158-- | Create an 'AnimatedModelRenderer' from the given 'AnimatedModelResource'. 158-- | Create a renderer from the given model resource.
159animatedModelRenderer :: AnimationSpeed -> AnimatedModelResource -> AnimatedModelRenderer 159animatedModelRenderer :: AnimationSpeed -> AnimatedModelResource -> AnimatedModelRenderer
160animatedModelRenderer animSpeed modelResource = 160animatedModelRenderer animSpeed modelResource =
161 AnimatedModelRenderer modelResource 0 0 0 0 0 animSpeed 161 AnimatedModelRenderer modelResource 0 0 0 0 0 animSpeed
162 162
163 163
164-- | Update the 'AnimatedModelRenderer'. 164-- | Update the renderer.
165update dt (AnimatedModelRenderer model curAnim startFrame endFrame curFrame fp s) = 165update dt (AnimatedModelRenderer model curAnim startFrame endFrame curFrame fp s) =
166 AnimatedModelRenderer model curAnim startFrame endFrame curFrame' fp' s 166 AnimatedModelRenderer model curAnim startFrame endFrame curFrame' fp' s
167 where f = fp + dt * s 167 where f = fp + dt * s
@@ -212,7 +212,7 @@ setAnimationSpeed :: AnimationSpeed -> AnimatedModelRenderer -> AnimatedModelRen
212setAnimationSpeed s r = r { animationSpeed = s } 212setAnimationSpeed s r = r { animationSpeed = s }
213 213
214 214
215-- | Bind the given 'AnimatedModelRenderer' to prepare it for rendering. 215-- | Bind the given renderer to prepare it for rendering.
216bind :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () 216bind :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO ()
217bind (AnimatedProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _ _) modelRend = 217bind (AnimatedProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _ _) modelRend =
218 let model' = modelResource modelRend 218 let model' = modelResource modelRend
@@ -223,7 +223,7 @@ bind (AnimatedProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _ _) modelRend
223 glUniform1i texLoc 0 223 glUniform1i texLoc 0
224 224
225 225
226-- | Render the model described by the given 'AnimatedModelRenderer'. 226-- | Render the model described by the given renderer.
227render :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () 227render :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO ()
228render uniforms (AnimatedModelRenderer model _ _ _ curFrame fp _) = 228render uniforms (AnimatedModelRenderer model _ _ _ curFrame fp _) =
229 let n = nVertices model 229 let n = nVertices model
diff --git a/Spear/Render/StaticModel.hs b/Spear/Render/StaticModel.hs
index cdd5c31..c67405a 100644
--- a/Spear/Render/StaticModel.hs
+++ b/Spear/Render/StaticModel.hs
@@ -64,7 +64,7 @@ instance Ord StaticModelRenderer where
64 m1 < m2 = model m1 < model m2 64 m1 < m2 = model m1 < model m2
65 65
66 66
67-- | Create a 'StaticModelResource' from the given 'Model'. 67-- | Create a model resource from the given model.
68staticModelResource :: StaticProgramChannels 68staticModelResource :: StaticProgramChannels
69 -> Material 69 -> Material
70 -> Texture 70 -> Texture
@@ -105,12 +105,12 @@ staticModelResource (StaticProgramChannels vertChan normChan texChan) material t
105 vao (unsafeCoerce numVertices) material texture boxes rkey 105 vao (unsafeCoerce numVertices) material texture boxes rkey
106 106
107 107
108-- | Release the given 'StaticModelResource'. 108-- | Release the given model resource.
109release :: StaticModelResource -> Setup () 109release :: StaticModelResource -> Setup ()
110release = Setup.release . rkey 110release = Setup.release . rkey
111 111
112 112
113-- | Create a 'StaticModelRenderer' from the given 'StaticModelResource'. 113-- | Create a renderer from the given model resource.
114staticModelRenderer :: StaticModelResource -> StaticModelRenderer 114staticModelRenderer :: StaticModelResource -> StaticModelRenderer
115staticModelRenderer = StaticModelRenderer 115staticModelRenderer = StaticModelRenderer
116 116
@@ -125,7 +125,7 @@ modelRes :: StaticModelRenderer -> StaticModelResource
125modelRes = model 125modelRes = model
126 126
127 127
128-- | Bind the given 'StaticModelRenderer' to prepare it for rendering. 128-- | Bind the given renderer to prepare it for rendering.
129bind :: StaticProgramUniforms -> StaticModelRenderer -> IO () 129bind :: StaticProgramUniforms -> StaticModelRenderer -> IO ()
130bind (StaticProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _) (StaticModelRenderer model) = 130bind (StaticProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _) (StaticModelRenderer model) =
131 let (Material _ ka kd ks shi) = material model 131 let (Material _ ka kd ks shi) = material model
@@ -136,7 +136,7 @@ bind (StaticProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _) (StaticModelR
136 glUniform1i texLoc 0 136 glUniform1i texLoc 0
137 137
138 138
139-- | Render the given 'StaticModelRenderer'. 139-- | Render the given renderer.
140render :: StaticProgramUniforms -> StaticModelRenderer -> IO () 140render :: StaticProgramUniforms -> StaticModelRenderer -> IO ()
141render uniforms (StaticModelRenderer model) = 141render uniforms (StaticModelRenderer model) =
142 let (Material _ ka kd ks shi) = material model 142 let (Material _ ka kd ks shi) = material model