Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Geometry is
- data Vertex is where
- data Triangle a = Triangle a a a
- mkGeometry :: (GLES, Attributes (i ': is)) => [Triangle (Vertex (i ': is))] -> Geometry (i ': is)
- mapVertices :: (Attributes is, Attributes is', GLES) => (Triangle (Vertex is) -> a) -> ([a] -> Vertex is -> Vertex is') -> Geometry is -> Geometry is'
- removeAttribute :: (RemoveAttr i is, Attributes is, Attributes (Remove i is), GLES) => (a -> i) -> Geometry is -> Geometry (Remove i is)
- decompose :: Geometry (i ': is) -> [Triangle (Vertex (i ': is))]
- class Attributes is
- data AttrVertex is
- type GeometryBuilder is = GeometryBuilderT is Identity
- data GeometryBuilderT is m a
- vertex :: (Monad m, Attributes is) => Vertex is -> GeometryBuilderT is m (AttrVertex is)
- triangle :: (Monad m, Attributes is) => AttrVertex is -> AttrVertex is -> AttrVertex is -> GeometryBuilderT is m ()
- buildGeometry :: Attributes (i ': is) => GeometryBuilder (i ': is) () -> Geometry (i ': is)
- buildGeometryT :: (Monad m, Attributes (i ': is)) => GeometryBuilderT (i ': is) m () -> m (Geometry (i ': is))
- type Geometry2D = '[Position2, UV]
- type Geometry3D = '[Position3, UV, Normal3]
- mkGeometry2D :: GLES => [Triangle (Vec2, Vec2)] -> Geometry Geometry2D
- mkGeometry3D :: GLES => [Triangle (Vec3, Vec2, Vec3)] -> Geometry Geometry3D
- mkGeometry2D' :: (GLES, Attributes (Append (i ': is) Geometry2D)) => [Triangle (Vertex (i ': is), Vec2, Vec2)] -> Geometry (Append (i ': is) Geometry2D)
- mkGeometry3D' :: (GLES, Attributes (Append (i ': is) Geometry3D)) => [Triangle (Vertex (i ': is), Vec3, Vec2, Vec3)] -> Geometry (Append (i ': is) Geometry3D)
- vertex2D :: (GLES, Monad m) => Vec2 -> Vec2 -> GeometryBuilderT Geometry2D m (AttrVertex Geometry2D)
- vertex3D :: (GLES, Monad m) => Vec3 -> Vec2 -> Vec3 -> GeometryBuilderT Geometry3D m (AttrVertex Geometry3D)
Documentation
A set of triangles.
A list of the attributes of a vertex.
For instance: Attr Position3 p :~ Attr UV u :~ Attr Normal3 n
Triangle a a a |
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.
:: (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 #
emptyAttrCol, cell, addTop, foldTop, rowToVertex
data AttrVertex is Source #
A vertex in a Geometry
.
Eq (AttrVertex is) Source # | |
Hashable (AttrVertex is) Source # | |
type GeometryBuilder is = GeometryBuilderT is Identity Source #
data GeometryBuilderT is m a Source #
MonadTrans (GeometryBuilderT is) Source # | |
Monad m => Monad (GeometryBuilderT is m) Source # | |
Functor m => Functor (GeometryBuilderT is m) Source # | |
Monad m => Applicative (GeometryBuilderT is m) Source # | |
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.
Create a 2D Geometry
.
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.