rev |
line source |
nuclear@0
|
1 /*
|
nuclear@0
|
2 Open Asset Import Library (assimp)
|
nuclear@0
|
3 ----------------------------------------------------------------------
|
nuclear@0
|
4
|
nuclear@0
|
5 Copyright (c) 2006-2012, assimp team
|
nuclear@0
|
6 All rights reserved.
|
nuclear@0
|
7
|
nuclear@0
|
8 Redistribution and use of this software in source and binary forms,
|
nuclear@0
|
9 with or without modification, are permitted provided that the
|
nuclear@0
|
10 following conditions are met:
|
nuclear@0
|
11
|
nuclear@0
|
12 * Redistributions of source code must retain the above
|
nuclear@0
|
13 copyright notice, this list of conditions and the
|
nuclear@0
|
14 following disclaimer.
|
nuclear@0
|
15
|
nuclear@0
|
16 * Redistributions in binary form must reproduce the above
|
nuclear@0
|
17 copyright notice, this list of conditions and the
|
nuclear@0
|
18 following disclaimer in the documentation and/or other
|
nuclear@0
|
19 materials provided with the distribution.
|
nuclear@0
|
20
|
nuclear@0
|
21 * Neither the name of the assimp team, nor the names of its
|
nuclear@0
|
22 contributors may be used to endorse or promote products
|
nuclear@0
|
23 derived from this software without specific prior
|
nuclear@0
|
24 written permission of the assimp team.
|
nuclear@0
|
25
|
nuclear@0
|
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
nuclear@0
|
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
nuclear@0
|
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
nuclear@0
|
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
nuclear@0
|
30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
nuclear@0
|
31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
nuclear@0
|
32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
nuclear@0
|
33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
nuclear@0
|
34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
nuclear@0
|
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
nuclear@0
|
36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
nuclear@0
|
37
|
nuclear@0
|
38 ----------------------------------------------------------------------
|
nuclear@0
|
39 */
|
nuclear@0
|
40
|
nuclear@0
|
41 /** @file LWOFileData.h
|
nuclear@0
|
42 * @brief Defines chunk constants used by the LWO file format
|
nuclear@0
|
43
|
nuclear@0
|
44 The chunks are taken from the official LightWave SDK headers.
|
nuclear@0
|
45
|
nuclear@0
|
46 */
|
nuclear@0
|
47 #ifndef AI_LWO_FILEDATA_INCLUDED
|
nuclear@0
|
48 #define AI_LWO_FILEDATA_INCLUDED
|
nuclear@0
|
49
|
nuclear@0
|
50 // STL headers
|
nuclear@0
|
51 #include <vector>
|
nuclear@0
|
52 #include <list>
|
nuclear@0
|
53
|
nuclear@0
|
54 // public ASSIMP headers
|
nuclear@0
|
55 #include "assimp/mesh.h"
|
nuclear@0
|
56
|
nuclear@0
|
57 // internal headers
|
nuclear@0
|
58 #include "IFF.h"
|
nuclear@0
|
59 #include "LWOAnimation.h"
|
nuclear@0
|
60
|
nuclear@0
|
61 namespace Assimp {
|
nuclear@0
|
62 namespace LWO {
|
nuclear@0
|
63
|
nuclear@0
|
64 #define AI_LWO_FOURCC_LWOB AI_IFF_FOURCC('L','W','O','B')
|
nuclear@0
|
65 #define AI_LWO_FOURCC_LWO2 AI_IFF_FOURCC('L','W','O','2')
|
nuclear@0
|
66 #define AI_LWO_FOURCC_LXOB AI_IFF_FOURCC('L','X','O','B')
|
nuclear@0
|
67
|
nuclear@0
|
68 // chunks specific to the LWOB format
|
nuclear@0
|
69 #define AI_LWO_SRFS AI_IFF_FOURCC('S','R','F','S')
|
nuclear@0
|
70 #define AI_LWO_FLAG AI_IFF_FOURCC('F','L','A','G')
|
nuclear@0
|
71 #define AI_LWO_VLUM AI_IFF_FOURCC('V','L','U','M')
|
nuclear@0
|
72 #define AI_LWO_VDIF AI_IFF_FOURCC('V','D','I','F')
|
nuclear@0
|
73 #define AI_LWO_VSPC AI_IFF_FOURCC('V','S','P','C')
|
nuclear@0
|
74 #define AI_LWO_RFLT AI_IFF_FOURCC('R','F','L','T')
|
nuclear@0
|
75 #define AI_LWO_BTEX AI_IFF_FOURCC('B','T','E','X')
|
nuclear@0
|
76 #define AI_LWO_CTEX AI_IFF_FOURCC('C','T','E','X')
|
nuclear@0
|
77 #define AI_LWO_DTEX AI_IFF_FOURCC('D','T','E','X')
|
nuclear@0
|
78 #define AI_LWO_LTEX AI_IFF_FOURCC('L','T','E','X')
|
nuclear@0
|
79 #define AI_LWO_RTEX AI_IFF_FOURCC('R','T','E','X')
|
nuclear@0
|
80 #define AI_LWO_STEX AI_IFF_FOURCC('S','T','E','X')
|
nuclear@0
|
81 #define AI_LWO_TTEX AI_IFF_FOURCC('T','T','E','X')
|
nuclear@0
|
82 #define AI_LWO_TFLG AI_IFF_FOURCC('T','F','L','G')
|
nuclear@0
|
83 #define AI_LWO_TSIZ AI_IFF_FOURCC('T','S','I','Z')
|
nuclear@0
|
84 #define AI_LWO_TCTR AI_IFF_FOURCC('T','C','T','R')
|
nuclear@0
|
85 #define AI_LWO_TFAL AI_IFF_FOURCC('T','F','A','L')
|
nuclear@0
|
86 #define AI_LWO_TVEL AI_IFF_FOURCC('T','V','E','L')
|
nuclear@0
|
87 #define AI_LWO_TCLR AI_IFF_FOURCC('T','C','L','R')
|
nuclear@0
|
88 #define AI_LWO_TVAL AI_IFF_FOURCC('T','V','A','L')
|
nuclear@0
|
89 #define AI_LWO_TAMP AI_IFF_FOURCC('T','A','M','P')
|
nuclear@0
|
90 #define AI_LWO_TIMG AI_IFF_FOURCC('T','I','M','G')
|
nuclear@0
|
91 #define AI_LWO_TAAS AI_IFF_FOURCC('T','A','A','S')
|
nuclear@0
|
92 #define AI_LWO_TREF AI_IFF_FOURCC('T','R','E','F')
|
nuclear@0
|
93 #define AI_LWO_TOPC AI_IFF_FOURCC('T','O','P','C')
|
nuclear@0
|
94 #define AI_LWO_SDAT AI_IFF_FOURCC('S','D','A','T')
|
nuclear@0
|
95 #define AI_LWO_TFP0 AI_IFF_FOURCC('T','F','P','0')
|
nuclear@0
|
96 #define AI_LWO_TFP1 AI_IFF_FOURCC('T','F','P','1')
|
nuclear@0
|
97
|
nuclear@0
|
98
|
nuclear@0
|
99 /* top-level chunks */
|
nuclear@0
|
100 #define AI_LWO_LAYR AI_IFF_FOURCC('L','A','Y','R')
|
nuclear@0
|
101 #define AI_LWO_TAGS AI_IFF_FOURCC('T','A','G','S')
|
nuclear@0
|
102 #define AI_LWO_PNTS AI_IFF_FOURCC('P','N','T','S')
|
nuclear@0
|
103 #define AI_LWO_BBOX AI_IFF_FOURCC('B','B','O','X')
|
nuclear@0
|
104 #define AI_LWO_VMAP AI_IFF_FOURCC('V','M','A','P')
|
nuclear@0
|
105 #define AI_LWO_VMAD AI_IFF_FOURCC('V','M','A','D')
|
nuclear@0
|
106 #define AI_LWO_POLS AI_IFF_FOURCC('P','O','L','S')
|
nuclear@0
|
107 #define AI_LWO_PTAG AI_IFF_FOURCC('P','T','A','G')
|
nuclear@0
|
108 #define AI_LWO_ENVL AI_IFF_FOURCC('E','N','V','L')
|
nuclear@0
|
109 #define AI_LWO_CLIP AI_IFF_FOURCC('C','L','I','P')
|
nuclear@0
|
110 #define AI_LWO_SURF AI_IFF_FOURCC('S','U','R','F')
|
nuclear@0
|
111 #define AI_LWO_DESC AI_IFF_FOURCC('D','E','S','C')
|
nuclear@0
|
112 #define AI_LWO_TEXT AI_IFF_FOURCC('T','E','X','T')
|
nuclear@0
|
113 #define AI_LWO_ICON AI_IFF_FOURCC('I','C','O','N')
|
nuclear@0
|
114
|
nuclear@0
|
115 /* polygon types */
|
nuclear@0
|
116 #define AI_LWO_FACE AI_IFF_FOURCC('F','A','C','E')
|
nuclear@0
|
117 #define AI_LWO_CURV AI_IFF_FOURCC('C','U','R','V')
|
nuclear@0
|
118 #define AI_LWO_PTCH AI_IFF_FOURCC('P','T','C','H')
|
nuclear@0
|
119 #define AI_LWO_MBAL AI_IFF_FOURCC('M','B','A','L')
|
nuclear@0
|
120 #define AI_LWO_BONE AI_IFF_FOURCC('B','O','N','E')
|
nuclear@0
|
121 #define AI_LWO_SUBD AI_IFF_FOURCC('S','U','B','D')
|
nuclear@0
|
122
|
nuclear@0
|
123 /* polygon tags */
|
nuclear@0
|
124 #define AI_LWO_SURF AI_IFF_FOURCC('S','U','R','F')
|
nuclear@0
|
125 #define AI_LWO_PART AI_IFF_FOURCC('P','A','R','T')
|
nuclear@0
|
126 #define AI_LWO_SMGP AI_IFF_FOURCC('S','M','G','P')
|
nuclear@0
|
127
|
nuclear@0
|
128 /* envelopes */
|
nuclear@0
|
129 #define AI_LWO_PRE AI_IFF_FOURCC('P','R','E',' ')
|
nuclear@0
|
130 #define AI_LWO_POST AI_IFF_FOURCC('P','O','S','T')
|
nuclear@0
|
131 #define AI_LWO_KEY AI_IFF_FOURCC('K','E','Y',' ')
|
nuclear@0
|
132 #define AI_LWO_SPAN AI_IFF_FOURCC('S','P','A','N')
|
nuclear@0
|
133 #define AI_LWO_TCB AI_IFF_FOURCC('T','C','B',' ')
|
nuclear@0
|
134 #define AI_LWO_HERM AI_IFF_FOURCC('H','E','R','M')
|
nuclear@0
|
135 #define AI_LWO_BEZI AI_IFF_FOURCC('B','E','Z','I')
|
nuclear@0
|
136 #define AI_LWO_BEZ2 AI_IFF_FOURCC('B','E','Z','2')
|
nuclear@0
|
137 #define AI_LWO_LINE AI_IFF_FOURCC('L','I','N','E')
|
nuclear@0
|
138 #define AI_LWO_STEP AI_IFF_FOURCC('S','T','E','P')
|
nuclear@0
|
139
|
nuclear@0
|
140 /* clips */
|
nuclear@0
|
141 #define AI_LWO_STIL AI_IFF_FOURCC('S','T','I','L')
|
nuclear@0
|
142 #define AI_LWO_ISEQ AI_IFF_FOURCC('I','S','E','Q')
|
nuclear@0
|
143 #define AI_LWO_ANIM AI_IFF_FOURCC('A','N','I','M')
|
nuclear@0
|
144 #define AI_LWO_XREF AI_IFF_FOURCC('X','R','E','F')
|
nuclear@0
|
145 #define AI_LWO_STCC AI_IFF_FOURCC('S','T','C','C')
|
nuclear@0
|
146 #define AI_LWO_TIME AI_IFF_FOURCC('T','I','M','E')
|
nuclear@0
|
147 #define AI_LWO_CONT AI_IFF_FOURCC('C','O','N','T')
|
nuclear@0
|
148 #define AI_LWO_BRIT AI_IFF_FOURCC('B','R','I','T')
|
nuclear@0
|
149 #define AI_LWO_SATR AI_IFF_FOURCC('S','A','T','R')
|
nuclear@0
|
150 #define AI_LWO_HUE AI_IFF_FOURCC('H','U','E',' ')
|
nuclear@0
|
151 #define AI_LWO_GAMM AI_IFF_FOURCC('G','A','M','M')
|
nuclear@0
|
152 #define AI_LWO_NEGA AI_IFF_FOURCC('N','E','G','A')
|
nuclear@0
|
153 #define AI_LWO_IFLT AI_IFF_FOURCC('I','F','L','T')
|
nuclear@0
|
154 #define AI_LWO_PFLT AI_IFF_FOURCC('P','F','L','T')
|
nuclear@0
|
155
|
nuclear@0
|
156 /* surfaces */
|
nuclear@0
|
157 #define AI_LWO_COLR AI_IFF_FOURCC('C','O','L','R')
|
nuclear@0
|
158 #define AI_LWO_LUMI AI_IFF_FOURCC('L','U','M','I')
|
nuclear@0
|
159 #define AI_LWO_DIFF AI_IFF_FOURCC('D','I','F','F')
|
nuclear@0
|
160 #define AI_LWO_SPEC AI_IFF_FOURCC('S','P','E','C')
|
nuclear@0
|
161 #define AI_LWO_GLOS AI_IFF_FOURCC('G','L','O','S')
|
nuclear@0
|
162 #define AI_LWO_REFL AI_IFF_FOURCC('R','E','F','L')
|
nuclear@0
|
163 #define AI_LWO_RFOP AI_IFF_FOURCC('R','F','O','P')
|
nuclear@0
|
164 #define AI_LWO_RIMG AI_IFF_FOURCC('R','I','M','G')
|
nuclear@0
|
165 #define AI_LWO_RSAN AI_IFF_FOURCC('R','S','A','N')
|
nuclear@0
|
166 #define AI_LWO_TRAN AI_IFF_FOURCC('T','R','A','N')
|
nuclear@0
|
167 #define AI_LWO_TROP AI_IFF_FOURCC('T','R','O','P')
|
nuclear@0
|
168 #define AI_LWO_TIMG AI_IFF_FOURCC('T','I','M','G')
|
nuclear@0
|
169 #define AI_LWO_RIND AI_IFF_FOURCC('R','I','N','D')
|
nuclear@0
|
170 #define AI_LWO_TRNL AI_IFF_FOURCC('T','R','N','L')
|
nuclear@0
|
171 #define AI_LWO_BUMP AI_IFF_FOURCC('B','U','M','P')
|
nuclear@0
|
172 #define AI_LWO_SMAN AI_IFF_FOURCC('S','M','A','N')
|
nuclear@0
|
173 #define AI_LWO_SIDE AI_IFF_FOURCC('S','I','D','E')
|
nuclear@0
|
174 #define AI_LWO_CLRH AI_IFF_FOURCC('C','L','R','H')
|
nuclear@0
|
175 #define AI_LWO_CLRF AI_IFF_FOURCC('C','L','R','F')
|
nuclear@0
|
176 #define AI_LWO_ADTR AI_IFF_FOURCC('A','D','T','R')
|
nuclear@0
|
177 #define AI_LWO_SHRP AI_IFF_FOURCC('S','H','R','P')
|
nuclear@0
|
178 #define AI_LWO_LINE AI_IFF_FOURCC('L','I','N','E')
|
nuclear@0
|
179 #define AI_LWO_LSIZ AI_IFF_FOURCC('L','S','I','Z')
|
nuclear@0
|
180 #define AI_LWO_ALPH AI_IFF_FOURCC('A','L','P','H')
|
nuclear@0
|
181 #define AI_LWO_AVAL AI_IFF_FOURCC('A','V','A','L')
|
nuclear@0
|
182 #define AI_LWO_GVAL AI_IFF_FOURCC('G','V','A','L')
|
nuclear@0
|
183 #define AI_LWO_BLOK AI_IFF_FOURCC('B','L','O','K')
|
nuclear@0
|
184 #define AI_LWO_VCOL AI_IFF_FOURCC('V','C','O','L')
|
nuclear@0
|
185
|
nuclear@0
|
186 /* texture layer */
|
nuclear@0
|
187 #define AI_LWO_TYPE AI_IFF_FOURCC('T','Y','P','E')
|
nuclear@0
|
188 #define AI_LWO_CHAN AI_IFF_FOURCC('C','H','A','N')
|
nuclear@0
|
189 #define AI_LWO_NAME AI_IFF_FOURCC('N','A','M','E')
|
nuclear@0
|
190 #define AI_LWO_ENAB AI_IFF_FOURCC('E','N','A','B')
|
nuclear@0
|
191 #define AI_LWO_OPAC AI_IFF_FOURCC('O','P','A','C')
|
nuclear@0
|
192 #define AI_LWO_FLAG AI_IFF_FOURCC('F','L','A','G')
|
nuclear@0
|
193 #define AI_LWO_PROJ AI_IFF_FOURCC('P','R','O','J')
|
nuclear@0
|
194 #define AI_LWO_STCK AI_IFF_FOURCC('S','T','C','K')
|
nuclear@0
|
195 #define AI_LWO_TAMP AI_IFF_FOURCC('T','A','M','P')
|
nuclear@0
|
196
|
nuclear@0
|
197 /* texture coordinates */
|
nuclear@0
|
198 #define AI_LWO_TMAP AI_IFF_FOURCC('T','M','A','P')
|
nuclear@0
|
199 #define AI_LWO_AXIS AI_IFF_FOURCC('A','X','I','S')
|
nuclear@0
|
200 #define AI_LWO_CNTR AI_IFF_FOURCC('C','N','T','R')
|
nuclear@0
|
201 #define AI_LWO_SIZE AI_IFF_FOURCC('S','I','Z','E')
|
nuclear@0
|
202 #define AI_LWO_ROTA AI_IFF_FOURCC('R','O','T','A')
|
nuclear@0
|
203 #define AI_LWO_OREF AI_IFF_FOURCC('O','R','E','F')
|
nuclear@0
|
204 #define AI_LWO_FALL AI_IFF_FOURCC('F','A','L','L')
|
nuclear@0
|
205 #define AI_LWO_CSYS AI_IFF_FOURCC('C','S','Y','S')
|
nuclear@0
|
206
|
nuclear@0
|
207 /* image map */
|
nuclear@0
|
208 #define AI_LWO_IMAP AI_IFF_FOURCC('I','M','A','P')
|
nuclear@0
|
209 #define AI_LWO_IMAG AI_IFF_FOURCC('I','M','A','G')
|
nuclear@0
|
210 #define AI_LWO_WRAP AI_IFF_FOURCC('W','R','A','P')
|
nuclear@0
|
211 #define AI_LWO_WRPW AI_IFF_FOURCC('W','R','P','W')
|
nuclear@0
|
212 #define AI_LWO_WRPH AI_IFF_FOURCC('W','R','P','H')
|
nuclear@0
|
213 #define AI_LWO_VMAP AI_IFF_FOURCC('V','M','A','P')
|
nuclear@0
|
214 #define AI_LWO_AAST AI_IFF_FOURCC('A','A','S','T')
|
nuclear@0
|
215 #define AI_LWO_PIXB AI_IFF_FOURCC('P','I','X','B')
|
nuclear@0
|
216
|
nuclear@0
|
217 /* procedural */
|
nuclear@0
|
218 #define AI_LWO_PROC AI_IFF_FOURCC('P','R','O','C')
|
nuclear@0
|
219 #define AI_LWO_COLR AI_IFF_FOURCC('C','O','L','R')
|
nuclear@0
|
220 #define AI_LWO_VALU AI_IFF_FOURCC('V','A','L','U')
|
nuclear@0
|
221 #define AI_LWO_FUNC AI_IFF_FOURCC('F','U','N','C')
|
nuclear@0
|
222 #define AI_LWO_FTPS AI_IFF_FOURCC('F','T','P','S')
|
nuclear@0
|
223 #define AI_LWO_ITPS AI_IFF_FOURCC('I','T','P','S')
|
nuclear@0
|
224 #define AI_LWO_ETPS AI_IFF_FOURCC('E','T','P','S')
|
nuclear@0
|
225
|
nuclear@0
|
226 /* gradient */
|
nuclear@0
|
227 #define AI_LWO_GRAD AI_IFF_FOURCC('G','R','A','D')
|
nuclear@0
|
228 #define AI_LWO_GRST AI_IFF_FOURCC('G','R','S','T')
|
nuclear@0
|
229 #define AI_LWO_GREN AI_IFF_FOURCC('G','R','E','N')
|
nuclear@0
|
230 #define AI_LWO_PNAM AI_IFF_FOURCC('P','N','A','M')
|
nuclear@0
|
231 #define AI_LWO_INAM AI_IFF_FOURCC('I','N','A','M')
|
nuclear@0
|
232 #define AI_LWO_GRPT AI_IFF_FOURCC('G','R','P','T')
|
nuclear@0
|
233 #define AI_LWO_FKEY AI_IFF_FOURCC('F','K','E','Y')
|
nuclear@0
|
234 #define AI_LWO_IKEY AI_IFF_FOURCC('I','K','E','Y')
|
nuclear@0
|
235
|
nuclear@0
|
236 /* shader */
|
nuclear@0
|
237 #define AI_LWO_SHDR AI_IFF_FOURCC('S','H','D','R')
|
nuclear@0
|
238 #define AI_LWO_DATA AI_IFF_FOURCC('D','A','T','A')
|
nuclear@0
|
239
|
nuclear@0
|
240
|
nuclear@0
|
241 /* VMAP types */
|
nuclear@0
|
242 #define AI_LWO_TXUV AI_IFF_FOURCC('T','X','U','V')
|
nuclear@0
|
243 #define AI_LWO_RGB AI_IFF_FOURCC('R','G','B',' ')
|
nuclear@0
|
244 #define AI_LWO_RGBA AI_IFF_FOURCC('R','G','B','A')
|
nuclear@0
|
245 #define AI_LWO_WGHT AI_IFF_FOURCC('W','G','H','T')
|
nuclear@0
|
246
|
nuclear@0
|
247 #define AI_LWO_MNVW AI_IFF_FOURCC('M','N','V','W')
|
nuclear@0
|
248 #define AI_LWO_MORF AI_IFF_FOURCC('M','O','R','F')
|
nuclear@0
|
249 #define AI_LWO_SPOT AI_IFF_FOURCC('S','P','O','T')
|
nuclear@0
|
250 #define AI_LWO_PICK AI_IFF_FOURCC('P','I','C','K')
|
nuclear@0
|
251
|
nuclear@0
|
252 // MODO extension - per-vertex normal vectors
|
nuclear@0
|
253 #define AI_LWO_MODO_NORM AI_IFF_FOURCC('N', 'O', 'R', 'M')
|
nuclear@0
|
254
|
nuclear@0
|
255
|
nuclear@0
|
256 // ---------------------------------------------------------------------------
|
nuclear@0
|
257 /** \brief Data structure for a face in a LWO file
|
nuclear@0
|
258 *
|
nuclear@0
|
259 * \note We can't use the code in SmoothingGroups.inl here - the mesh
|
nuclear@0
|
260 * structures of 3DS/ASE and LWO are too different.
|
nuclear@0
|
261 */
|
nuclear@0
|
262 struct Face : public aiFace
|
nuclear@0
|
263 {
|
nuclear@0
|
264 //! Default construction
|
nuclear@0
|
265 Face()
|
nuclear@0
|
266 : surfaceIndex (0)
|
nuclear@0
|
267 , smoothGroup (0)
|
nuclear@0
|
268 , type (AI_LWO_FACE)
|
nuclear@0
|
269 {}
|
nuclear@0
|
270
|
nuclear@0
|
271 //! Construction from given type
|
nuclear@0
|
272 Face(uint32_t _type)
|
nuclear@0
|
273 : surfaceIndex (0)
|
nuclear@0
|
274 , smoothGroup (0)
|
nuclear@0
|
275 , type (_type)
|
nuclear@0
|
276 {}
|
nuclear@0
|
277
|
nuclear@0
|
278 //! Copy construction
|
nuclear@0
|
279 Face(const Face& f) : aiFace() {
|
nuclear@0
|
280 *this = f;
|
nuclear@0
|
281 }
|
nuclear@0
|
282
|
nuclear@0
|
283 //! Zero-based index into tags chunk
|
nuclear@0
|
284 unsigned int surfaceIndex;
|
nuclear@0
|
285
|
nuclear@0
|
286 //! Smooth group this face is assigned to
|
nuclear@0
|
287 unsigned int smoothGroup;
|
nuclear@0
|
288
|
nuclear@0
|
289 //! Type of face
|
nuclear@0
|
290 uint32_t type;
|
nuclear@0
|
291
|
nuclear@0
|
292
|
nuclear@0
|
293 //! Assignment operator
|
nuclear@0
|
294 Face& operator=(const LWO::Face& f) {
|
nuclear@0
|
295 aiFace::operator =(f);
|
nuclear@0
|
296 surfaceIndex = f.surfaceIndex;
|
nuclear@0
|
297 smoothGroup = f.smoothGroup;
|
nuclear@0
|
298 type = f.type;
|
nuclear@0
|
299 return *this;
|
nuclear@0
|
300 }
|
nuclear@0
|
301 };
|
nuclear@0
|
302
|
nuclear@0
|
303 // ---------------------------------------------------------------------------
|
nuclear@0
|
304 /** \brief Base structure for all vertex map representations
|
nuclear@0
|
305 */
|
nuclear@0
|
306 struct VMapEntry
|
nuclear@0
|
307 {
|
nuclear@0
|
308 VMapEntry(unsigned int _dims)
|
nuclear@0
|
309 : dims(_dims)
|
nuclear@0
|
310 {}
|
nuclear@0
|
311
|
nuclear@0
|
312 virtual ~VMapEntry() {}
|
nuclear@0
|
313
|
nuclear@0
|
314 //! allocates memory for the vertex map
|
nuclear@0
|
315 virtual void Allocate(unsigned int num)
|
nuclear@0
|
316 {
|
nuclear@0
|
317 if (!rawData.empty())
|
nuclear@0
|
318 return; // return if already allocated
|
nuclear@0
|
319
|
nuclear@0
|
320 const unsigned int m = num*dims;
|
nuclear@0
|
321 rawData.reserve(m + (m>>2u)); // 25% as extra storage for VMADs
|
nuclear@0
|
322 rawData.resize(m,0.f);
|
nuclear@0
|
323 abAssigned.resize(num,false);
|
nuclear@0
|
324 }
|
nuclear@0
|
325
|
nuclear@0
|
326 std::string name;
|
nuclear@0
|
327 unsigned int dims;
|
nuclear@0
|
328
|
nuclear@0
|
329 std::vector<float> rawData;
|
nuclear@0
|
330 std::vector<bool> abAssigned;
|
nuclear@0
|
331 };
|
nuclear@0
|
332
|
nuclear@0
|
333 // ---------------------------------------------------------------------------
|
nuclear@0
|
334 /** \brief Represents an extra vertex color channel
|
nuclear@0
|
335 */
|
nuclear@0
|
336 struct VColorChannel : public VMapEntry
|
nuclear@0
|
337 {
|
nuclear@0
|
338 VColorChannel()
|
nuclear@0
|
339 : VMapEntry(4)
|
nuclear@0
|
340 {}
|
nuclear@0
|
341
|
nuclear@0
|
342 //! need to overwrite this function - the alpha channel must
|
nuclear@0
|
343 //! be initialized to 1.0 by default
|
nuclear@0
|
344 virtual void Allocate(unsigned int num)
|
nuclear@0
|
345 {
|
nuclear@0
|
346 if (!rawData.empty())
|
nuclear@0
|
347 return; // return if already allocated
|
nuclear@0
|
348
|
nuclear@0
|
349 register unsigned int m = num*dims;
|
nuclear@0
|
350 rawData.reserve(m + (m>>2u)); // 25% as extra storage for VMADs
|
nuclear@0
|
351 rawData.resize(m);
|
nuclear@0
|
352
|
nuclear@0
|
353 for (aiColor4D* p = (aiColor4D*)&rawData[0]; p < (aiColor4D*)&rawData[m-1]; ++p)
|
nuclear@0
|
354 p->a = 1.f;
|
nuclear@0
|
355
|
nuclear@0
|
356 abAssigned.resize(num,false);
|
nuclear@0
|
357 }
|
nuclear@0
|
358 };
|
nuclear@0
|
359
|
nuclear@0
|
360 // ---------------------------------------------------------------------------
|
nuclear@0
|
361 /** \brief Represents an extra vertex UV channel
|
nuclear@0
|
362 */
|
nuclear@0
|
363 struct UVChannel : public VMapEntry
|
nuclear@0
|
364 {
|
nuclear@0
|
365 UVChannel()
|
nuclear@0
|
366 : VMapEntry(2)
|
nuclear@0
|
367 {}
|
nuclear@0
|
368 };
|
nuclear@0
|
369
|
nuclear@0
|
370 // ---------------------------------------------------------------------------
|
nuclear@0
|
371 /** \brief Represents a weight map
|
nuclear@0
|
372 */
|
nuclear@0
|
373 struct WeightChannel : public VMapEntry
|
nuclear@0
|
374 {
|
nuclear@0
|
375 WeightChannel()
|
nuclear@0
|
376 : VMapEntry(1)
|
nuclear@0
|
377 {}
|
nuclear@0
|
378 };
|
nuclear@0
|
379
|
nuclear@0
|
380 // ---------------------------------------------------------------------------
|
nuclear@0
|
381 /** \brief Represents a vertex-normals channel (MODO extension)
|
nuclear@0
|
382 */
|
nuclear@0
|
383 struct NormalChannel : public VMapEntry
|
nuclear@0
|
384 {
|
nuclear@0
|
385 NormalChannel()
|
nuclear@0
|
386 : VMapEntry(3)
|
nuclear@0
|
387 {}
|
nuclear@0
|
388 };
|
nuclear@0
|
389
|
nuclear@0
|
390 // ---------------------------------------------------------------------------
|
nuclear@0
|
391 /** \brief Data structure for a LWO file texture
|
nuclear@0
|
392 */
|
nuclear@0
|
393 struct Texture
|
nuclear@0
|
394 {
|
nuclear@0
|
395 // we write the enum values out here to make debugging easier ...
|
nuclear@0
|
396 enum BlendType
|
nuclear@0
|
397 {
|
nuclear@0
|
398 Normal = 0,
|
nuclear@0
|
399 Subtractive = 1,
|
nuclear@0
|
400 Difference = 2,
|
nuclear@0
|
401 Multiply = 3,
|
nuclear@0
|
402 Divide = 4,
|
nuclear@0
|
403 Alpha = 5,
|
nuclear@0
|
404 TextureDispl = 6,
|
nuclear@0
|
405 Additive = 7
|
nuclear@0
|
406 };
|
nuclear@0
|
407
|
nuclear@0
|
408 enum MappingMode
|
nuclear@0
|
409 {
|
nuclear@0
|
410 Planar = 0,
|
nuclear@0
|
411 Cylindrical = 1,
|
nuclear@0
|
412 Spherical = 2,
|
nuclear@0
|
413 Cubic = 3,
|
nuclear@0
|
414 FrontProjection = 4,
|
nuclear@0
|
415 UV = 5
|
nuclear@0
|
416 };
|
nuclear@0
|
417
|
nuclear@0
|
418 enum Axes
|
nuclear@0
|
419 {
|
nuclear@0
|
420 AXIS_X = 0,
|
nuclear@0
|
421 AXIS_Y = 1,
|
nuclear@0
|
422 AXIS_Z = 2
|
nuclear@0
|
423 };
|
nuclear@0
|
424
|
nuclear@0
|
425 enum Wrap
|
nuclear@0
|
426 {
|
nuclear@0
|
427 RESET = 0,
|
nuclear@0
|
428 REPEAT = 1,
|
nuclear@0
|
429 MIRROR = 2,
|
nuclear@0
|
430 EDGE = 3
|
nuclear@0
|
431 };
|
nuclear@0
|
432
|
nuclear@0
|
433 Texture()
|
nuclear@0
|
434 : mClipIdx(UINT_MAX)
|
nuclear@0
|
435 , mStrength (1.0f)
|
nuclear@0
|
436 , mUVChannelIndex ("unknown")
|
nuclear@0
|
437 , mRealUVIndex (UINT_MAX)
|
nuclear@0
|
438 , enabled (true)
|
nuclear@0
|
439 , blendType (Additive)
|
nuclear@0
|
440 , bCanUse (true)
|
nuclear@0
|
441 , mapMode (UV)
|
nuclear@0
|
442 , majorAxis (AXIS_X)
|
nuclear@0
|
443 , wrapAmountH (1.0f)
|
nuclear@0
|
444 , wrapAmountW (1.0f)
|
nuclear@0
|
445 , wrapModeWidth (REPEAT)
|
nuclear@0
|
446 , wrapModeHeight (REPEAT)
|
nuclear@0
|
447 , ordinal ("\x00")
|
nuclear@0
|
448 {}
|
nuclear@0
|
449
|
nuclear@0
|
450 //! File name of the texture
|
nuclear@0
|
451 std::string mFileName;
|
nuclear@0
|
452
|
nuclear@0
|
453 //! Clip index
|
nuclear@0
|
454 unsigned int mClipIdx;
|
nuclear@0
|
455
|
nuclear@0
|
456 //! Strength of the texture - blend factor
|
nuclear@0
|
457 float mStrength;
|
nuclear@0
|
458
|
nuclear@0
|
459 uint32_t type; // type of the texture
|
nuclear@0
|
460
|
nuclear@0
|
461 //! Name of the corresponding UV channel
|
nuclear@0
|
462 std::string mUVChannelIndex;
|
nuclear@0
|
463 unsigned int mRealUVIndex;
|
nuclear@0
|
464
|
nuclear@0
|
465 //! is the texture enabled?
|
nuclear@0
|
466 bool enabled;
|
nuclear@0
|
467
|
nuclear@0
|
468 //! blend type
|
nuclear@0
|
469 BlendType blendType;
|
nuclear@0
|
470
|
nuclear@0
|
471 //! are we able to use the texture?
|
nuclear@0
|
472 bool bCanUse;
|
nuclear@0
|
473
|
nuclear@0
|
474 //! mapping mode
|
nuclear@0
|
475 MappingMode mapMode;
|
nuclear@0
|
476
|
nuclear@0
|
477 //! major axis for planar, cylindrical, spherical projections
|
nuclear@0
|
478 Axes majorAxis;
|
nuclear@0
|
479
|
nuclear@0
|
480 //! wrap amount for cylindrical and spherical projections
|
nuclear@0
|
481 float wrapAmountH,wrapAmountW;
|
nuclear@0
|
482
|
nuclear@0
|
483 //! wrapping mode for the texture
|
nuclear@0
|
484 Wrap wrapModeWidth,wrapModeHeight;
|
nuclear@0
|
485
|
nuclear@0
|
486 //! ordinal string of the texture
|
nuclear@0
|
487 std::string ordinal;
|
nuclear@0
|
488 };
|
nuclear@0
|
489
|
nuclear@0
|
490 // ---------------------------------------------------------------------------
|
nuclear@0
|
491 /** \brief Data structure for a LWO file clip
|
nuclear@0
|
492 */
|
nuclear@0
|
493 struct Clip
|
nuclear@0
|
494 {
|
nuclear@0
|
495 enum Type
|
nuclear@0
|
496 {
|
nuclear@0
|
497 STILL, SEQ, REF, UNSUPPORTED
|
nuclear@0
|
498 } type;
|
nuclear@0
|
499
|
nuclear@0
|
500 Clip()
|
nuclear@0
|
501 : type (UNSUPPORTED)
|
nuclear@0
|
502 , idx (0)
|
nuclear@0
|
503 , negate (false)
|
nuclear@0
|
504 {}
|
nuclear@0
|
505
|
nuclear@0
|
506 //! path to the base texture -
|
nuclear@0
|
507 std::string path;
|
nuclear@0
|
508
|
nuclear@0
|
509 //! reference to another CLIP
|
nuclear@0
|
510 unsigned int clipRef;
|
nuclear@0
|
511
|
nuclear@0
|
512 //! index of the clip
|
nuclear@0
|
513 unsigned int idx;
|
nuclear@0
|
514
|
nuclear@0
|
515 //! Negate the clip?
|
nuclear@0
|
516 bool negate;
|
nuclear@0
|
517 };
|
nuclear@0
|
518
|
nuclear@0
|
519
|
nuclear@0
|
520 // ---------------------------------------------------------------------------
|
nuclear@0
|
521 /** \brief Data structure for a LWO file shader
|
nuclear@0
|
522 *
|
nuclear@0
|
523 * Later
|
nuclear@0
|
524 */
|
nuclear@0
|
525 struct Shader
|
nuclear@0
|
526 {
|
nuclear@0
|
527 Shader()
|
nuclear@0
|
528 : ordinal ("\x00")
|
nuclear@0
|
529 , functionName ("unknown")
|
nuclear@0
|
530 , enabled (true)
|
nuclear@0
|
531 {}
|
nuclear@0
|
532
|
nuclear@0
|
533 std::string ordinal;
|
nuclear@0
|
534 std::string functionName;
|
nuclear@0
|
535 bool enabled;
|
nuclear@0
|
536 };
|
nuclear@0
|
537
|
nuclear@0
|
538 typedef std::list < Texture > TextureList;
|
nuclear@0
|
539 typedef std::list < Shader > ShaderList;
|
nuclear@0
|
540
|
nuclear@0
|
541 // ---------------------------------------------------------------------------
|
nuclear@0
|
542 /** \brief Data structure for a LWO file surface (= material)
|
nuclear@0
|
543 */
|
nuclear@0
|
544 struct Surface
|
nuclear@0
|
545 {
|
nuclear@0
|
546 Surface()
|
nuclear@0
|
547 : mColor (0.78431f,0.78431f,0.78431f)
|
nuclear@0
|
548 , bDoubleSided (false)
|
nuclear@0
|
549 , mDiffuseValue (1.f)
|
nuclear@0
|
550 , mSpecularValue (0.f)
|
nuclear@0
|
551 , mTransparency (0.f)
|
nuclear@0
|
552 , mGlossiness (0.4f)
|
nuclear@0
|
553 , mLuminosity (0.f)
|
nuclear@0
|
554 , mColorHighlights (0.f)
|
nuclear@0
|
555 , mMaximumSmoothAngle (0.f) // 0 == not specified, no smoothing
|
nuclear@0
|
556 , mVCMap ("")
|
nuclear@0
|
557 , mVCMapType (AI_LWO_RGBA)
|
nuclear@0
|
558 , mIOR (1.f) // vakuum
|
nuclear@0
|
559 , mBumpIntensity (1.f)
|
nuclear@0
|
560 , mWireframe (false)
|
nuclear@0
|
561 , mAdditiveTransparency (0.f)
|
nuclear@0
|
562 {}
|
nuclear@0
|
563
|
nuclear@0
|
564 //! Name of the surface
|
nuclear@0
|
565 std::string mName;
|
nuclear@0
|
566
|
nuclear@0
|
567 //! Color of the surface
|
nuclear@0
|
568 aiColor3D mColor;
|
nuclear@0
|
569
|
nuclear@0
|
570 //! true for two-sided materials
|
nuclear@0
|
571 bool bDoubleSided;
|
nuclear@0
|
572
|
nuclear@0
|
573 //! Various material parameters
|
nuclear@0
|
574 float mDiffuseValue,mSpecularValue,mTransparency,mGlossiness,mLuminosity,mColorHighlights;
|
nuclear@0
|
575
|
nuclear@0
|
576 //! Maximum angle between two adjacent triangles
|
nuclear@0
|
577 //! that they can be smoothed - in degrees
|
nuclear@0
|
578 float mMaximumSmoothAngle;
|
nuclear@0
|
579
|
nuclear@0
|
580 //! Vertex color map to be used to color the surface
|
nuclear@0
|
581 std::string mVCMap;
|
nuclear@0
|
582 uint32_t mVCMapType;
|
nuclear@0
|
583
|
nuclear@0
|
584 //! Names of the special shaders to be applied to the surface
|
nuclear@0
|
585 ShaderList mShaders;
|
nuclear@0
|
586
|
nuclear@0
|
587 //! Textures - the first entry in the list is evaluated first
|
nuclear@0
|
588 TextureList mColorTextures, // color textures are added to both diffuse and specular texture stacks
|
nuclear@0
|
589 mDiffuseTextures,
|
nuclear@0
|
590 mSpecularTextures,
|
nuclear@0
|
591 mOpacityTextures,
|
nuclear@0
|
592 mBumpTextures,
|
nuclear@0
|
593 mGlossinessTextures,
|
nuclear@0
|
594 mReflectionTextures;
|
nuclear@0
|
595
|
nuclear@0
|
596 //! Index of refraction
|
nuclear@0
|
597 float mIOR;
|
nuclear@0
|
598
|
nuclear@0
|
599 //! Bump intensity scaling
|
nuclear@0
|
600 float mBumpIntensity;
|
nuclear@0
|
601
|
nuclear@0
|
602 //! Wireframe flag
|
nuclear@0
|
603 bool mWireframe;
|
nuclear@0
|
604
|
nuclear@0
|
605 //! Intensity of additive blending
|
nuclear@0
|
606 float mAdditiveTransparency;
|
nuclear@0
|
607 };
|
nuclear@0
|
608
|
nuclear@0
|
609 // ---------------------------------------------------------------------------
|
nuclear@0
|
610 #define AI_LWO_VALIDATE_CHUNK_LENGTH(length,name,size) \
|
nuclear@0
|
611 if (length < size) \
|
nuclear@0
|
612 { \
|
nuclear@0
|
613 throw DeadlyImportError("LWO: "#name" chunk is too small"); \
|
nuclear@0
|
614 } \
|
nuclear@0
|
615
|
nuclear@0
|
616
|
nuclear@0
|
617 // some typedefs ... to make life with loader monsters like this easier
|
nuclear@0
|
618 typedef std::vector < aiVector3D > PointList;
|
nuclear@0
|
619 typedef std::vector < LWO::Face > FaceList;
|
nuclear@0
|
620 typedef std::vector < LWO::Surface > SurfaceList;
|
nuclear@0
|
621 typedef std::vector < std::string > TagList;
|
nuclear@0
|
622 typedef std::vector < unsigned int > TagMappingTable;
|
nuclear@0
|
623 typedef std::vector < unsigned int > ReferrerList;
|
nuclear@0
|
624 typedef std::vector < WeightChannel > WeightChannelList;
|
nuclear@0
|
625 typedef std::vector < VColorChannel > VColorChannelList;
|
nuclear@0
|
626 typedef std::vector < UVChannel > UVChannelList;
|
nuclear@0
|
627 typedef std::vector < Clip > ClipList;
|
nuclear@0
|
628 typedef std::vector < Envelope > EnvelopeList;
|
nuclear@0
|
629 typedef std::vector < unsigned int > SortedRep;
|
nuclear@0
|
630
|
nuclear@0
|
631 // ---------------------------------------------------------------------------
|
nuclear@0
|
632 /** \brief Represents a layer in the file
|
nuclear@0
|
633 */
|
nuclear@0
|
634 struct Layer
|
nuclear@0
|
635 {
|
nuclear@0
|
636 Layer()
|
nuclear@0
|
637 : mFaceIDXOfs (0)
|
nuclear@0
|
638 , mPointIDXOfs (0)
|
nuclear@0
|
639 , mParent (0x0)
|
nuclear@0
|
640 , mIndex (0xffff)
|
nuclear@0
|
641 , skip (false)
|
nuclear@0
|
642 {}
|
nuclear@0
|
643
|
nuclear@0
|
644 /** Temporary point list from the file */
|
nuclear@0
|
645 PointList mTempPoints;
|
nuclear@0
|
646
|
nuclear@0
|
647 /** Lists for every point the index of another point
|
nuclear@0
|
648 that has been copied from *this* point or UINT_MAX if
|
nuclear@0
|
649 no copy of the point has been made */
|
nuclear@0
|
650 ReferrerList mPointReferrers;
|
nuclear@0
|
651
|
nuclear@0
|
652 /** Weight channel list from the file */
|
nuclear@0
|
653 WeightChannelList mWeightChannels;
|
nuclear@0
|
654
|
nuclear@0
|
655 /** Subdivision weight channel list from the file */
|
nuclear@0
|
656 WeightChannelList mSWeightChannels;
|
nuclear@0
|
657
|
nuclear@0
|
658 /** Vertex color list from the file */
|
nuclear@0
|
659 VColorChannelList mVColorChannels;
|
nuclear@0
|
660
|
nuclear@0
|
661 /** UV channel list from the file */
|
nuclear@0
|
662 UVChannelList mUVChannels;
|
nuclear@0
|
663
|
nuclear@0
|
664 /** Normal vector channel from the file */
|
nuclear@0
|
665 NormalChannel mNormals;
|
nuclear@0
|
666
|
nuclear@0
|
667 /** Temporary face list from the file*/
|
nuclear@0
|
668 FaceList mFaces;
|
nuclear@0
|
669
|
nuclear@0
|
670 /** Current face indexing offset from the beginning of the buffers*/
|
nuclear@0
|
671 unsigned int mFaceIDXOfs;
|
nuclear@0
|
672
|
nuclear@0
|
673 /** Current point indexing offset from the beginning of the buffers*/
|
nuclear@0
|
674 unsigned int mPointIDXOfs;
|
nuclear@0
|
675
|
nuclear@0
|
676 /** Parent index */
|
nuclear@0
|
677 uint16_t mParent;
|
nuclear@0
|
678
|
nuclear@0
|
679 /** Index of the layer */
|
nuclear@0
|
680 uint16_t mIndex;
|
nuclear@0
|
681
|
nuclear@0
|
682 /** Name of the layer */
|
nuclear@0
|
683 std::string mName;
|
nuclear@0
|
684
|
nuclear@0
|
685 /** Pivot point of the layer */
|
nuclear@0
|
686 aiVector3D mPivot;
|
nuclear@0
|
687
|
nuclear@0
|
688 /** Skip this layer? */
|
nuclear@0
|
689 bool skip;
|
nuclear@0
|
690 };
|
nuclear@0
|
691
|
nuclear@0
|
692 typedef std::list<LWO::Layer> LayerList;
|
nuclear@0
|
693
|
nuclear@0
|
694
|
nuclear@0
|
695 }}
|
nuclear@0
|
696
|
nuclear@0
|
697
|
nuclear@0
|
698 #endif // !! AI_LWO_FILEDATA_INCLUDED
|
nuclear@0
|
699
|