addded parse of mesh-line in sce.

This commit is contained in:
Nicole Dresselhaus 2014-11-13 14:35:16 +01:00
parent a1157e2ec4
commit ff38526158

View File

@ -75,6 +75,7 @@ parseObject = do
return $ OpL (Light p c i)
"sphere" -> parseSphere
"plane" -> parsePlane
"mesh" -> parseMesh
_ -> undefined
parseCamera :: Parser ObjectParser
@ -111,8 +112,6 @@ parseCamera = do
, xDir = xDir'
, yDir = yDir'
}
where
parsePlane :: Parser ObjectParser
parsePlane = do
@ -167,3 +166,20 @@ parseVector = do
return $ V3 (f a) (f b) (f c)
where
f = fromRational . toRational --convert Double to Float
parseMesh :: Parser ObjectParser
parseMesh = do
name <- takeTill isSpace
skipSpace
shading <- string "FLAT" <|> string "PHONG"
skipSpace
mat <- parseMaterial
let shading' = case shading of
"FLAT" = Flat
"PHONG" = Phong
return $ OpM Mesh
{ meshFilename = name
, meshShading = shading'
, material = mat
}