wavefront-obj-0.1.0.1: Wavefront .obj file loader

Copyright(c) Alexis Williams 2016
LicenseBSD3
Maintainersasinestro@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Data.WavefrontObj

Contents

Description

A (very) minimal microlibrary to load 3D geometry from Wavefront .obj files.

Synopsis

Types

data WavefrontVertex Source #

Contains the data for an individual vertex, with the world-space coordinate, (optional) texture-space coordinate, and the (optional) precalculated normal vector.

TODO: Add an option to add normals for models without them(?).

newtype WavefrontFace' a Source #

The underlying datatype to store the vertices for a face.

Constructors

WavefrontFace [a] 

Instances

Functor WavefrontFace' Source # 

Methods

fmap :: (a -> b) -> WavefrontFace' a -> WavefrontFace' b #

(<$) :: a -> WavefrontFace' b -> WavefrontFace' a #

Foldable WavefrontFace' Source # 

Methods

fold :: Monoid m => WavefrontFace' m -> m #

foldMap :: Monoid m => (a -> m) -> WavefrontFace' a -> m #

foldr :: (a -> b -> b) -> b -> WavefrontFace' a -> b #

foldr' :: (a -> b -> b) -> b -> WavefrontFace' a -> b #

foldl :: (b -> a -> b) -> b -> WavefrontFace' a -> b #

foldl' :: (b -> a -> b) -> b -> WavefrontFace' a -> b #

foldr1 :: (a -> a -> a) -> WavefrontFace' a -> a #

foldl1 :: (a -> a -> a) -> WavefrontFace' a -> a #

toList :: WavefrontFace' a -> [a] #

null :: WavefrontFace' a -> Bool #

length :: WavefrontFace' a -> Int #

elem :: Eq a => a -> WavefrontFace' a -> Bool #

maximum :: Ord a => WavefrontFace' a -> a #

minimum :: Ord a => WavefrontFace' a -> a #

sum :: Num a => WavefrontFace' a -> a #

product :: Num a => WavefrontFace' a -> a #

Eq a => Eq (WavefrontFace' a) Source # 
Show a => Show (WavefrontFace' a) Source # 

type WavefrontFace = WavefrontFace' WavefrontVertex Source #

An alias to make the the type signatures look nicer while still allowing the instances that you would want (without pulling in mono-traversable).

newtype WavefrontModel' a Source #

Models are not exactly complicated in this system, just a list of faces.

Constructors

WavefrontModel [a] 

Instances

Functor WavefrontModel' Source # 

Methods

fmap :: (a -> b) -> WavefrontModel' a -> WavefrontModel' b #

(<$) :: a -> WavefrontModel' b -> WavefrontModel' a #

Foldable WavefrontModel' Source # 

Methods

fold :: Monoid m => WavefrontModel' m -> m #

foldMap :: Monoid m => (a -> m) -> WavefrontModel' a -> m #

foldr :: (a -> b -> b) -> b -> WavefrontModel' a -> b #

foldr' :: (a -> b -> b) -> b -> WavefrontModel' a -> b #

foldl :: (b -> a -> b) -> b -> WavefrontModel' a -> b #

foldl' :: (b -> a -> b) -> b -> WavefrontModel' a -> b #

foldr1 :: (a -> a -> a) -> WavefrontModel' a -> a #

foldl1 :: (a -> a -> a) -> WavefrontModel' a -> a #

toList :: WavefrontModel' a -> [a] #

null :: WavefrontModel' a -> Bool #

length :: WavefrontModel' a -> Int #

elem :: Eq a => a -> WavefrontModel' a -> Bool #

maximum :: Ord a => WavefrontModel' a -> a #

minimum :: Ord a => WavefrontModel' a -> a #

sum :: Num a => WavefrontModel' a -> a #

product :: Num a => WavefrontModel' a -> a #

Eq a => Eq (WavefrontModel' a) Source # 
Show a => Show (WavefrontModel' a) Source # 

type WavefrontModel = WavefrontModel' WavefrontFace Source #

Another alias to beautify type signatures.

Interface

parseWavefrontObj :: Text -> Either String WavefrontModel Source #

Takes a Text and gives you either an error message or a WavefrontModel containing the geometry data from the input.

loadWavefrontObj :: FilePath -> IO (Either String WavefrontModel) Source #

A convienence function for the common case of loading a model from a text file on disk.