wavefront-0.4: Wavefront OBJ loader

Copyright(C) 2015 Dimitri Sabadie
LicenseBSD3
MaintainerDimitri Sabadie <dimitri.sabadie@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Codec.Wavefront

Contents

Description

Currently, you can parse a file and get a WavefrontOBJ with the fromFile function.

Synopsis

Vertex location

data Location Source

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

data TexCoord Source

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

data Normal Source

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

data Point Source

A point is a single index that references the locations. It’s a canonical type that truly represents a polygonal point.

Lines

data Line Source

A line is a pair of indexes. Line vi vti. vi references the locations and vti indexes the texture coordinates. If vti == Nothing, then that 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 Lines.

Faces

data Face Source

A face is a triplet of indices. Face vi vti vni is a face that indexes the locations with vi, the texture coordinates with vti and the normals with vni. An index set to Nothing means no information. That is, if vni == Nothing, then that 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 Faces.

Element

data Element a Source

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.

Instances

Eq a => Eq (Element a) Source 
Show a => Show (Element a) Source 

Object

data WavefrontOBJ Source

Constructors

WavefrontOBJ 

Fields

objLocations :: Vector Location

Locations.

objTexCoords :: Vector TexCoord

Texture coordinates.

objNormals :: Vector Normal

Normals.

objPoints :: Vector (Element Point)

Points.

objLines :: Vector (Element Line)

Lines.

objFaces :: Vector (Element Face)

Faces.

objMtlLibs :: Vector Text

Material libraries.

Re-exports