domAnimation.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 __domAnimation_h__
  14. #define __domAnimation_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domAsset.h>
  19. #include <dom/domSource.h>
  20. #include <dom/domSampler.h>
  21. #include <dom/domChannel.h>
  22. #include <dom/domAnimation.h>
  23. #include <dom/domExtra.h>
  24. class DAE;
  25. /**
  26. * The animation element categorizes the declaration of animation information.
  27. * The animation hierarchy contains elements that describe the animation’s
  28. * key-frame data and sampler functions, ordered in such a way to group together
  29. * animations that should be executed together.
  30. */
  31. class domAnimation : public daeElement
  32. {
  33. public:
  34. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::ANIMATION; }
  35. static daeInt ID() { return 651; }
  36. virtual daeInt typeID() const { return ID(); }
  37. protected: // Attributes
  38. /**
  39. * The id attribute is a text string containing the unique identifier of
  40. * this element. This value must be unique within the instance document.
  41. * Optional attribute.
  42. */
  43. xsID attrId;
  44. /**
  45. * The name attribute is the text string name of this element. Optional attribute.
  46. */
  47. xsNCName attrName;
  48. protected: // Elements
  49. /**
  50. * The animation element may contain an asset element. @see domAsset
  51. */
  52. domAssetRef elemAsset;
  53. /**
  54. * The animation element may contain any number of source elements. @see
  55. * domSource
  56. */
  57. domSource_Array elemSource_array;
  58. /**
  59. * The animation element may contain any number of sampler elements. @see
  60. * domSampler
  61. */
  62. domSampler_Array elemSampler_array;
  63. /**
  64. * The animation element may contain any number of channel elements. @see
  65. * domChannel
  66. */
  67. domChannel_Array elemChannel_array;
  68. /**
  69. * The animation may be hierarchical and may contain any number of other
  70. * animation elements. @see domAnimation
  71. */
  72. domAnimation_Array elemAnimation_array;
  73. /**
  74. * The extra element may appear any number of times. @see domExtra
  75. */
  76. domExtra_Array elemExtra_array;
  77. /**
  78. * Used to preserve order in elements that do not specify strict sequencing of sub-elements.
  79. */
  80. daeElementRefArray _contents;
  81. /**
  82. * Used to preserve order in elements that have a complex content model.
  83. */
  84. daeUIntArray _contentsOrder;
  85. /**
  86. * Used to store information needed for some content model objects.
  87. */
  88. daeTArray< daeCharArray * > _CMData;
  89. public: //Accessors and Mutators
  90. /**
  91. * Gets the id attribute.
  92. * @return Returns a xsID of the id attribute.
  93. */
  94. xsID getId() const { return attrId; }
  95. /**
  96. * Sets the id attribute.
  97. * @param atId The new value for the id attribute.
  98. */
  99. void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
  100. if( _document != NULL ) _document->changeElementID( this, attrId );
  101. }
  102. /**
  103. * Gets the name attribute.
  104. * @return Returns a xsNCName of the name attribute.
  105. */
  106. xsNCName getName() const { return attrName; }
  107. /**
  108. * Sets the name attribute.
  109. * @param atName The new value for the name attribute.
  110. */
  111. void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
  112. /**
  113. * Gets the asset element.
  114. * @return a daeSmartRef to the asset element.
  115. */
  116. const domAssetRef getAsset() const { return elemAsset; }
  117. /**
  118. * Gets the source element array.
  119. * @return Returns a reference to the array of source elements.
  120. */
  121. domSource_Array &getSource_array() { return elemSource_array; }
  122. /**
  123. * Gets the source element array.
  124. * @return Returns a constant reference to the array of source elements.
  125. */
  126. const domSource_Array &getSource_array() const { return elemSource_array; }
  127. /**
  128. * Gets the sampler element array.
  129. * @return Returns a reference to the array of sampler elements.
  130. */
  131. domSampler_Array &getSampler_array() { return elemSampler_array; }
  132. /**
  133. * Gets the sampler element array.
  134. * @return Returns a constant reference to the array of sampler elements.
  135. */
  136. const domSampler_Array &getSampler_array() const { return elemSampler_array; }
  137. /**
  138. * Gets the channel element array.
  139. * @return Returns a reference to the array of channel elements.
  140. */
  141. domChannel_Array &getChannel_array() { return elemChannel_array; }
  142. /**
  143. * Gets the channel element array.
  144. * @return Returns a constant reference to the array of channel elements.
  145. */
  146. const domChannel_Array &getChannel_array() const { return elemChannel_array; }
  147. /**
  148. * Gets the animation element array.
  149. * @return Returns a reference to the array of animation elements.
  150. */
  151. domAnimation_Array &getAnimation_array() { return elemAnimation_array; }
  152. /**
  153. * Gets the animation element array.
  154. * @return Returns a constant reference to the array of animation elements.
  155. */
  156. const domAnimation_Array &getAnimation_array() const { return elemAnimation_array; }
  157. /**
  158. * Gets the extra element array.
  159. * @return Returns a reference to the array of extra elements.
  160. */
  161. domExtra_Array &getExtra_array() { return elemExtra_array; }
  162. /**
  163. * Gets the extra element array.
  164. * @return Returns a constant reference to the array of extra elements.
  165. */
  166. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  167. /**
  168. * Gets the _contents array.
  169. * @return Returns a reference to the _contents element array.
  170. */
  171. daeElementRefArray &getContents() { return _contents; }
  172. /**
  173. * Gets the _contents array.
  174. * @return Returns a constant reference to the _contents element array.
  175. */
  176. const daeElementRefArray &getContents() const { return _contents; }
  177. protected:
  178. /**
  179. * Constructor
  180. */
  181. domAnimation(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemSource_array(), elemSampler_array(), elemChannel_array(), elemAnimation_array(), elemExtra_array() {}
  182. /**
  183. * Destructor
  184. */
  185. virtual ~domAnimation() { daeElement::deleteCMDataArray(_CMData); }
  186. /**
  187. * Overloaded assignment operator
  188. */
  189. virtual domAnimation &operator=( const domAnimation &cpy ) { (void)cpy; return *this; }
  190. public: // STATIC METHODS
  191. /**
  192. * Creates an instance of this class and returns a daeElementRef referencing it.
  193. * @return a daeElementRef referencing an instance of this object.
  194. */
  195. static DLLSPEC daeElementRef create(DAE& dae);
  196. /**
  197. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  198. * If a daeMetaElement already exists it will return that instead of creating a new one.
  199. * @return A daeMetaElement describing this COLLADA element.
  200. */
  201. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  202. };
  203. #endif