-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell binding to the Cal3D animation library. -- -- Haskell binding to the Cal3D, a skeletal-based animation library -- written in C++. See also the related packages cal3d-opengl and -- cal3d-examples. @package cal3d @version 0.1 module Graphics.Animation.Cal3D.Error type Fallible a = Either String a type IOFallible a = IO (Fallible a) -- | Compares the result of an action with a bad value, such as an error -- code, returns (Left errormessage) if action value == bad, otherwise -- (Right actionresult) checkErrorValue :: (Eq a) => IO a -> a -> String -> IO (Either String a) -- | Like checkError, but returns (Right ()) instead of an interesting -- value. checkError :: (Eq a) => IO a -> a -> String -> IO (Either String ()) -- | Most (possibly all) data type declarations are collected here, in -- order to avoid mutually recursive modules, like where module Model -- needs data Mixer from module Mixer, and module Mixer needs data -- Model from module Model. module Graphics.Animation.Cal3D.Types -- | A CoreModel is a type which may have multiple instances -- (Models). See Graphics.Animation.Cal3D.Model. data CoreModel -- | LoadResult is (Left error_message) or (Right thing_loaded_from_file) type LoadResult a = IO (Either String a) -- | A function that loads something from a file. type Loader a = CoreModel -> FilePath -> LoadResult a type CLoader = CoreModel -> CString -> IO CInt -- | Identifies an animation. newtype AnimationId AnimationId :: CInt -> AnimationId -- | Identifies a mesh. newtype MeshId MeshId :: CInt -> MeshId -- | Identifies a material. newtype MaterialId MaterialId :: CInt -> MaterialId -- | Identifies a material thread. data MaterialThreadId MaterialThreadId :: Int -> MaterialThreadId -- | Identifies a material set. data MaterialSetId MaterialSetId :: Int -> MaterialSetId -- | A Model is an "instance" of a CoreModel. See -- Graphics.Animation.Cal3D.Model. data Model -- | A Mixer can blend simultaneous animations and play them. See -- Graphics.Animation.Cal3D.Mixer. data Mixer -- | A Renderer provides data needed for graphics rendering. Cal3D does no -- rendering itself; the Renderer simply provides the needed information -- for a graphics API such as OpenGL. See -- Graphics.Animation.Cal3D.Renderer; also see the cal3d-opengl -- package. data Renderer instance Show MeshId instance Eq MeshId -- | A Renderer provides information needed for graphics rendering; it does -- not output any graphics by itself, but needs the cooperation of a -- graphics API. Consider using Graphics.Animation.Cal3D.OpenGL from the -- cal3d-opengl package. module Graphics.Animation.Cal3D.Renderer -- | Create a Renderer. newRenderer :: Model -> IO Renderer -- | Destroy a Renderer. deleteRenderer :: Renderer -> IO () -- | Executes a rendering action. -- --
-- renderAnimation renderer action ---- -- corresponds to -- --
-- renderer->beginRendering(); -- action(); -- renderer->endRendering(); ---- -- in the Cal3D C++ API. renderAnimation :: Renderer -> IO () -> IO (Either String ()) -- | The number of meshes in the Renderer's Model. getMeshCount :: Renderer -> IO Int -- | The number of submeshes in the given mesh of the Renderer's -- Model. getSubmeshCount :: Renderer -> Int -> IO Int -- | Selects a particular (mesh, submesh) so that all subsequent operations -- refer to this (mesh, submesh) pair. selectMeshSubmesh :: Renderer -> Int -> Int -> IO (Either String ()) -- | Used to index faces. type CalIndex = CInt -- | The number of faces in the current (mesh, submesh). getFaceCount :: Renderer -> IO Int -- | Fills a buffer with the face numbers. getFaces :: Renderer -> Ptr CalIndex -> IO Int -- | Calls an action with a pointer to the ambient color data. The color -- data are four bytes (red, green, blue, alpha). If you are using -- OpenGL, use Graphics.Animation.Cal3D.OpenGL.getAmbientColor instead. -- You almost certainly don't want to use withAmbientColorPtr -- directly, unless your are connecting Cal3D to a different graphics -- API. withAmbientColorPtr :: (Storable c) => (Ptr Word8 -> IO c) -> Renderer -> IO c -- | Diffuse color, like withAmbientColorPtr. withDiffuseColorPtr :: (Storable c) => (Ptr Word8 -> IO c) -> Renderer -> IO c -- | Specular color, like withAmbientColorPtr. withSpecularColorPtr :: (Storable c) => (Ptr Word8 -> IO c) -> Renderer -> IO c -- | The shininess, which affects the extent of speculr effects. getShininess :: Renderer -> IO Float -- | The number of vertices, also the number of normals, in the current -- (mesh, submesh). getVertexCount :: Renderer -> IO Int -- | Fills a buffer with the vertex data of the current (mesh, submesh). getVertices :: Renderer -> Ptr Float -> Int -> IO Int -- | Fills a buffer with the normal data for the current (mesh, submesh). getNormals :: Renderer -> Ptr Float -> Int -> IO Int module Graphics.Animation.Cal3D.Mixer -- | Create a Mixer. newMixer :: IO Mixer -- | Destroy a Mixer. deleteMixer :: Mixer -> IO () -- | Add an animation to be cycled (repeated) to the current mix. -- The animation will continue playing until removed by -- clearCycle. blendCycle :: Mixer -> AnimationId -> Float -> Float -> IO (Either String ()) -- | Remove a cycled animation from the current mix. clearCycle :: Mixer -> AnimationId -> Float -> IO (Either String ()) -- | Execute an animation once, instead of repeating it. executeAction :: Mixer -> AnimationId -> Float -> Float -> Float -> Bool -> IO (Either String ()) -- | A CoreModel is a model type from which many instance -- Models can be created. For example, there could be a clown -- CoreModel and many individual clown instances. The CoreModel contains -- data shared by its instances: -- --