lambdacube-engine-0.2.1: 3D rendering engine written entirely in Haskell

Graphics.LambdaCube.World

Contents

Synopsis

World transformation

newtype LCM w e a Source

Constructors

LCM 

Fields

unLCM :: forall r. (a -> w -> IO r) -> (e -> w -> IO r) -> w -> IO r
 

Instances

Monad (LCM w e) 
Functor (LCM w e) 
Applicative (LCM w e) 
MonadIO (LCM w e) 

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.

inLCM :: (w -> IO w) -> LCM w e ()Source

pokeLCM :: w -> LCM w e ()Source

throwLCM :: e -> LCM w e aSource

catchLCM :: LCM w a a -> LCM w e aSource

World

data (HardwareVertexBuffer vb, HardwareIndexBuffer ib, Texture t, LinkedGpuProgram lp) => FlattenScene vb ib t lp Source

Constructors

FlattenScene 

Fields

fsRenderable :: [(Proj4, [RenderEntity vb ib t lp], Int, Int)]

List of Renderable information including WorldMatrix RenderQueueID and RenderPriority

fsCamera :: [(Proj4, Camera)]
 
fsLight :: [(Proj4, Light)]
 

data RenderSystem r vb ib q t p lp => World r vb ib q t p lp Source

updateWorld :: (w -> w) -> LCM w e ()Source

updateResource :: RenderSystem r vb ib q t p lp => (ResourceLibrary vb ib t p lp -> ResourceLibrary vb ib t p lp) -> LCM (World r vb ib q t p lp) e ()Source

mapScene :: RenderSystem r vb ib q t p lp => (Scene vb ib t lp -> Scene vb ib t lp) -> World r vb ib q t p lp -> World r vb ib q t p lpSource

mapTargets :: RenderSystem r vb ib q t p lp => (Map String (RenderTarget t lp) -> Map String (RenderTarget t lp)) -> World r vb ib q t p lp -> World r vb ib q t p lpSource

mkWorld :: RenderSystem r vb ib q t p lp => r -> [ImageLoader] -> World r vb ib q t p lpSource

Resource

SceneGraph

data Camera Source

Camera description.

Constructors

Camera 

Fields

cmName :: String

The name of the camera.

cmFov :: FloatType

Field of view in radians.

cmNear :: FloatType

Near plane clipping distance.

cmFar :: FloatType

Far plane clipping distance.

cmAspectRatio :: Maybe FloatType

Camera aspect ratio (width/height).

cmPolygonMode :: PolygonMode

Rendering type.

data (HardwareVertexBuffer vb, HardwareIndexBuffer ib, Texture t, LinkedGpuProgram lp) => SceneNode vb ib t lp Source

Constructors

SceneNode 

Fields

snName :: String
 
snObject :: [SceneObject vb ib t lp]
 
snTransform :: Proj4
 

data Sky Source

Constructors

SkyBox 
SkyDome 
SkyPlane 

data (HardwareVertexBuffer vb, HardwareIndexBuffer ib, Texture t, LinkedGpuProgram lp) => Scene vb ib t lp Source

Constructors

Scene 

Fields

scGraph :: IndexedTree (SceneNode vb ib t lp)
 
scSky :: Maybe Sky
 

addVMeshSource

Arguments

:: RenderSystem r vb ib q t p lp 
=> String

The name of the mesh in the world.

-> VMesh

The mesh to add.

-> LCM (World r vb ib q t p lp) e () 

Add a new vector mesh to the world.

getVMesh :: RenderSystem r vb ib q t p lp => String -> LCM (World r vb ib q t p lp) e VMeshSource

Retrieve a vector mesh from the world by name.

addMesh :: RenderSystem r vb ib q t p lp => String -> Mesh vb ib -> World r vb ib q t p lp -> World r vb ib q1 t p lpSource

getMesh :: RenderSystem r vb ib q t p lp => String -> LCM (World r vb ib q t p lp) e (Mesh vb ib)Source

loadMaterialResources :: RenderSystem rs vb ib q t p lp => Material t lp -> LCM (World rs vb ib q t p lp) e (Material t lp)Source

getLoadedMaterial :: RenderSystem r vb ib q t p lp => String -> LCM (World r vb ib q t p lp) e (Maybe (Material t lp))Source

setEntityMaterial :: RenderSystem r vb ib q t p lp => [String] -> Entity vb ib t lp -> LCM (World r vb ib q t p lp) e (Entity vb ib t lp)Source

createEntity :: (RenderSystem r vb ib q t p lp, Enum rqp) => String -> String -> rqp -> LCM (World r vb ib q t p lp) e (Entity vb ib t lp)Source

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.

renderFlatScene :: RenderSystem r vb ib q t p lp => FloatType -> String -> FlattenScene vb ib t lp -> LCM (World r vb ib q t p lp) e ()Source

addRenderTextureSource

Arguments

:: 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.

addRenderWindowSource

Arguments

:: 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.

mkCompositorChain :: RenderSystem r vb ib q t p lp => [Compositor t lp] -> LCM (World r vb ib q t p lp) e [Compositor t lp]Source

Create render textures, and setup compositor chain.

viewportSource

Arguments

:: 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.

updateTargetSizeSource

Arguments

:: 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.