module Graphics.Animation.Cal3D.Model
(newModel, deleteModel
, attachMesh
, setLodLevel
, setMaterialSet
, getMixer
, update
, getRenderer
)
where
import Foreign
import Foreign.C.Types
import Foreign.C.String
import Graphics.Animation.Cal3D.Types
import Graphics.Animation.Cal3D.CoreModel
import Graphics.Animation.Cal3D.Error
foreign import ccall safe "newModel"
newModel :: CoreModel -> IO Model
foreign import ccall safe "deleteModel"
deleteModel :: Model -> IO ()
attachMesh :: Model -> MeshId -> IO (Either String ())
attachMesh model (MeshId id) =
checkError (c_attachMesh model id) 0 "failed to attach mesh"
foreign import ccall safe "attachMesh"
c_attachMesh :: Model -> CInt -> IO CInt
setLodLevel :: Model -> Float -> IO ()
setLodLevel model = c_setLodLevel model . realToFrac
foreign import ccall safe "setLodLevel"
c_setLodLevel :: Model -> CFloat -> IO ()
setMaterialSet :: Model -> MaterialSetId -> IO ()
setMaterialSet model (MaterialSetId id) =
c_setMaterialSet model (fromIntegral id)
foreign import ccall safe "setMaterialSet"
c_setMaterialSet :: Model -> CInt -> IO ()
foreign import ccall safe "getMixer"
getMixer :: Model -> IO Mixer
update :: Model
-> Float
-> IO ()
update model deltaTime = c_update model (realToFrac deltaTime)
foreign import ccall safe "update"
c_update :: Model -> CFloat -> IO ()
foreign import ccall safe "getRenderer"
getRenderer :: Model -> IO Renderer