wavefront 0.1.0.2 → 0.2
raw patch · 9 files changed
+53/−7 lines, 9 files
Files
- CHANGELOG.md +11/−0
- src/Codec/Wavefront/Face.hs +7/−0
- src/Codec/Wavefront/Line.hs +6/−0
- src/Codec/Wavefront/Location.hs +7/−0
- src/Codec/Wavefront/Normal.hs +7/−0
- src/Codec/Wavefront/Object.hs +4/−6
- src/Codec/Wavefront/Point.hs +2/−0
- src/Codec/Wavefront/TexCoord.hs +8/−0
- wavefront.cabal +1/−1
CHANGELOG.md view
@@ -1,3 +1,14 @@+# 0.2++#### Non-breaking changes++- Added more verbose documentation everywhere.++#### Breaking changes++- Removed `ctxtName`. It was an old function used to implement user-defined+ objects, but since we have `Element`, we don’t those anymore.+ ### 0.1.0.2 - Changed the loop of `tokenize` from `many1` to `untilEnd` (internal parser in Token.hs). That’s
src/Codec/Wavefront/Face.hs view
@@ -11,5 +11,12 @@ module Codec.Wavefront.Face where +-- |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 'Face's. data Face = Face {-# UNPACK #-} !(Int,Maybe Int,Maybe Int) deriving (Eq,Show)
src/Codec/Wavefront/Line.hs view
@@ -11,5 +11,11 @@ module Codec.Wavefront.Line where +-- |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 'Line's. data Line = Line {-# UNPACK #-} !(Int,Maybe Int) deriving (Eq,Show)
src/Codec/Wavefront/Location.hs view
@@ -11,6 +11,13 @@ module Codec.Wavefront.Location where +-- |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 = Location {-# UNPACK #-} !Float {-# UNPACK #-} !Float
src/Codec/Wavefront/Normal.hs view
@@ -11,6 +11,13 @@ module Codec.Wavefront.Normal where +-- |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 = Normal {-# UNPACK #-} !Float {-# UNPACK #-} !Float
src/Codec/Wavefront/Object.hs view
@@ -32,7 +32,8 @@ import Data.Foldable ( traverse_ ) -- |An element holds a value along with the user-defined object’s name (if exists), the associated--- groups and the used material.+-- 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 = Element { elObject :: Maybe Text , elGroups :: [Text]@@ -42,10 +43,8 @@ -- |The lexer context. The result of lexing a stream of tokens is this exact type. data Ctxt = Ctxt {- -- |Name of the object. 'Nothing' means that the object is not user-defined.- ctxtName :: Maybe Text -- |Locations.- , ctxtLocations :: DList Location+ ctxtLocations :: DList Location -- |Texture coordinates. , ctxtTexCoords :: DList TexCoord -- |Normals.@@ -73,8 +72,7 @@ -- as we consume tokens. emptyCtxt :: Ctxt emptyCtxt = Ctxt {- ctxtName = Nothing- , ctxtLocations = empty+ ctxtLocations = empty , ctxtTexCoords = empty , ctxtNormals = empty , ctxtPoints = empty
src/Codec/Wavefront/Point.hs view
@@ -11,5 +11,7 @@ module Codec.Wavefront.Point where +-- |A point is a single index that references the locations. It’s a canonical type that truly+-- represents a polygonal point. data Point = Point {-# UNPACK #-} !Int deriving (Eq,Show)
src/Codec/Wavefront/TexCoord.hs view
@@ -11,6 +11,14 @@ module Codec.Wavefront.TexCoord where +-- |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 = TexCoord {-# UNPACK #-} !Float {-# UNPACK #-} !Float
wavefront.cabal view
@@ -1,5 +1,5 @@ name: wavefront-version: 0.1.0.2+version: 0.2 synopsis: Wavefront OBJ loader description: A Wavefront OBJ loader. Currently supports polygonal information. More could be added if needed (like curves and surface) if people contribute. Feel free