ombra-0.3.1.0: Render engine.

Safe HaskellNone
LanguageHaskell2010

Graphics.Rendering.Ombra.Geometry

Contents

Synopsis

Documentation

data Geometry is Source #

A set of triangles.

Instances

Eq (Geometry is) Source # 

Methods

(==) :: Geometry is -> Geometry is -> Bool #

(/=) :: Geometry is -> Geometry is -> Bool #

Hashable (Geometry is) Source # 

Methods

hashWithSalt :: Int -> Geometry is -> Int #

hash :: Geometry is -> Int #

data Vertex is where Source #

A list of the attributes of a vertex.

For instance: Attr Position3 p :~ Attr UV u :~ Attr Normal3 n

Constructors

Attr :: (Eq (CPU S i), Hashable (CPU S i), Attribute S i) => (a -> i) -> CPU S i -> Vertex '[i] 
(:~) :: Vertex '[i] -> Vertex is -> Vertex (i ': is) infixr 5 

Instances

Eq (Vertex is) Source # 

Methods

(==) :: Vertex is -> Vertex is -> Bool #

(/=) :: Vertex is -> Vertex is -> Bool #

Hashable (Vertex is) Source # 

Methods

hashWithSalt :: Int -> Vertex is -> Int #

hash :: Vertex is -> Int #

data Triangle a Source #

Constructors

Triangle a a a 

Instances

Functor Triangle Source # 

Methods

fmap :: (a -> b) -> Triangle a -> Triangle b #

(<$) :: a -> Triangle b -> Triangle a #

Hashable a => Hashable (Triangle a) Source # 

Methods

hashWithSalt :: Int -> Triangle a -> Int #

hash :: Triangle a -> Int #

mkGeometry :: (GLES, Attributes (i ': is)) => [Triangle (Vertex (i ': is))] -> Geometry (i ': is) Source #

Create a Geometry using a list of triangles.

mapVertices :: (Attributes is, Attributes is', GLES) => (Triangle (Vertex is) -> a) -> ([a] -> Vertex is -> Vertex is') -> Geometry is -> Geometry is' Source #

Transform each vertex of a geometry. You can create a value for each triangle so that the transforming function will receive a list of the values of the triangles the vertex belongs to.

removeAttribute Source #

Arguments

:: (RemoveAttr i is, Attributes is, Attributes (Remove i is), GLES) 
=> (a -> i)

Attribute constructor (or any other function with that type).

-> Geometry is 
-> Geometry (Remove i is) 

Remove an attribute from a geometry.

decompose :: Geometry (i ': is) -> [Triangle (Vertex (i ': is))] Source #

Convert a Geometry back to a list of triangles.

Geometry builder

class Attributes is Source #

Minimal complete definition

emptyAttrCol, cell, addTop, foldTop, rowToVertex

Instances

(Attribute (S * *) i1, Eq (CPU (S * *) i1), Attributes ((:) * i2 is)) => Attributes ((:) * i1 ((:) * i2 is)) Source # 

Methods

emptyAttrCol :: AttrCol ((* ': i1) ((* ': i2) is))

cell :: Vertex ((* ': i1) ((* ': i2) is)) -> AttrTable p ((* ': i1) ((* ': i2) is)) -> AttrTable (Previous p) ((* ': i1) ((* ': i2) is))

addTop :: Vertex ((* ': i1) ((* ': i2) is)) -> AttrCol ((* ': i1) ((* ': i2) is)) -> AttrCol ((* ': i1) ((* ': i2) is))

foldTop :: (forall i is0. b -> AttrCol ((* ': i) is0) -> b) -> b -> AttrCol ((* ': i1) ((* ': i2) is)) -> b

rowToVertex :: NotTop p => AttrTable p ((* ': i1) ((* ': i2) is)) -> Vertex ((* ': i1) ((* ': i2) is))

(Attribute (S * *) i, Eq (CPU (S * *) i)) => Attributes ((:) * i ([] *)) Source # 

Methods

emptyAttrCol :: AttrCol ((* ': i) [*])

cell :: Vertex ((* ': i) [*]) -> AttrTable p ((* ': i) [*]) -> AttrTable (Previous p) ((* ': i) [*])

addTop :: Vertex ((* ': i) [*]) -> AttrCol ((* ': i) [*]) -> AttrCol ((* ': i) [*])

foldTop :: (forall a is. b -> AttrCol ((* ': a) is) -> b) -> b -> AttrCol ((* ': i) [*]) -> b

rowToVertex :: NotTop p => AttrTable p ((* ': i) [*]) -> Vertex ((* ': i) [*])

data AttrVertex is Source #

A vertex in a Geometry.

Instances

Eq (AttrVertex is) Source # 

Methods

(==) :: AttrVertex is -> AttrVertex is -> Bool #

(/=) :: AttrVertex is -> AttrVertex is -> Bool #

Hashable (AttrVertex is) Source # 

Methods

hashWithSalt :: Int -> AttrVertex is -> Int #

hash :: AttrVertex is -> Int #

data GeometryBuilderT is m a Source #

Instances

MonadTrans (GeometryBuilderT is) Source # 

Methods

lift :: Monad m => m a -> GeometryBuilderT is m a #

Monad m => Monad (GeometryBuilderT is m) Source # 

Methods

(>>=) :: GeometryBuilderT is m a -> (a -> GeometryBuilderT is m b) -> GeometryBuilderT is m b #

(>>) :: GeometryBuilderT is m a -> GeometryBuilderT is m b -> GeometryBuilderT is m b #

return :: a -> GeometryBuilderT is m a #

fail :: String -> GeometryBuilderT is m a #

Functor m => Functor (GeometryBuilderT is m) Source # 

Methods

fmap :: (a -> b) -> GeometryBuilderT is m a -> GeometryBuilderT is m b #

(<$) :: a -> GeometryBuilderT is m b -> GeometryBuilderT is m a #

Monad m => Applicative (GeometryBuilderT is m) Source # 

Methods

pure :: a -> GeometryBuilderT is m a #

(<*>) :: GeometryBuilderT is m (a -> b) -> GeometryBuilderT is m a -> GeometryBuilderT is m b #

(*>) :: GeometryBuilderT is m a -> GeometryBuilderT is m b -> GeometryBuilderT is m b #

(<*) :: GeometryBuilderT is m a -> GeometryBuilderT is m b -> GeometryBuilderT is m a #

vertex :: (Monad m, Attributes is) => Vertex is -> GeometryBuilderT is m (AttrVertex is) Source #

Create a new vertex that can be used in addTriangle.

triangle :: (Monad m, Attributes is) => AttrVertex is -> AttrVertex is -> AttrVertex is -> GeometryBuilderT is m () Source #

Add a triangle to the current geometry.

buildGeometry :: Attributes (i ': is) => GeometryBuilder (i ': is) () -> Geometry (i ': is) Source #

Create a Geometry using the GeometryBuilder monad. This is more efficient than mkGeometry.

buildGeometryT :: (Monad m, Attributes (i ': is)) => GeometryBuilderT (i ': is) m () -> m (Geometry (i ': is)) Source #

2D and 3D geometries

type Geometry2D = '[Position2, UV] Source #

A 2D geometry.

type Geometry3D = '[Position3, UV, Normal3] Source #

A 3D geometry.

mkGeometry2D Source #

Arguments

:: GLES 
=> [Triangle (Vec2, Vec2)]

(Position, Texture UV coordinates)

-> Geometry Geometry2D 

Create a 2D Geometry.

mkGeometry3D Source #

Arguments

:: GLES 
=> [Triangle (Vec3, Vec2, Vec3)]

(Position, UV, Normal)

-> Geometry Geometry3D 

Create a 3D Geometry.

mkGeometry2D' :: (GLES, Attributes (Append (i ': is) Geometry2D)) => [Triangle (Vertex (i ': is), Vec2, Vec2)] -> Geometry (Append (i ': is) Geometry2D) Source #

Create an extended 2D Geometry.

mkGeometry3D' :: (GLES, Attributes (Append (i ': is) Geometry3D)) => [Triangle (Vertex (i ': is), Vec3, Vec2, Vec3)] -> Geometry (Append (i ': is) Geometry3D) Source #

Create an extended 3D Geometry.

vertex2D :: (GLES, Monad m) => Vec2 -> Vec2 -> GeometryBuilderT Geometry2D m (AttrVertex Geometry2D) Source #

Create a new 2D vertex.

vertex3D :: (GLES, Monad m) => Vec3 -> Vec2 -> Vec3 -> GeometryBuilderT Geometry3D m (AttrVertex Geometry3D) Source #

Create a new 3D vertex.