diff options
Diffstat (limited to 'src/Wavefront')
-rw-r--r-- | src/Wavefront/Types.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Wavefront/Types.hs b/src/Wavefront/Types.hs index 564f5d5..2e49ba9 100644 --- a/src/Wavefront/Types.hs +++ b/src/Wavefront/Types.hs | |||
@@ -84,7 +84,7 @@ data Location = Location { | |||
84 | , locY :: {-# UNPACK #-} !Float | 84 | , locY :: {-# UNPACK #-} !Float |
85 | , locZ :: {-# UNPACK #-} !Float | 85 | , locZ :: {-# UNPACK #-} !Float |
86 | , locW :: {-# UNPACK #-} !Float | 86 | , locW :: {-# UNPACK #-} !Float |
87 | } deriving (Eq,Show) | 87 | } deriving (Eq,Ord,Show) |
88 | 88 | ||
89 | -- | A texture coordinate is a 3D-floating vector. You can access to its | 89 | -- | A texture coordinate is a 3D-floating vector. You can access to its |
90 | -- components by pattern matching on them: | 90 | -- components by pattern matching on them: |
@@ -96,7 +96,7 @@ data TexCoord = TexCoord { | |||
96 | texcoordR :: {-# UNPACK #-} !Float | 96 | texcoordR :: {-# UNPACK #-} !Float |
97 | , texcoordS :: {-# UNPACK #-} !Float | 97 | , texcoordS :: {-# UNPACK #-} !Float |
98 | , texcoordT :: {-# UNPACK #-} !Float | 98 | , texcoordT :: {-# UNPACK #-} !Float |
99 | } deriving (Eq,Show) | 99 | } deriving (Eq,Ord,Show) |
100 | 100 | ||
101 | 101 | ||
102 | -- | A normal is a 3-floating vector. You can access to its components by | 102 | -- | A normal is a 3-floating vector. You can access to its components by |
@@ -109,13 +109,13 @@ data Normal = Normal { | |||
109 | norX :: {-# UNPACK #-} !Float | 109 | norX :: {-# UNPACK #-} !Float |
110 | , norY :: {-# UNPACK #-} !Float | 110 | , norY :: {-# UNPACK #-} !Float |
111 | , norZ :: {-# UNPACK #-} !Float | 111 | , norZ :: {-# UNPACK #-} !Float |
112 | } deriving (Eq,Show) | 112 | } deriving (Eq,Ord,Show) |
113 | 113 | ||
114 | -- | A point is a single index that references the locations. It’s a canonical | 114 | -- | A point is a single index that references the locations. It’s a canonical |
115 | -- type that truly represents a polygonal point. | 115 | -- type that truly represents a polygonal point. |
116 | data Point = Point { | 116 | data Point = Point { |
117 | pointLocIndex :: {-# UNPACK #-} !Int | 117 | pointLocIndex :: {-# UNPACK #-} !Int |
118 | } deriving (Eq,Show) | 118 | } deriving (Eq,Ord,Show) |
119 | 119 | ||
120 | -- | A line index is a pair of indices. @'LineIndex' vi vti@. @vi@ references | 120 | -- | A line index is a pair of indices. @'LineIndex' vi vti@. @vi@ references |
121 | -- the locations and @vti@ indexes the texture coordinates. If @vti == | 121 | -- the locations and @vti@ indexes the texture coordinates. If @vti == |
@@ -124,14 +124,14 @@ data Point = Point { | |||
124 | data LineIndex = LineIndex { | 124 | data LineIndex = LineIndex { |
125 | lineLocIndex :: {-# UNPACK #-} !Int | 125 | lineLocIndex :: {-# UNPACK #-} !Int |
126 | , lineTexCoordIndex :: !(Maybe Int) | 126 | , lineTexCoordIndex :: !(Maybe Int) |
127 | } deriving (Eq,Show) | 127 | } deriving (Eq,Ord,Show) |
128 | 128 | ||
129 | -- | A line gathers two line indices accessible by pattern matching or | 129 | -- | A line gathers two line indices accessible by pattern matching or |
130 | -- 'lineIndexA' and 'lineIndexB'. | 130 | -- 'lineIndexA' and 'lineIndexB'. |
131 | data Line = Line { | 131 | data Line = Line { |
132 | lineIndexA :: LineIndex | 132 | lineIndexA :: LineIndex |
133 | , lineIndexB :: LineIndex | 133 | , lineIndexB :: LineIndex |
134 | } deriving (Eq,Show) | 134 | } deriving (Eq,Ord,Show) |
135 | 135 | ||
136 | -- | A face index is a triplet of indices. @'FaceIndex' vi vti vni@ is a face | 136 | -- | A face index is a triplet of indices. @'FaceIndex' vi vti vni@ is a face |
137 | -- that indexes the locations with @vi@, the texture coordinates with @vti@ and | 137 | -- that indexes the locations with @vi@, the texture coordinates with @vti@ and |
@@ -142,11 +142,11 @@ data FaceIndex = FaceIndex { | |||
142 | faceLocIndex :: {-# UNPACK #-} !Int | 142 | faceLocIndex :: {-# UNPACK #-} !Int |
143 | , faceTexCoordIndex :: !(Maybe Int) | 143 | , faceTexCoordIndex :: !(Maybe Int) |
144 | , faceNorIndex :: !(Maybe Int) | 144 | , faceNorIndex :: !(Maybe Int) |
145 | } deriving (Eq,Show) | 145 | } deriving (Eq,Ord,Show) |
146 | 146 | ||
147 | -- | A face gathers several 'FaceIndex' to build up faces. It has a least three | 147 | -- | A face gathers several 'FaceIndex' to build up faces. It has a least three |
148 | -- vertices | 148 | -- vertices |
149 | data Face = Face FaceIndex FaceIndex FaceIndex [FaceIndex] deriving (Eq,Show) | 149 | data Face = Face FaceIndex FaceIndex FaceIndex [FaceIndex] deriving (Eq,Ord,Show) |
150 | 150 | ||
151 | pattern Triangle :: FaceIndex -> FaceIndex -> FaceIndex -> Face | 151 | pattern Triangle :: FaceIndex -> FaceIndex -> FaceIndex -> Face |
152 | pattern Triangle a b c = Face a b c [] | 152 | pattern Triangle a b c = Face a b c [] |
@@ -164,4 +164,4 @@ data Element a = Element { | |||
164 | , elMtl :: Maybe Text | 164 | , elMtl :: Maybe Text |
165 | , elSmoothingGroup :: Natural | 165 | , elSmoothingGroup :: Natural |
166 | , elValue :: a | 166 | , elValue :: a |
167 | } deriving (Eq,Show,Functor) | 167 | } deriving (Eq,Ord,Show,Functor) |