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