BlenderScene.h 24 KB

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