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