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 __domCamera_h__ 10 #define __domCamera_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/domExtra.h> 18 #include <dom/domTechnique.h> 19 #include <dom/domTargetableFloat.h> 20 class DAE; 21 22 /** 23 * The camera element declares a view into the scene hierarchy or scene graph. 24 * The camera contains elements that describe the cameras optics and imager. 25 */ 26 class domCamera : public daeElement 27 { 28 public: 29 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::CAMERA; } 30 static daeInt ID() { return 645; } 31 virtual daeInt typeID() const { return ID(); } 32 public: 33 class domOptics; 34 35 typedef daeSmartRef<domOptics> domOpticsRef; 36 typedef daeTArray<domOpticsRef> domOptics_Array; 37 38 /** 39 * Optics represents the apparatus on a camera that projects the image onto 40 * the image sensor. 41 */ 42 class domOptics : public daeElement 43 { 44 public: 45 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::OPTICS; } 46 static daeInt ID() { return 646; } 47 virtual daeInt typeID() const { return ID(); } 48 public: 49 class domTechnique_common; 50 51 typedef daeSmartRef<domTechnique_common> domTechnique_commonRef; 52 typedef daeTArray<domTechnique_commonRef> domTechnique_common_Array; 53 54 /** 55 * The technique_common element specifies the optics information for the common 56 * profile which all COLLADA implementations need to support. 57 */ 58 class domTechnique_common : public daeElement 59 { 60 public: 61 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::TECHNIQUE_COMMON; } 62 static daeInt ID() { return 647; } 63 virtual daeInt typeID() const { return ID(); } 64 public: 65 class domOrthographic; 66 67 typedef daeSmartRef<domOrthographic> domOrthographicRef; 68 typedef daeTArray<domOrthographicRef> domOrthographic_Array; 69 70 /** 71 * The orthographic element describes the field of view of an orthographic 72 * camera. 73 */ 74 class domOrthographic : public daeElement 75 { 76 public: 77 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::ORTHOGRAPHIC; } 78 static daeInt ID() { return 648; } 79 virtual daeInt typeID() const { return ID(); } 80 81 protected: // Elements 82 /** 83 * The xmag element contains a floating point number describing the horizontal 84 * magnification of the view. @see domXmag 85 */ 86 domTargetableFloatRef elemXmag; 87 /** 88 * The ymag element contains a floating point number describing the vertical 89 * magnification of the view. It can also have a sid. @see domYmag 90 */ 91 domTargetableFloatRef elemYmag; 92 /** 93 * The aspect_ratio element contains a floating point number describing the 94 * aspect ratio of the field of view. If the aspect_ratio element is not 95 * present the aspect ratio is to be calculated from the xmag or ymag elements 96 * and the current viewport. @see domAspect_ratio 97 */ 98 domTargetableFloatRef elemAspect_ratio; 99 /** 100 * The znear element contains a floating point number that describes the distance 101 * to the near clipping plane. The znear element must occur exactly once. 102 * @see domZnear 103 */ 104 domTargetableFloatRef elemZnear; 105 /** 106 * The zfar element contains a floating point number that describes the distance 107 * to the far clipping plane. The zfar element must occur exactly once. @see 108 * domZfar 109 */ 110 domTargetableFloatRef elemZfar; 111 /** 112 * Used to preserve order in elements that do not specify strict sequencing of sub-elements. 113 */ 114 daeElementRefArray _contents; 115 /** 116 * Used to preserve order in elements that have a complex content model. 117 */ 118 daeUIntArray _contentsOrder; 119 120 /** 121 * Used to store information needed for some content model objects. 122 */ 123 daeTArray< daeCharArray * > _CMData; 124 125 126 public: //Accessors and Mutators 127 /** 128 * Gets the xmag element. 129 * @return a daeSmartRef to the xmag element. 130 */ 131 const domTargetableFloatRef getXmag() const { return elemXmag; } 132 /** 133 * Gets the ymag element. 134 * @return a daeSmartRef to the ymag element. 135 */ 136 const domTargetableFloatRef getYmag() const { return elemYmag; } 137 /** 138 * Gets the aspect_ratio element. 139 * @return a daeSmartRef to the aspect_ratio element. 140 */ 141 const domTargetableFloatRef getAspect_ratio() const { return elemAspect_ratio; } 142 /** 143 * Gets the znear element. 144 * @return a daeSmartRef to the znear element. 145 */ 146 const domTargetableFloatRef getZnear() const { return elemZnear; } 147 /** 148 * Gets the zfar element. 149 * @return a daeSmartRef to the zfar element. 150 */ 151 const domTargetableFloatRef getZfar() const { return elemZfar; } 152 /** 153 * Gets the _contents array. 154 * @return Returns a reference to the _contents element array. 155 */ 156 daeElementRefArray &getContents() { return _contents; } 157 /** 158 * Gets the _contents array. 159 * @return Returns a constant reference to the _contents element array. 160 */ 161 const daeElementRefArray &getContents() const { return _contents; } 162 163 protected: 164 /** 165 * Constructor 166 */ 167 domOrthographic(DAE& dae) : daeElement(dae), elemXmag(), elemYmag(), elemAspect_ratio(), elemZnear(), elemZfar() {} 168 /** 169 * Destructor 170 */ 171 virtual ~domOrthographic() { daeElement::deleteCMDataArray(_CMData); } 172 /** 173 * Overloaded assignment operator 174 */ 175 virtual domOrthographic &operator=( const domOrthographic &cpy ) { (void)cpy; return *this; } 176 177 public: // STATIC METHODS 178 /** 179 * Creates an instance of this class and returns a daeElementRef referencing it. 180 * @return a daeElementRef referencing an instance of this object. 181 */ 182 static DLLSPEC daeElementRef create(DAE& dae); 183 /** 184 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 185 * If a daeMetaElement already exists it will return that instead of creating a new one. 186 * @return A daeMetaElement describing this COLLADA element. 187 */ 188 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 189 }; 190 191 class domPerspective; 192 193 typedef daeSmartRef<domPerspective> domPerspectiveRef; 194 typedef daeTArray<domPerspectiveRef> domPerspective_Array; 195 196 /** 197 * The perspective element describes the optics of a perspective camera. 198 */ 199 class domPerspective : public daeElement 200 { 201 public: 202 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::PERSPECTIVE; } 203 static daeInt ID() { return 649; } 204 virtual daeInt typeID() const { return ID(); } 205 206 protected: // Elements 207 /** 208 * The xfov element contains a floating point number describing the horizontal 209 * field of view in degrees. @see domXfov 210 */ 211 domTargetableFloatRef elemXfov; 212 /** 213 * The yfov element contains a floating point number describing the verticle 214 * field of view in degrees. @see domYfov 215 */ 216 domTargetableFloatRef elemYfov; 217 /** 218 * The aspect_ratio element contains a floating point number describing the 219 * aspect ratio of the field of view. If the aspect_ratio element is not 220 * present the aspect ratio is to be calculated from the xfov or yfov elements 221 * and the current viewport. @see domAspect_ratio 222 */ 223 domTargetableFloatRef elemAspect_ratio; 224 /** 225 * The znear element contains a floating point number that describes the distance 226 * to the near clipping plane. The znear element must occur exactly once. 227 * @see domZnear 228 */ 229 domTargetableFloatRef elemZnear; 230 /** 231 * The zfar element contains a floating point number that describes the distance 232 * to the far clipping plane. The zfar element must occur exactly once. @see 233 * domZfar 234 */ 235 domTargetableFloatRef elemZfar; 236 /** 237 * Used to preserve order in elements that do not specify strict sequencing of sub-elements. 238 */ 239 daeElementRefArray _contents; 240 /** 241 * Used to preserve order in elements that have a complex content model. 242 */ 243 daeUIntArray _contentsOrder; 244 245 /** 246 * Used to store information needed for some content model objects. 247 */ 248 daeTArray< daeCharArray * > _CMData; 249 250 251 public: //Accessors and Mutators 252 /** 253 * Gets the xfov element. 254 * @return a daeSmartRef to the xfov element. 255 */ 256 const domTargetableFloatRef getXfov() const { return elemXfov; } 257 /** 258 * Gets the yfov element. 259 * @return a daeSmartRef to the yfov element. 260 */ 261 const domTargetableFloatRef getYfov() const { return elemYfov; } 262 /** 263 * Gets the aspect_ratio element. 264 * @return a daeSmartRef to the aspect_ratio element. 265 */ 266 const domTargetableFloatRef getAspect_ratio() const { return elemAspect_ratio; } 267 /** 268 * Gets the znear element. 269 * @return a daeSmartRef to the znear element. 270 */ 271 const domTargetableFloatRef getZnear() const { return elemZnear; } 272 /** 273 * Gets the zfar element. 274 * @return a daeSmartRef to the zfar element. 275 */ 276 const domTargetableFloatRef getZfar() const { return elemZfar; } 277 /** 278 * Gets the _contents array. 279 * @return Returns a reference to the _contents element array. 280 */ 281 daeElementRefArray &getContents() { return _contents; } 282 /** 283 * Gets the _contents array. 284 * @return Returns a constant reference to the _contents element array. 285 */ 286 const daeElementRefArray &getContents() const { return _contents; } 287 288 protected: 289 /** 290 * Constructor 291 */ 292 domPerspective(DAE& dae) : daeElement(dae), elemXfov(), elemYfov(), elemAspect_ratio(), elemZnear(), elemZfar() {} 293 /** 294 * Destructor 295 */ 296 virtual ~domPerspective() { daeElement::deleteCMDataArray(_CMData); } 297 /** 298 * Overloaded assignment operator 299 */ 300 virtual domPerspective &operator=( const domPerspective &cpy ) { (void)cpy; return *this; } 301 302 public: // STATIC METHODS 303 /** 304 * Creates an instance of this class and returns a daeElementRef referencing it. 305 * @return a daeElementRef referencing an instance of this object. 306 */ 307 static DLLSPEC daeElementRef create(DAE& dae); 308 /** 309 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 310 * If a daeMetaElement already exists it will return that instead of creating a new one. 311 * @return A daeMetaElement describing this COLLADA element. 312 */ 313 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 314 }; 315 316 317 318 protected: // Elements 319 /** 320 * The orthographic element describes the field of view of an orthographic 321 * camera. @see domOrthographic 322 */ 323 domOrthographicRef elemOrthographic; 324 /** 325 * The perspective element describes the optics of a perspective camera. @see 326 * domPerspective 327 */ 328 domPerspectiveRef elemPerspective; 329 /** 330 * Used to preserve order in elements that do not specify strict sequencing of sub-elements. 331 */ 332 daeElementRefArray _contents; 333 /** 334 * Used to preserve order in elements that have a complex content model. 335 */ 336 daeUIntArray _contentsOrder; 337 338 /** 339 * Used to store information needed for some content model objects. 340 */ 341 daeTArray< daeCharArray * > _CMData; 342 343 344 public: //Accessors and Mutators 345 /** 346 * Gets the orthographic element. 347 * @return a daeSmartRef to the orthographic element. 348 */ 349 const domOrthographicRef getOrthographic() const { return elemOrthographic; } 350 /** 351 * Gets the perspective element. 352 * @return a daeSmartRef to the perspective element. 353 */ 354 const domPerspectiveRef getPerspective() const { return elemPerspective; } 355 /** 356 * Gets the _contents array. 357 * @return Returns a reference to the _contents element array. 358 */ 359 daeElementRefArray &getContents() { return _contents; } 360 /** 361 * Gets the _contents array. 362 * @return Returns a constant reference to the _contents element array. 363 */ 364 const daeElementRefArray &getContents() const { return _contents; } 365 366 protected: 367 /** 368 * Constructor 369 */ 370 domTechnique_common(DAE& dae) : daeElement(dae), elemOrthographic(), elemPerspective() {} 371 /** 372 * Destructor 373 */ 374 virtual ~domTechnique_common() { daeElement::deleteCMDataArray(_CMData); } 375 /** 376 * Overloaded assignment operator 377 */ 378 virtual domTechnique_common &operator=( const domTechnique_common &cpy ) { (void)cpy; return *this; } 379 380 public: // STATIC METHODS 381 /** 382 * Creates an instance of this class and returns a daeElementRef referencing it. 383 * @return a daeElementRef referencing an instance of this object. 384 */ 385 static DLLSPEC daeElementRef create(DAE& dae); 386 /** 387 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 388 * If a daeMetaElement already exists it will return that instead of creating a new one. 389 * @return A daeMetaElement describing this COLLADA element. 390 */ 391 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 392 }; 393 394 395 396 protected: // Elements 397 /** 398 * The technique_common element specifies the optics information for the common 399 * profile which all COLLADA implementations need to support. @see domTechnique_common 400 */ 401 domTechnique_commonRef elemTechnique_common; 402 /** 403 * This element may contain any number of non-common profile techniques. 404 * @see domTechnique 405 */ 406 domTechnique_Array elemTechnique_array; 407 /** 408 * The extra element may appear any number of times. @see domExtra 409 */ 410 domExtra_Array elemExtra_array; 411 412 public: //Accessors and Mutators 413 /** 414 * Gets the technique_common element. 415 * @return a daeSmartRef to the technique_common element. 416 */ 417 const domTechnique_commonRef getTechnique_common() const { return elemTechnique_common; } 418 /** 419 * Gets the technique element array. 420 * @return Returns a reference to the array of technique elements. 421 */ 422 domTechnique_Array &getTechnique_array() { return elemTechnique_array; } 423 /** 424 * Gets the technique element array. 425 * @return Returns a constant reference to the array of technique elements. 426 */ 427 const domTechnique_Array &getTechnique_array() const { return elemTechnique_array; } 428 /** 429 * Gets the extra element array. 430 * @return Returns a reference to the array of extra elements. 431 */ 432 domExtra_Array &getExtra_array() { return elemExtra_array; } 433 /** 434 * Gets the extra element array. 435 * @return Returns a constant reference to the array of extra elements. 436 */ 437 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 438 protected: 439 /** 440 * Constructor 441 */ 442 domOptics(DAE& dae) : daeElement(dae), elemTechnique_common(), elemTechnique_array(), elemExtra_array() {} 443 /** 444 * Destructor 445 */ 446 virtual ~domOptics() {} 447 /** 448 * Overloaded assignment operator 449 */ 450 virtual domOptics &operator=( const domOptics &cpy ) { (void)cpy; return *this; } 451 452 public: // STATIC METHODS 453 /** 454 * Creates an instance of this class and returns a daeElementRef referencing it. 455 * @return a daeElementRef referencing an instance of this object. 456 */ 457 static DLLSPEC daeElementRef create(DAE& dae); 458 /** 459 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 460 * If a daeMetaElement already exists it will return that instead of creating a new one. 461 * @return A daeMetaElement describing this COLLADA element. 462 */ 463 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 464 }; 465 466 class domImager; 467 468 typedef daeSmartRef<domImager> domImagerRef; 469 typedef daeTArray<domImagerRef> domImager_Array; 470 471 /** 472 * Imagers represent the image sensor of a camera (for example film or CCD). 473 */ 474 class domImager : public daeElement 475 { 476 public: 477 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::IMAGER; } 478 static daeInt ID() { return 650; } 479 virtual daeInt typeID() const { return ID(); } 480 481 protected: // Elements 482 /** 483 * This element may contain any number of non-common profile techniques. 484 * There is no common technique for imager. @see domTechnique 485 */ 486 domTechnique_Array elemTechnique_array; 487 /** 488 * The extra element may appear any number of times. @see domExtra 489 */ 490 domExtra_Array elemExtra_array; 491 492 public: //Accessors and Mutators 493 /** 494 * Gets the technique element array. 495 * @return Returns a reference to the array of technique elements. 496 */ 497 domTechnique_Array &getTechnique_array() { return elemTechnique_array; } 498 /** 499 * Gets the technique element array. 500 * @return Returns a constant reference to the array of technique elements. 501 */ 502 const domTechnique_Array &getTechnique_array() const { return elemTechnique_array; } 503 /** 504 * Gets the extra element array. 505 * @return Returns a reference to the array of extra elements. 506 */ 507 domExtra_Array &getExtra_array() { return elemExtra_array; } 508 /** 509 * Gets the extra element array. 510 * @return Returns a constant reference to the array of extra elements. 511 */ 512 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 513 protected: 514 /** 515 * Constructor 516 */ 517 domImager(DAE& dae) : daeElement(dae), elemTechnique_array(), elemExtra_array() {} 518 /** 519 * Destructor 520 */ 521 virtual ~domImager() {} 522 /** 523 * Overloaded assignment operator 524 */ 525 virtual domImager &operator=( const domImager &cpy ) { (void)cpy; return *this; } 526 527 public: // STATIC METHODS 528 /** 529 * Creates an instance of this class and returns a daeElementRef referencing it. 530 * @return a daeElementRef referencing an instance of this object. 531 */ 532 static DLLSPEC daeElementRef create(DAE& dae); 533 /** 534 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 535 * If a daeMetaElement already exists it will return that instead of creating a new one. 536 * @return A daeMetaElement describing this COLLADA element. 537 */ 538 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 539 }; 540 541 542 protected: // Attributes 543 /** 544 * The id attribute is a text string containing the unique identifier of 545 * this element. This value must be unique within the instance document. 546 * Optional attribute. 547 */ 548 xsID attrId; 549 /** 550 * The name attribute is the text string name of this element. Optional attribute. 551 */ 552 xsNCName attrName; 553 554 protected: // Elements 555 /** 556 * The camera element may contain an asset element. @see domAsset 557 */ 558 domAssetRef elemAsset; 559 /** 560 * Optics represents the apparatus on a camera that projects the image onto 561 * the image sensor. @see domOptics 562 */ 563 domOpticsRef elemOptics; 564 /** 565 * Imagers represent the image sensor of a camera (for example film or CCD). 566 * @see domImager 567 */ 568 domImagerRef elemImager; 569 /** 570 * The extra element may appear any number of times. @see domExtra 571 */ 572 domExtra_Array elemExtra_array; 573 574 public: //Accessors and Mutators 575 /** 576 * Gets the id attribute. 577 * @return Returns a xsID of the id attribute. 578 */ 579 xsID getId() const { return attrId; } 580 /** 581 * Sets the id attribute. 582 * @param atId The new value for the id attribute. 583 */ 584 void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true; 585 if( _document != NULL ) _document->changeElementID( this, attrId ); 586 } 587 588 /** 589 * Gets the name attribute. 590 * @return Returns a xsNCName of the name attribute. 591 */ 592 xsNCName getName() const { return attrName; } 593 /** 594 * Sets the name attribute. 595 * @param atName The new value for the name attribute. 596 */ 597 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; } 598 599 /** 600 * Gets the asset element. 601 * @return a daeSmartRef to the asset element. 602 */ 603 const domAssetRef getAsset() const { return elemAsset; } 604 /** 605 * Gets the optics element. 606 * @return a daeSmartRef to the optics element. 607 */ 608 const domOpticsRef getOptics() const { return elemOptics; } 609 /** 610 * Gets the imager element. 611 * @return a daeSmartRef to the imager element. 612 */ 613 const domImagerRef getImager() const { return elemImager; } 614 /** 615 * Gets the extra element array. 616 * @return Returns a reference to the array of extra elements. 617 */ 618 domExtra_Array &getExtra_array() { return elemExtra_array; } 619 /** 620 * Gets the extra element array. 621 * @return Returns a constant reference to the array of extra elements. 622 */ 623 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 624 protected: 625 /** 626 * Constructor 627 */ 628 domCamera(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemOptics(), elemImager(), elemExtra_array() {} 629 /** 630 * Destructor 631 */ 632 virtual ~domCamera() {} 633 /** 634 * Overloaded assignment operator 635 */ 636 virtual domCamera &operator=( const domCamera &cpy ) { (void)cpy; return *this; } 637 638 public: // STATIC METHODS 639 /** 640 * Creates an instance of this class and returns a daeElementRef referencing it. 641 * @return a daeElementRef referencing an instance of this object. 642 */ 643 static DLLSPEC daeElementRef create(DAE& dae); 644 /** 645 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 646 * If a daeMetaElement already exists it will return that instead of creating a new one. 647 * @return A daeMetaElement describing this COLLADA element. 648 */ 649 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 650 }; 651 652 653 #endif 654