domPhysics_model.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 __domPhysics_model_h__
  14. #define __domPhysics_model_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domAsset.h>
  19. #include <dom/domRigid_body.h>
  20. #include <dom/domRigid_constraint.h>
  21. #include <dom/domInstance_physics_model.h>
  22. #include <dom/domExtra.h>
  23. class DAE;
  24. /**
  25. * This element allows for building complex combinations of rigid-bodies and
  26. * constraints that may be instantiated multiple times.
  27. */
  28. class domPhysics_model : public daeElement
  29. {
  30. public:
  31. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::PHYSICS_MODEL; }
  32. static daeInt ID() { return 813; }
  33. virtual daeInt typeID() const { return ID(); }
  34. protected: // Attributes
  35. /**
  36. * The id attribute is a text string containing the unique identifier of
  37. * this element. This value must be unique within the instance document.
  38. * Optional attribute.
  39. */
  40. xsID attrId;
  41. /**
  42. * The name attribute is the text string name of this element. Optional attribute.
  43. */
  44. xsNCName attrName;
  45. protected: // Elements
  46. /**
  47. * The physics_model element may contain an asset element. @see domAsset
  48. */
  49. domAssetRef elemAsset;
  50. /**
  51. * The physics_model may define any number of rigid_body elements. @see
  52. * domRigid_body
  53. */
  54. domRigid_body_Array elemRigid_body_array;
  55. /**
  56. * The physics_model may define any number of rigid_constraint elements.
  57. * @see domRigid_constraint
  58. */
  59. domRigid_constraint_Array elemRigid_constraint_array;
  60. /**
  61. * The physics_model may instance any number of other physics_model elements.
  62. * @see domInstance_physics_model
  63. */
  64. domInstance_physics_model_Array elemInstance_physics_model_array;
  65. /**
  66. * The extra element may appear any number of times. @see domExtra
  67. */
  68. domExtra_Array elemExtra_array;
  69. public: //Accessors and Mutators
  70. /**
  71. * Gets the id attribute.
  72. * @return Returns a xsID of the id attribute.
  73. */
  74. xsID getId() const { return attrId; }
  75. /**
  76. * Sets the id attribute.
  77. * @param atId The new value for the id attribute.
  78. */
  79. void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
  80. if( _document != NULL ) _document->changeElementID( this, attrId );
  81. }
  82. /**
  83. * Gets the name attribute.
  84. * @return Returns a xsNCName of the name attribute.
  85. */
  86. xsNCName getName() const { return attrName; }
  87. /**
  88. * Sets the name attribute.
  89. * @param atName The new value for the name attribute.
  90. */
  91. void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
  92. /**
  93. * Gets the asset element.
  94. * @return a daeSmartRef to the asset element.
  95. */
  96. const domAssetRef getAsset() const { return elemAsset; }
  97. /**
  98. * Gets the rigid_body element array.
  99. * @return Returns a reference to the array of rigid_body elements.
  100. */
  101. domRigid_body_Array &getRigid_body_array() { return elemRigid_body_array; }
  102. /**
  103. * Gets the rigid_body element array.
  104. * @return Returns a constant reference to the array of rigid_body elements.
  105. */
  106. const domRigid_body_Array &getRigid_body_array() const { return elemRigid_body_array; }
  107. /**
  108. * Gets the rigid_constraint element array.
  109. * @return Returns a reference to the array of rigid_constraint elements.
  110. */
  111. domRigid_constraint_Array &getRigid_constraint_array() { return elemRigid_constraint_array; }
  112. /**
  113. * Gets the rigid_constraint element array.
  114. * @return Returns a constant reference to the array of rigid_constraint elements.
  115. */
  116. const domRigid_constraint_Array &getRigid_constraint_array() const { return elemRigid_constraint_array; }
  117. /**
  118. * Gets the instance_physics_model element array.
  119. * @return Returns a reference to the array of instance_physics_model elements.
  120. */
  121. domInstance_physics_model_Array &getInstance_physics_model_array() { return elemInstance_physics_model_array; }
  122. /**
  123. * Gets the instance_physics_model element array.
  124. * @return Returns a constant reference to the array of instance_physics_model elements.
  125. */
  126. const domInstance_physics_model_Array &getInstance_physics_model_array() const { return elemInstance_physics_model_array; }
  127. /**
  128. * Gets the extra element array.
  129. * @return Returns a reference to the array of extra elements.
  130. */
  131. domExtra_Array &getExtra_array() { return elemExtra_array; }
  132. /**
  133. * Gets the extra element array.
  134. * @return Returns a constant reference to the array of extra elements.
  135. */
  136. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  137. protected:
  138. /**
  139. * Constructor
  140. */
  141. domPhysics_model(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemRigid_body_array(), elemRigid_constraint_array(), elemInstance_physics_model_array(), elemExtra_array() {}
  142. /**
  143. * Destructor
  144. */
  145. virtual ~domPhysics_model() {}
  146. /**
  147. * Overloaded assignment operator
  148. */
  149. virtual domPhysics_model &operator=( const domPhysics_model &cpy ) { (void)cpy; return *this; }
  150. public: // STATIC METHODS
  151. /**
  152. * Creates an instance of this class and returns a daeElementRef referencing it.
  153. * @return a daeElementRef referencing an instance of this object.
  154. */
  155. static DLLSPEC daeElementRef create(DAE& dae);
  156. /**
  157. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  158. * If a daeMetaElement already exists it will return that instead of creating a new one.
  159. * @return A daeMetaElement describing this COLLADA element.
  160. */
  161. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  162. };
  163. #endif