Copyright | (C) 2015 Dimitri Sabadie |
---|---|
License | BSD3 |
Maintainer | Dimitri Sabadie <dimitri.sabadie@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Currently, you can parse a file and get a WavefrontOBJ
with the fromFile
function.
- data Location
- locX :: Location -> Float
- locY :: Location -> Float
- locZ :: Location -> Float
- locW :: Location -> Float
- data TexCoord
- texcoordR :: TexCoord -> Float
- texcoordS :: TexCoord -> Float
- texcoordT :: TexCoord -> Float
- data Normal
- norX :: Normal -> Float
- norY :: Normal -> Float
- norZ :: Normal -> Float
- data Point
- pointLocIndex :: Point -> Int
- data Line
- lineLocIndex :: Line -> Int
- lineTexCoordIndex :: Line -> Maybe Int
- data Face
- faceLocIndex :: Face -> Int
- faceTexCoordIndex :: Face -> Maybe Int
- faceNorIndex :: Face -> Maybe Int
- data Element a
- elObject :: Element a -> Maybe Text
- elGroups :: Element a -> [Text]
- elMtl :: Element a -> Maybe Text
- elValue :: Element a -> a
- data WavefrontOBJ = WavefrontOBJ {}
- module Codec.Wavefront.IO
Vertex location
A location is a 4-floating vector. You can access to its components by pattern matching on them:
let Location x y z w = Location 1 2 3 4
That type is strict and unboxed.
Vertex texture coordinates
A texture coordinate is a 3D-floating vector. You can access to its components by pattern matching on them:
let TexCoord r s t = TexCoord 0.1 0.2 0.3
That type is strcit and unboxed.
Vertex normals
A normal is a 3-floating vector. You can access to its components by pattern matching on them:
let Normal nx ny nz = Normal 0.1 0.2 0.3
That type is strict and unboxed.
Points
A point is a single index that references the locations. It’s a canonical type that truly represents a polygonal point.
pointLocIndex :: Point -> Int Source
Lines
A line is a pair of indexes.
. Line
vi vtivi
references the locations and vti
indexes
the texture coordinates. If vti ==
, then that Nothing
Line
doesn’t have texture coordinates
associated with.
Keep in mind that Line
doesn’t represent a polygonal line directly. It represents a line index,
which is a pair. In theory, a polygonal line is 2 Line
s.
lineLocIndex :: Line -> Int Source
lineTexCoordIndex :: Line -> Maybe Int Source
Faces
A face is a triplet of indices.
is a face that indexes the locations with
Face
vi vti vnivi
, the texture coordinates with vti
and the normals with vni
. An index set to Nothing
means no information. That is, if vni ==
, then that Nothing
Face
doesn’t have a normal
associated with.
Keep in mind that Face
doesn’t represent a polygonal face directly. It represents a face index,
which is a triplet. In theory, a polygonal face is 3 Face
s.
faceLocIndex :: Face -> Int Source
faceTexCoordIndex :: Face -> Maybe Int Source
faceNorIndex :: Face -> Maybe Int Source
Element
An element holds a value along with the user-defined object’s name (if exists), the associated groups and the used material. Those values can be used to sort the data per object or per group and to lookup materials.
Object
Re-exports
module Codec.Wavefront.IO