wavefront 0.5.1 → 0.6
raw patch · 5 files changed
+21/−14 lines, 5 filesdep −semigroups
Dependencies removed: semigroups
Files
- CHANGELOG.md +5/−0
- src/Codec/Wavefront.hs +4/−0
- src/Codec/Wavefront/Face.hs +10/−8
- src/Codec/Wavefront/Token.hs +1/−4
- wavefront.cabal +1/−2
CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.6++- `Face` has just a single constructor now; pattern synonmys are available to pattern match against+ `Triangle` and `Quad`.+ ## 0.5.1 - Exported all useful constructors and symbols.
src/Codec/Wavefront.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE PatternSynonyms #-}+ ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2015 Dimitri Sabadie@@ -26,6 +28,8 @@ -- * Faces , Face(..) , FaceIndex(..)+ , pattern Triangle+ , pattern Quad -- * Element , Element(..) -- * Object
src/Codec/Wavefront/Face.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE PatternSynonyms #-}+ ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2015 Dimitri Sabadie@@ -11,7 +13,6 @@ module Codec.Wavefront.Face where -import Data.List.NonEmpty ( NonEmpty ) -- |A face index is a triplet of indices. @'FaceIndex' 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 'FaceIndex'@@ -22,10 +23,11 @@ , faceNorIndex :: !(Maybe Int) } deriving (Eq,Show) --- |A face gathers several 'FaceIndex' to build up faces, arranged in either 'Triangle', 'Quad' or--- an arbritatry 'Polygon'.-data Face- = Triangle FaceIndex FaceIndex FaceIndex- | Quad FaceIndex FaceIndex FaceIndex FaceIndex- | Polygon (NonEmpty FaceIndex)- deriving (Eq,Show)+-- |A face gathers several 'FaceIndex' to build up faces. It has a least three vertices+data Face = Face FaceIndex FaceIndex FaceIndex [FaceIndex] deriving (Eq,Show)++pattern Triangle :: FaceIndex -> FaceIndex -> FaceIndex -> Face+pattern Triangle a b c = Face a b c []++pattern Quad :: FaceIndex -> FaceIndex -> FaceIndex -> FaceIndex -> Face+pattern Quad a b c d = Face a b c [d]
src/Codec/Wavefront/Token.hs view
@@ -20,7 +20,6 @@ import Control.Applicative ( Alternative(..) ) import Data.Attoparsec.Text as AP import Data.Char ( isSpace )-import Data.List.NonEmpty ( NonEmpty(..) ) import Data.Maybe ( catMaybes ) import Data.Text ( Text, unpack ) import qualified Data.Text as T ( empty )@@ -144,9 +143,7 @@ skipHSpace faceIndices <- parseFaceIndices f <- case faceIndices of- [a,b,c] -> pure (Triangle a b c)- [a,b,c,d] -> pure (Quad a b c d)- _:_:_:_:_:_ -> pure (Polygon $ head faceIndices :| tail faceIndices)+ a:b:c:s -> pure (Face a b c s) _ -> fail "face doesn't have at least three points" eol pure f
wavefront.cabal view
@@ -1,5 +1,5 @@ name: wavefront-version: 0.5.1+version: 0.6 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@@ -45,7 +45,6 @@ , dlist >= 0.7 && < 0.8 , filepath >= 1.4 && < 1.5 , mtl >= 2.2 && < 2.3- , semigroups >= 0.18 && < 0.19 , text >= 1.2 && < 1.3 , transformers >= 0.4 && < 0.5 , vector >= 0.11 && < 0.12