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 Defines helper data structures for the import of 3DS files */
|
nuclear@0
|
42
|
nuclear@0
|
43 #ifndef AI_3DSFILEHELPER_H_INC
|
nuclear@0
|
44 #define AI_3DSFILEHELPER_H_INC
|
nuclear@0
|
45
|
nuclear@0
|
46
|
nuclear@0
|
47 #include "SpatialSort.h"
|
nuclear@0
|
48 #include "SmoothingGroups.h"
|
nuclear@0
|
49
|
nuclear@0
|
50 namespace Assimp {
|
nuclear@0
|
51 namespace D3DS {
|
nuclear@0
|
52
|
nuclear@0
|
53 #include "assimp/Compiler/pushpack1.h"
|
nuclear@0
|
54
|
nuclear@0
|
55 // ---------------------------------------------------------------------------
|
nuclear@0
|
56 /** Discreet3DS class: Helper class for loading 3ds files. Defines chunks
|
nuclear@0
|
57 * and data structures.
|
nuclear@0
|
58 */
|
nuclear@0
|
59 class Discreet3DS
|
nuclear@0
|
60 {
|
nuclear@0
|
61 private:
|
nuclear@0
|
62 inline Discreet3DS() {}
|
nuclear@0
|
63
|
nuclear@0
|
64 public:
|
nuclear@0
|
65
|
nuclear@0
|
66 //! data structure for a single chunk in a .3ds file
|
nuclear@0
|
67 struct Chunk
|
nuclear@0
|
68 {
|
nuclear@0
|
69 uint16_t Flag;
|
nuclear@0
|
70 uint32_t Size;
|
nuclear@0
|
71 } PACK_STRUCT;
|
nuclear@0
|
72
|
nuclear@0
|
73
|
nuclear@0
|
74 //! Used for shading field in material3ds structure
|
nuclear@0
|
75 //! From AutoDesk 3ds SDK
|
nuclear@0
|
76 typedef enum
|
nuclear@0
|
77 {
|
nuclear@0
|
78 // translated to gouraud shading with wireframe active
|
nuclear@0
|
79 Wire = 0x0,
|
nuclear@0
|
80
|
nuclear@0
|
81 // if this material is set, no vertex normals will
|
nuclear@0
|
82 // be calculated for the model. Face normals + gouraud
|
nuclear@0
|
83 Flat = 0x1,
|
nuclear@0
|
84
|
nuclear@0
|
85 // standard gouraud shading
|
nuclear@0
|
86 Gouraud = 0x2,
|
nuclear@0
|
87
|
nuclear@0
|
88 // phong shading
|
nuclear@0
|
89 Phong = 0x3,
|
nuclear@0
|
90
|
nuclear@0
|
91 // cooktorrance or anistropic phong shading ...
|
nuclear@0
|
92 // the exact meaning is unknown, if you know it
|
nuclear@0
|
93 // feel free to tell me ;-)
|
nuclear@0
|
94 Metal = 0x4,
|
nuclear@0
|
95
|
nuclear@0
|
96 // required by the ASE loader
|
nuclear@0
|
97 Blinn = 0x5
|
nuclear@0
|
98 } shadetype3ds;
|
nuclear@0
|
99
|
nuclear@0
|
100 // Flags for animated keys
|
nuclear@0
|
101 enum
|
nuclear@0
|
102 {
|
nuclear@0
|
103 KEY_USE_TENS = 0x1,
|
nuclear@0
|
104 KEY_USE_CONT = 0x2,
|
nuclear@0
|
105 KEY_USE_BIAS = 0x4,
|
nuclear@0
|
106 KEY_USE_EASE_TO = 0x8,
|
nuclear@0
|
107 KEY_USE_EASE_FROM = 0x10
|
nuclear@0
|
108 } ;
|
nuclear@0
|
109
|
nuclear@0
|
110 enum
|
nuclear@0
|
111 {
|
nuclear@0
|
112
|
nuclear@0
|
113 // ********************************************************************
|
nuclear@0
|
114 // Basic chunks which can be found everywhere in the file
|
nuclear@0
|
115 CHUNK_VERSION = 0x0002,
|
nuclear@0
|
116 CHUNK_RGBF = 0x0010, // float4 R; float4 G; float4 B
|
nuclear@0
|
117 CHUNK_RGBB = 0x0011, // int1 R; int1 G; int B
|
nuclear@0
|
118
|
nuclear@0
|
119 // Linear color values (gamma = 2.2?)
|
nuclear@0
|
120 CHUNK_LINRGBF = 0x0013, // float4 R; float4 G; float4 B
|
nuclear@0
|
121 CHUNK_LINRGBB = 0x0012, // int1 R; int1 G; int B
|
nuclear@0
|
122
|
nuclear@0
|
123 CHUNK_PERCENTW = 0x0030, // int2 percentage
|
nuclear@0
|
124 CHUNK_PERCENTF = 0x0031, // float4 percentage
|
nuclear@0
|
125 // ********************************************************************
|
nuclear@0
|
126
|
nuclear@0
|
127 // Prj master chunk
|
nuclear@0
|
128 CHUNK_PRJ = 0xC23D,
|
nuclear@0
|
129
|
nuclear@0
|
130 // MDLI master chunk
|
nuclear@0
|
131 CHUNK_MLI = 0x3DAA,
|
nuclear@0
|
132
|
nuclear@0
|
133 // Primary main chunk of the .3ds file
|
nuclear@0
|
134 CHUNK_MAIN = 0x4D4D,
|
nuclear@0
|
135
|
nuclear@0
|
136 // Mesh main chunk
|
nuclear@0
|
137 CHUNK_OBJMESH = 0x3D3D,
|
nuclear@0
|
138
|
nuclear@0
|
139 // Specifies the background color of the .3ds file
|
nuclear@0
|
140 // This is passed through the material system for
|
nuclear@0
|
141 // viewing purposes.
|
nuclear@0
|
142 CHUNK_BKGCOLOR = 0x1200,
|
nuclear@0
|
143
|
nuclear@0
|
144 // Specifies the ambient base color of the scene.
|
nuclear@0
|
145 // This is added to all materials in the file
|
nuclear@0
|
146 CHUNK_AMBCOLOR = 0x2100,
|
nuclear@0
|
147
|
nuclear@0
|
148 // Specifies the background image for the whole scene
|
nuclear@0
|
149 // This value is passed through the material system
|
nuclear@0
|
150 // to the viewer
|
nuclear@0
|
151 CHUNK_BIT_MAP = 0x1100,
|
nuclear@0
|
152 CHUNK_BIT_MAP_EXISTS = 0x1101,
|
nuclear@0
|
153
|
nuclear@0
|
154 // ********************************************************************
|
nuclear@0
|
155 // Viewport related stuff. Ignored
|
nuclear@0
|
156 CHUNK_DEFAULT_VIEW = 0x3000,
|
nuclear@0
|
157 CHUNK_VIEW_TOP = 0x3010,
|
nuclear@0
|
158 CHUNK_VIEW_BOTTOM = 0x3020,
|
nuclear@0
|
159 CHUNK_VIEW_LEFT = 0x3030,
|
nuclear@0
|
160 CHUNK_VIEW_RIGHT = 0x3040,
|
nuclear@0
|
161 CHUNK_VIEW_FRONT = 0x3050,
|
nuclear@0
|
162 CHUNK_VIEW_BACK = 0x3060,
|
nuclear@0
|
163 CHUNK_VIEW_USER = 0x3070,
|
nuclear@0
|
164 CHUNK_VIEW_CAMERA = 0x3080,
|
nuclear@0
|
165 // ********************************************************************
|
nuclear@0
|
166
|
nuclear@0
|
167 // Mesh chunks
|
nuclear@0
|
168 CHUNK_OBJBLOCK = 0x4000,
|
nuclear@0
|
169 CHUNK_TRIMESH = 0x4100,
|
nuclear@0
|
170 CHUNK_VERTLIST = 0x4110,
|
nuclear@0
|
171 CHUNK_VERTFLAGS = 0x4111,
|
nuclear@0
|
172 CHUNK_FACELIST = 0x4120,
|
nuclear@0
|
173 CHUNK_FACEMAT = 0x4130,
|
nuclear@0
|
174 CHUNK_MAPLIST = 0x4140,
|
nuclear@0
|
175 CHUNK_SMOOLIST = 0x4150,
|
nuclear@0
|
176 CHUNK_TRMATRIX = 0x4160,
|
nuclear@0
|
177 CHUNK_MESHCOLOR = 0x4165,
|
nuclear@0
|
178 CHUNK_TXTINFO = 0x4170,
|
nuclear@0
|
179 CHUNK_LIGHT = 0x4600,
|
nuclear@0
|
180 CHUNK_CAMERA = 0x4700,
|
nuclear@0
|
181 CHUNK_HIERARCHY = 0x4F00,
|
nuclear@0
|
182
|
nuclear@0
|
183 // Specifies the global scaling factor. This is applied
|
nuclear@0
|
184 // to the root node's transformation matrix
|
nuclear@0
|
185 CHUNK_MASTER_SCALE = 0x0100,
|
nuclear@0
|
186
|
nuclear@0
|
187 // ********************************************************************
|
nuclear@0
|
188 // Material chunks
|
nuclear@0
|
189 CHUNK_MAT_MATERIAL = 0xAFFF,
|
nuclear@0
|
190
|
nuclear@0
|
191 // asciiz containing the name of the material
|
nuclear@0
|
192 CHUNK_MAT_MATNAME = 0xA000,
|
nuclear@0
|
193 CHUNK_MAT_AMBIENT = 0xA010, // followed by color chunk
|
nuclear@0
|
194 CHUNK_MAT_DIFFUSE = 0xA020, // followed by color chunk
|
nuclear@0
|
195 CHUNK_MAT_SPECULAR = 0xA030, // followed by color chunk
|
nuclear@0
|
196
|
nuclear@0
|
197 // Specifies the shininess of the material
|
nuclear@0
|
198 // followed by percentage chunk
|
nuclear@0
|
199 CHUNK_MAT_SHININESS = 0xA040,
|
nuclear@0
|
200 CHUNK_MAT_SHININESS_PERCENT = 0xA041 ,
|
nuclear@0
|
201
|
nuclear@0
|
202 // Specifies the shading mode to be used
|
nuclear@0
|
203 // followed by a short
|
nuclear@0
|
204 CHUNK_MAT_SHADING = 0xA100,
|
nuclear@0
|
205
|
nuclear@0
|
206 // NOTE: Emissive color (self illumination) seems not
|
nuclear@0
|
207 // to be a color but a single value, type is unknown.
|
nuclear@0
|
208 // Make the parser accept both of them.
|
nuclear@0
|
209 // followed by percentage chunk (?)
|
nuclear@0
|
210 CHUNK_MAT_SELF_ILLUM = 0xA080,
|
nuclear@0
|
211
|
nuclear@0
|
212 // Always followed by percentage chunk (?)
|
nuclear@0
|
213 CHUNK_MAT_SELF_ILPCT = 0xA084,
|
nuclear@0
|
214
|
nuclear@0
|
215 // Always followed by percentage chunk
|
nuclear@0
|
216 CHUNK_MAT_TRANSPARENCY = 0xA050,
|
nuclear@0
|
217
|
nuclear@0
|
218 // Diffuse texture channel 0
|
nuclear@0
|
219 CHUNK_MAT_TEXTURE = 0xA200,
|
nuclear@0
|
220
|
nuclear@0
|
221 // Contains opacity information for each texel
|
nuclear@0
|
222 CHUNK_MAT_OPACMAP = 0xA210,
|
nuclear@0
|
223
|
nuclear@0
|
224 // Contains a reflection map to be used to reflect
|
nuclear@0
|
225 // the environment. This is partially supported.
|
nuclear@0
|
226 CHUNK_MAT_REFLMAP = 0xA220,
|
nuclear@0
|
227
|
nuclear@0
|
228 // Self Illumination map (emissive colors)
|
nuclear@0
|
229 CHUNK_MAT_SELFIMAP = 0xA33d,
|
nuclear@0
|
230
|
nuclear@0
|
231 // Bumpmap. Not specified whether it is a heightmap
|
nuclear@0
|
232 // or a normal map. Assme it is a heightmap since
|
nuclear@0
|
233 // artist normally prefer this format.
|
nuclear@0
|
234 CHUNK_MAT_BUMPMAP = 0xA230,
|
nuclear@0
|
235
|
nuclear@0
|
236 // Specular map. Seems to influence the specular color
|
nuclear@0
|
237 CHUNK_MAT_SPECMAP = 0xA204,
|
nuclear@0
|
238
|
nuclear@0
|
239 // Holds shininess data.
|
nuclear@0
|
240 CHUNK_MAT_MAT_SHINMAP = 0xA33C,
|
nuclear@0
|
241
|
nuclear@0
|
242 // Scaling in U/V direction.
|
nuclear@0
|
243 // (need to gen separate UV coordinate set
|
nuclear@0
|
244 // and do this by hand)
|
nuclear@0
|
245 CHUNK_MAT_MAP_USCALE = 0xA354,
|
nuclear@0
|
246 CHUNK_MAT_MAP_VSCALE = 0xA356,
|
nuclear@0
|
247
|
nuclear@0
|
248 // Translation in U/V direction.
|
nuclear@0
|
249 // (need to gen separate UV coordinate set
|
nuclear@0
|
250 // and do this by hand)
|
nuclear@0
|
251 CHUNK_MAT_MAP_UOFFSET = 0xA358,
|
nuclear@0
|
252 CHUNK_MAT_MAP_VOFFSET = 0xA35a,
|
nuclear@0
|
253
|
nuclear@0
|
254 // UV-coordinates rotation around the z-axis
|
nuclear@0
|
255 // Assumed to be in radians.
|
nuclear@0
|
256 CHUNK_MAT_MAP_ANG = 0xA35C,
|
nuclear@0
|
257
|
nuclear@0
|
258 // Tiling flags for 3DS files
|
nuclear@0
|
259 CHUNK_MAT_MAP_TILING = 0xa351,
|
nuclear@0
|
260
|
nuclear@0
|
261 // Specifies the file name of a texture
|
nuclear@0
|
262 CHUNK_MAPFILE = 0xA300,
|
nuclear@0
|
263
|
nuclear@0
|
264 // Specifies whether a materail requires two-sided rendering
|
nuclear@0
|
265 CHUNK_MAT_TWO_SIDE = 0xA081,
|
nuclear@0
|
266 // ********************************************************************
|
nuclear@0
|
267
|
nuclear@0
|
268 // Main keyframer chunk. Contains translation/rotation/scaling data
|
nuclear@0
|
269 CHUNK_KEYFRAMER = 0xB000,
|
nuclear@0
|
270
|
nuclear@0
|
271 // Supported sub chunks
|
nuclear@0
|
272 CHUNK_TRACKINFO = 0xB002,
|
nuclear@0
|
273 CHUNK_TRACKOBJNAME = 0xB010,
|
nuclear@0
|
274 CHUNK_TRACKDUMMYOBJNAME = 0xB011,
|
nuclear@0
|
275 CHUNK_TRACKPIVOT = 0xB013,
|
nuclear@0
|
276 CHUNK_TRACKPOS = 0xB020,
|
nuclear@0
|
277 CHUNK_TRACKROTATE = 0xB021,
|
nuclear@0
|
278 CHUNK_TRACKSCALE = 0xB022,
|
nuclear@0
|
279
|
nuclear@0
|
280 // ********************************************************************
|
nuclear@0
|
281 // Keyframes for various other stuff in the file
|
nuclear@0
|
282 // Partially ignored
|
nuclear@0
|
283 CHUNK_AMBIENTKEY = 0xB001,
|
nuclear@0
|
284 CHUNK_TRACKMORPH = 0xB026,
|
nuclear@0
|
285 CHUNK_TRACKHIDE = 0xB029,
|
nuclear@0
|
286 CHUNK_OBJNUMBER = 0xB030,
|
nuclear@0
|
287 CHUNK_TRACKCAMERA = 0xB003,
|
nuclear@0
|
288 CHUNK_TRACKFOV = 0xB023,
|
nuclear@0
|
289 CHUNK_TRACKROLL = 0xB024,
|
nuclear@0
|
290 CHUNK_TRACKCAMTGT = 0xB004,
|
nuclear@0
|
291 CHUNK_TRACKLIGHT = 0xB005,
|
nuclear@0
|
292 CHUNK_TRACKLIGTGT = 0xB006,
|
nuclear@0
|
293 CHUNK_TRACKSPOTL = 0xB007,
|
nuclear@0
|
294 CHUNK_FRAMES = 0xB008,
|
nuclear@0
|
295 // ********************************************************************
|
nuclear@0
|
296
|
nuclear@0
|
297 // light sub-chunks
|
nuclear@0
|
298 CHUNK_DL_OFF = 0x4620,
|
nuclear@0
|
299 CHUNK_DL_OUTER_RANGE = 0x465A,
|
nuclear@0
|
300 CHUNK_DL_INNER_RANGE = 0x4659,
|
nuclear@0
|
301 CHUNK_DL_MULTIPLIER = 0x465B,
|
nuclear@0
|
302 CHUNK_DL_EXCLUDE = 0x4654,
|
nuclear@0
|
303 CHUNK_DL_ATTENUATE = 0x4625,
|
nuclear@0
|
304 CHUNK_DL_SPOTLIGHT = 0x4610,
|
nuclear@0
|
305
|
nuclear@0
|
306 // camera sub-chunks
|
nuclear@0
|
307 CHUNK_CAM_RANGES = 0x4720
|
nuclear@0
|
308 };
|
nuclear@0
|
309 };
|
nuclear@0
|
310
|
nuclear@0
|
311 // ---------------------------------------------------------------------------
|
nuclear@0
|
312 /** Helper structure representing a 3ds mesh face */
|
nuclear@0
|
313 struct Face : public FaceWithSmoothingGroup
|
nuclear@0
|
314 {
|
nuclear@0
|
315 };
|
nuclear@0
|
316
|
nuclear@0
|
317 // ---------------------------------------------------------------------------
|
nuclear@0
|
318 /** Helper structure representing a texture */
|
nuclear@0
|
319 struct Texture
|
nuclear@0
|
320 {
|
nuclear@0
|
321 //! Default constructor
|
nuclear@0
|
322 Texture()
|
nuclear@0
|
323 : mOffsetU (0.0f)
|
nuclear@0
|
324 , mOffsetV (0.0f)
|
nuclear@0
|
325 , mScaleU (1.0f)
|
nuclear@0
|
326 , mScaleV (1.0f)
|
nuclear@0
|
327 , mRotation (0.0f)
|
nuclear@0
|
328 , mMapMode (aiTextureMapMode_Wrap)
|
nuclear@0
|
329 , iUVSrc (0)
|
nuclear@0
|
330 {
|
nuclear@0
|
331 mTextureBlend = get_qnan();
|
nuclear@0
|
332 }
|
nuclear@0
|
333
|
nuclear@0
|
334 //! Specifies the blend factor for the texture
|
nuclear@0
|
335 float mTextureBlend;
|
nuclear@0
|
336
|
nuclear@0
|
337 //! Specifies the filename of the texture
|
nuclear@0
|
338 std::string mMapName;
|
nuclear@0
|
339
|
nuclear@0
|
340 //! Specifies texture coordinate offsets/scaling/rotations
|
nuclear@0
|
341 float mOffsetU;
|
nuclear@0
|
342 float mOffsetV;
|
nuclear@0
|
343 float mScaleU;
|
nuclear@0
|
344 float mScaleV;
|
nuclear@0
|
345 float mRotation;
|
nuclear@0
|
346
|
nuclear@0
|
347 //! Specifies the mapping mode to be used for the texture
|
nuclear@0
|
348 aiTextureMapMode mMapMode;
|
nuclear@0
|
349
|
nuclear@0
|
350 //! Used internally
|
nuclear@0
|
351 bool bPrivate;
|
nuclear@0
|
352 int iUVSrc;
|
nuclear@0
|
353 };
|
nuclear@0
|
354
|
nuclear@0
|
355 #include "assimp/Compiler/poppack1.h"
|
nuclear@0
|
356
|
nuclear@0
|
357 // ---------------------------------------------------------------------------
|
nuclear@0
|
358 /** Helper structure representing a 3ds material */
|
nuclear@0
|
359 struct Material
|
nuclear@0
|
360 {
|
nuclear@0
|
361 //! Default constructor. Builds a default name for the material
|
nuclear@0
|
362 Material()
|
nuclear@0
|
363 :
|
nuclear@0
|
364 mDiffuse (0.6f,0.6f,0.6f), // FIX ... we won't want object to be black
|
nuclear@0
|
365 mSpecularExponent (0.0f),
|
nuclear@0
|
366 mShininessStrength (1.0f),
|
nuclear@0
|
367 mShading(Discreet3DS::Gouraud),
|
nuclear@0
|
368 mTransparency (1.0f),
|
nuclear@0
|
369 mBumpHeight (1.0f),
|
nuclear@0
|
370 mTwoSided (false)
|
nuclear@0
|
371 {
|
nuclear@0
|
372 static int iCnt = 0;
|
nuclear@0
|
373
|
nuclear@0
|
374 char szTemp[128];
|
nuclear@0
|
375 sprintf(szTemp,"UNNAMED_%i",iCnt++);
|
nuclear@0
|
376 mName = szTemp;
|
nuclear@0
|
377 }
|
nuclear@0
|
378
|
nuclear@0
|
379 //! Name of the material
|
nuclear@0
|
380 std::string mName;
|
nuclear@0
|
381 //! Diffuse color of the material
|
nuclear@0
|
382 aiColor3D mDiffuse;
|
nuclear@0
|
383 //! Specular exponent
|
nuclear@0
|
384 float mSpecularExponent;
|
nuclear@0
|
385 //! Shininess strength, in percent
|
nuclear@0
|
386 float mShininessStrength;
|
nuclear@0
|
387 //! Specular color of the material
|
nuclear@0
|
388 aiColor3D mSpecular;
|
nuclear@0
|
389 //! Ambient color of the material
|
nuclear@0
|
390 aiColor3D mAmbient;
|
nuclear@0
|
391 //! Shading type to be used
|
nuclear@0
|
392 Discreet3DS::shadetype3ds mShading;
|
nuclear@0
|
393 //! Opacity of the material
|
nuclear@0
|
394 float mTransparency;
|
nuclear@0
|
395 //! Diffuse texture channel
|
nuclear@0
|
396 Texture sTexDiffuse;
|
nuclear@0
|
397 //! Opacity texture channel
|
nuclear@0
|
398 Texture sTexOpacity;
|
nuclear@0
|
399 //! Specular texture channel
|
nuclear@0
|
400 Texture sTexSpecular;
|
nuclear@0
|
401 //! Reflective texture channel
|
nuclear@0
|
402 Texture sTexReflective;
|
nuclear@0
|
403 //! Bump texture channel
|
nuclear@0
|
404 Texture sTexBump;
|
nuclear@0
|
405 //! Emissive texture channel
|
nuclear@0
|
406 Texture sTexEmissive;
|
nuclear@0
|
407 //! Shininess texture channel
|
nuclear@0
|
408 Texture sTexShininess;
|
nuclear@0
|
409 //! Scaling factor for the bump values
|
nuclear@0
|
410 float mBumpHeight;
|
nuclear@0
|
411 //! Emissive color
|
nuclear@0
|
412 aiColor3D mEmissive;
|
nuclear@0
|
413 //! Ambient texture channel
|
nuclear@0
|
414 //! (used by the ASE format)
|
nuclear@0
|
415 Texture sTexAmbient;
|
nuclear@0
|
416 //! True if the material must be rendered from two sides
|
nuclear@0
|
417 bool mTwoSided;
|
nuclear@0
|
418 };
|
nuclear@0
|
419
|
nuclear@0
|
420 // ---------------------------------------------------------------------------
|
nuclear@0
|
421 /** Helper structure to represent a 3ds file mesh */
|
nuclear@0
|
422 struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
|
nuclear@0
|
423 {
|
nuclear@0
|
424 //! Default constructor
|
nuclear@0
|
425 Mesh()
|
nuclear@0
|
426 {
|
nuclear@0
|
427 static int iCnt = 0;
|
nuclear@0
|
428
|
nuclear@0
|
429 // Generate a default name for the mesh
|
nuclear@0
|
430 char szTemp[128];
|
nuclear@0
|
431 ::sprintf(szTemp,"UNNAMED_%i",iCnt++);
|
nuclear@0
|
432 mName = szTemp;
|
nuclear@0
|
433 }
|
nuclear@0
|
434
|
nuclear@0
|
435 //! Name of the mesh
|
nuclear@0
|
436 std::string mName;
|
nuclear@0
|
437
|
nuclear@0
|
438 //! Texture coordinates
|
nuclear@0
|
439 std::vector<aiVector3D> mTexCoords;
|
nuclear@0
|
440
|
nuclear@0
|
441 //! Face materials
|
nuclear@0
|
442 std::vector<unsigned int> mFaceMaterials;
|
nuclear@0
|
443
|
nuclear@0
|
444 //! Local transformation matrix
|
nuclear@0
|
445 aiMatrix4x4 mMat;
|
nuclear@0
|
446 };
|
nuclear@0
|
447
|
nuclear@0
|
448 // ---------------------------------------------------------------------------
|
nuclear@0
|
449 /** Float key - quite similar to aiVectorKey and aiQuatKey. Both are in the
|
nuclear@0
|
450 C-API, so it would be difficult to make them a template. */
|
nuclear@0
|
451 struct aiFloatKey
|
nuclear@0
|
452 {
|
nuclear@0
|
453 double mTime; ///< The time of this key
|
nuclear@0
|
454 float mValue; ///< The value of this key
|
nuclear@0
|
455
|
nuclear@0
|
456 #ifdef __cplusplus
|
nuclear@0
|
457
|
nuclear@0
|
458 // time is not compared
|
nuclear@0
|
459 bool operator == (const aiFloatKey& o) const
|
nuclear@0
|
460 {return o.mValue == this->mValue;}
|
nuclear@0
|
461
|
nuclear@0
|
462 bool operator != (const aiFloatKey& o) const
|
nuclear@0
|
463 {return o.mValue != this->mValue;}
|
nuclear@0
|
464
|
nuclear@0
|
465 // Only time is compared. This operator is defined
|
nuclear@0
|
466 // for use with std::sort
|
nuclear@0
|
467 bool operator < (const aiFloatKey& o) const
|
nuclear@0
|
468 {return mTime < o.mTime;}
|
nuclear@0
|
469
|
nuclear@0
|
470 bool operator > (const aiFloatKey& o) const
|
nuclear@0
|
471 {return mTime < o.mTime;}
|
nuclear@0
|
472
|
nuclear@0
|
473 #endif
|
nuclear@0
|
474 };
|
nuclear@0
|
475
|
nuclear@0
|
476 // ---------------------------------------------------------------------------
|
nuclear@0
|
477 /** Helper structure to represent a 3ds file node */
|
nuclear@0
|
478 struct Node
|
nuclear@0
|
479 {
|
nuclear@0
|
480 Node()
|
nuclear@0
|
481
|
nuclear@0
|
482 : mHierarchyPos (0)
|
nuclear@0
|
483 , mHierarchyIndex (0)
|
nuclear@0
|
484
|
nuclear@0
|
485 {
|
nuclear@0
|
486 static int iCnt = 0;
|
nuclear@0
|
487
|
nuclear@0
|
488 // Generate a default name for the node
|
nuclear@0
|
489 char szTemp[128];
|
nuclear@0
|
490 ::sprintf(szTemp,"UNNAMED_%i",iCnt++);
|
nuclear@0
|
491 mName = szTemp;
|
nuclear@0
|
492
|
nuclear@0
|
493 aRotationKeys.reserve (20);
|
nuclear@0
|
494 aPositionKeys.reserve (20);
|
nuclear@0
|
495 aScalingKeys.reserve (20);
|
nuclear@0
|
496 }
|
nuclear@0
|
497
|
nuclear@0
|
498 ~Node()
|
nuclear@0
|
499 {
|
nuclear@0
|
500 for (unsigned int i = 0; i < mChildren.size();++i)
|
nuclear@0
|
501 delete mChildren[i];
|
nuclear@0
|
502 }
|
nuclear@0
|
503
|
nuclear@0
|
504 //! Pointer to the parent node
|
nuclear@0
|
505 Node* mParent;
|
nuclear@0
|
506
|
nuclear@0
|
507 //! Holds all child nodes
|
nuclear@0
|
508 std::vector<Node*> mChildren;
|
nuclear@0
|
509
|
nuclear@0
|
510 //! Name of the node
|
nuclear@0
|
511 std::string mName;
|
nuclear@0
|
512
|
nuclear@0
|
513 //! Dummy nodes: real name to be combined with the $$$DUMMY
|
nuclear@0
|
514 std::string mDummyName;
|
nuclear@0
|
515
|
nuclear@0
|
516 //! Position of the node in the hierarchy (tree depth)
|
nuclear@0
|
517 int16_t mHierarchyPos;
|
nuclear@0
|
518
|
nuclear@0
|
519 //! Index of the node
|
nuclear@0
|
520 int16_t mHierarchyIndex;
|
nuclear@0
|
521
|
nuclear@0
|
522 //! Rotation keys loaded from the file
|
nuclear@0
|
523 std::vector<aiQuatKey> aRotationKeys;
|
nuclear@0
|
524
|
nuclear@0
|
525 //! Position keys loaded from the file
|
nuclear@0
|
526 std::vector<aiVectorKey> aPositionKeys;
|
nuclear@0
|
527
|
nuclear@0
|
528 //! Scaling keys loaded from the file
|
nuclear@0
|
529 std::vector<aiVectorKey> aScalingKeys;
|
nuclear@0
|
530
|
nuclear@0
|
531
|
nuclear@0
|
532 // For target lights (spot lights and directional lights):
|
nuclear@0
|
533 // The position of the target
|
nuclear@0
|
534 std::vector< aiVectorKey > aTargetPositionKeys;
|
nuclear@0
|
535
|
nuclear@0
|
536 // For cameras: the camera roll angle
|
nuclear@0
|
537 std::vector< aiFloatKey > aCameraRollKeys;
|
nuclear@0
|
538
|
nuclear@0
|
539 //! Pivot position loaded from the file
|
nuclear@0
|
540 aiVector3D vPivot;
|
nuclear@0
|
541
|
nuclear@0
|
542 //! Add a child node, setup the right parent node for it
|
nuclear@0
|
543 //! \param pc Node to be 'adopted'
|
nuclear@0
|
544 inline Node& push_back(Node* pc)
|
nuclear@0
|
545 {
|
nuclear@0
|
546 mChildren.push_back(pc);
|
nuclear@0
|
547 pc->mParent = this;
|
nuclear@0
|
548 return *this;
|
nuclear@0
|
549 }
|
nuclear@0
|
550 };
|
nuclear@0
|
551 // ---------------------------------------------------------------------------
|
nuclear@0
|
552 /** Helper structure analogue to aiScene */
|
nuclear@0
|
553 struct Scene
|
nuclear@0
|
554 {
|
nuclear@0
|
555 //! List of all materials loaded
|
nuclear@0
|
556 //! NOTE: 3ds references materials globally
|
nuclear@0
|
557 std::vector<Material> mMaterials;
|
nuclear@0
|
558
|
nuclear@0
|
559 //! List of all meshes loaded
|
nuclear@0
|
560 std::vector<Mesh> mMeshes;
|
nuclear@0
|
561
|
nuclear@0
|
562 //! List of all cameras loaded
|
nuclear@0
|
563 std::vector<aiCamera*> mCameras;
|
nuclear@0
|
564
|
nuclear@0
|
565 //! List of all lights loaded
|
nuclear@0
|
566 std::vector<aiLight*> mLights;
|
nuclear@0
|
567
|
nuclear@0
|
568 //! Pointer to the root node of the scene
|
nuclear@0
|
569 // --- moved to main class
|
nuclear@0
|
570 // Node* pcRootNode;
|
nuclear@0
|
571 };
|
nuclear@0
|
572
|
nuclear@0
|
573
|
nuclear@0
|
574 } // end of namespace D3DS
|
nuclear@0
|
575 } // end of namespace Assimp
|
nuclear@0
|
576
|
nuclear@0
|
577 #endif // AI_XFILEHELPER_H_INC
|