Graphics.Rendering.OpenGL.GLU.Tessellation

| HOpenGL Libraries (OpenGL package) | Contents | Index
Graphics.Rendering.OpenGL.GLU.Tessellation |
Portability | portable
Stability | provisional
Maintainer | sven.panne@aedion.de
Contents
Polygon description Combining vertices Tessellation parameters Tessellator type Contour extraction Triangulation Tessellation into primitives
Description
This module corresponds to chapter 5 (Polygon Tessellation) of the GLU specs.
Synopsis
data AnnotatedVertex v = AnnotatedVertex (Vertex3 GLdouble) v
newtype ComplexContour v = ComplexContour [AnnotatedVertex v]
newtype ComplexPolygon v = ComplexPolygon [ComplexContour v]
data WeightedProperties v = WeightedProperties (GLclampf, v) (GLclampf, v) (GLclampf, v) (GLclampf, v)
type Combiner v = Vertex3 GLdouble -> WeightedProperties v -> v
data TessWinding
= TessWindingOdd
| TessWindingNonzero
| TessWindingPositive
| TessWindingNegative
| TessWindingAbsGeqTwo
type Tolerance = GLdouble
type Tessellator p v = TessWinding -> Tolerance -> Normal3 GLdouble -> Combiner v -> ComplexPolygon v -> IO (p v)
newtype SimpleContour v = SimpleContour [AnnotatedVertex v]
newtype PolygonContours v = PolygonContours [SimpleContour v]
extractContours :: Storable v => Tessellator PolygonContours v
type TriangleVertex v = AnnotatedVertex (v, EdgeFlag)
data Triangle v = Triangle (TriangleVertex v) (TriangleVertex v) (TriangleVertex v)
newtype Triangulation v = Triangulation [Triangle v]
triangulate :: Storable v => Tessellator Triangulation v
data Primitive v = Primitive PrimitiveMode [AnnotatedVertex v]
newtype SimplePolygon v = SimplePolygon [Primitive v]
tessellate :: Storable v => Tessellator SimplePolygon v
Polygon description
data AnnotatedVertex v
The basic building block in tessellation is a 3D vertex with an associated property, e.g. color, texture coordinates, etc.
Constructors
AnnotatedVertex (Vertex3 GLdouble) v |
Instances
Eq v => Eq (AnnotatedVertex v)
Ord v => Ord (AnnotatedVertex v)
Storable v => Storable (AnnotatedVertex v)
newtype ComplexContour v
A complex contour, which can be self-intersecting and/or concave.
Constructors
ComplexContour [AnnotatedVertex v] |
Instances
Eq v => Eq (ComplexContour v)
Ord v => Ord (ComplexContour v)
newtype ComplexPolygon v
A complex (possibly concave) polygon, represented by one or more complex and possibly intersecting contours.
Constructors
ComplexPolygon [ComplexContour v] |
Instances
Eq v => Eq (ComplexPolygon v)
Ord v => Ord (ComplexPolygon v)
Combining vertices
data WeightedProperties v
Four vertex properties (cf. `AnnotatedVertex`) with associated weigths summing up to 1.0.
Constructors
WeightedProperties (GLclampf, v) (GLclampf, v) (GLclampf, v) (GLclampf, v) |
Instances
Eq v => Eq (WeightedProperties v)
Ord v => Ord (WeightedProperties v)
type Combiner v = Vertex3 GLdouble -> WeightedProperties v -> v
A function combining given vertex properties into a property for a newly generated vertex
Tessellation parameters
data TessWinding
Constructors
TessWindingOdd |
TessWindingNonzero |
TessWindingPositive |
TessWindingNegative |
TessWindingAbsGeqTwo |
Instances
Eq TessWinding
Ord TessWinding
Show TessWinding
type Tolerance = GLdouble
The relative tolerance under which two vertices can be combined (see `Combiner`). Multiplication with the largest coordinate magnitude of all polygon vertices yields the maximum distance between two mergeable vertices. Note that merging is optional and the tolerance is only a hint.
Tessellator type
type Tessellator p v = TessWinding -> Tolerance -> Normal3 GLdouble -> Combiner v -> ComplexPolygon v -> IO (p v)
A general tessellator type. Before tessellation of a complex polygon, all its vertices are projected into a plane perpendicular to the given normal. If the given normal is `Normal3 0 0 0`, a fitting plane of all vertices is used.
Contour extraction
newtype SimpleContour v
A simple, non-self-intersecting contour
Constructors
SimpleContour [AnnotatedVertex v] |
Instances
Eq v => Eq (SimpleContour v)
Ord v => Ord (SimpleContour v)
newtype PolygonContours v
The contours of a complex polygon, represented by one or more non-intersecting simple contours
Constructors
PolygonContours [SimpleContour v] |
Instances
Eq v => Eq (PolygonContours v)
Ord v => Ord (PolygonContours v)
extractContours :: Storable v => Tessellator PolygonContours v
Triangulation
type TriangleVertex v = AnnotatedVertex (v, EdgeFlag)
A triangle vertex with additional information about the edge it begins
data Triangle v
A triangle, represented by three triangle vertices
Constructors
Triangle (TriangleVertex v) (TriangleVertex v) (TriangleVertex v) |
Instances
Eq v => Eq (Triangle v)
Ord v => Ord (Triangle v)
newtype Triangulation v
A triangulation of a complex polygon
Constructors
Triangulation [Triangle v] |
Instances
Eq v => Eq (Triangulation v)
Ord v => Ord (Triangulation v)
triangulate :: Storable v => Tessellator Triangulation v
Tessellation into primitives
data Primitive v
Constructors
Primitive PrimitiveMode [AnnotatedVertex v] |
Instances
Eq v => Eq (Primitive v)
Ord v => Ord (Primitive v)
newtype SimplePolygon v
Constructors
SimplePolygon [Primitive v] |
Instances
Eq v => Eq (SimplePolygon v)
Ord v => Ord (SimplePolygon v)
tessellate :: Storable v => Tessellator SimplePolygon v
Produced by Haddock version 0.7