From 37713def23629097a79887f02e290e0027337c27 Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Thu, 30 Aug 2012 20:08:20 +0200 Subject: Enhanced docs --- Spear/Render/AnimatedModel.hs | 30 +++++++++++++++++------------- 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 @@ module Spear.Render.AnimatedModel ( + -- * Data types AnimatedModelResource , AnimatedModelRenderer , AnimationSpeed + -- * Construction and destruction , animatedModelResource , animatedModelRenderer , Spear.Render.AnimatedModel.release + -- * Manipulation +, update , setAnimation , currentAnimation , animationSpeed , setAnimationSpeed -, bind -, render -, update , box , modelRes + -- * Rendering +, bind +, render ) where @@ -179,6 +183,16 @@ setAnimationSpeed :: AnimationSpeed -> AnimatedModelRenderer -> AnimatedModelRen setAnimationSpeed s r = r { animationSpeed = s } +-- | Get the model's ith bounding box. +box :: Int -> AnimatedModelResource -> Box +box i model = boxes model V.! i + + +-- | Get the renderer's model resource. +modelRes :: AnimatedModelRenderer -> AnimatedModelResource +modelRes = modelResource + + -- | Bind the given 'AnimatedModelRenderer' to prepare it for rendering. bind :: AnimatedProgramUniforms -> AnimatedModelRenderer -> IO () bind (AnimatedProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _ _) modelRend = @@ -202,13 +216,3 @@ render uniforms (AnimatedModelRenderer model _ _ _ curFrame fp _) = glUniform1f (shiLoc uniforms) $ unsafeCoerce shi glUniform1f (fpLoc uniforms) (unsafeCoerce fp) drawArrays gl_TRIANGLES (n*curFrame) n - - --- | Get the model's ith bounding box. -box :: Int -> AnimatedModelResource -> Box -box i model = boxes model V.! i - - --- | Get the renderer's model resource. -modelRes :: AnimatedModelRenderer -> AnimatedModelResource -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 @@ module Spear.Render.StaticModel ( + -- * Data types StaticModelResource , StaticModelRenderer + -- * Construction and destruction , staticModelResource , staticModelRenderer , Spear.Render.StaticModel.release -, bind -, render + -- * Manipulation , box , modelRes + -- * Rendering +, bind +, render ) where @@ -107,6 +111,16 @@ staticModelRenderer :: StaticModelResource -> StaticModelRenderer staticModelRenderer = StaticModelRenderer +-- | Get the model's ith bounding box. +box :: Int -> StaticModelResource -> Box +box i model = boxes model V.! i + + +-- | Get the renderer's model resource. +modelRes :: StaticModelRenderer -> StaticModelResource +modelRes = model + + -- | Bind the given 'StaticModelRenderer' to prepare it for rendering. bind :: StaticProgramUniforms -> StaticModelRenderer -> IO () bind (StaticProgramUniforms kaLoc kdLoc ksLoc shiLoc texLoc _ _ _) (StaticModelRenderer model) = @@ -128,13 +142,3 @@ render uniforms (StaticModelRenderer model) = uniformVec4 (ksLoc uniforms) ks glUniform1f (shiLoc uniforms) $ unsafeCoerce shi drawArrays gl_TRIANGLES 0 $ nVertices model - - --- | Get the model's ith bounding box. -box :: Int -> StaticModelResource -> Box -box i model = boxes model V.! i - - --- | Get the renderer's model resource. -modelRes :: StaticModelRenderer -> StaticModelResource -modelRes = model -- cgit v1.2.3