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