diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-30 20:08:20 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-30 20:08:20 +0200 |
commit | 37713def23629097a79887f02e290e0027337c27 (patch) | |
tree | e88d7bd3b6338d2c8f7d9ff89b24703612f79e7d | |
parent | a502bf0a62c38a789c1325d6f1082d5ff2af612c (diff) |
Enhanced docs
-rw-r--r-- | Spear/Render/AnimatedModel.hs | 30 | ||||
-rw-r--r-- | Spear/Render/StaticModel.hs | 28 |
2 files changed, 33 insertions, 25 deletions
diff --git a/Spear/Render/AnimatedModel.hs b/Spear/Render/AnimatedModel.hs index 2673db8..1703141 100644 --- a/Spear/Render/AnimatedModel.hs +++ b/Spear/Render/AnimatedModel.hs | |||
@@ -1,20 +1,24 @@ | |||
1 | module Spear.Render.AnimatedModel | 1 | module Spear.Render.AnimatedModel |
2 | ( | 2 | ( |
3 | -- * Data types | ||
3 | AnimatedModelResource | 4 | AnimatedModelResource |
4 | , AnimatedModelRenderer | 5 | , AnimatedModelRenderer |
5 | , AnimationSpeed | 6 | , AnimationSpeed |
7 | -- * Construction and destruction | ||
6 | , animatedModelResource | 8 | , animatedModelResource |
7 | , animatedModelRenderer | 9 | , animatedModelRenderer |
8 | , Spear.Render.AnimatedModel.release | 10 | , Spear.Render.AnimatedModel.release |
11 | -- * Manipulation | ||
12 | , update | ||
9 | , setAnimation | 13 | , setAnimation |
10 | , currentAnimation | 14 | , currentAnimation |
11 | , animationSpeed | 15 | , animationSpeed |
12 | , setAnimationSpeed | 16 | , setAnimationSpeed |
13 | , bind | ||
14 | , render | ||
15 | , update | ||
16 | , box | 17 | , box |
17 | , modelRes | 18 | , modelRes |
19 | -- * Rendering | ||
20 | , bind | ||
21 | , render | ||
18 | ) | 22 | ) |
19 | where | 23 | where |
20 | 24 | ||
@@ -179,6 +183,16 @@ setAnimationSpeed :: AnimationSpeed -> AnimatedModelRenderer -> AnimatedModelRen | |||
179 | setAnimationSpeed s r = r { animationSpeed = s } | 183 | setAnimationSpeed s r = r { animationSpeed = s } |
180 | 184 | ||
181 | 185 | ||
186 | -- | Get the model's ith bounding box. | ||
187 | box :: Int -> AnimatedModelResource -> Box | ||
188 | box i model = boxes model V.! i | ||
189 | |||
190 | |||
191 | -- | Get the renderer's model resource. | ||
192 | modelRes :: AnimatedModelRenderer -> AnimatedModelResource | ||
193 | modelRes = modelResource | ||
194 | |||
195 | |||
182 | -- | Bind the given 'AnimatedModelRenderer' to prepare it for rendering. | 196 | -- | Bind the given 'AnimatedModelRenderer' to prepare it for rendering. |
183 | bind :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () | 197 | bind :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () |
184 | bind (AnimatedProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _ _) modelRend = | 198 | bind (AnimatedProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _ _) modelRend = |
@@ -202,13 +216,3 @@ render uniforms (AnimatedModelRenderer model _ _ _ curFrame fp _) = | |||
202 | glUniform1f (shiLoc uniforms) $ unsafeCoerce shi | 216 | glUniform1f (shiLoc uniforms) $ unsafeCoerce shi |
203 | glUniform1f (fpLoc uniforms) (unsafeCoerce fp) | 217 | glUniform1f (fpLoc uniforms) (unsafeCoerce fp) |
204 | drawArrays gl_TRIANGLES (n*curFrame) n | 218 | drawArrays gl_TRIANGLES (n*curFrame) n |
205 | |||
206 | |||
207 | -- | Get the model's ith bounding box. | ||
208 | box :: Int -> AnimatedModelResource -> Box | ||
209 | box i model = boxes model V.! i | ||
210 | |||
211 | |||
212 | -- | Get the renderer's model resource. | ||
213 | modelRes :: AnimatedModelRenderer -> AnimatedModelResource | ||
214 | modelRes = modelResource | ||
diff --git a/Spear/Render/StaticModel.hs b/Spear/Render/StaticModel.hs index 473df1b..31acaa2 100644 --- a/Spear/Render/StaticModel.hs +++ b/Spear/Render/StaticModel.hs | |||
@@ -1,14 +1,18 @@ | |||
1 | module Spear.Render.StaticModel | 1 | module Spear.Render.StaticModel |
2 | ( | 2 | ( |
3 | -- * Data types | ||
3 | StaticModelResource | 4 | StaticModelResource |
4 | , StaticModelRenderer | 5 | , StaticModelRenderer |
6 | -- * Construction and destruction | ||
5 | , staticModelResource | 7 | , staticModelResource |
6 | , staticModelRenderer | 8 | , staticModelRenderer |
7 | , Spear.Render.StaticModel.release | 9 | , Spear.Render.StaticModel.release |
8 | , bind | 10 | -- * Manipulation |
9 | , render | ||
10 | , box | 11 | , box |
11 | , modelRes | 12 | , modelRes |
13 | -- * Rendering | ||
14 | , bind | ||
15 | , render | ||
12 | ) | 16 | ) |
13 | where | 17 | where |
14 | 18 | ||
@@ -107,6 +111,16 @@ staticModelRenderer :: StaticModelResource -> StaticModelRenderer | |||
107 | staticModelRenderer = StaticModelRenderer | 111 | staticModelRenderer = StaticModelRenderer |
108 | 112 | ||
109 | 113 | ||
114 | -- | Get the model's ith bounding box. | ||
115 | box :: Int -> StaticModelResource -> Box | ||
116 | box i model = boxes model V.! i | ||
117 | |||
118 | |||
119 | -- | Get the renderer's model resource. | ||
120 | modelRes :: StaticModelRenderer -> StaticModelResource | ||
121 | modelRes = model | ||
122 | |||
123 | |||
110 | -- | Bind the given 'StaticModelRenderer' to prepare it for rendering. | 124 | -- | Bind the given 'StaticModelRenderer' to prepare it for rendering. |
111 | bind :: StaticProgramUniforms -> StaticModelRenderer -> IO () | 125 | bind :: StaticProgramUniforms -> StaticModelRenderer -> IO () |
112 | bind (StaticProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _) (StaticModelRenderer model) = | 126 | bind (StaticProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _) (StaticModelRenderer model) = |
@@ -128,13 +142,3 @@ render uniforms (StaticModelRenderer model) = | |||
128 | uniformVec4 (ksLoc uniforms) ks | 142 | uniformVec4 (ksLoc uniforms) ks |
129 | glUniform1f (shiLoc uniforms) $ unsafeCoerce shi | 143 | glUniform1f (shiLoc uniforms) $ unsafeCoerce shi |
130 | drawArrays gl_TRIANGLES 0 $ nVertices model | 144 | drawArrays gl_TRIANGLES 0 $ nVertices model |
131 | |||
132 | |||
133 | -- | Get the model's ith bounding box. | ||
134 | box :: Int -> StaticModelResource -> Box | ||
135 | box i model = boxes model V.! i | ||
136 | |||
137 | |||
138 | -- | Get the renderer's model resource. | ||
139 | modelRes :: StaticModelRenderer -> StaticModelResource | ||
140 | modelRes = model | ||