diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-09-03 19:40:09 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-09-03 19:40:09 +0200 |
commit | a618215f35d7359a5f4c94a0b88d2449c92c77e7 (patch) | |
tree | df59b163de64aef9d2d83a30bc2821aac9eca1d2 | |
parent | e51486ea0ae18bd7291eb7bda8d7f0c6f0caddf1 (diff) |
docs
-rw-r--r-- | Spear/Render/AnimatedModel.hs | 12 | ||||
-rw-r--r-- | Spear/Render/StaticModel.hs | 10 |
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. |
106 | animatedModelResource :: AnimatedProgramChannels | 106 | animatedModelResource :: 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. |
154 | release :: AnimatedModelResource -> Setup () | 154 | release :: AnimatedModelResource -> Setup () |
155 | release = Setup.release . rkey | 155 | release = Setup.release . rkey |
156 | 156 | ||
157 | 157 | ||
158 | -- | Create an 'AnimatedModelRenderer' from the given 'AnimatedModelResource'. | 158 | -- | Create a renderer from the given model resource. |
159 | animatedModelRenderer :: AnimationSpeed -> AnimatedModelResource -> AnimatedModelRenderer | 159 | animatedModelRenderer :: AnimationSpeed -> AnimatedModelResource -> AnimatedModelRenderer |
160 | animatedModelRenderer animSpeed modelResource = | 160 | animatedModelRenderer 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. |
165 | update dt (AnimatedModelRenderer model curAnim startFrame endFrame curFrame fp s) = | 165 | update 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 | |||
212 | setAnimationSpeed s r = r { animationSpeed = s } | 212 | setAnimationSpeed 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. |
216 | bind :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () | 216 | bind :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () |
217 | bind (AnimatedProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _ _) modelRend = | 217 | bind (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. |
227 | render :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () | 227 | render :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () |
228 | render uniforms (AnimatedModelRenderer model _ _ _ curFrame fp _) = | 228 | render 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. |
68 | staticModelResource :: StaticProgramChannels | 68 | staticModelResource :: 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. |
109 | release :: StaticModelResource -> Setup () | 109 | release :: StaticModelResource -> Setup () |
110 | release = Setup.release . rkey | 110 | release = Setup.release . rkey |
111 | 111 | ||
112 | 112 | ||
113 | -- | Create a 'StaticModelRenderer' from the given 'StaticModelResource'. | 113 | -- | Create a renderer from the given model resource. |
114 | staticModelRenderer :: StaticModelResource -> StaticModelRenderer | 114 | staticModelRenderer :: StaticModelResource -> StaticModelRenderer |
115 | staticModelRenderer = StaticModelRenderer | 115 | staticModelRenderer = StaticModelRenderer |
116 | 116 | ||
@@ -125,7 +125,7 @@ modelRes :: StaticModelRenderer -> StaticModelResource | |||
125 | modelRes = model | 125 | modelRes = 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. |
129 | bind :: StaticProgramUniforms -> StaticModelRenderer -> IO () | 129 | bind :: StaticProgramUniforms -> StaticModelRenderer -> IO () |
130 | bind (StaticProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _) (StaticModelRenderer model) = | 130 | bind (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. |
140 | render :: StaticProgramUniforms -> StaticModelRenderer -> IO () | 140 | render :: StaticProgramUniforms -> StaticModelRenderer -> IO () |
141 | render uniforms (StaticModelRenderer model) = | 141 | render uniforms (StaticModelRenderer model) = |
142 | let (Material _ ka kd ks shi) = material model | 142 | let (Material _ ka kd ks shi) = material model |