summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-07-20 21:04:52 -0400
committerJoe Crayne <joe@jerkface.net>2019-07-20 21:04:52 -0400
commit3a9d1a324b8728c5dfd12bb3c41dcf1170ae0596 (patch)
tree8b96575f826941ed533b859d58a12c36f87b8dfd
parentf414c3f017a9da40440262bda8aac0486ef6e21b (diff)
Support for multiple mtllib files.
-rw-r--r--src/Wavefront.hs3
-rw-r--r--src/Wavefront/Types.hs2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/Wavefront.hs b/src/Wavefront.hs
index 32959d4..cae6508 100644
--- a/src/Wavefront.hs
+++ b/src/Wavefront.hs
@@ -114,7 +114,8 @@ buildOBJ = nullBuilder
114 modify' $ second $ \e -> e { elObject = Just o } 114 modify' $ second $ \e -> e { elObject = Just o }
115 , usemtl = \x -> do 115 , usemtl = \x -> do
116 let mtl = decodeUtf8 x 116 let mtl = decodeUtf8 x
117 modify' $ second $ \e -> e { elMtl = Just mtl } 117 libs <- DList.toList <$> gets (objMtlLibs . fst)
118 modify' $ second $ \e -> e { elMtl = Just (length libs,mtl) }
118 , smoothingGroup = \x -> when (x > 0) $ do 119 , smoothingGroup = \x -> when (x > 0) $ do
119 modify $ second $ \e -> e { elSmoothingGroup = fromIntegral x } 120 modify $ second $ \e -> e { elSmoothingGroup = fromIntegral x }
120 } 121 }
diff --git a/src/Wavefront/Types.hs b/src/Wavefront/Types.hs
index 2e49ba9..99bbb15 100644
--- a/src/Wavefront/Types.hs
+++ b/src/Wavefront/Types.hs
@@ -161,7 +161,7 @@ pattern Quad a b c d = Face a b c [d]
161data Element a = Element { 161data Element a = Element {
162 elObject :: Maybe Text 162 elObject :: Maybe Text
163 , elGroups :: [Text] 163 , elGroups :: [Text]
164 , elMtl :: Maybe Text 164 , elMtl :: Maybe (Int,Text) -- Size of stack of mtllibs, mtlname
165 , elSmoothingGroup :: Natural 165 , elSmoothingGroup :: Natural
166 , elValue :: a 166 , elValue :: a
167 } deriving (Eq,Ord,Show,Functor) 167 } deriving (Eq,Ord,Show,Functor)