License | BSD3 |
---|---|
Maintainer | ziocroc@gmail.com |
Stability | experimental |
Portability | GHC only |
Safe Haskell | None |
Language | Haskell2010 |
Graphics.Rendering.Ombra.Geometry
Contents
Description
- data Geometry e g
- data Point a = Point a
- data Line a = Line a a
- data Triangle a = Triangle a a a
- mkGeometry :: (GLES, GeometryVertex g, ElementType e, Hashable (e (AttrVertex (AttributeTypes g)))) => [e (Vertex g)] -> Geometry e g
- mapVertices :: (GLES, GeometryVertex g, GeometryVertex g', ElementType e) => (e (Vertex g) -> a) -> ([a] -> Vertex g -> Vertex g') -> Geometry e g -> Geometry e g'
- foldGeometry :: forall g e vacc eacc. (GLES, GeometryVertex g, ElementType e) => (e (Vertex g) -> eacc -> eacc) -> (eacc -> Vertex g -> vacc -> vacc) -> eacc -> vacc -> Geometry e g -> (eacc, vacc)
- decompose :: (GeometryVertex g, Functor e) => Geometry e g -> [e (Vertex g)]
- class Empty is ~ False => Attributes is
- data AttrVertex is
- type GeometryBuilder e g = GeometryBuilderT e g Identity
- data GeometryBuilderT e g m a
- vertex :: (Monad m, GeometryVertex g) => Vertex g -> GeometryBuilderT e g m (AttrVertex (AttributeTypes g))
- point :: (Monad m, GeometryVertex g) => AttrVertex (AttributeTypes g) -> GeometryBuilderT Point g m ()
- line :: (Monad m, GeometryVertex g) => AttrVertex (AttributeTypes g) -> AttrVertex (AttributeTypes g) -> GeometryBuilderT Line g m ()
- triangle :: (Monad m, GeometryVertex g) => AttrVertex (AttributeTypes g) -> AttrVertex (AttributeTypes g) -> AttrVertex (AttributeTypes g) -> GeometryBuilderT Triangle g m ()
- buildGeometry :: GeometryVertex g => GeometryBuilder e g () -> Geometry e g
- buildGeometryT :: (Monad m, GeometryVertex g) => GeometryBuilderT e g m () -> m (Geometry e g)
- class Attributes (AttributeTypes a) => GeometryVertex a where
- type AttributeTypes a :: [*]
- type Vertex a = v | v -> a
- class (Functor e, Foldable e) => ElementType e
Documentation
A set of triangles.
Constructors
Point a |
Constructors
Line a a |
Constructors
Triangle a a a |
Arguments
:: (GLES, GeometryVertex g, ElementType e, Hashable (e (AttrVertex (AttributeTypes g)))) | |
=> [e (Vertex g)] | List of elements. |
-> Geometry e g |
Create a Geometry
using a list of points, lines or triangles.
Arguments
:: (GLES, GeometryVertex g, GeometryVertex g', ElementType e) | |
=> (e (Vertex g) -> a) | Value to associate to each element. |
-> ([a] -> Vertex g -> Vertex g') | The first argument is the list of values associated with the elements the vertex belongs to. |
-> Geometry e g | |
-> Geometry e g' |
Transform each vertex of a geometry.
foldGeometry :: forall g e vacc eacc. (GLES, GeometryVertex g, ElementType e) => (e (Vertex g) -> eacc -> eacc) -> (eacc -> Vertex g -> vacc -> vacc) -> eacc -> vacc -> Geometry e g -> (eacc, vacc) Source #
Fold elements and then vertices.
decompose :: (GeometryVertex g, Functor e) => Geometry e g -> [e (Vertex g)] Source #
Convert a Geometry
back to a list of elements.
Geometry builder
class Empty is ~ False => Attributes is Source #
Minimal complete definition
emptyAttrCol, cell, addTop, foldTop, rowToVertexAttributes
data AttrVertex is Source #
A vertex in a Geometry
.
Instances
Eq (AttrVertex is) Source # | |
Hashable (AttrVertex is) Source # | |
type GeometryBuilder e g = GeometryBuilderT e g Identity Source #
data GeometryBuilderT e g m a Source #
Instances
MonadTrans (GeometryBuilderT e g) Source # | |
Monad m => Monad (GeometryBuilderT e g m) Source # | |
Functor m => Functor (GeometryBuilderT e g m) Source # | |
Monad m => Applicative (GeometryBuilderT e g m) Source # | |
vertex :: (Monad m, GeometryVertex g) => Vertex g -> GeometryBuilderT e g m (AttrVertex (AttributeTypes g)) Source #
point :: (Monad m, GeometryVertex g) => AttrVertex (AttributeTypes g) -> GeometryBuilderT Point g m () Source #
Add a point to the current geometry.
line :: (Monad m, GeometryVertex g) => AttrVertex (AttributeTypes g) -> AttrVertex (AttributeTypes g) -> GeometryBuilderT Line g m () Source #
Add a line to the current geometry.
triangle :: (Monad m, GeometryVertex g) => AttrVertex (AttributeTypes g) -> AttrVertex (AttributeTypes g) -> AttrVertex (AttributeTypes g) -> GeometryBuilderT Triangle g m () Source #
Add a triangle to the current geometry.
buildGeometry :: GeometryVertex g => GeometryBuilder e g () -> Geometry e g Source #
Create a Geometry
using the GeometryBuilder
monad. This is more
efficient than mkGeometry
.
buildGeometryT :: (Monad m, GeometryVertex g) => GeometryBuilderT e g m () -> m (Geometry e g) Source #
class Attributes (AttributeTypes a) => GeometryVertex a where Source #
Types that can be used as Geometry
vertices.
Methods
toVertexAttributes :: Vertex a -> VertexAttributes (AttributeTypes a) Source #
toVertexAttributes :: (Generic a, Generic (Vertex a), GGeometryVertex (Rep a) (Rep (Vertex a)), VertexAttributes (AttributeTypes a) ~ VertexAttributes (GAttributeTypes (Rep a) (Rep (Vertex a)))) => Vertex a -> VertexAttributes (AttributeTypes a) Source #
fromVertexAttributes :: VertexAttributes (AttributeTypes a) -> Vertex a Source #
fromVertexAttributes :: (Generic a, Generic (Vertex a), GGeometryVertex (Rep a) (Rep (Vertex a)), VertexAttributes (AttributeTypes a) ~ VertexAttributes (GAttributeTypes (Rep a) (Rep (Vertex a)))) => VertexAttributes (AttributeTypes a) -> Vertex a Source #
Instances
GLES => GeometryVertex GIVec4 Source # | |
GLES => GeometryVertex GIVec3 Source # | |
GLES => GeometryVertex GIVec2 Source # | |
GLES => GeometryVertex GVec4 Source # | |
GLES => GeometryVertex GVec3 Source # | |
GLES => GeometryVertex GVec2 Source # | |
GLES => GeometryVertex GInt Source # | |
GLES => GeometryVertex GFloat Source # | |
GLES => GeometryVertex GBool Source # | |
(GeometryVertex a, GeometryVertex b, BreakVertex (AttributeTypes a) (AttributeTypes b), AppendVertex (AttributeTypes a) (AttributeTypes b)) => GeometryVertex (a, b) Source # | |
(GeometryVertex a, GeometryVertex b, GeometryVertex c, BreakVertex (AttributeTypes a) (Append (AttributeTypes b) (AttributeTypes c)), BreakVertex (AttributeTypes b) (AttributeTypes c), AppendVertex (AttributeTypes a) (Append (AttributeTypes b) (AttributeTypes c)), AppendVertex (AttributeTypes b) (AttributeTypes c)) => GeometryVertex (a, b, c) Source # | |
class (Functor e, Foldable e) => ElementType e Source #
Minimal complete definition
elementType, elementFromList
Instances