domPhysics_material.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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_material_h__
  14. #define __domPhysics_material_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domAsset.h>
  19. #include <dom/domTechnique.h>
  20. #include <dom/domExtra.h>
  21. #include <dom/domTargetableFloat.h>
  22. class DAE;
  23. /**
  24. * This element defines the physical properties of an object. It contains
  25. * a technique/profile with parameters. The COMMON profile defines the built-in
  26. * names, such as static_friction.
  27. */
  28. class domPhysics_material : public daeElement
  29. {
  30. public:
  31. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::PHYSICS_MATERIAL; }
  32. static daeInt ID() { return 791; }
  33. virtual daeInt typeID() const { return ID(); }
  34. public:
  35. class domTechnique_common;
  36. typedef daeSmartRef<domTechnique_common> domTechnique_commonRef;
  37. typedef daeTArray<domTechnique_commonRef> domTechnique_common_Array;
  38. /**
  39. * The technique_common element specifies the physics_material information
  40. * for the common profile which all COLLADA implementations need to support.
  41. */
  42. class domTechnique_common : public daeElement
  43. {
  44. public:
  45. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::TECHNIQUE_COMMON; }
  46. static daeInt ID() { return 792; }
  47. virtual daeInt typeID() const { return ID(); }
  48. protected: // Elements
  49. /**
  50. * Dynamic friction coefficient @see domDynamic_friction
  51. */
  52. domTargetableFloatRef elemDynamic_friction;
  53. /**
  54. * The proportion of the kinetic energy preserved in the impact (typically
  55. * ranges from 0.0 to 1.0) @see domRestitution
  56. */
  57. domTargetableFloatRef elemRestitution;
  58. /**
  59. * Static friction coefficient @see domStatic_friction
  60. */
  61. domTargetableFloatRef elemStatic_friction;
  62. public: //Accessors and Mutators
  63. /**
  64. * Gets the dynamic_friction element.
  65. * @return a daeSmartRef to the dynamic_friction element.
  66. */
  67. const domTargetableFloatRef getDynamic_friction() const { return elemDynamic_friction; }
  68. /**
  69. * Gets the restitution element.
  70. * @return a daeSmartRef to the restitution element.
  71. */
  72. const domTargetableFloatRef getRestitution() const { return elemRestitution; }
  73. /**
  74. * Gets the static_friction element.
  75. * @return a daeSmartRef to the static_friction element.
  76. */
  77. const domTargetableFloatRef getStatic_friction() const { return elemStatic_friction; }
  78. protected:
  79. /**
  80. * Constructor
  81. */
  82. domTechnique_common(DAE& dae) : daeElement(dae), elemDynamic_friction(), elemRestitution(), elemStatic_friction() {}
  83. /**
  84. * Destructor
  85. */
  86. virtual ~domTechnique_common() {}
  87. /**
  88. * Overloaded assignment operator
  89. */
  90. virtual domTechnique_common &operator=( const domTechnique_common &cpy ) { (void)cpy; return *this; }
  91. public: // STATIC METHODS
  92. /**
  93. * Creates an instance of this class and returns a daeElementRef referencing it.
  94. * @return a daeElementRef referencing an instance of this object.
  95. */
  96. static DLLSPEC daeElementRef create(DAE& dae);
  97. /**
  98. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  99. * If a daeMetaElement already exists it will return that instead of creating a new one.
  100. * @return A daeMetaElement describing this COLLADA element.
  101. */
  102. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  103. };
  104. protected: // Attributes
  105. /**
  106. * The id attribute is a text string containing the unique identifier of
  107. * this element. This value must be unique within the instance document.
  108. * Optional attribute.
  109. */
  110. xsID attrId;
  111. /**
  112. * The name attribute is the text string name of this element. Optional attribute.
  113. */
  114. xsNCName attrName;
  115. protected: // Elements
  116. /**
  117. * The physics_material element may contain an asset element. @see domAsset
  118. */
  119. domAssetRef elemAsset;
  120. /**
  121. * The technique_common element specifies the physics_material information
  122. * for the common profile which all COLLADA implementations need to support.
  123. * @see domTechnique_common
  124. */
  125. domTechnique_commonRef elemTechnique_common;
  126. /**
  127. * This element may contain any number of non-common profile techniques.
  128. * @see domTechnique
  129. */
  130. domTechnique_Array elemTechnique_array;
  131. /**
  132. * The extra element may appear any number of times. @see domExtra
  133. */
  134. domExtra_Array elemExtra_array;
  135. public: //Accessors and Mutators
  136. /**
  137. * Gets the id attribute.
  138. * @return Returns a xsID of the id attribute.
  139. */
  140. xsID getId() const { return attrId; }
  141. /**
  142. * Sets the id attribute.
  143. * @param atId The new value for the id attribute.
  144. */
  145. void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
  146. if( _document != NULL ) _document->changeElementID( this, attrId );
  147. }
  148. /**
  149. * Gets the name attribute.
  150. * @return Returns a xsNCName of the name attribute.
  151. */
  152. xsNCName getName() const { return attrName; }
  153. /**
  154. * Sets the name attribute.
  155. * @param atName The new value for the name attribute.
  156. */
  157. void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
  158. /**
  159. * Gets the asset element.
  160. * @return a daeSmartRef to the asset element.
  161. */
  162. const domAssetRef getAsset() const { return elemAsset; }
  163. /**
  164. * Gets the technique_common element.
  165. * @return a daeSmartRef to the technique_common element.
  166. */
  167. const domTechnique_commonRef getTechnique_common() const { return elemTechnique_common; }
  168. /**
  169. * Gets the technique element array.
  170. * @return Returns a reference to the array of technique elements.
  171. */
  172. domTechnique_Array &getTechnique_array() { return elemTechnique_array; }
  173. /**
  174. * Gets the technique element array.
  175. * @return Returns a constant reference to the array of technique elements.
  176. */
  177. const domTechnique_Array &getTechnique_array() const { return elemTechnique_array; }
  178. /**
  179. * Gets the extra element array.
  180. * @return Returns a reference to the array of extra elements.
  181. */
  182. domExtra_Array &getExtra_array() { return elemExtra_array; }
  183. /**
  184. * Gets the extra element array.
  185. * @return Returns a constant reference to the array of extra elements.
  186. */
  187. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  188. protected:
  189. /**
  190. * Constructor
  191. */
  192. domPhysics_material(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemTechnique_common(), elemTechnique_array(), elemExtra_array() {}
  193. /**
  194. * Destructor
  195. */
  196. virtual ~domPhysics_material() {}
  197. /**
  198. * Overloaded assignment operator
  199. */
  200. virtual domPhysics_material &operator=( const domPhysics_material &cpy ) { (void)cpy; return *this; }
  201. public: // STATIC METHODS
  202. /**
  203. * Creates an instance of this class and returns a daeElementRef referencing it.
  204. * @return a daeElementRef referencing an instance of this object.
  205. */
  206. static DLLSPEC daeElementRef create(DAE& dae);
  207. /**
  208. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  209. * If a daeMetaElement already exists it will return that instead of creating a new one.
  210. * @return A daeMetaElement describing this COLLADA element.
  211. */
  212. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  213. };
  214. #endif