This module contains the data types of the Collada scene graph.
- topDown :: (acc -> x -> (acc, y)) -> acc -> Tree x -> Tree y
- bottomUp :: ([acc] -> x -> (acc, y)) -> Tree x -> (acc, Tree y)
- prune :: (a -> Bool) -> Tree a -> Maybe (Tree a)
- type SIDPath = [String]
- topDownSIDPath :: (x -> (SID, Maybe ID)) -> Tree x -> Tree (SIDPath, x)
- topDownTransform :: (x -> Mat44 Float) -> Tree x -> Tree (Mat44 Float, x)
- alterSID :: (String -> a -> Maybe a) -> [(SID, a)] -> [(SID, a)]
- lookupSID :: String -> [(SID, a)] -> Maybe a
- hasDynVertex :: Typeable a => Map Semantic TypeRep -> Semantic -> a -> Bool
- dynVertex :: Typeable a => Map Semantic Dynamic -> Semantic -> Maybe a
- viewScene :: Scene -> Vec2 Int -> FrameBuffer RGBFormat DepthFormat ()
General Tree utilities
topDown :: (acc -> x -> (acc, y)) -> acc -> Tree x -> Tree ySource
Traverse a Tree top down, much like mapAccumL
. The function recieves an accumulator from its parent and generates one that is passed down to its children.
Useful for accumulating transformations, etc.
bottomUp :: ([acc] -> x -> (acc, y)) -> Tree x -> (acc, Tree y)Source
Traverse a Tree bottom up, much like mapAccumR
. The function recieves the accumulators of all its children and generates one that is passed up to its parent.
Useful for accumulating AABBs, etc.
prune :: (a -> Bool) -> Tree a -> Maybe (Tree a)Source
Remove branches of a tree where the function evaluates to True
. Useful for selecting LODs, etc.
Scene utilities
A path where the first string in the list is the closest ID and the rest is all SIDs found in order.
topDownSIDPath :: (x -> (SID, Maybe ID)) -> Tree x -> Tree (SIDPath, x)Source
Traverse a tree top down accumulating the SIDPath
for each node. The projection function enables this to be used on trees that are not Scene
s.
The accumulated SIDPath
for a node will include the node's SID
at the end, but not its ID
. The ID
will however be the first String
in the
SIDPath
s of the children, and the nodes SID
won't be included in this case.
SID utilities
lookupSID :: String -> [(SID, a)] -> Maybe aSource
Find the first element in the list that is attributed with the provided SID.
Geometry utilities
Debug utilities
viewScene :: Scene -> Vec2 Int -> FrameBuffer RGBFormat DepthFormat ()Source
Render the scene using a simple shading technique through the first camera found, or through a defult camera if the scene doesn't contain any cameras. The scene's lights aren't
used in the rendering. The source of this function can also serve as an example of how a Collada Scene
can be processed.