-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Wavefront .obj file loader -- -- See -- https://github.com/SASinestro/wavefront-obj/blob/master/README.md. @package wavefront-obj @version 0.1.0.0 -- | A (very) minimal microlibrary to load 3D geometry from Wavefront .obj -- files. module Data.WavefrontObj -- | 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(?). data WavefrontVertex WavefrontVertex :: !(Point V3 Double) -> !(Maybe (Point V2 Double)) -> !(Maybe (V3 Double)) -> WavefrontVertex [_vertexPoint] :: WavefrontVertex -> !(Point V3 Double) [_textureCoordinate] :: WavefrontVertex -> !(Maybe (Point V2 Double)) [_vertexNormal] :: WavefrontVertex -> !(Maybe (V3 Double)) -- | The underlying datatype to store the vertices for a face. newtype WavefrontFace' a WavefrontFace :: [a] -> WavefrontFace' a -- | An alias to make the the type signatures look nicer while still -- allowing the instances that you would want (without pulling in -- mono-traversable). type WavefrontFace = WavefrontFace' WavefrontVertex -- | Models are not exactly complicated in this system, just a list of -- faces. newtype WavefrontModel' a WavefrontModel :: [a] -> WavefrontModel' a -- | Another alias to beautify type signatures. type WavefrontModel = WavefrontModel' WavefrontFace -- | Takes a Text and gives you either an error message or a -- WavefrontModel containing the geometry data from the input. parseWavefrontObj :: Text -> (Either String WavefrontModel) -- | A convienence function for the common case of loading a model from a -- text file on disk. loadWavefrontObj :: FilePath -> IO (Either String WavefrontModel)