vrshoot

view libs/assimp/BlenderScene.h @ 2:334d17aed7de

visual studio project files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 18:36:38 +0200
parents
children
line source
1 /*
2 Open Asset Import Library (assimp)
3 ----------------------------------------------------------------------
5 Copyright (c) 2006-2012, assimp team
6 All rights reserved.
8 Redistribution and use of this software in source and binary forms,
9 with or without modification, are permitted provided that the
10 following conditions are met:
12 * Redistributions of source code must retain the above
13 copyright notice, this list of conditions and the
14 following disclaimer.
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the
18 following disclaimer in the documentation and/or other
19 materials provided with the distribution.
21 * Neither the name of the assimp team, nor the names of its
22 contributors may be used to endorse or promote products
23 derived from this software without specific prior
24 written permission of the assimp team.
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ----------------------------------------------------------------------
39 */
41 /** @file BlenderScene.h
42 * @brief Intermediate representation of a BLEND scene.
43 */
44 #ifndef INCLUDED_AI_BLEND_SCENE_H
45 #define INCLUDED_AI_BLEND_SCENE_H
47 namespace Assimp {
48 namespace Blender {
50 // Minor parts of this file are extracts from blender data structures,
51 // declared in the ./source/blender/makesdna directory.
52 // Stuff that is not used by Assimp is commented.
55 // NOTE
56 // this file serves as input data to the `./scripts/genblenddna.py`
57 // script. This script generates the actual binding code to read a
58 // blender file with a possibly different DNA into our structures.
59 // Only `struct` declarations are considered and the following
60 // rules must be obeyed in order for the script to work properly:
61 //
62 // * C++ style comments only
63 //
64 // * Structures may include the primitive types char, int, short,
65 // float, double. Signedness specifiers are not allowed on
66 // integers. Enum types are allowed, but they must have been
67 // defined in this header.
68 //
69 // * Structures may aggregate other structures, unless not defined
70 // in this header.
71 //
72 // * Pointers to other structures or primitive types are allowed.
73 // No references or double pointers or arrays of pointers.
74 // A pointer to a T is normally written as boost::shared_ptr, while a
75 // pointer to an array of elements is written as boost::
76 // shared_array. To avoid cyclic pointers, use raw pointers in
77 // one direction.
78 //
79 // * Arrays can have maximally two-dimensions. Any non-pointer
80 // type can form them.
81 //
82 // * Multiple fields can be declare in a single line (i.e `int a,b;`)
83 // provided they are neither pointers nor arrays.
84 //
85 // * One of WARN, FAIL can be appended to the declaration (
86 // prior to the semiolon to specifiy the error handling policy if
87 // this field is missing in the input DNA). If none of those
88 // is specified the default policy is to subtitute a default
89 // value for the field.
90 //
92 #define WARN // warn if field is missing, substitute default value
93 #define FAIL // fail the import if the field does not exist
95 struct Object;
96 struct MTex;
97 struct Image;
99 #define AI_BLEND_MESH_MAX_VERTS 2000000000L
101 // -------------------------------------------------------------------------------
102 struct ID : ElemBase {
104 char name[24] WARN;
105 short flag;
106 };
108 // -------------------------------------------------------------------------------
109 struct ListBase : ElemBase {
111 boost::shared_ptr<ElemBase> first;
112 boost::shared_ptr<ElemBase> last;
113 };
116 // -------------------------------------------------------------------------------
117 struct PackedFile : ElemBase {
118 int size WARN;
119 int seek WARN;
120 boost::shared_ptr< FileOffset > data WARN;
121 };
123 // -------------------------------------------------------------------------------
124 struct GroupObject : ElemBase {
126 boost::shared_ptr<GroupObject> prev,next FAIL;
127 boost::shared_ptr<Object> ob;
128 };
130 // -------------------------------------------------------------------------------
131 struct Group : ElemBase {
132 ID id FAIL;
133 int layer;
135 boost::shared_ptr<GroupObject> gobject;
136 };
138 // -------------------------------------------------------------------------------
139 struct World : ElemBase {
140 ID id FAIL;
142 };
144 // -------------------------------------------------------------------------------
145 struct MVert : ElemBase {
146 float co[3] FAIL;
147 float no[3] FAIL;
148 char flag;
149 int mat_nr WARN;
150 int bweight;
151 };
153 // -------------------------------------------------------------------------------
154 struct MEdge : ElemBase {
155 int v1, v2 FAIL;
156 char crease, bweight;
157 short flag;
158 };
160 // -------------------------------------------------------------------------------
161 struct MLoop : ElemBase {
162 int v, e;
163 };
165 // -------------------------------------------------------------------------------
166 struct MLoopUV : ElemBase {
167 float uv[2];
168 int flag;
169 };
171 // -------------------------------------------------------------------------------
172 // Note that red and blue are not swapped, as with MCol
173 struct MLoopCol : ElemBase {
174 char r, g, b, a;
175 };
177 // -------------------------------------------------------------------------------
178 struct MPoly : ElemBase {
179 int loopstart;
180 int totloop;
181 short mat_nr;
182 char flag;
183 };
185 // -------------------------------------------------------------------------------
186 struct MTexPoly : ElemBase {
187 Image* tpage;
188 char flag, transp;
189 short mode, tile, pad;
190 };
192 // -------------------------------------------------------------------------------
193 struct MCol : ElemBase {
194 char r,g,b,a FAIL;
195 };
197 // -------------------------------------------------------------------------------
198 struct MFace : ElemBase {
199 int v1,v2,v3,v4 FAIL;
200 int mat_nr FAIL;
201 char flag;
202 };
204 // -------------------------------------------------------------------------------
205 struct TFace : ElemBase {
206 float uv[4][2] FAIL;
207 int col[4] FAIL;
208 char flag;
209 short mode;
210 short tile;
211 short unwrap;
212 };
214 // -------------------------------------------------------------------------------
215 struct MTFace : ElemBase {
217 float uv[4][2] FAIL;
218 char flag;
219 short mode;
220 short tile;
221 short unwrap;
223 // boost::shared_ptr<Image> tpage;
224 };
226 // -------------------------------------------------------------------------------
227 struct MDeformWeight : ElemBase {
228 int def_nr FAIL;
229 float weight FAIL;
230 };
232 // -------------------------------------------------------------------------------
233 struct MDeformVert : ElemBase {
235 vector<MDeformWeight> dw WARN;
236 int totweight;
237 };
239 // -------------------------------------------------------------------------------
240 struct Material : ElemBase {
241 ID id FAIL;
243 float r,g,b WARN;
244 float specr,specg,specb WARN;
245 short har;
246 float ambr,ambg,ambb WARN;
247 float mirr,mirg,mirb;
248 float emit WARN;
249 float alpha WARN;
250 float ref;
251 float translucency;
252 float roughness;
253 float darkness;
254 float refrac;
256 boost::shared_ptr<Group> group;
258 short diff_shader WARN;
259 short spec_shader WARN;
261 boost::shared_ptr<MTex> mtex[18];
262 };
264 // -------------------------------------------------------------------------------
265 struct Mesh : ElemBase {
266 ID id FAIL;
268 int totface FAIL;
269 int totedge FAIL;
270 int totvert FAIL;
271 int totloop;
272 int totpoly;
274 short subdiv;
275 short subdivr;
276 short subsurftype;
277 short smoothresh;
279 vector<MFace> mface FAIL;
280 vector<MTFace> mtface;
281 vector<TFace> tface;
282 vector<MVert> mvert FAIL;
283 vector<MEdge> medge WARN;
284 vector<MLoop> mloop;
285 vector<MLoopUV> mloopuv;
286 vector<MLoopCol> mloopcol;
287 vector<MPoly> mpoly;
288 vector<MTexPoly> mtpoly;
289 vector<MDeformVert> dvert;
290 vector<MCol> mcol;
292 vector< boost::shared_ptr<Material> > mat FAIL;
293 };
295 // -------------------------------------------------------------------------------
296 struct Library : ElemBase {
297 ID id FAIL;
299 char name[240] WARN;
300 char filename[240] FAIL;
301 boost::shared_ptr<Library> parent WARN;
302 };
304 // -------------------------------------------------------------------------------
305 struct Camera : ElemBase {
306 enum Type {
307 Type_PERSP = 0
308 ,Type_ORTHO = 1
309 };
311 ID id FAIL;
313 // struct AnimData *adt;
315 Type type,flag WARN;
316 float angle WARN;
317 //float passepartalpha, angle;
318 //float clipsta, clipend;
319 //float lens, ortho_scale, drawsize;
320 //float shiftx, shifty;
322 //float YF_dofdist, YF_aperture;
323 //short YF_bkhtype, YF_bkhbias;
324 //float YF_bkhrot;
325 };
328 // -------------------------------------------------------------------------------
329 struct Lamp : ElemBase {
331 enum FalloffType {
332 FalloffType_Constant = 0x0
333 ,FalloffType_InvLinear = 0x1
334 ,FalloffType_InvSquare = 0x2
335 //,FalloffType_Curve = 0x3
336 //,FalloffType_Sliders = 0x4
337 };
339 enum Type {
340 Type_Local = 0x0
341 ,Type_Sun = 0x1
342 ,Type_Spot = 0x2
343 ,Type_Hemi = 0x3
344 ,Type_Area = 0x4
345 //,Type_YFPhoton = 0x5
346 };
348 ID id FAIL;
349 //AnimData *adt;
351 Type type FAIL;
352 short flags;
354 //int mode;
356 short colormodel, totex;
357 float r,g,b,k WARN;
358 //float shdwr, shdwg, shdwb;
360 float energy, dist, spotsize, spotblend;
361 //float haint;
363 float att1, att2;
364 //struct CurveMapping *curfalloff;
365 FalloffType falloff_type;
367 //float clipsta, clipend, shadspotsize;
368 //float bias, soft, compressthresh;
369 //short bufsize, samp, buffers, filtertype;
370 //char bufflag, buftype;
372 //short ray_samp, ray_sampy, ray_sampz;
373 //short ray_samp_type;
374 //short area_shape;
375 //float area_size, area_sizey, area_sizez;
376 //float adapt_thresh;
377 //short ray_samp_method;
379 //short texact, shadhalostep;
381 //short sun_effect_type;
382 //short skyblendtype;
383 //float horizon_brightness;
384 //float spread;
385 float sun_brightness;
386 //float sun_size;
387 //float backscattered_light;
388 //float sun_intensity;
389 //float atm_turbidity;
390 //float atm_inscattering_factor;
391 //float atm_extinction_factor;
392 //float atm_distance_factor;
393 //float skyblendfac;
394 //float sky_exposure;
395 //short sky_colorspace;
397 // int YF_numphotons, YF_numsearch;
398 // short YF_phdepth, YF_useqmc, YF_bufsize, YF_pad;
399 // float YF_causticblur, YF_ltradius;
401 // float YF_glowint, YF_glowofs;
402 // short YF_glowtype, YF_pad2;
404 //struct Ipo *ipo;
405 //struct MTex *mtex[18];
406 // short pr_texture;
408 //struct PreviewImage *preview;
409 };
411 // -------------------------------------------------------------------------------
412 struct ModifierData : ElemBase {
413 enum ModifierType {
414 eModifierType_None = 0,
415 eModifierType_Subsurf,
416 eModifierType_Lattice,
417 eModifierType_Curve,
418 eModifierType_Build,
419 eModifierType_Mirror,
420 eModifierType_Decimate,
421 eModifierType_Wave,
422 eModifierType_Armature,
423 eModifierType_Hook,
424 eModifierType_Softbody,
425 eModifierType_Boolean,
426 eModifierType_Array,
427 eModifierType_EdgeSplit,
428 eModifierType_Displace,
429 eModifierType_UVProject,
430 eModifierType_Smooth,
431 eModifierType_Cast,
432 eModifierType_MeshDeform,
433 eModifierType_ParticleSystem,
434 eModifierType_ParticleInstance,
435 eModifierType_Explode,
436 eModifierType_Cloth,
437 eModifierType_Collision,
438 eModifierType_Bevel,
439 eModifierType_Shrinkwrap,
440 eModifierType_Fluidsim,
441 eModifierType_Mask,
442 eModifierType_SimpleDeform,
443 eModifierType_Multires,
444 eModifierType_Surface,
445 eModifierType_Smoke,
446 eModifierType_ShapeKey
447 };
449 boost::shared_ptr<ElemBase> next WARN;
450 boost::shared_ptr<ElemBase> prev WARN;
452 int type, mode;
453 char name[32];
454 };
456 // -------------------------------------------------------------------------------
457 struct SubsurfModifierData : ElemBase {
459 enum Type {
461 TYPE_CatmullClarke = 0x0,
462 TYPE_Simple = 0x1
463 };
465 enum Flags {
466 // some omitted
467 FLAGS_SubsurfUV =1<<3
468 };
470 ModifierData modifier FAIL;
471 short subdivType WARN;
472 short levels FAIL;
473 short renderLevels ;
474 short flags;
475 };
477 // -------------------------------------------------------------------------------
478 struct MirrorModifierData : ElemBase {
480 enum Flags {
481 Flags_CLIPPING =1<<0,
482 Flags_MIRROR_U =1<<1,
483 Flags_MIRROR_V =1<<2,
484 Flags_AXIS_X =1<<3,
485 Flags_AXIS_Y =1<<4,
486 Flags_AXIS_Z =1<<5,
487 Flags_VGROUP =1<<6
488 };
490 ModifierData modifier FAIL;
492 short axis, flag;
493 float tolerance;
494 boost::shared_ptr<Object> mirror_ob;
495 };
497 // -------------------------------------------------------------------------------
498 struct Object : ElemBase {
499 ID id FAIL;
501 enum Type {
502 Type_EMPTY = 0
503 ,Type_MESH = 1
504 ,Type_CURVE = 2
505 ,Type_SURF = 3
506 ,Type_FONT = 4
507 ,Type_MBALL = 5
509 ,Type_LAMP = 10
510 ,Type_CAMERA = 11
512 ,Type_WAVE = 21
513 ,Type_LATTICE = 22
514 };
516 Type type FAIL;
517 float obmat[4][4] WARN;
518 float parentinv[4][4] WARN;
519 char parsubstr[32] WARN;
521 Object* parent WARN;
522 boost::shared_ptr<Object> track WARN;
524 boost::shared_ptr<Object> proxy,proxy_from,proxy_group WARN;
525 boost::shared_ptr<Group> dup_group WARN;
526 boost::shared_ptr<ElemBase> data FAIL;
528 ListBase modifiers;
529 };
532 // -------------------------------------------------------------------------------
533 struct Base : ElemBase {
534 Base* prev WARN;
535 boost::shared_ptr<Base> next WARN;
536 boost::shared_ptr<Object> object WARN;
537 };
539 // -------------------------------------------------------------------------------
540 struct Scene : ElemBase {
541 ID id FAIL;
543 boost::shared_ptr<Object> camera WARN;
544 boost::shared_ptr<World> world WARN;
545 boost::shared_ptr<Base> basact WARN;
547 ListBase base;
548 };
551 // -------------------------------------------------------------------------------
552 struct Image : ElemBase {
553 ID id FAIL;
555 char name[240] WARN;
557 //struct anim *anim;
559 short ok, flag;
560 short source, type, pad, pad1;
561 int lastframe;
563 short tpageflag, totbind;
564 short xrep, yrep;
565 short twsta, twend;
566 //unsigned int bindcode;
567 //unsigned int *repbind;
569 boost::shared_ptr<PackedFile> packedfile;
570 //struct PreviewImage * preview;
572 float lastupdate;
573 int lastused;
574 short animspeed;
576 short gen_x, gen_y, gen_type;
577 };
579 // -------------------------------------------------------------------------------
580 struct Tex : ElemBase {
582 // actually, the only texture type we support is Type_IMAGE
583 enum Type {
584 Type_CLOUDS = 1
585 ,Type_WOOD = 2
586 ,Type_MARBLE = 3
587 ,Type_MAGIC = 4
588 ,Type_BLEND = 5
589 ,Type_STUCCI = 6
590 ,Type_NOISE = 7
591 ,Type_IMAGE = 8
592 ,Type_PLUGIN = 9
593 ,Type_ENVMAP = 10
594 ,Type_MUSGRAVE = 11
595 ,Type_VORONOI = 12
596 ,Type_DISTNOISE = 13
597 ,Type_POINTDENSITY = 14
598 ,Type_VOXELDATA = 15
599 };
601 ID id FAIL;
602 // AnimData *adt;
604 //float noisesize, turbul;
605 //float bright, contrast, rfac, gfac, bfac;
606 //float filtersize;
608 //float mg_H, mg_lacunarity, mg_octaves, mg_offset, mg_gain;
609 //float dist_amount, ns_outscale;
611 //float vn_w1;
612 //float vn_w2;
613 //float vn_w3;
614 //float vn_w4;
615 //float vn_mexp;
616 //short vn_distm, vn_coltype;
618 //short noisedepth, noisetype;
619 //short noisebasis, noisebasis2;
621 //short imaflag, flag;
622 Type type FAIL;
623 //short stype;
625 //float cropxmin, cropymin, cropxmax, cropymax;
626 //int texfilter;
627 //int afmax;
628 //short xrepeat, yrepeat;
629 //short extend;
631 //short fie_ima;
632 //int len;
633 //int frames, offset, sfra;
635 //float checkerdist, nabla;
636 //float norfac;
638 //ImageUser iuser;
640 //bNodeTree *nodetree;
641 //Ipo *ipo;
642 boost::shared_ptr<Image> ima WARN;
643 //PluginTex *plugin;
644 //ColorBand *coba;
645 //EnvMap *env;
646 //PreviewImage * preview;
647 //PointDensity *pd;
648 //VoxelData *vd;
650 //char use_nodes;
651 };
653 // -------------------------------------------------------------------------------
654 struct MTex : ElemBase {
656 enum Projection {
657 Proj_N = 0
658 ,Proj_X = 1
659 ,Proj_Y = 2
660 ,Proj_Z = 3
661 };
663 enum Flag {
664 Flag_RGBTOINT = 0x1
665 ,Flag_STENCIL = 0x2
666 ,Flag_NEGATIVE = 0x4
667 ,Flag_ALPHAMIX = 0x8
668 ,Flag_VIEWSPACE = 0x10
669 };
671 enum BlendType {
672 BlendType_BLEND = 0
673 ,BlendType_MUL = 1
674 ,BlendType_ADD = 2
675 ,BlendType_SUB = 3
676 ,BlendType_DIV = 4
677 ,BlendType_DARK = 5
678 ,BlendType_DIFF = 6
679 ,BlendType_LIGHT = 7
680 ,BlendType_SCREEN = 8
681 ,BlendType_OVERLAY = 9
682 ,BlendType_BLEND_HUE = 10
683 ,BlendType_BLEND_SAT = 11
684 ,BlendType_BLEND_VAL = 12
685 ,BlendType_BLEND_COLOR = 13
686 };
688 // short texco, mapto, maptoneg;
690 BlendType blendtype;
691 boost::shared_ptr<Object> object;
692 boost::shared_ptr<Tex> tex;
693 char uvname[32];
695 Projection projx,projy,projz;
696 char mapping;
697 float ofs[3], size[3], rot;
699 int texflag;
700 short colormodel, pmapto, pmaptoneg;
701 //short normapspace, which_output;
702 //char brush_map_mode;
703 float r,g,b,k WARN;
704 //float def_var, rt;
706 //float colfac, varfac;
708 //float norfac, dispfac, warpfac;
709 float colspecfac, mirrfac, alphafac;
710 float difffac, specfac, emitfac, hardfac;
711 //float raymirrfac, translfac, ambfac;
712 //float colemitfac, colreflfac, coltransfac;
713 //float densfac, scatterfac, reflfac;
715 //float timefac, lengthfac, clumpfac;
716 //float kinkfac, roughfac, padensfac;
717 //float lifefac, sizefac, ivelfac, pvelfac;
718 //float shadowfac;
719 //float zenupfac, zendownfac, blendfac;
720 };
723 }
724 }
725 #endif