Coverage Report

Created: 2025-08-26 06:41

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