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