| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
FWGL.Geometry
- data AttrList is where
- AttrListNil :: AttrList `[]`
- AttrListCons :: (Hashable c, AttributeCPU c i, ShaderType i) => (a -> i) -> [c] -> AttrList is -> AttrList (i : is)
- data Geometry is = Geometry (AttrList is) [Word16] Int
- type Geometry2D = `[Position2, UV]`
- type Geometry3D = `[Position3, UV, Normal3]`
- data GPUBufferGeometry = GPUBufferGeometry {
- attributeBuffers :: [(Buffer, GLUInt, GLUInt -> GL ())]
- elementBuffer :: Buffer
- elementCount :: Int
- geometryHash :: Int
- data GPUVAOGeometry = GPUVAOGeometry {}
- extend :: (AttributeCPU c i, Hashable c, ShaderType i, GLES) => (a -> i) -> [c] -> Geometry is -> Geometry (i : is)
- remove :: (RemoveAttr i is is', GLES) => (a -> i) -> Geometry is -> Geometry is'
- withGPUBufferGeometry :: GLES => GPUBufferGeometry -> (Int -> [Buffer] -> GL a) -> GL a
- mkGeometry :: GLES => AttrList is -> [Word16] -> Geometry is
- mkGeometry2D :: GLES => [Vec2] -> [Vec2] -> [Word16] -> Geometry Geometry2D
- mkGeometry3D :: GLES => [Vec3] -> [Vec2] -> [Vec3] -> [Word16] -> Geometry Geometry3D
- castGeometry :: Geometry is -> Geometry is'
- facesToArrays :: Vector Vec3 -> Vector Vec2 -> Vector Vec3 -> [[(Int, Int, Int)]] -> [(Vec3, Vec2, Vec3)]
- arraysToElements :: Foldable f => f (Vec3, Vec2, Vec3) -> ([Vec3], [Vec2], [Vec3], [Word16])
- triangulate :: [a] -> [(a, a, a)]
Documentation
A heterogeneous list of attributes.
Constructors
| AttrListNil :: AttrList `[]` | |
| AttrListCons :: (Hashable c, AttributeCPU c i, ShaderType i) => (a -> i) -> [c] -> AttrList is -> AttrList (i : is) |
A set of attributes and indices.
type Geometry2D = `[Position2, UV]` Source
A 2D geometry.
type Geometry3D = `[Position3, UV, Normal3]` Source
A 3D geometry.
data GPUBufferGeometry Source
Constructors
| GPUBufferGeometry | |
Fields
| |
Instances
data GPUVAOGeometry Source
Constructors
| GPUVAOGeometry | |
Fields
| |
Arguments
| :: (AttributeCPU c i, Hashable c, ShaderType i, GLES) | |
| => (a -> i) | Attribute constructor (or any other function with that type). |
| -> [c] | List of values |
| -> Geometry is | |
| -> Geometry (i : is) |
Add an attribute to a geometry.
Arguments
| :: (RemoveAttr i is is', GLES) | |
| => (a -> i) | Attribute constructor (or any other function with that type). |
| -> Geometry is | |
| -> Geometry is' |
Remove an attribute from a geometry.
withGPUBufferGeometry :: GLES => GPUBufferGeometry -> (Int -> [Buffer] -> GL a) -> GL a Source
Arguments
| :: GLES | |
| => [Vec2] | List of vertices. |
| -> [Vec2] | List of UV coordinates. |
| -> [Word16] | Triangles expressed as triples of indices to the two lists above. |
| -> Geometry Geometry2D |
Create a 2D Geometry. The first two lists should have the same length.
Arguments
| :: GLES | |
| => [Vec3] | List of vertices. |
| -> [Vec2] | List of UV coordinates. |
| -> [Vec3] | List of normals. |
| -> [Word16] | Triangles expressed as triples of indices to the three lists above. |
| -> Geometry Geometry3D |
Create a 3D Geometry. The first three lists should have the same length.
castGeometry :: Geometry is -> Geometry is' Source
facesToArrays :: Vector Vec3 -> Vector Vec2 -> Vector Vec3 -> [[(Int, Int, Int)]] -> [(Vec3, Vec2, Vec3)] Source
triangulate :: [a] -> [(a, a, a)] Source