domCOLLADA.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. /*
  2. * Copyright 2006 Sony Computer Entertainment Inc.
  3. *
  4. * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this
  5. * file except in compliance with the License. You may obtain a copy of the License at:
  6. * http://research.scea.com/scea_shared_source_license.html
  7. *
  8. * Unless required by applicable law or agreed to in writing, software distributed under the License
  9. * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10. * implied. See the License for the specific language governing permissions and limitations under the
  11. * License.
  12. */
  13. #ifndef __domCOLLADA_h__
  14. #define __domCOLLADA_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domAsset.h>
  19. #include <dom/domLibrary_animations.h>
  20. #include <dom/domLibrary_animation_clips.h>
  21. #include <dom/domLibrary_cameras.h>
  22. #include <dom/domLibrary_controllers.h>
  23. #include <dom/domLibrary_geometries.h>
  24. #include <dom/domLibrary_effects.h>
  25. #include <dom/domLibrary_force_fields.h>
  26. #include <dom/domLibrary_images.h>
  27. #include <dom/domLibrary_lights.h>
  28. #include <dom/domLibrary_materials.h>
  29. #include <dom/domLibrary_nodes.h>
  30. #include <dom/domLibrary_physics_materials.h>
  31. #include <dom/domLibrary_physics_models.h>
  32. #include <dom/domLibrary_physics_scenes.h>
  33. #include <dom/domLibrary_visual_scenes.h>
  34. #include <dom/domExtra.h>
  35. #include <dom/domInstanceWithExtra.h>
  36. class DAE;
  37. /**
  38. * The COLLADA element declares the root of the document that comprises some
  39. * of the content in the COLLADA schema.
  40. */
  41. class domCOLLADA : public daeElement
  42. {
  43. public:
  44. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::COLLADA; }
  45. static daeInt ID() { return 602; }
  46. virtual daeInt typeID() const { return ID(); }
  47. public:
  48. class domScene;
  49. typedef daeSmartRef<domScene> domSceneRef;
  50. typedef daeTArray<domSceneRef> domScene_Array;
  51. /**
  52. * The scene embodies the entire set of information that can be visualized
  53. * from the contents of a COLLADA resource. The scene element declares the
  54. * base of the scene hierarchy or scene graph. The scene contains elements
  55. * that comprise much of the visual and transformational information content
  56. * as created by the authoring tools.
  57. */
  58. class domScene : public daeElement
  59. {
  60. public:
  61. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::SCENE; }
  62. static daeInt ID() { return 603; }
  63. virtual daeInt typeID() const { return ID(); }
  64. protected: // Elements
  65. /**
  66. * The instance_physics_scene element declares the instantiation of a COLLADA
  67. * physics_scene resource. The instance_physics_scene element may appear any
  68. * number of times. @see domInstance_physics_scene
  69. */
  70. domInstanceWithExtra_Array elemInstance_physics_scene_array;
  71. /**
  72. * The instance_visual_scene element declares the instantiation of a COLLADA
  73. * visual_scene resource. The instance_visual_scene element may only appear
  74. * once. @see domInstance_visual_scene
  75. */
  76. domInstanceWithExtraRef elemInstance_visual_scene;
  77. /**
  78. * The extra element may appear any number of times. @see domExtra
  79. */
  80. domExtra_Array elemExtra_array;
  81. public: //Accessors and Mutators
  82. /**
  83. * Gets the instance_physics_scene element array.
  84. * @return Returns a reference to the array of instance_physics_scene elements.
  85. */
  86. domInstanceWithExtra_Array &getInstance_physics_scene_array() { return elemInstance_physics_scene_array; }
  87. /**
  88. * Gets the instance_physics_scene element array.
  89. * @return Returns a constant reference to the array of instance_physics_scene elements.
  90. */
  91. const domInstanceWithExtra_Array &getInstance_physics_scene_array() const { return elemInstance_physics_scene_array; }
  92. /**
  93. * Gets the instance_visual_scene element.
  94. * @return a daeSmartRef to the instance_visual_scene element.
  95. */
  96. const domInstanceWithExtraRef getInstance_visual_scene() const { return elemInstance_visual_scene; }
  97. /**
  98. * Gets the extra element array.
  99. * @return Returns a reference to the array of extra elements.
  100. */
  101. domExtra_Array &getExtra_array() { return elemExtra_array; }
  102. /**
  103. * Gets the extra element array.
  104. * @return Returns a constant reference to the array of extra elements.
  105. */
  106. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  107. protected:
  108. /**
  109. * Constructor
  110. */
  111. domScene(DAE& dae) : daeElement(dae), elemInstance_physics_scene_array(), elemInstance_visual_scene(), elemExtra_array() {}
  112. /**
  113. * Destructor
  114. */
  115. virtual ~domScene() {}
  116. /**
  117. * Overloaded assignment operator
  118. */
  119. virtual domScene &operator=( const domScene &cpy ) { (void)cpy; return *this; }
  120. public: // STATIC METHODS
  121. /**
  122. * Creates an instance of this class and returns a daeElementRef referencing it.
  123. * @return a daeElementRef referencing an instance of this object.
  124. */
  125. static DLLSPEC daeElementRef create(DAE& dae);
  126. /**
  127. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  128. * If a daeMetaElement already exists it will return that instead of creating a new one.
  129. * @return A daeMetaElement describing this COLLADA element.
  130. */
  131. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  132. };
  133. protected: // Attributes
  134. /**
  135. * This element may specify its own xmlns.
  136. */
  137. xsAnyURI attrXmlns;
  138. /**
  139. * The version attribute is the COLLADA schema revision with which the instance
  140. * document conforms. Required Attribute.
  141. */
  142. domVersionType attrVersion;
  143. /**
  144. * The xml:base attribute allows you to define the base URI for this COLLADA
  145. * document. See http://www.w3.org/TR/xmlbase/ for more information.
  146. */
  147. xsAnyURI attrXml_base;
  148. protected: // Elements
  149. /**
  150. * The COLLADA element must contain an asset element. @see domAsset
  151. */
  152. domAssetRef elemAsset;
  153. /**
  154. * The COLLADA element may contain any number of library_animations elements.
  155. * @see domLibrary_animations
  156. */
  157. domLibrary_animations_Array elemLibrary_animations_array;
  158. /**
  159. * The COLLADA element may contain any number of library_animation_clips
  160. * elements. @see domLibrary_animation_clips
  161. */
  162. domLibrary_animation_clips_Array elemLibrary_animation_clips_array;
  163. /**
  164. * The COLLADA element may contain any number of library_cameras elements.
  165. * @see domLibrary_cameras
  166. */
  167. domLibrary_cameras_Array elemLibrary_cameras_array;
  168. /**
  169. * The COLLADA element may contain any number of library_controllerss elements.
  170. * @see domLibrary_controllers
  171. */
  172. domLibrary_controllers_Array elemLibrary_controllers_array;
  173. /**
  174. * The COLLADA element may contain any number of library_geometriess elements.
  175. * @see domLibrary_geometries
  176. */
  177. domLibrary_geometries_Array elemLibrary_geometries_array;
  178. /**
  179. * The COLLADA element may contain any number of library_effects elements.
  180. * @see domLibrary_effects
  181. */
  182. domLibrary_effects_Array elemLibrary_effects_array;
  183. /**
  184. * The COLLADA element may contain any number of library_force_fields elements.
  185. * @see domLibrary_force_fields
  186. */
  187. domLibrary_force_fields_Array elemLibrary_force_fields_array;
  188. /**
  189. * The COLLADA element may contain any number of library_images elements.
  190. * @see domLibrary_images
  191. */
  192. domLibrary_images_Array elemLibrary_images_array;
  193. /**
  194. * The COLLADA element may contain any number of library_lights elements.
  195. * @see domLibrary_lights
  196. */
  197. domLibrary_lights_Array elemLibrary_lights_array;
  198. /**
  199. * The COLLADA element may contain any number of library_materials elements.
  200. * @see domLibrary_materials
  201. */
  202. domLibrary_materials_Array elemLibrary_materials_array;
  203. /**
  204. * The COLLADA element may contain any number of library_nodes elements.
  205. * @see domLibrary_nodes
  206. */
  207. domLibrary_nodes_Array elemLibrary_nodes_array;
  208. /**
  209. * The COLLADA element may contain any number of library_materials elements.
  210. * @see domLibrary_physics_materials
  211. */
  212. domLibrary_physics_materials_Array elemLibrary_physics_materials_array;
  213. /**
  214. * The COLLADA element may contain any number of library_physics_models elements.
  215. * @see domLibrary_physics_models
  216. */
  217. domLibrary_physics_models_Array elemLibrary_physics_models_array;
  218. /**
  219. * The COLLADA element may contain any number of library_physics_scenes elements.
  220. * @see domLibrary_physics_scenes
  221. */
  222. domLibrary_physics_scenes_Array elemLibrary_physics_scenes_array;
  223. /**
  224. * The COLLADA element may contain any number of library_visual_scenes elements.
  225. * @see domLibrary_visual_scenes
  226. */
  227. domLibrary_visual_scenes_Array elemLibrary_visual_scenes_array;
  228. /**
  229. * The scene embodies the entire set of information that can be visualized
  230. * from the contents of a COLLADA resource. The scene element declares the
  231. * base of the scene hierarchy or scene graph. The scene contains elements
  232. * that comprise much of the visual and transformational information content
  233. * as created by the authoring tools. @see domScene
  234. */
  235. domSceneRef elemScene;
  236. /**
  237. * The extra element may appear any number of times. @see domExtra
  238. */
  239. domExtra_Array elemExtra_array;
  240. /**
  241. * Used to preserve order in elements that do not specify strict sequencing of sub-elements.
  242. */
  243. daeElementRefArray _contents;
  244. /**
  245. * Used to preserve order in elements that have a complex content model.
  246. */
  247. daeUIntArray _contentsOrder;
  248. /**
  249. * Used to store information needed for some content model objects.
  250. */
  251. daeTArray< daeCharArray * > _CMData;
  252. public: //Accessors and Mutators
  253. /**
  254. * Gets the xmlns attribute.
  255. * @return Returns a xsAnyURI reference of the xmlns attribute.
  256. */
  257. xsAnyURI &getXmlns() { return attrXmlns; }
  258. /**
  259. * Gets the xmlns attribute.
  260. * @return Returns a constant xsAnyURI reference of the xmlns attribute.
  261. */
  262. const xsAnyURI &getXmlns() const { return attrXmlns; }
  263. /**
  264. * Sets the xmlns attribute.
  265. * @param xmlns The new value for the xmlns attribute.
  266. */
  267. void setXmlns( const xsAnyURI &xmlns ) { attrXmlns = xmlns;
  268. _validAttributeArray[0] = true; }
  269. /**
  270. * Gets the version attribute.
  271. * @return Returns a domVersionType of the version attribute.
  272. */
  273. domVersionType getVersion() const { return attrVersion; }
  274. /**
  275. * Sets the version attribute.
  276. * @param atVersion The new value for the version attribute.
  277. */
  278. void setVersion( domVersionType atVersion ) { attrVersion = atVersion; _validAttributeArray[1] = true; }
  279. /**
  280. * Gets the xml_base attribute.
  281. * @return Returns a xsAnyURI reference of the xml_base attribute.
  282. */
  283. xsAnyURI &getXml_base() { return attrXml_base; }
  284. /**
  285. * Gets the xml_base attribute.
  286. * @return Returns a constant xsAnyURI reference of the xml_base attribute.
  287. */
  288. const xsAnyURI &getXml_base() const { return attrXml_base; }
  289. /**
  290. * Sets the xml_base attribute.
  291. * @param atXml_base The new value for the xml_base attribute.
  292. */
  293. void setXml_base( const xsAnyURI &atXml_base ) { attrXml_base = atXml_base; _validAttributeArray[2] = true; }
  294. /**
  295. * Sets the xml_base attribute.
  296. * @param atXml_base The new value for the xml_base attribute.
  297. */
  298. void setXml_base( xsString atXml_base ) { attrXml_base = atXml_base; _validAttributeArray[2] = true; }
  299. /**
  300. * Gets the asset element.
  301. * @return a daeSmartRef to the asset element.
  302. */
  303. const domAssetRef getAsset() const { return elemAsset; }
  304. /**
  305. * Gets the library_animations element array.
  306. * @return Returns a reference to the array of library_animations elements.
  307. */
  308. domLibrary_animations_Array &getLibrary_animations_array() { return elemLibrary_animations_array; }
  309. /**
  310. * Gets the library_animations element array.
  311. * @return Returns a constant reference to the array of library_animations elements.
  312. */
  313. const domLibrary_animations_Array &getLibrary_animations_array() const { return elemLibrary_animations_array; }
  314. /**
  315. * Gets the library_animation_clips element array.
  316. * @return Returns a reference to the array of library_animation_clips elements.
  317. */
  318. domLibrary_animation_clips_Array &getLibrary_animation_clips_array() { return elemLibrary_animation_clips_array; }
  319. /**
  320. * Gets the library_animation_clips element array.
  321. * @return Returns a constant reference to the array of library_animation_clips elements.
  322. */
  323. const domLibrary_animation_clips_Array &getLibrary_animation_clips_array() const { return elemLibrary_animation_clips_array; }
  324. /**
  325. * Gets the library_cameras element array.
  326. * @return Returns a reference to the array of library_cameras elements.
  327. */
  328. domLibrary_cameras_Array &getLibrary_cameras_array() { return elemLibrary_cameras_array; }
  329. /**
  330. * Gets the library_cameras element array.
  331. * @return Returns a constant reference to the array of library_cameras elements.
  332. */
  333. const domLibrary_cameras_Array &getLibrary_cameras_array() const { return elemLibrary_cameras_array; }
  334. /**
  335. * Gets the library_controllers element array.
  336. * @return Returns a reference to the array of library_controllers elements.
  337. */
  338. domLibrary_controllers_Array &getLibrary_controllers_array() { return elemLibrary_controllers_array; }
  339. /**
  340. * Gets the library_controllers element array.
  341. * @return Returns a constant reference to the array of library_controllers elements.
  342. */
  343. const domLibrary_controllers_Array &getLibrary_controllers_array() const { return elemLibrary_controllers_array; }
  344. /**
  345. * Gets the library_geometries element array.
  346. * @return Returns a reference to the array of library_geometries elements.
  347. */
  348. domLibrary_geometries_Array &getLibrary_geometries_array() { return elemLibrary_geometries_array; }
  349. /**
  350. * Gets the library_geometries element array.
  351. * @return Returns a constant reference to the array of library_geometries elements.
  352. */
  353. const domLibrary_geometries_Array &getLibrary_geometries_array() const { return elemLibrary_geometries_array; }
  354. /**
  355. * Gets the library_effects element array.
  356. * @return Returns a reference to the array of library_effects elements.
  357. */
  358. domLibrary_effects_Array &getLibrary_effects_array() { return elemLibrary_effects_array; }
  359. /**
  360. * Gets the library_effects element array.
  361. * @return Returns a constant reference to the array of library_effects elements.
  362. */
  363. const domLibrary_effects_Array &getLibrary_effects_array() const { return elemLibrary_effects_array; }
  364. /**
  365. * Gets the library_force_fields element array.
  366. * @return Returns a reference to the array of library_force_fields elements.
  367. */
  368. domLibrary_force_fields_Array &getLibrary_force_fields_array() { return elemLibrary_force_fields_array; }
  369. /**
  370. * Gets the library_force_fields element array.
  371. * @return Returns a constant reference to the array of library_force_fields elements.
  372. */
  373. const domLibrary_force_fields_Array &getLibrary_force_fields_array() const { return elemLibrary_force_fields_array; }
  374. /**
  375. * Gets the library_images element array.
  376. * @return Returns a reference to the array of library_images elements.
  377. */
  378. domLibrary_images_Array &getLibrary_images_array() { return elemLibrary_images_array; }
  379. /**
  380. * Gets the library_images element array.
  381. * @return Returns a constant reference to the array of library_images elements.
  382. */
  383. const domLibrary_images_Array &getLibrary_images_array() const { return elemLibrary_images_array; }
  384. /**
  385. * Gets the library_lights element array.
  386. * @return Returns a reference to the array of library_lights elements.
  387. */
  388. domLibrary_lights_Array &getLibrary_lights_array() { return elemLibrary_lights_array; }
  389. /**
  390. * Gets the library_lights element array.
  391. * @return Returns a constant reference to the array of library_lights elements.
  392. */
  393. const domLibrary_lights_Array &getLibrary_lights_array() const { return elemLibrary_lights_array; }
  394. /**
  395. * Gets the library_materials element array.
  396. * @return Returns a reference to the array of library_materials elements.
  397. */
  398. domLibrary_materials_Array &getLibrary_materials_array() { return elemLibrary_materials_array; }
  399. /**
  400. * Gets the library_materials element array.
  401. * @return Returns a constant reference to the array of library_materials elements.
  402. */
  403. const domLibrary_materials_Array &getLibrary_materials_array() const { return elemLibrary_materials_array; }
  404. /**
  405. * Gets the library_nodes element array.
  406. * @return Returns a reference to the array of library_nodes elements.
  407. */
  408. domLibrary_nodes_Array &getLibrary_nodes_array() { return elemLibrary_nodes_array; }
  409. /**
  410. * Gets the library_nodes element array.
  411. * @return Returns a constant reference to the array of library_nodes elements.
  412. */
  413. const domLibrary_nodes_Array &getLibrary_nodes_array() const { return elemLibrary_nodes_array; }
  414. /**
  415. * Gets the library_physics_materials element array.
  416. * @return Returns a reference to the array of library_physics_materials elements.
  417. */
  418. domLibrary_physics_materials_Array &getLibrary_physics_materials_array() { return elemLibrary_physics_materials_array; }
  419. /**
  420. * Gets the library_physics_materials element array.
  421. * @return Returns a constant reference to the array of library_physics_materials elements.
  422. */
  423. const domLibrary_physics_materials_Array &getLibrary_physics_materials_array() const { return elemLibrary_physics_materials_array; }
  424. /**
  425. * Gets the library_physics_models element array.
  426. * @return Returns a reference to the array of library_physics_models elements.
  427. */
  428. domLibrary_physics_models_Array &getLibrary_physics_models_array() { return elemLibrary_physics_models_array; }
  429. /**
  430. * Gets the library_physics_models element array.
  431. * @return Returns a constant reference to the array of library_physics_models elements.
  432. */
  433. const domLibrary_physics_models_Array &getLibrary_physics_models_array() const { return elemLibrary_physics_models_array; }
  434. /**
  435. * Gets the library_physics_scenes element array.
  436. * @return Returns a reference to the array of library_physics_scenes elements.
  437. */
  438. domLibrary_physics_scenes_Array &getLibrary_physics_scenes_array() { return elemLibrary_physics_scenes_array; }
  439. /**
  440. * Gets the library_physics_scenes element array.
  441. * @return Returns a constant reference to the array of library_physics_scenes elements.
  442. */
  443. const domLibrary_physics_scenes_Array &getLibrary_physics_scenes_array() const { return elemLibrary_physics_scenes_array; }
  444. /**
  445. * Gets the library_visual_scenes element array.
  446. * @return Returns a reference to the array of library_visual_scenes elements.
  447. */
  448. domLibrary_visual_scenes_Array &getLibrary_visual_scenes_array() { return elemLibrary_visual_scenes_array; }
  449. /**
  450. * Gets the library_visual_scenes element array.
  451. * @return Returns a constant reference to the array of library_visual_scenes elements.
  452. */
  453. const domLibrary_visual_scenes_Array &getLibrary_visual_scenes_array() const { return elemLibrary_visual_scenes_array; }
  454. /**
  455. * Gets the scene element.
  456. * @return a daeSmartRef to the scene element.
  457. */
  458. const domSceneRef getScene() const { return elemScene; }
  459. /**
  460. * Gets the extra element array.
  461. * @return Returns a reference to the array of extra elements.
  462. */
  463. domExtra_Array &getExtra_array() { return elemExtra_array; }
  464. /**
  465. * Gets the extra element array.
  466. * @return Returns a constant reference to the array of extra elements.
  467. */
  468. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  469. /**
  470. * Gets the _contents array.
  471. * @return Returns a reference to the _contents element array.
  472. */
  473. daeElementRefArray &getContents() { return _contents; }
  474. /**
  475. * Gets the _contents array.
  476. * @return Returns a constant reference to the _contents element array.
  477. */
  478. const daeElementRefArray &getContents() const { return _contents; }
  479. protected:
  480. /**
  481. * Constructor
  482. */
  483. domCOLLADA(DAE& dae) : daeElement(dae), attrXmlns(dae, *this), attrVersion(), attrXml_base(dae, *this), elemAsset(), elemLibrary_animations_array(), elemLibrary_animation_clips_array(), elemLibrary_cameras_array(), elemLibrary_controllers_array(), elemLibrary_geometries_array(), elemLibrary_effects_array(), elemLibrary_force_fields_array(), elemLibrary_images_array(), elemLibrary_lights_array(), elemLibrary_materials_array(), elemLibrary_nodes_array(), elemLibrary_physics_materials_array(), elemLibrary_physics_models_array(), elemLibrary_physics_scenes_array(), elemLibrary_visual_scenes_array(), elemScene(), elemExtra_array() {}
  484. /**
  485. * Destructor
  486. */
  487. virtual ~domCOLLADA() { daeElement::deleteCMDataArray(_CMData); }
  488. /**
  489. * Overloaded assignment operator
  490. */
  491. virtual domCOLLADA &operator=( const domCOLLADA &cpy ) { (void)cpy; return *this; }
  492. public: // STATIC METHODS
  493. /**
  494. * Creates an instance of this class and returns a daeElementRef referencing it.
  495. * @return a daeElementRef referencing an instance of this object.
  496. */
  497. static DLLSPEC daeElementRef create(DAE& dae);
  498. /**
  499. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  500. * If a daeMetaElement already exists it will return that instead of creating a new one.
  501. * @return A daeMetaElement describing this COLLADA element.
  502. */
  503. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  504. };
  505. #endif