-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Scene Graph -- -- Scene Graph Library. @package scenegraph @version 0.2.0.0 module Graphics.SceneGraph.Matrix translateM :: V3 Float -> M44 Float -> M44 Float translatePostM :: V3 Float -> M44 Float -> M44 Float scaleM :: V3 Float -> M44 Float -> M44 Float rotateM :: Float -> V3 Float -> M44 Float -> M44 Float rotatePostM :: Float -> V3 Float -> M44 Float -> M44 Float module Graphics.SceneGraph.Types -- | Scene Graph based on a Graph type SceneGraph g = Gr (SceneNode g) SceneEdge -- | Empty edge label for scene graphs. data SceneEdge DefaultEdge :: SceneEdge -- | Scene Node. Made up of data and maybe a widget data SceneNode g SceneNode :: Node -> String -> SceneData g -> SceneNode g [nodeId] :: SceneNode g -> Node [nodeLabel] :: SceneNode g -> String [nodeData] :: SceneNode g -> SceneData g -- | Creates an empty scene graph nullNode :: Node -> SceneNode g -- | Creates a scene graph containing the supplied node trivialGr :: SceneNode g -> SceneGraph g -- | Scene Graph with indicate root node data Scene g Scene :: SceneGraph g -> Node -> Scene g [sceneGraph] :: Scene g -> SceneGraph g [sceneRoot] :: Scene g -> Node -- | View port refers to a camera node and has its own Scene which is drawn -- flattened data Viewport g Viewport :: Node -> Scene g -> Viewport g [viewCamera] :: Viewport g -> Node [viewScene] :: Viewport g -> Scene g -- | A scene with a number of view ports looking onto it. data World g World :: Scene g -> [Viewport g] -> World g [worldScene] :: World g -> Scene g [worldViewports] :: World g -> [Viewport g] data KeyState Up :: KeyState Down :: KeyState type ClickHandler g = Scene g -> KeyState -> IO (SceneGraph g) type DragHandler g = Scene g -> V3 Float -> IO (SceneGraph g, Float) type Sink a = a -> IO () -- | Scene Node Data. data SceneData g Group :: SceneData g Geode :: Text -> g -> SceneData g LOD :: SceneData g MatrixTransform :: M44 Float -> SceneData g Switch :: Int -> SceneData g Material :: Phong -> SceneData g Handler :: Maybe (ClickHandler g, Sink ()) -> Maybe (DragHandler g, Sink Float) -> SceneData g Light :: SceneData g Camera :: SceneData g Texture :: FilePath -> SceneData g Text :: Text -> SceneData g -- | Geometry. Either a basic GL object or a mesh. data Geometry Mesh2D :: [V2 Float] -> Geometry Mesh3D :: [(V3 Float, V3 Float)] -> Geometry -- | Simple colors data Color Grey :: Color JustWhite :: Color Red :: Color Green :: Color Blue :: Color Black :: Color LightBlue :: Color White :: Color Yellow :: Color mapColor :: Color -> V4 Float -- | Phong lighting data Phong Phong :: Maybe (V4 Float) -> Maybe (V4 Float) -> Maybe (V4 Float) -> Maybe (V4 Float) -> Maybe Float -> Maybe (V4 Float) -> Maybe Float -> Maybe (V4 Float) -> Maybe Float -> Phong [phEmission] :: Phong -> Maybe (V4 Float) [phAmbient] :: Phong -> Maybe (V4 Float) [phDiffuse] :: Phong -> Maybe (V4 Float) [phSpecular] :: Phong -> Maybe (V4 Float) [phShine] :: Phong -> Maybe Float [phReflective] :: Phong -> Maybe (V4 Float) [phReflectivity] :: Phong -> Maybe Float [phTransparent] :: Phong -> Maybe (V4 Float) [phTransparency] :: Phong -> Maybe Float -- | Convert from simple color to Phong colorToPhong :: Color -> Phong llab :: SceneGraph g -> Node -> SceneNode g instance GHC.Classes.Ord Graphics.SceneGraph.Types.SceneEdge instance GHC.Classes.Eq Graphics.SceneGraph.Types.SceneEdge instance GHC.Show.Show Graphics.SceneGraph.Types.KeyState instance GHC.Classes.Eq Graphics.SceneGraph.Types.KeyState instance GHC.Show.Show Graphics.SceneGraph.Types.Geometry instance GHC.Classes.Eq Graphics.SceneGraph.Types.Geometry instance GHC.Classes.Eq Graphics.SceneGraph.Types.Color instance GHC.Show.Show Graphics.SceneGraph.Types.Color instance GHC.Show.Show Graphics.SceneGraph.Types.Phong instance GHC.Classes.Eq Graphics.SceneGraph.Types.Phong instance GHC.Show.Show (Graphics.SceneGraph.Types.SceneNode g) instance GHC.Classes.Eq (Graphics.SceneGraph.Types.SceneNode g) instance GHC.Show.Show (Graphics.SceneGraph.Types.ClickHandler g) instance GHC.Show.Show (Graphics.SceneGraph.Types.DragHandler g) instance GHC.Show.Show (Graphics.SceneGraph.Types.SceneData g) instance Data.Default.Class.Default Graphics.SceneGraph.Types.Phong instance GHC.Show.Show Graphics.SceneGraph.Types.SceneEdge module Graphics.SceneGraph.Render -- | Draw a scene graph (or a scenegraph fragment) drawScene :: Monad m => Scene g -> (M44 Float -> Phong -> g -> m ()) -> m () drawScene' :: Monad m => M44 Float -> Phong -> Scene g -> (M44 Float -> Phong -> g -> m ()) -> m () mapSceneData :: (SceneData g1 -> SceneData g2) -> SceneGraph g1 -> SceneGraph g2 foldSceneData :: (SceneData g -> a -> a) -> a -> SceneGraph g -> a module Graphics.SceneGraph.BoundingBox -- | A box. Used for calculating bounds type Box a = (V3 a, V3 a) -- | Return the diagonal vector across the box corners. boxSize :: Box Float -> V3 Float -- | Bounds suitable for starting off with smallBox :: Box Float -- | Create union of two boxes union :: Box Float -> Box Float -> Box Float bounds :: Scene g -> Box Float -- | Determine bounds of a SceneNode boundsSceneNode :: SceneGraph g -> SceneNode g -> Box Float boundsOfChildren :: SceneGraph g -> Node -> Box Float module Graphics.SceneGraph.Basic -- | Holds state of graph as it is built. data OSGState g OSGState :: SceneGraph g -> [SceneNode g] -> Int -> Int -> OSGState g [graph] :: OSGState g -> SceneGraph g [context] :: OSGState g -> [SceneNode g] [startNode] :: OSGState g -> Int [root] :: OSGState g -> Int emptyState :: OSGState g -- | The OSG monad within which construction of scene graphs occur. was -- 'type OSGT m = ErrorT Throwable (ST.StateT OSGState m)' type OSGT m g = StateT (OSGState g) m type OSGSceneT m g = OSGT m g (SceneNode g) type OSG g = OSGT Identity g -- | Create and run a OSG monad to return a scene graph and root node. runOSG :: Monad m => OSGState g -> OSGSceneT m g -> m (SceneNode g, OSGState g, Node) runOSGShow :: OSGSceneT IO g -> IO () -- | Wrapper for running the OSG monad to return a scene graph and root -- node. osg :: Monad m => OSGSceneT m g -> m (Scene g) idd :: SceneNode g -> Node -- | Basic add node addNodeBasic :: Monad m => SceneNode g -> OSGSceneT m g -- | Add node with scene data addBasicNode :: Monad m => SceneData g -> OSGSceneT m g -- | Add node with scene data addBasicNamedNode :: Monad m => String -> SceneData g -> OSGSceneT m g -- | Add empty node addNullNode :: Monad m => OSGSceneT m g -- | Add a node to a scene graph with supplied children addNode :: Monad m => SceneNode g -> [(SceneEdge, Node)] -> OSGSceneT m g -- | Non-monadic form of addNode addNode' :: OSGState g -> SceneNode g -> [(SceneEdge, Node)] -> (SceneNode g, OSGState g) -- | Replace a Scene Node replaceNode :: Monad m => SceneNode g -> OSGSceneT m g -- | Inner monad version of replace node replaceNode' :: Monad md => SceneGraph g -> SceneNode g -> md (SceneGraph g) -- | Actually does the job of replacing node in a scene graph replaceNode'' :: SceneGraph g -> SceneNode g -> SceneGraph g -- | Run the monad but keep it in the family. runOSGL :: Monad m => OSGState g -> OSGSceneT m g -> OSGT m g (SceneNode g, OSGState g, Node) -- | Run the monad but keep it in the family. runOSGL' :: Monad m => OSGSceneT m g -> OSGT m g (SceneNode g, Node) -- | Perform a function on a scene node doOnNode :: Monad m => OSGSceneT m g -> (SceneNode g -> SceneNode g) -> OSGSceneT m g -- | Create a light light :: Monad m => OSGSceneT m g -- | Create a camera camera :: Monad m => OSGSceneT m g -- | Create a camera mesh :: Monad m => Text -> g -> OSGSceneT m g fi :: (Integral a, Integral b) => a -> b -- | Scale a node by equal amounts in all directions scaleS :: Monad m => Float -> OSGSceneT m g -> OSGSceneT m g -- | Scale a node scale :: Monad m => V3 Float -> OSGSceneT m g -> OSGSceneT m g -- | Translate a node translate :: Monad m => V3 Float -> OSGSceneT m g -> OSGSceneT m g -- | Rotate a node by an angle around a vector. rotate :: Monad m => (Float, V3 Float) -> OSGSceneT m g -> OSGSceneT m g rad :: Float -> Float -- | Rotate a node around X axis rotateX :: Monad m => Float -> OSGSceneT m g -> OSGSceneT m g -- | Rotate a node around Y axis rotateY :: Monad m => Float -> OSGSceneT m g -> OSGSceneT m g -- | Rotate a node around Z axis rotateZ :: Monad m => Float -> OSGSceneT m g -> OSGSceneT m g -- | Apply colour to the node colourSG :: Monad m => OSGSceneT m g -> (Phong -> Phong) -> (OSGSceneT m g -> OSGSceneT m g) -> OSGSceneT m g -- | Transform the node of a scene graph within the Monad with the supplied -- matrix transform transformSG :: Monad m => (M44 Float -> M44 Float) -> (OSGSceneT m g -> OSGSceneT m g) -> OSGSceneT m g -> OSGSceneT m g -- | Transform the node of a scene graph with the supplied matrix transform transformSG' :: SceneGraph g -> Node -> (M44 Float -> M44 Float) -> SceneGraph g translateSG' :: SceneGraph g -> Node -> V3 Float -> SceneGraph g translatePostSG' :: SceneGraph g -> Node -> V3 Float -> SceneGraph g rotatePostSG' :: SceneGraph g -> Node -> V3 Float -> Float -> SceneGraph g -- | Add color to a node color :: Monad m => Color -> OSGSceneT m g -> OSGSceneT m g -- | Label a node label :: Monad m => OSGSceneT m g -> String -> OSGSceneT m g -- | Add texture texture :: Monad m => OSGSceneT m g -> String -> OSGSceneT m g text :: Monad m => Text -> OSGSceneT m g -- | Join two graphs together (<+>) :: Monad m => OSGSceneT m g -> OSGSceneT m g -> OSGSceneT m g infixr 5 <+> -- | Translate a node (<->) :: Monad m => OSGSceneT m g -> V3 Float -> OSGSceneT m g infixl 9 <-> -- | Scale a node () :: Monad m => OSGSceneT m g -> V3 Float -> OSGSceneT m g infixl 9 doNothing :: Monad m => p -> m () -- | Add an handler node handler :: Monad m => OSGSceneT m g -> ClickHandler g -> OSGSceneT m g handler2 :: Monad m => OSGSceneT m g -> (ClickHandler g, DragHandler g) -> OSGSceneT m g -- | Create a DragHandler dragHandler :: DragHandler g -- | Create a ClickHandler switchHandler :: ClickHandler g switchNode' :: Node -> Int -> SceneGraph g -> SceneGraph g switchNode :: SceneNode g -> Int -> SceneGraph g -> SceneGraph g -- | Create a switch node switch :: Monad m => OSGSceneT m g -> OSGSceneT m g -> OSGSceneT m g switch' :: Monad m => Int -> OSGSceneT m g -> OSGSceneT m g -> OSGSceneT m g -- | Make a group node from list of nodes group :: Monad m => [SceneNode g] -> OSGSceneT m g emptyScene :: Scene g getHitAction :: Scene g -> Int -> IO () -- | Work up the tree from indicated no to find the first handler scene -- node. findHandler :: SceneGraph g -> Int -> Maybe (SceneNode g) -- | Work down the tree from indicated no to find the first handler scene -- node. findHandlerDown :: SceneGraph g -> Int -> Int findTextDown :: SceneGraph g -> Int -> Int -- | Handle some event handleClickEvent :: Scene g -> Int -> KeyState -> IO (Scene g, Maybe (Scene g), Maybe (SceneGraph g -> SceneGraph g)) emptyOSG :: SceneGraph g findCamera :: Scene g -> Int -> Node findCameraPath :: Scene g -> Int -> Path -- | Return the matrix got by traversing down the Node getTransformTo :: Scene g -> Node -> M44 Float getByLabel :: SceneGraph g -> String -> Node instance GHC.Show.Show (Graphics.SceneGraph.Basic.OSGState g) instance GHC.Classes.Eq (Graphics.SceneGraph.Basic.OSGState g) instance Data.Default.Class.Default (Graphics.SceneGraph.Basic.OSGState g) module Graphics.SceneGraph.Visualise toDot :: Scene g -> FilePath -> IO FilePath toSvg :: Scene g -> FilePath -> IO FilePath instance Data.GraphViz.Attributes.Labellable (Graphics.SceneGraph.Types.SceneNode g) instance Data.GraphViz.Attributes.Labellable Graphics.SceneGraph.Types.SceneEdge instance Data.GraphViz.Attributes.Labellable (Graphics.SceneGraph.Types.SceneData g) module Graphics.SceneGraph