Copyright | (C) 2015 Dimitri Sabadie |
---|---|
License | BSD3 |
Maintainer | Dimitri Sabadie <dimitri.sabadie@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Codec.Wavefront
Description
Currently, you can parse a file and get a WavefrontOBJ
with the fromFile
function.
Synopsis
- data Location = Location {}
- data TexCoord = TexCoord {}
- data Normal = Normal {}
- data Point = Point {
- pointLocIndex :: !Int
- data Line = Line {}
- data LineIndex = LineIndex {
- lineLocIndex :: !Int
- lineTexCoordIndex :: !(Maybe Int)
- data Face = Face FaceIndex FaceIndex FaceIndex [FaceIndex]
- data FaceIndex = FaceIndex {
- faceLocIndex :: !Int
- faceTexCoordIndex :: !(Maybe Int)
- faceNorIndex :: !(Maybe Int)
- pattern Triangle :: FaceIndex -> FaceIndex -> FaceIndex -> Face
- pattern Quad :: FaceIndex -> FaceIndex -> FaceIndex -> FaceIndex -> Face
- data Element a = Element {}
- data WavefrontOBJ = WavefrontOBJ {
- objLocations :: Vector Location
- objTexCoords :: Vector TexCoord
- objNormals :: Vector Normal
- objPoints :: Vector (Element Point)
- objLines :: Vector (Element Line)
- objFaces :: Vector (Element Face)
- objMtlLibs :: Vector Text
- 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.
Constructors
Point | |
Fields
|
Lines
Constructors
Line | |
Fields |
A line index is a pair of indices.
. LineIndex
vi vtivi
references the locations and vti
indexes the texture coordinates. If vti ==
, then that Nothing
LineIndex
doesn’t have
texture coordinates associated with.
Constructors
LineIndex | |
Fields
|
Faces
A face gathers several FaceIndex
to build up faces. It has a least three vertices
A face index is a triplet of indices.
is a face that indexes the
locations with FaceIndex
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
FaceIndex
doesn’t have a normal associated with.
Constructors
FaceIndex | |
Fields
|
Element
An element holds a value along with the user-defined object’s name (if any), the associated groups, the used material and the smoothing group the element belongs to (if any). Those values can be used to sort the data per object or per group and to lookup materials.
Constructors
Element | |
Object
data WavefrontOBJ Source #
Constructors
WavefrontOBJ | |
Fields
|
Instances
Eq WavefrontOBJ Source # | |
Defined in Codec.Wavefront.Object | |
Show WavefrontOBJ Source # | |
Defined in Codec.Wavefront.Object Methods showsPrec :: Int -> WavefrontOBJ -> ShowS # show :: WavefrontOBJ -> String # showList :: [WavefrontOBJ] -> ShowS # |
Re-exports
module Codec.Wavefront.IO