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