diff options
Diffstat (limited to 'src/Codec/Wavefront/Lexer.hs')
-rw-r--r-- | src/Codec/Wavefront/Lexer.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Codec/Wavefront/Lexer.hs b/src/Codec/Wavefront/Lexer.hs index efb4b97..712cabf 100644 --- a/src/Codec/Wavefront/Lexer.hs +++ b/src/Codec/Wavefront/Lexer.hs | |||
@@ -32,6 +32,8 @@ data Ctxt = Ctxt { | |||
32 | ctxtLocations :: DList Location | 32 | ctxtLocations :: DList Location |
33 | -- |Texture coordinates. | 33 | -- |Texture coordinates. |
34 | , ctxtTexCoords :: DList TexCoord | 34 | , ctxtTexCoords :: DList TexCoord |
35 | -- |Texture coordinates. | ||
36 | , ctxtParamCoords :: DList ParamCoord | ||
35 | -- |Normals. | 37 | -- |Normals. |
36 | , ctxtNormals :: DList Normal | 38 | , ctxtNormals :: DList Normal |
37 | -- |Points. | 39 | -- |Points. |
@@ -58,6 +60,7 @@ emptyCtxt :: Ctxt | |||
58 | emptyCtxt = Ctxt { | 60 | emptyCtxt = Ctxt { |
59 | ctxtLocations = empty | 61 | ctxtLocations = empty |
60 | , ctxtTexCoords = empty | 62 | , ctxtTexCoords = empty |
63 | , ctxtParamCoords = empty | ||
61 | , ctxtNormals = empty | 64 | , ctxtNormals = empty |
62 | , ctxtPoints = empty | 65 | , ctxtPoints = empty |
63 | , ctxtLines = empty | 66 | , ctxtLines = empty |
@@ -83,6 +86,9 @@ lexer stream = execState (traverse_ consume stream) emptyCtxt | |||
83 | TknVT vt -> do | 86 | TknVT vt -> do |
84 | texCoords <- gets ctxtTexCoords | 87 | texCoords <- gets ctxtTexCoords |
85 | modify $ \ctxt -> ctxt { ctxtTexCoords = texCoords `snoc` vt } | 88 | modify $ \ctxt -> ctxt { ctxtTexCoords = texCoords `snoc` vt } |
89 | TknVP vp -> do | ||
90 | pCoords <- gets ctxtParamCoords | ||
91 | modify $ \ctxt -> ctxt { ctxtParamCoords = pCoords `snoc` vp } | ||
86 | TknP p -> do | 92 | TknP p -> do |
87 | (pts,element) <- prepareElement ctxtPoints | 93 | (pts,element) <- prepareElement ctxtPoints |
88 | modify $ \ctxt -> ctxt { ctxtPoints = pts `append` fmap element (fromList p) } | 94 | modify $ \ctxt -> ctxt { ctxtPoints = pts `append` fmap element (fromList p) } |