diff options
author | Joe Crayne <joe@jerkface.net> | 2019-06-11 17:29:21 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-06-11 17:29:21 -0400 |
commit | e0a3b4650f92a39fed428c26c1e137767fffa15c (patch) | |
tree | ba92b4d1552607e86c4de7b0f257171f2a648ef1 | |
parent | 2e367da3b4db976018c8b04f2a9ef75514a0b9a6 (diff) |
Sabadie: Started free-form geometry support.
-rw-r--r-- | src/Codec/Wavefront/FreeForm.hs | 10 | ||||
-rw-r--r-- | src/Codec/Wavefront/Lexer.hs | 10 | ||||
-rw-r--r-- | src/Codec/Wavefront/Object.hs | 10 | ||||
-rw-r--r-- | wavefront-obj.cabal | 1 |
4 files changed, 31 insertions, 0 deletions
diff --git a/src/Codec/Wavefront/FreeForm.hs b/src/Codec/Wavefront/FreeForm.hs new file mode 100644 index 0000000..4e418a7 --- /dev/null +++ b/src/Codec/Wavefront/FreeForm.hs | |||
@@ -0,0 +1,10 @@ | |||
1 | module Codec.Wavefront.FreeForm where | ||
2 | |||
3 | data Curve = Curve | ||
4 | deriving (Eq,Show) | ||
5 | |||
6 | data EmbeddedCurve = EmbeddedCurve | ||
7 | deriving (Eq,Show) | ||
8 | |||
9 | data Surface = Surface | ||
10 | deriving (Eq,Show) | ||
diff --git a/src/Codec/Wavefront/Lexer.hs b/src/Codec/Wavefront/Lexer.hs index 77ecb35..ea32e2a 100644 --- a/src/Codec/Wavefront/Lexer.hs +++ b/src/Codec/Wavefront/Lexer.hs | |||
@@ -14,6 +14,7 @@ module Codec.Wavefront.Lexer where | |||
14 | 14 | ||
15 | import Codec.Wavefront.Element | 15 | import Codec.Wavefront.Element |
16 | import Codec.Wavefront.Face | 16 | import Codec.Wavefront.Face |
17 | import Codec.Wavefront.FreeForm | ||
17 | import Codec.Wavefront.Line | 18 | import Codec.Wavefront.Line |
18 | import Codec.Wavefront.Location | 19 | import Codec.Wavefront.Location |
19 | import Codec.Wavefront.Normal | 20 | import Codec.Wavefront.Normal |
@@ -42,6 +43,12 @@ data Ctxt = Ctxt { | |||
42 | , ctxtLines :: DList (Element Line) | 43 | , ctxtLines :: DList (Element Line) |
43 | -- |Faces. | 44 | -- |Faces. |
44 | , ctxtFaces :: DList (Element Face) | 45 | , ctxtFaces :: DList (Element Face) |
46 | -- |Curves. | ||
47 | , ctxtCurves :: DList (Element Curve) | ||
48 | -- |Curves on surfaces. | ||
49 | , ctxtEmbeddedCurves :: DList (Element EmbeddedCurve) | ||
50 | -- |Surfaces. | ||
51 | , ctxtSurfaces :: DList (Element Surface) | ||
45 | -- |Current object. | 52 | -- |Current object. |
46 | , ctxtCurrentObject :: Maybe Text | 53 | , ctxtCurrentObject :: Maybe Text |
47 | -- |Current groups. | 54 | -- |Current groups. |
@@ -65,6 +72,9 @@ emptyCtxt = Ctxt { | |||
65 | , ctxtPoints = empty | 72 | , ctxtPoints = empty |
66 | , ctxtLines = empty | 73 | , ctxtLines = empty |
67 | , ctxtFaces = empty | 74 | , ctxtFaces = empty |
75 | , ctxtCurves = empty | ||
76 | , ctxtEmbeddedCurves = empty | ||
77 | , ctxtSurfaces = empty | ||
68 | , ctxtCurrentObject = Nothing | 78 | , ctxtCurrentObject = Nothing |
69 | , ctxtCurrentGroups = ["default"] | 79 | , ctxtCurrentGroups = ["default"] |
70 | , ctxtCurrentMtl = Nothing | 80 | , ctxtCurrentMtl = Nothing |
diff --git a/src/Codec/Wavefront/Object.hs b/src/Codec/Wavefront/Object.hs index 26d85c2..65c062e 100644 --- a/src/Codec/Wavefront/Object.hs +++ b/src/Codec/Wavefront/Object.hs | |||
@@ -13,6 +13,7 @@ module Codec.Wavefront.Object where | |||
13 | 13 | ||
14 | import Codec.Wavefront.Element | 14 | import Codec.Wavefront.Element |
15 | import Codec.Wavefront.Face | 15 | import Codec.Wavefront.Face |
16 | import Codec.Wavefront.FreeForm | ||
16 | import Codec.Wavefront.Lexer ( Ctxt(..) ) | 17 | import Codec.Wavefront.Lexer ( Ctxt(..) ) |
17 | import Codec.Wavefront.Line | 18 | import Codec.Wavefront.Line |
18 | import Codec.Wavefront.Location | 19 | import Codec.Wavefront.Location |
@@ -38,6 +39,12 @@ data WavefrontOBJ = WavefrontOBJ { | |||
38 | , objLines :: Vector (Element Line) | 39 | , objLines :: Vector (Element Line) |
39 | -- |Faces. | 40 | -- |Faces. |
40 | , objFaces :: Vector (Element Face) | 41 | , objFaces :: Vector (Element Face) |
42 | -- |Curves. | ||
43 | , objCurves :: Vector (Element Curve) | ||
44 | -- |Curves on surfaces. | ||
45 | , objEmbeddedCurves :: Vector (Element EmbeddedCurve) | ||
46 | -- |Surfaces. | ||
47 | , objSurfaces :: Vector (Element Surface) | ||
41 | -- |Material libraries. | 48 | -- |Material libraries. |
42 | , objMtlLibs :: Vector Text | 49 | , objMtlLibs :: Vector Text |
43 | } deriving (Eq,Show) | 50 | } deriving (Eq,Show) |
@@ -51,6 +58,9 @@ ctxtToWavefrontOBJ ctxt = WavefrontOBJ { | |||
51 | , objPoints = fromDList (ctxtPoints ctxt) | 58 | , objPoints = fromDList (ctxtPoints ctxt) |
52 | , objLines = fromDList (ctxtLines ctxt) | 59 | , objLines = fromDList (ctxtLines ctxt) |
53 | , objFaces = fromDList (ctxtFaces ctxt) | 60 | , objFaces = fromDList (ctxtFaces ctxt) |
61 | , objCurves = fromDList (ctxtCurves ctxt) | ||
62 | , objEmbeddedCurves = fromDList (ctxtEmbeddedCurves ctxt) | ||
63 | , objSurfaces = fromDList (ctxtSurfaces ctxt) | ||
54 | , objMtlLibs = fromDList (ctxtMtlLibs ctxt) | 64 | , objMtlLibs = fromDList (ctxtMtlLibs ctxt) |
55 | } | 65 | } |
56 | 66 | ||
diff --git a/wavefront-obj.cabal b/wavefront-obj.cabal index 2a0532c..717ab5f 100644 --- a/wavefront-obj.cabal +++ b/wavefront-obj.cabal | |||
@@ -46,6 +46,7 @@ library | |||
46 | , Codec.Wavefront.Normal | 46 | , Codec.Wavefront.Normal |
47 | , Codec.Wavefront.Point | 47 | , Codec.Wavefront.Point |
48 | , Codec.Wavefront.Face | 48 | , Codec.Wavefront.Face |
49 | , Codec.Wavefront.FreeForm | ||
49 | , Codec.Wavefront.Token | 50 | , Codec.Wavefront.Token |
50 | -- other-modules: | 51 | -- other-modules: |
51 | other-extensions: ForeignFunctionInterface | 52 | other-extensions: ForeignFunctionInterface |