Fix build and freeze
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{-# OPTIONS_HADDOCK ignore-exports #-}
|
||||
|
||||
module Parser.Meshparser (meshToArr, facesToArr) where
|
||||
module Parser.Meshparser (meshToArr, facesToArr, parseObj) where
|
||||
|
||||
import Control.Applicative
|
||||
import Data.Attoparsec.ByteString.Char8
|
||||
@@ -9,13 +9,8 @@ import qualified Data.ByteString.Char8 as B
|
||||
import Diagrams.TwoD.Types
|
||||
|
||||
|
||||
-- |Convert a text String with multiple vertices and faces into
|
||||
-- a list of vertices, ordered by the faces specification.
|
||||
facesToArr :: B.ByteString -> [[P2 Double]]
|
||||
facesToArr str = fmap (fmap (\y -> meshToArr str !! (fromIntegral y - 1)))
|
||||
(faces str)
|
||||
where
|
||||
faces = rights . fmap (parseOnly parseFace) . B.lines
|
||||
facesToArr :: B.ByteString -> [[Int]]
|
||||
facesToArr = rights . fmap (parseOnly parseFace) . B.lines
|
||||
|
||||
|
||||
-- |Convert a text String with multiple vertices into
|
||||
@@ -37,5 +32,14 @@ parseVertice =
|
||||
<*> (many' space *> double)
|
||||
|
||||
|
||||
parseFace :: Parser [Integer]
|
||||
parseFace :: Parser [Int]
|
||||
parseFace = char 'f' *> many1' (many' space *> decimal)
|
||||
|
||||
|
||||
-- |Convert a text String with multiple vertices and faces into
|
||||
-- a list of vertices, ordered by the faces specification.
|
||||
parseObj :: B.ByteString -> [[P2 Double]]
|
||||
parseObj str = fmap (fmap (\y -> meshToArr str !! (fromIntegral y - 1)))
|
||||
(faces str)
|
||||
where
|
||||
faces = rights . fmap (parseOnly parseFace) . B.lines
|
||||
|
||||
Reference in New Issue
Block a user