-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Wavefront OBJ loader -- -- A Wavefront OBJ loader. Currently supports polygonal information. More -- could be added if needed (like curves and surface) if people -- contribute. Feel free to help! @package wavefront @version 0.5 module Codec.Wavefront.IO -- | Extract a WavefrontOBJ from a Wavefront OBJ formatted file. fromFile :: (MonadIO m) => FilePath -> m (Either String WavefrontOBJ) -- | Currently, you can parse a file and get a WavefrontOBJ with the -- fromFile function. module Codec.Wavefront -- | 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. data Location locX :: Location -> Float locY :: Location -> Float locZ :: Location -> Float locW :: Location -> Float -- | 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. data TexCoord texcoordR :: TexCoord -> Float texcoordS :: TexCoord -> Float texcoordT :: TexCoord -> Float -- | 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. data Normal norX :: Normal -> Float norY :: Normal -> Float norZ :: Normal -> Float -- | A point is a single index that references the locations. It’s a -- canonical type that truly represents a polygonal point. data Point pointLocIndex :: Point -> Int data Line lineLocIndex :: LineIndex -> Int lineTexCoordIndex :: LineIndex -> (Maybe Int) -- | A face gathers several FaceIndex to build up faces, arranged in -- either Triangle, Quad or an arbritatry Polygon. data Face faceLocIndex :: FaceIndex -> Int faceTexCoordIndex :: FaceIndex -> (Maybe Int) faceNorIndex :: FaceIndex -> (Maybe Int) -- | 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. data Element a elObject :: Element a -> Maybe Text elGroups :: Element a -> [Text] elMtl :: Element a -> Maybe Text elValue :: Element a -> a data WavefrontOBJ WavefrontOBJ :: Vector Location -> Vector TexCoord -> Vector Normal -> Vector (Element Point) -> Vector (Element Line) -> Vector (Element Face) -> Vector Text -> WavefrontOBJ -- | Locations. [objLocations] :: WavefrontOBJ -> Vector Location -- | Texture coordinates. [objTexCoords] :: WavefrontOBJ -> Vector TexCoord -- | Normals. [objNormals] :: WavefrontOBJ -> Vector Normal -- | Points. [objPoints] :: WavefrontOBJ -> Vector (Element Point) -- | Lines. [objLines] :: WavefrontOBJ -> Vector (Element Line) -- | Faces. [objFaces] :: WavefrontOBJ -> Vector (Element Face) -- | Material libraries. [objMtlLibs] :: WavefrontOBJ -> Vector Text