Safe Haskell | Safe-Infered |
---|
This is the public interface of LambdaCube. All the other modules are exposed for the benefit of library writers, but if you feel the need to use any of them as a simple user, that should be considered a defect and reported in the issue tracker.
- module Graphics.LambdaCube.Types
- module Graphics.LambdaCube.MeshUtil
- module Graphics.LambdaCube.Utility
- class (HardwareVertexBuffer vb, HardwareIndexBuffer ib, HardwareOcclusionQuery q, Texture t, GpuProgram p, LinkedGpuProgram lp) => RenderSystem rs vb ib q t p lp | rs -> vb ib q t p lp
- data RenderSystem r vb ib q t p lp => World r vb ib q t p lp
- data LCM w e a
- runLCM :: RenderSystem r vb ib q t1 p lp => r -> [ImageLoader] -> LCM (World r vb ib q t1 p lp) e a -> IO ()
- data PathType
- addResourceLibrary :: RenderSystem r vb ib q t p lp => [ResourceGroup] -> LCM (World r vb ib q t p lp) e ()
- readFile :: RenderSystem r vb ib q t p lp => FilePath -> LCM (World r vb ib q t p lp) e ByteString
- readFile' :: RenderSystem r vb ib q t p lp => FilePath -> LCM (World r vb ib q t p lp) e ByteString
- addScene :: RenderSystem r vb ib q t p lp => [MkNodeAction r vb ib q t p lp e] -> LCM (World r vb ib q t p lp) e ()
- updateTransforms :: RenderSystem r vb ib q t p lp => [(String, Proj4)] -> LCM (World r vb ib q t p lp) e ()
- updateObjects :: RenderSystem rs vb ib q t p lp => [(String, [MkSceneObjectAction rs vb ib q t p lp e])] -> LCM (World rs vb ib q t p lp) e ()
- data Light = Light {}
- data LightTypes
- data Camera = Camera {}
- data RenderQueuePriority
- defaultRQP :: Maybe RenderQueuePriority
- node :: RenderSystem r vb ib q t p lp => String -> String -> Proj4 -> [MkSceneObjectAction r vb ib q t p lp e] -> MkNodeAction r vb ib q t p lp e
- camera :: RenderSystem r vb ib q t p lp => Camera -> MkSceneObjectAction r vb ib q t p lp e
- simpleCamera :: RenderSystem r vb ib q t p lp => String -> MkSceneObjectAction r vb ib q t p lp e
- wireCamera :: RenderSystem r vb ib q t p lp => String -> MkSceneObjectAction r vb ib q t p lp e
- light :: RenderSystem r vb ib q t p lp => Light -> MkSceneObjectAction r vb ib q t p lp e
- defaultLight :: RenderSystem r vb ib q t p lp => MkSceneObjectAction r vb ib q t p lp e
- mesh :: (RenderSystem rs vb ib q t p lp, Enum rqp) => Maybe rqp -> Maybe [String] -> String -> MkSceneObjectAction rs vb ib q t p lp e
- addRenderTexture :: RenderSystem r vb ib q a p lp => String -> Int -> Int -> LCM (World r vb ib q a p lp) e ()
- addRenderWindow :: RenderSystem r vb ib q t p lp => String -> Int -> Int -> [LCM (World r vb ib q t p lp) e (Viewport t lp)] -> LCM (World r vb ib q t p lp) e ()
- viewport :: RenderSystem r vb ib q t p lp => FloatType -> FloatType -> FloatType -> FloatType -> String -> [String] -> LCM (World r vb ib q t p lp) e (Viewport t lp)
- renderWorld :: RenderSystem r vb ib q t p lp => FloatType -> String -> LCM (World r vb ib q t p lp) e ()
- updateTargetSize :: RenderSystem rs vb ib q t p lp => String -> Int -> Int -> LCM (World rs vb ib q t p lp) e ()
- data VectorVertexType
- data VectorVertexData
- = VVD_POSITION (Vector Vec3)
- | VVD_BLEND_WEIGHTS (Vector FloatType)
- | VVD_BLEND_INDICES (Vector Int)
- | VVD_NORMAL (Vector Vec3)
- | VVD_DIFFUSE (Vector Vec4)
- | VVD_SPECULAR (Vector Vec3)
- | VVD_TEXTURE_COORDINATES1 (Vector FloatType)
- | VVD_TEXTURE_COORDINATES2 (Vector Vec2)
- | VVD_TEXTURE_COORDINATES3 (Vector Vec3)
- | VVD_BINORMAL (Vector Vec3)
- | VVD_TANGENT (Vector Vec3)
- data VMesh = VMesh {}
- data VSubMesh = VSubMesh {}
- data OperationType
- vectorVertexType :: VectorVertexData -> VectorVertexType
- addVMesh :: RenderSystem r vb ib q t p lp => String -> VMesh -> LCM (World r vb ib q t p lp) e ()
- getVMesh :: RenderSystem r vb ib q t p lp => String -> LCM (World r vb ib q t p lp) e VMesh
Documentation
module Graphics.LambdaCube.Types
module Graphics.LambdaCube.MeshUtil
module Graphics.LambdaCube.Utility
Entry point
class (HardwareVertexBuffer vb, HardwareIndexBuffer ib, HardwareOcclusionQuery q, Texture t, GpuProgram p, LinkedGpuProgram lp) => RenderSystem rs vb ib q t p lp | rs -> vb ib q t p lpSource
data RenderSystem r vb ib q t p lp => World r vb ib q t p lp Source
runLCM :: RenderSystem r vb ib q t1 p lp => r -> [ImageLoader] -> LCM (World r vb ib q t1 p lp) e a -> IO ()Source
Embed a LambdaCube program in IO. The embedding manages a world, therefore it requires all the information to create one: the render system and a list of image loaders.
Resource management
The type of path leading to a resource.
addResourceLibrary :: RenderSystem r vb ib q t p lp => [ResourceGroup] -> LCM (World r vb ib q t p lp) e ()Source
Add a resource library (essentially a collection of paths) to the current set of search paths stored in the world.
readFile :: RenderSystem r vb ib q t p lp => FilePath -> LCM (World r vb ib q t p lp) e ByteStringSource
Get the raw data for a resource in a lazy bytestring given its path. The data is cached, so this does not necessarily require disk I/O.
readFile' :: RenderSystem r vb ib q t p lp => FilePath -> LCM (World r vb ib q t p lp) e ByteStringSource
Get the raw data for a resource in a strict bytestring given its path. The data is cached, so this does not necessarily require disk I/O.
Scene graph management
addScene :: RenderSystem r vb ib q t p lp => [MkNodeAction r vb ib q t p lp e] -> LCM (World r vb ib q t p lp) e ()Source
Add a list of new nodes to the global scene.
updateTransforms :: RenderSystem r vb ib q t p lp => [(String, Proj4)] -> LCM (World r vb ib q t p lp) e ()Source
Update the transformation matrices of the given nodes.
updateObjects :: RenderSystem rs vb ib q t p lp => [(String, [MkSceneObjectAction rs vb ib q t p lp e])] -> LCM (World rs vb ib q t p lp) e ()Source
Update the objects associated with the given nodes.
Scene node definitions
Light source description.
data LightTypes Source
Possible types of light sources.
LT_POINT | Point light sources give off light equally in all directions, so they require only position but no direction. |
LT_DIRECTIONAL | Directional lights simulate parallel light beams from a distant source, hence have direction but no position. |
LT_SPOTLIGHT | Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff. |
Camera description.
Camera | |
|
data RenderQueuePriority Source
Standard render queue priorities. Note that any enumeration type can be used to specify render priorities (i.e. top-level drawing order), this is just a simple convenience type.
defaultRQP :: Maybe RenderQueuePrioritySource
The default render queue priority.
:: RenderSystem r vb ib q t p lp | |
=> String | The name of the parent node. |
-> String | The name of the node. |
-> Proj4 | The transformation to apply the subtree with the node in its root. |
-> [MkSceneObjectAction r vb ib q t p lp e] | The scene objects that make up the node. |
-> MkNodeAction r vb ib q t p lp e |
Construct a scene graph node description.
camera :: RenderSystem r vb ib q t p lp => Camera -> MkSceneObjectAction r vb ib q t p lp eSource
Construct a scene object representing a camera with the given specification.
simpleCamera :: RenderSystem r vb ib q t p lp => String -> MkSceneObjectAction r vb ib q t p lp eSource
Construct a scene object representing a basic camera with the given name.
wireCamera :: RenderSystem r vb ib q t p lp => String -> MkSceneObjectAction r vb ib q t p lp eSource
Construct a scene object representing a wireframe-mode camera with the given name.
light :: RenderSystem r vb ib q t p lp => Light -> MkSceneObjectAction r vb ib q t p lp eSource
Construct a scene object representing a light source with the given specification.
defaultLight :: RenderSystem r vb ib q t p lp => MkSceneObjectAction r vb ib q t p lp eSource
Construct a scene object representing a basic light source.
:: (RenderSystem rs vb ib q t p lp, Enum rqp) | |
=> Maybe rqp | Render queue priority (defaults to |
-> Maybe [String] | The list of materials to overried those supplied by the original mesh. |
-> String | The name of the mesh to use as the source. |
-> MkSceneObjectAction rs vb ib q t p lp e |
Construct a scene object representing a polygon mesh.
Rendering
:: RenderSystem r vb ib q a p lp | |
=> String | The name of the texture. |
-> Int | Width in texels. |
-> Int | Height in texels. |
-> LCM (World r vb ib q a p lp) e () |
Create a new texture.
:: RenderSystem r vb ib q t p lp | |
=> String | The name of the window. |
-> Int | The width of the window in pixels. |
-> Int | The height of the window in pixels. |
-> [LCM (World r vb ib q t p lp) e (Viewport t lp)] | The actions describing the viewports to use. |
-> LCM (World r vb ib q t p lp) e () |
Specify the viewports to display in the window.
:: RenderSystem r vb ib q t p lp | |
=> FloatType | Viewport x position. |
-> FloatType | Viewport y position. |
-> FloatType | Viewport width. |
-> FloatType | Viewport height. |
-> String | The camera associated with the viewport. |
-> [String] | The compositor chain to process the image with. |
-> LCM (World r vb ib q t p lp) e (Viewport t lp) |
Create a viewport and attach given compositors.
:: RenderSystem r vb ib q t p lp | |
=> FloatType | The current time in seconds (needed for animation). |
-> String | The target to render. |
-> LCM (World r vb ib q t p lp) e () |
Render the given target.
:: RenderSystem rs vb ib q t p lp | |
=> String | The target to adjust. |
-> Int | The new width. |
-> Int | The new height. |
-> LCM (World rs vb ib q t p lp) e () |
Adjust the dimensions of a given render target.
Vector vertex buffers
data VectorVertexType Source
The types of VectorVertexData
without the data.
data VectorVertexData Source
Primitive buffer data
Multimaterial geometry, including a default geometry for submeshes that don't provide their own.
VMesh | |
|
Geometry with associated material.
VSubMesh | |
|
data OperationType Source
The interpretation of a sequence of vertices.
OT_POINT_LIST | A list of points, 1 vertex per point. |
OT_LINE_LIST | A list of lines, 2 vertices per line. |
OT_LINE_STRIP | A strip of connected lines, 1 vertex per line plus 1 start vertex. |
OT_TRIANGLE_LIST | A list of triangles, 3 vertices per triangle. |
OT_TRIANGLE_STRIP | A strip of triangles, 3 vertices for the first triangle, and 1 per triangle after that. |
OT_TRIANGLE_FAN | A fan of triangles, 3 vertices for the first triangle, and 1 per triangle after that. |
vectorVertexType :: VectorVertexData -> VectorVertexTypeSource
Extract the type of the vertex data.