/src/assimp/code/AssetLib/Blender/BlenderScene.h
Line | Count | Source |
1 | | /* |
2 | | Open Asset Import Library (assimp) |
3 | | ---------------------------------------------------------------------- |
4 | | |
5 | | Copyright (c) 2006-2025, assimp team |
6 | | |
7 | | All rights reserved. |
8 | | |
9 | | Redistribution and use of this software in source and binary forms, |
10 | | with or without modification, are permitted provided that the |
11 | | following 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 | | |
27 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
28 | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
29 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
30 | | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
31 | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
32 | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
33 | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
34 | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
35 | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
36 | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
37 | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
38 | | |
39 | | ---------------------------------------------------------------------- |
40 | | */ |
41 | | |
42 | | /** @file BlenderScene.h |
43 | | * @brief Intermediate representation of a BLEND scene. |
44 | | */ |
45 | | #ifndef INCLUDED_AI_BLEND_SCENE_H |
46 | | #define INCLUDED_AI_BLEND_SCENE_H |
47 | | |
48 | | #include "BlenderDNA.h" |
49 | | |
50 | | namespace Assimp::Blender { |
51 | | |
52 | | // Minor parts of this file are extracts from blender data structures, |
53 | | // declared in the ./source/blender/makesdna directory. |
54 | | // Stuff that is not used by Assimp is commented. |
55 | | |
56 | | // NOTE |
57 | | // this file serves as input data to the `./scripts/genblenddna.py` |
58 | | // script. This script generates the actual binding code to read a |
59 | | // blender file with a possibly different DNA into our structures. |
60 | | // Only `struct` declarations are considered and the following |
61 | | // rules must be obeyed in order for the script to work properly: |
62 | | // |
63 | | // * C++ style comments only |
64 | | // |
65 | | // * Structures may include the primitive types char, int, short, |
66 | | // float, double. Signed specifiers are not allowed on |
67 | | // integers. Enum types are allowed, but they must have been |
68 | | // defined in this header. |
69 | | // |
70 | | // * Structures may aggregate other structures, unless not defined |
71 | | // in this header. |
72 | | // |
73 | | // * Pointers to other structures or primitive types are allowed. |
74 | | // No references or double pointers or arrays of pointers. |
75 | | // A pointer to a T is normally written as std::shared_ptr, while a |
76 | | // pointer to an array of elements is written as boost:: |
77 | | // shared_array. To avoid cyclic pointers, use raw pointers in |
78 | | // one direction. |
79 | | // |
80 | | // * Arrays can have maximally two-dimensions. Any non-pointer |
81 | | // type can form them. |
82 | | // |
83 | | // * Multiple fields can be declare in a single line (i.e `int a,b;`) |
84 | | // provided they are neither pointers nor arrays. |
85 | | // |
86 | | // * One of WARN, FAIL can be appended to the declaration ( |
87 | | // prior to the semicolon to specify the error handling policy if |
88 | | // this field is missing in the input DNA). If none of those |
89 | | // is specified the default policy is to substitute a default |
90 | | // value for the field. |
91 | | // |
92 | | |
93 | | // warn if field is missing, substitute default value |
94 | | #ifdef WARN |
95 | | #undef WARN |
96 | | #endif |
97 | | #define WARN |
98 | | |
99 | | // fail the import if the field does not exist |
100 | | #ifdef FAIL |
101 | | #undef FAIL |
102 | | #endif |
103 | | #define FAIL |
104 | | |
105 | | struct Object; |
106 | | struct MTex; |
107 | | struct Image; |
108 | | struct Collection; |
109 | | |
110 | | #include <memory> |
111 | | |
112 | | #define AI_BLEND_MESH_MAX_VERTS 2000000000L |
113 | | |
114 | | static const size_t MaxNameLen = 1024; |
115 | | |
116 | | // ------------------------------------------------------------------------------- |
117 | | struct ID final : ElemBase { |
118 | | char name[MaxNameLen] WARN; |
119 | | short flag; |
120 | | }; |
121 | | |
122 | | // ------------------------------------------------------------------------------- |
123 | | struct ListBase final : ElemBase { |
124 | | std::shared_ptr<ElemBase> first; |
125 | | std::weak_ptr<ElemBase> last; |
126 | | }; |
127 | | |
128 | | // ------------------------------------------------------------------------------- |
129 | | struct PackedFile final : ElemBase { |
130 | | int size WARN; |
131 | | int seek WARN; |
132 | | std::shared_ptr<FileOffset> data WARN; |
133 | | }; |
134 | | |
135 | | // ------------------------------------------------------------------------------- |
136 | | struct GroupObject final : ElemBase { |
137 | | std::shared_ptr<GroupObject> prev, next FAIL; |
138 | | std::shared_ptr<Object> ob; |
139 | | }; |
140 | | |
141 | | // ------------------------------------------------------------------------------- |
142 | | struct Group final : ElemBase { |
143 | | ID id FAIL; |
144 | | int layer; |
145 | | |
146 | | std::shared_ptr<GroupObject> gobject; |
147 | | }; |
148 | | |
149 | | // ------------------------------------------------------------------------------- |
150 | | struct CollectionObject final : ElemBase { |
151 | | //CollectionObject* prev; |
152 | | std::shared_ptr<CollectionObject> next; |
153 | | Object *ob; |
154 | | }; |
155 | | |
156 | | // ------------------------------------------------------------------------------- |
157 | | struct CollectionChild final : ElemBase { |
158 | | std::shared_ptr<CollectionChild> next, prev; |
159 | | std::shared_ptr<Collection> collection; |
160 | | }; |
161 | | |
162 | | // ------------------------------------------------------------------------------- |
163 | | struct Collection final : ElemBase { |
164 | | ID id FAIL; |
165 | | ListBase gobject; // CollectionObject |
166 | | ListBase children; // CollectionChild |
167 | | }; |
168 | | |
169 | | // ------------------------------------------------------------------------------- |
170 | | struct World final : ElemBase { |
171 | | ID id FAIL; |
172 | | }; |
173 | | |
174 | | // ------------------------------------------------------------------------------- |
175 | | struct MVert final : ElemBase { |
176 | | float co[3] FAIL; |
177 | | float no[3] FAIL; // read as short and divided through / 32767.f |
178 | | char flag; |
179 | | int mat_nr WARN; |
180 | | int bweight; |
181 | | |
182 | | MVert() : |
183 | 0 | flag(0), mat_nr(0), bweight(0) {} |
184 | | }; |
185 | | |
186 | | // ------------------------------------------------------------------------------- |
187 | | struct MEdge final : ElemBase { |
188 | | int v1, v2 FAIL; |
189 | | char crease, bweight; |
190 | | short flag; |
191 | | }; |
192 | | |
193 | | // ------------------------------------------------------------------------------- |
194 | | struct MLoop final : ElemBase { |
195 | | int v, e; |
196 | | }; |
197 | | |
198 | | // ------------------------------------------------------------------------------- |
199 | | struct MLoopUV final : ElemBase { |
200 | | float uv[2]; |
201 | | int flag; |
202 | | }; |
203 | | |
204 | | // ------------------------------------------------------------------------------- |
205 | | // Note that red and blue are not swapped, as with MCol |
206 | | struct MLoopCol final : ElemBase { |
207 | | unsigned char r, g, b, a; |
208 | | }; |
209 | | |
210 | | // ------------------------------------------------------------------------------- |
211 | | struct MPoly final : ElemBase { |
212 | | int loopstart; |
213 | | int totloop; |
214 | | short mat_nr; |
215 | | char flag; |
216 | | }; |
217 | | |
218 | | // ------------------------------------------------------------------------------- |
219 | | struct MTexPoly final : ElemBase { |
220 | | Image *tpage; |
221 | | char flag, transp; |
222 | | short mode, tile, pad; |
223 | | }; |
224 | | |
225 | | // ------------------------------------------------------------------------------- |
226 | | struct MCol final : ElemBase { |
227 | | char r, g, b, a FAIL; |
228 | | }; |
229 | | |
230 | | // ------------------------------------------------------------------------------- |
231 | | struct MFace final : ElemBase { |
232 | | int v1, v2, v3, v4 FAIL; |
233 | | int mat_nr FAIL; |
234 | | char flag; |
235 | | }; |
236 | | |
237 | | // ------------------------------------------------------------------------------- |
238 | | struct TFace final : ElemBase { |
239 | | float uv[4][2] FAIL; |
240 | | int col[4] FAIL; |
241 | | char flag; |
242 | | short mode; |
243 | | short tile; |
244 | | short unwrap; |
245 | | }; |
246 | | |
247 | | // ------------------------------------------------------------------------------- |
248 | | struct MTFace final : ElemBase { |
249 | | MTFace() : |
250 | 0 | flag(0), |
251 | 0 | mode(0), |
252 | 0 | tile(0), |
253 | 0 | unwrap(0) { |
254 | 0 | } |
255 | | |
256 | | float uv[4][2] FAIL; |
257 | | char flag; |
258 | | short mode; |
259 | | short tile; |
260 | | short unwrap; |
261 | | |
262 | | // std::shared_ptr<Image> tpage; |
263 | | }; |
264 | | |
265 | | // ------------------------------------------------------------------------------- |
266 | | struct MDeformWeight final : ElemBase { |
267 | | int def_nr FAIL; |
268 | | float weight FAIL; |
269 | | }; |
270 | | |
271 | | // ------------------------------------------------------------------------------- |
272 | | struct MDeformVert final : ElemBase { |
273 | | vector<MDeformWeight> dw WARN; |
274 | | int totweight; |
275 | | }; |
276 | | |
277 | | // ------------------------------------------------------------------------------- |
278 | | constexpr uint32_t MA_RAYMIRROR = 0x40000; |
279 | | constexpr uint32_t MA_TRANSPARENCY = 0x10000; |
280 | | constexpr uint32_t MA_RAYTRANSP = 0x20000; |
281 | | constexpr uint32_t MA_ZTRANSP = 0x00040; |
282 | | |
283 | | struct Material final : ElemBase { |
284 | | ID id FAIL; |
285 | | |
286 | | float r, g, b WARN; |
287 | | float specr, specg, specb WARN; |
288 | | short har; |
289 | | float ambr, ambg, ambb WARN; |
290 | | float mirr, mirg, mirb; |
291 | | float emit WARN; |
292 | | float ray_mirror; |
293 | | float alpha WARN; |
294 | | float ref; |
295 | | float translucency; |
296 | | int mode; |
297 | | float roughness; |
298 | | float darkness; |
299 | | float refrac; |
300 | | |
301 | | float amb; |
302 | | float ang; |
303 | | float spectra; |
304 | | float spec; |
305 | | float zoffs; |
306 | | float add; |
307 | | float fresnel_mir; |
308 | | float fresnel_mir_i; |
309 | | float fresnel_tra; |
310 | | float fresnel_tra_i; |
311 | | float filter; |
312 | | float tx_limit; |
313 | | float tx_falloff; |
314 | | float gloss_mir; |
315 | | float gloss_tra; |
316 | | float adapt_thresh_mir; |
317 | | float adapt_thresh_tra; |
318 | | float aniso_gloss_mir; |
319 | | float dist_mir; |
320 | | float hasize; |
321 | | float flaresize; |
322 | | float subsize; |
323 | | float flareboost; |
324 | | float strand_sta; |
325 | | float strand_end; |
326 | | float strand_ease; |
327 | | float strand_surfnor; |
328 | | float strand_min; |
329 | | float strand_widthfade; |
330 | | float sbias; |
331 | | float lbias; |
332 | | float shad_alpha; |
333 | | float param; |
334 | | float rms; |
335 | | float rampfac_col; |
336 | | float rampfac_spec; |
337 | | float friction; |
338 | | float fh; |
339 | | float reflect; |
340 | | float fhdist; |
341 | | float xyfrict; |
342 | | float sss_radius; |
343 | | float sss_col; |
344 | | float sss_error; |
345 | | float sss_scale; |
346 | | float sss_ior; |
347 | | float sss_colfac; |
348 | | float sss_texfac; |
349 | | float sss_front; |
350 | | float sss_back; |
351 | | |
352 | | short material_type; |
353 | | short flag; |
354 | | short ray_depth; |
355 | | short ray_depth_tra; |
356 | | short samp_gloss_mir; |
357 | | short samp_gloss_tra; |
358 | | short fadeto_mir; |
359 | | short shade_flag; |
360 | | short flarec; |
361 | | short starc; |
362 | | short linec; |
363 | | short ringc; |
364 | | short pr_lamp; |
365 | | short pr_texture; |
366 | | short ml_flag; |
367 | | short texco; |
368 | | short mapto; |
369 | | short ramp_show; |
370 | | short pad3; |
371 | | short dynamode; |
372 | | short pad2; |
373 | | short sss_flag; |
374 | | short sss_preset; |
375 | | short shadowonly_flag; |
376 | | short index; |
377 | | short vcol_alpha; |
378 | | short pad4; |
379 | | |
380 | | char seed1; |
381 | | char seed2; |
382 | | |
383 | | std::shared_ptr<Group> group; |
384 | | |
385 | | short diff_shader WARN; |
386 | | short spec_shader WARN; |
387 | | |
388 | | std::shared_ptr<MTex> mtex[18]; |
389 | | }; |
390 | | |
391 | | /* |
392 | | CustomDataLayer 104 |
393 | | |
394 | | int type 0 4 |
395 | | int offset 4 4 |
396 | | int flag 8 4 |
397 | | int active 12 4 |
398 | | int active_rnd 16 4 |
399 | | int active_clone 20 4 |
400 | | int active_mask 24 4 |
401 | | int uid 28 4 |
402 | | char name 32 64 |
403 | | void *data 96 8 |
404 | | */ |
405 | | struct CustomDataLayer final : ElemBase { |
406 | | int type; |
407 | | int offset; |
408 | | int flag; |
409 | | int active; |
410 | | int active_rnd; |
411 | | int active_clone; |
412 | | int active_mask; |
413 | | int uid; |
414 | | char name[64]; |
415 | | std::shared_ptr<ElemBase> data; // must be converted to real type according type member |
416 | | |
417 | | CustomDataLayer() : |
418 | 0 | type(0), |
419 | 0 | offset(0), |
420 | 0 | flag(0), |
421 | 0 | active(0), |
422 | 0 | active_rnd(0), |
423 | 0 | active_clone(0), |
424 | 0 | active_mask(0), |
425 | 0 | uid(0), |
426 | 0 | data(nullptr) { |
427 | 0 | memset(name, 0, sizeof name); |
428 | 0 | } |
429 | | }; |
430 | | |
431 | | /* |
432 | | CustomData 208 |
433 | | |
434 | | CustomDataLayer *layers 0 8 |
435 | | int typemap 8 168 |
436 | | int pad_i1 176 4 |
437 | | int totlayer 180 4 |
438 | | int maxlayer 184 4 |
439 | | int totsize 188 4 |
440 | | BLI_mempool *pool 192 8 |
441 | | CustomDataExternal *external 200 8 |
442 | | */ |
443 | | struct CustomData final : ElemBase { |
444 | | vector<std::shared_ptr<struct CustomDataLayer>> layers; |
445 | | int typemap[42]; // CD_NUMTYPES |
446 | | int totlayer; |
447 | | int maxlayer; |
448 | | int totsize; |
449 | | /* |
450 | | std::shared_ptr<BLI_mempool> pool; |
451 | | std::shared_ptr<CustomDataExternal> external; |
452 | | */ |
453 | | }; |
454 | | |
455 | | // ------------------------------------------------------------------------------- |
456 | | struct Mesh final : ElemBase { |
457 | | ID id FAIL; |
458 | | |
459 | | int totface FAIL; |
460 | | int totedge FAIL; |
461 | | int totvert FAIL; |
462 | | int totloop; |
463 | | int totpoly; |
464 | | |
465 | | short subdiv; |
466 | | short subdivr; |
467 | | short subsurftype; |
468 | | short smoothresh; |
469 | | |
470 | | vector<MFace> mface FAIL; |
471 | | vector<MTFace> mtface; |
472 | | vector<TFace> tface; |
473 | | vector<MVert> mvert FAIL; |
474 | | vector<MEdge> medge WARN; |
475 | | vector<MLoop> mloop; |
476 | | vector<MLoopUV> mloopuv; |
477 | | vector<MLoopCol> mloopcol; |
478 | | vector<MPoly> mpoly; |
479 | | vector<MTexPoly> mtpoly; |
480 | | vector<MDeformVert> dvert; |
481 | | vector<MCol> mcol; |
482 | | |
483 | | vector<std::shared_ptr<Material>> mat FAIL; |
484 | | |
485 | | struct CustomData vdata; |
486 | | struct CustomData edata; |
487 | | struct CustomData fdata; |
488 | | struct CustomData pdata; |
489 | | struct CustomData ldata; |
490 | | }; |
491 | | |
492 | | // ------------------------------------------------------------------------------- |
493 | | struct Library final : ElemBase { |
494 | | ID id FAIL; |
495 | | |
496 | | char name[240] WARN; |
497 | | char filename[240] FAIL; |
498 | | std::shared_ptr<Library> parent WARN; |
499 | | }; |
500 | | |
501 | | // ------------------------------------------------------------------------------- |
502 | | struct Camera : ElemBase { |
503 | | enum Type { |
504 | | Type_PERSP = 0, |
505 | | Type_ORTHO = 1 |
506 | | }; |
507 | | |
508 | | ID id FAIL; |
509 | | |
510 | | Type type, flag WARN; |
511 | | float lens WARN; |
512 | | float sensor_x WARN; |
513 | | float clipsta, clipend; |
514 | | }; |
515 | | |
516 | | // ------------------------------------------------------------------------------- |
517 | | struct Lamp final : ElemBase { |
518 | | |
519 | | enum FalloffType { |
520 | | FalloffType_Constant = 0x0, |
521 | | FalloffType_InvLinear = 0x1, |
522 | | FalloffType_InvSquare = 0x2 |
523 | | //,FalloffType_Curve = 0x3 |
524 | | //,FalloffType_Sliders = 0x4 |
525 | | }; |
526 | | |
527 | | enum Type { |
528 | | Type_Local = 0x0, |
529 | | Type_Sun = 0x1, |
530 | | Type_Spot = 0x2, |
531 | | Type_Hemi = 0x3, |
532 | | Type_Area = 0x4 |
533 | | //,Type_YFPhoton = 0x5 |
534 | | }; |
535 | | |
536 | | ID id FAIL; |
537 | | //AnimData *adt; |
538 | | |
539 | | Type type FAIL; |
540 | | short flags; |
541 | | |
542 | | //int mode; |
543 | | |
544 | | short colormodel, totex; |
545 | | float r, g, b, k WARN; |
546 | | //float shdwr, shdwg, shdwb; |
547 | | |
548 | | float energy, dist, spotsize, spotblend; |
549 | | //float haint; |
550 | | |
551 | | float constant_coefficient; |
552 | | float linear_coefficient; |
553 | | float quadratic_coefficient; |
554 | | |
555 | | float att1, att2; |
556 | | //struct CurveMapping *curfalloff; |
557 | | FalloffType falloff_type; |
558 | | |
559 | | //float clipsta, clipend, shadspotsize; |
560 | | //float bias, soft, compressthresh; |
561 | | //short bufsize, samp, buffers, filtertype; |
562 | | //char bufflag, buftype; |
563 | | |
564 | | //short ray_samp, ray_sampy, ray_sampz; |
565 | | //short ray_samp_type; |
566 | | short area_shape; |
567 | | float area_size, area_sizey, area_sizez; |
568 | | //float adapt_thresh; |
569 | | //short ray_samp_method; |
570 | | |
571 | | //short texact, shadhalostep; |
572 | | |
573 | | //short sun_effect_type; |
574 | | //short skyblendtype; |
575 | | //float horizon_brightness; |
576 | | //float spread; |
577 | | float sun_brightness; |
578 | | //float sun_size; |
579 | | //float backscattered_light; |
580 | | //float sun_intensity; |
581 | | //float atm_turbidity; |
582 | | //float atm_inscattering_factor; |
583 | | //float atm_extinction_factor; |
584 | | //float atm_distance_factor; |
585 | | //float skyblendfac; |
586 | | //float sky_exposure; |
587 | | //short sky_colorspace; |
588 | | |
589 | | // int YF_numphotons, YF_numsearch; |
590 | | // short YF_phdepth, YF_useqmc, YF_bufsize, YF_pad; |
591 | | // float YF_causticblur, YF_ltradius; |
592 | | |
593 | | // float YF_glowint, YF_glowofs; |
594 | | // short YF_glowtype, YF_pad2; |
595 | | |
596 | | //struct Ipo *ipo; |
597 | | //struct MTex *mtex[18]; |
598 | | // short pr_texture; |
599 | | |
600 | | //struct PreviewImage *preview; |
601 | | }; |
602 | | |
603 | | // ------------------------------------------------------------------------------- |
604 | | struct ModifierData final : ElemBase { |
605 | | enum ModifierType { |
606 | | eModifierType_None = 0, |
607 | | eModifierType_Subsurf, |
608 | | eModifierType_Lattice, |
609 | | eModifierType_Curve, |
610 | | eModifierType_Build, |
611 | | eModifierType_Mirror, |
612 | | eModifierType_Decimate, |
613 | | eModifierType_Wave, |
614 | | eModifierType_Armature, |
615 | | eModifierType_Hook, |
616 | | eModifierType_Softbody, |
617 | | eModifierType_Boolean, |
618 | | eModifierType_Array, |
619 | | eModifierType_EdgeSplit, |
620 | | eModifierType_Displace, |
621 | | eModifierType_UVProject, |
622 | | eModifierType_Smooth, |
623 | | eModifierType_Cast, |
624 | | eModifierType_MeshDeform, |
625 | | eModifierType_ParticleSystem, |
626 | | eModifierType_ParticleInstance, |
627 | | eModifierType_Explode, |
628 | | eModifierType_Cloth, |
629 | | eModifierType_Collision, |
630 | | eModifierType_Bevel, |
631 | | eModifierType_Shrinkwrap, |
632 | | eModifierType_Fluidsim, |
633 | | eModifierType_Mask, |
634 | | eModifierType_SimpleDeform, |
635 | | eModifierType_Multires, |
636 | | eModifierType_Surface, |
637 | | eModifierType_Smoke, |
638 | | eModifierType_ShapeKey |
639 | | }; |
640 | | |
641 | | std::shared_ptr<ElemBase> next WARN; |
642 | | std::weak_ptr<ElemBase> prev WARN; |
643 | | |
644 | | int type, mode; |
645 | | char name[32]; |
646 | | }; |
647 | | |
648 | | |
649 | | // ------------------------------------------------------------------------------------------------ |
650 | | struct SharedModifierData : ElemBase { |
651 | | ModifierData modifier; |
652 | | }; |
653 | | |
654 | | // ------------------------------------------------------------------------------- |
655 | | struct SubsurfModifierData final : SharedModifierData { |
656 | | |
657 | | enum Type { |
658 | | |
659 | | TYPE_CatmullClarke = 0x0, |
660 | | TYPE_Simple = 0x1 |
661 | | }; |
662 | | |
663 | | enum Flags { |
664 | | // some omitted |
665 | | FLAGS_SubsurfUV = 1 << 3 |
666 | | }; |
667 | | |
668 | | short subdivType WARN; |
669 | | short levels FAIL; |
670 | | short renderLevels; |
671 | | short flags; |
672 | | }; |
673 | | |
674 | | // ------------------------------------------------------------------------------- |
675 | | struct MirrorModifierData final : SharedModifierData { |
676 | | |
677 | | enum Flags { |
678 | | Flags_CLIPPING = 1 << 0, |
679 | | Flags_MIRROR_U = 1 << 1, |
680 | | Flags_MIRROR_V = 1 << 2, |
681 | | Flags_AXIS_X = 1 << 3, |
682 | | Flags_AXIS_Y = 1 << 4, |
683 | | Flags_AXIS_Z = 1 << 5, |
684 | | Flags_VGROUP = 1 << 6 |
685 | | }; |
686 | | |
687 | | short axis, flag; |
688 | | float tolerance; |
689 | | std::weak_ptr<Object> mirror_ob; |
690 | | }; |
691 | | |
692 | | // ------------------------------------------------------------------------------- |
693 | | struct Object final : ElemBase { |
694 | | ID id FAIL; |
695 | | |
696 | | enum Type { |
697 | | Type_EMPTY = 0, |
698 | | Type_MESH = 1, |
699 | | Type_CURVE = 2, |
700 | | Type_SURF = 3, |
701 | | Type_FONT = 4, |
702 | | Type_MBALL = 5 |
703 | | |
704 | | , |
705 | | Type_LAMP = 10, |
706 | | Type_CAMERA = 11 |
707 | | |
708 | | , |
709 | | Type_WAVE = 21, |
710 | | Type_LATTICE = 22 |
711 | | }; |
712 | | |
713 | | Type type FAIL; |
714 | | float obmat[4][4] WARN; |
715 | | float parentinv[4][4] WARN; |
716 | | char parsubstr[32] WARN; |
717 | | |
718 | | Object *parent WARN; |
719 | | std::shared_ptr<Object> track WARN; |
720 | | |
721 | | std::shared_ptr<Object> proxy, proxy_from, proxy_group WARN; |
722 | | std::shared_ptr<Group> dup_group WARN; |
723 | | std::shared_ptr<ElemBase> data FAIL; |
724 | | |
725 | | ListBase modifiers; |
726 | | |
727 | | Object() : |
728 | 0 | type(Type_EMPTY), parent(nullptr) { |
729 | | // empty |
730 | 0 | } |
731 | | }; |
732 | | |
733 | | // ------------------------------------------------------------------------------- |
734 | | struct Base final : ElemBase { |
735 | | Base *prev WARN; |
736 | | std::shared_ptr<Base> next WARN; |
737 | | std::shared_ptr<Object> object WARN; |
738 | | |
739 | | Base() : |
740 | 0 | prev(nullptr) { |
741 | | // empty |
742 | 0 | } |
743 | | }; |
744 | | |
745 | | // ------------------------------------------------------------------------------- |
746 | | struct Scene final : ElemBase { |
747 | | ID id FAIL; |
748 | | |
749 | | std::shared_ptr<Object> camera WARN; |
750 | | std::shared_ptr<World> world WARN; |
751 | | std::shared_ptr<Base> basact WARN; |
752 | | std::shared_ptr<Collection> master_collection WARN; |
753 | | |
754 | | ListBase base; |
755 | | |
756 | 0 | Scene() = default; |
757 | | }; |
758 | | |
759 | | // ------------------------------------------------------------------------------- |
760 | | struct Image final : ElemBase { |
761 | | ID id FAIL; |
762 | | |
763 | | char name[240] WARN; |
764 | | |
765 | | //struct anim *anim; |
766 | | |
767 | | short ok, flag; |
768 | | short source, type, pad, pad1; |
769 | | int lastframe; |
770 | | |
771 | | short tpageflag, totbind; |
772 | | short xrep, yrep; |
773 | | short twsta, twend; |
774 | | //unsigned int bindcode; |
775 | | //unsigned int *repbind; |
776 | | |
777 | | std::shared_ptr<PackedFile> packedfile; |
778 | | //struct PreviewImage * preview; |
779 | | |
780 | | float lastupdate; |
781 | | int lastused; |
782 | | short animspeed; |
783 | | |
784 | | short gen_x, gen_y, gen_type; |
785 | | |
786 | 0 | Image() = default; |
787 | | }; |
788 | | |
789 | | // ------------------------------------------------------------------------------- |
790 | | struct Tex final : ElemBase { |
791 | | |
792 | | // actually, the only texture type we support is Type_IMAGE |
793 | | enum Type { |
794 | | Type_CLOUDS = 1, |
795 | | Type_WOOD = 2, |
796 | | Type_MARBLE = 3, |
797 | | Type_MAGIC = 4, |
798 | | Type_BLEND = 5, |
799 | | Type_STUCCI = 6, |
800 | | Type_NOISE = 7, |
801 | | Type_IMAGE = 8, |
802 | | Type_PLUGIN = 9, |
803 | | Type_ENVMAP = 10, |
804 | | Type_MUSGRAVE = 11, |
805 | | Type_VORONOI = 12, |
806 | | Type_DISTNOISE = 13, |
807 | | Type_POINTDENSITY = 14, |
808 | | Type_VOXELDATA = 15 |
809 | | }; |
810 | | |
811 | | enum ImageFlags { |
812 | | ImageFlags_INTERPOL = 1, |
813 | | ImageFlags_USEALPHA = 2, |
814 | | ImageFlags_MIPMAP = 4, |
815 | | ImageFlags_IMAROT = 16, |
816 | | ImageFlags_CALCALPHA = 32, |
817 | | ImageFlags_NORMALMAP = 2048, |
818 | | ImageFlags_GAUSS_MIP = 4096, |
819 | | ImageFlags_FILTER_MIN = 8192, |
820 | | ImageFlags_DERIVATIVEMAP = 16384 |
821 | | }; |
822 | | |
823 | | ID id FAIL; |
824 | | // AnimData *adt; |
825 | | |
826 | | //float noisesize, turbul; |
827 | | //float bright, contrast, rfac, gfac, bfac; |
828 | | //float filtersize; |
829 | | |
830 | | //float mg_H, mg_lacunarity, mg_octaves, mg_offset, mg_gain; |
831 | | //float dist_amount, ns_outscale; |
832 | | |
833 | | //float vn_w1; |
834 | | //float vn_w2; |
835 | | //float vn_w3; |
836 | | //float vn_w4; |
837 | | //float vn_mexp; |
838 | | //short vn_distm, vn_coltype; |
839 | | |
840 | | //short noisedepth, noisetype; |
841 | | //short noisebasis, noisebasis2; |
842 | | |
843 | | //short flag; |
844 | | ImageFlags imaflag; |
845 | | Type type FAIL; |
846 | | //short stype; |
847 | | |
848 | | //float cropxmin, cropymin, cropxmax, cropymax; |
849 | | //int texfilter; |
850 | | //int afmax; |
851 | | //short xrepeat, yrepeat; |
852 | | //short extend; |
853 | | |
854 | | //short fie_ima; |
855 | | //int len; |
856 | | //int frames, offset, sfra; |
857 | | |
858 | | //float checkerdist, nabla; |
859 | | //float norfac; |
860 | | |
861 | | //ImageUser iuser; |
862 | | |
863 | | //bNodeTree *nodetree; |
864 | | //Ipo *ipo; |
865 | | std::shared_ptr<Image> ima WARN; |
866 | | //PluginTex *plugin; |
867 | | //ColorBand *coba; |
868 | | //EnvMap *env; |
869 | | //PreviewImage * preview; |
870 | | //PointDensity *pd; |
871 | | //VoxelData *vd; |
872 | | |
873 | | //char use_nodes; |
874 | | |
875 | 0 | Tex() : imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS) { |
876 | | // empty |
877 | 0 | } |
878 | | }; |
879 | | |
880 | | // ------------------------------------------------------------------------------- |
881 | | struct MTex final : ElemBase { |
882 | | |
883 | | enum Projection { |
884 | | Proj_N = 0, |
885 | | Proj_X = 1, |
886 | | Proj_Y = 2, |
887 | | Proj_Z = 3 |
888 | | }; |
889 | | |
890 | | enum Flag { |
891 | | Flag_RGBTOINT = 0x1, |
892 | | Flag_STENCIL = 0x2, |
893 | | Flag_NEGATIVE = 0x4, |
894 | | Flag_ALPHAMIX = 0x8, |
895 | | Flag_VIEWSPACE = 0x10 |
896 | | }; |
897 | | |
898 | | enum BlendType { |
899 | | BlendType_BLEND = 0, |
900 | | BlendType_MUL = 1, |
901 | | BlendType_ADD = 2, |
902 | | BlendType_SUB = 3, |
903 | | BlendType_DIV = 4, |
904 | | BlendType_DARK = 5, |
905 | | BlendType_DIFF = 6, |
906 | | BlendType_LIGHT = 7, |
907 | | BlendType_SCREEN = 8, |
908 | | BlendType_OVERLAY = 9, |
909 | | BlendType_BLEND_HUE = 10, |
910 | | BlendType_BLEND_SAT = 11, |
911 | | BlendType_BLEND_VAL = 12, |
912 | | BlendType_BLEND_COLOR = 13 |
913 | | }; |
914 | | |
915 | | enum MapType { |
916 | | MapType_COL = 1, |
917 | | MapType_NORM = 2, |
918 | | MapType_COLSPEC = 4, |
919 | | MapType_COLMIR = 8, |
920 | | MapType_REF = 16, |
921 | | MapType_SPEC = 32, |
922 | | MapType_EMIT = 64, |
923 | | MapType_ALPHA = 128, |
924 | | MapType_HAR = 256, |
925 | | MapType_RAYMIRR = 512, |
926 | | MapType_TRANSLU = 1024, |
927 | | MapType_AMB = 2048, |
928 | | MapType_DISPLACE = 4096, |
929 | | MapType_WARP = 8192 |
930 | | }; |
931 | | |
932 | | // short texco, maptoneg; |
933 | | MapType mapto; |
934 | | |
935 | | BlendType blendtype; |
936 | | std::shared_ptr<Object> object; |
937 | | std::shared_ptr<Tex> tex; |
938 | | char uvname[32]; |
939 | | |
940 | | Projection projx, projy, projz; |
941 | | char mapping; |
942 | | float ofs[3], size[3], rot; |
943 | | |
944 | | int texflag; |
945 | | short colormodel, pmapto, pmaptoneg; |
946 | | //short normapspace, which_output; |
947 | | //char brush_map_mode; |
948 | | float r, g, b, k WARN; |
949 | | //float def_var, rt; |
950 | | |
951 | | //float colfac, varfac; |
952 | | |
953 | | float norfac; |
954 | | //float dispfac, warpfac; |
955 | | float colspecfac, mirrfac, alphafac; |
956 | | float difffac, specfac, emitfac, hardfac; |
957 | | //float raymirrfac, translfac, ambfac; |
958 | | //float colemitfac, colreflfac, coltransfac; |
959 | | //float densfac, scatterfac, reflfac; |
960 | | |
961 | | //float timefac, lengthfac, clumpfac; |
962 | | //float kinkfac, roughfac, padensfac; |
963 | | //float lifefac, sizefac, ivelfac, pvelfac; |
964 | | //float shadowfac; |
965 | | //float zenupfac, zendownfac, blendfac; |
966 | | |
967 | 0 | MTex() = default; |
968 | | }; |
969 | | |
970 | | } // namespace Assimp::Blender |
971 | | |
972 | | #endif |