domAnimation_clip.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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_clip_h__
  14. #define __domAnimation_clip_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domAsset.h>
  19. #include <dom/domExtra.h>
  20. #include <dom/domInstanceWithExtra.h>
  21. class DAE;
  22. /**
  23. * The animation_clip element defines a section of the animation curves to
  24. * be used together as an animation clip.
  25. */
  26. class domAnimation_clip : public daeElement
  27. {
  28. public:
  29. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::ANIMATION_CLIP; }
  30. static daeInt ID() { return 652; }
  31. virtual daeInt typeID() const { return ID(); }
  32. protected: // Attributes
  33. /**
  34. * The id attribute is a text string containing the unique identifier of
  35. * this element. This value must be unique within the instance document.
  36. * Optional attribute.
  37. */
  38. xsID attrId;
  39. /**
  40. * The name attribute is the text string name of this element. Optional attribute.
  41. */
  42. xsNCName attrName;
  43. /**
  44. * The start attribute is the time in seconds of the beginning of the clip.
  45. * This time is the same as that used in the key-frame data and is used to
  46. * determine which set of key-frames will be included in the clip. The start
  47. * time does not specify when the clip will be played. If the time falls
  48. * between two keyframes of a referenced animation, an interpolated value
  49. * should be used. The default value is 0.0. Optional attribute.
  50. */
  51. xsDouble attrStart;
  52. /**
  53. * The end attribute is the time in seconds of the end of the clip. This
  54. * is used in the same way as the start time. If end is not specified, the
  55. * value is taken to be the end time of the longest animation. Optional
  56. * attribute.
  57. */
  58. xsDouble attrEnd;
  59. protected: // Elements
  60. /**
  61. * The animation_clip element may contain an asset element. @see domAsset
  62. */
  63. domAssetRef elemAsset;
  64. /**
  65. * The animation_clip must instance at least one animation element. @see domInstance_animation
  66. */
  67. domInstanceWithExtra_Array elemInstance_animation_array;
  68. /**
  69. * The extra element may appear any number of times. @see domExtra
  70. */
  71. domExtra_Array elemExtra_array;
  72. public: //Accessors and Mutators
  73. /**
  74. * Gets the id attribute.
  75. * @return Returns a xsID of the id attribute.
  76. */
  77. xsID getId() const { return attrId; }
  78. /**
  79. * Sets the id attribute.
  80. * @param atId The new value for the id attribute.
  81. */
  82. void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
  83. if( _document != NULL ) _document->changeElementID( this, attrId );
  84. }
  85. /**
  86. * Gets the name attribute.
  87. * @return Returns a xsNCName of the name attribute.
  88. */
  89. xsNCName getName() const { return attrName; }
  90. /**
  91. * Sets the name attribute.
  92. * @param atName The new value for the name attribute.
  93. */
  94. void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
  95. /**
  96. * Gets the start attribute.
  97. * @return Returns a xsDouble of the start attribute.
  98. */
  99. xsDouble getStart() const { return attrStart; }
  100. /**
  101. * Sets the start attribute.
  102. * @param atStart The new value for the start attribute.
  103. */
  104. void setStart( xsDouble atStart ) { attrStart = atStart; _validAttributeArray[2] = true; }
  105. /**
  106. * Gets the end attribute.
  107. * @return Returns a xsDouble of the end attribute.
  108. */
  109. xsDouble getEnd() const { return attrEnd; }
  110. /**
  111. * Sets the end attribute.
  112. * @param atEnd The new value for the end attribute.
  113. */
  114. void setEnd( xsDouble atEnd ) { attrEnd = atEnd; _validAttributeArray[3] = true; }
  115. /**
  116. * Gets the asset element.
  117. * @return a daeSmartRef to the asset element.
  118. */
  119. const domAssetRef getAsset() const { return elemAsset; }
  120. /**
  121. * Gets the instance_animation element array.
  122. * @return Returns a reference to the array of instance_animation elements.
  123. */
  124. domInstanceWithExtra_Array &getInstance_animation_array() { return elemInstance_animation_array; }
  125. /**
  126. * Gets the instance_animation element array.
  127. * @return Returns a constant reference to the array of instance_animation elements.
  128. */
  129. const domInstanceWithExtra_Array &getInstance_animation_array() const { return elemInstance_animation_array; }
  130. /**
  131. * Gets the extra element array.
  132. * @return Returns a reference to the array of extra elements.
  133. */
  134. domExtra_Array &getExtra_array() { return elemExtra_array; }
  135. /**
  136. * Gets the extra element array.
  137. * @return Returns a constant reference to the array of extra elements.
  138. */
  139. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  140. protected:
  141. /**
  142. * Constructor
  143. */
  144. domAnimation_clip(DAE& dae) : daeElement(dae), attrId(), attrName(), attrStart(), attrEnd(), elemAsset(), elemInstance_animation_array(), elemExtra_array() {}
  145. /**
  146. * Destructor
  147. */
  148. virtual ~domAnimation_clip() {}
  149. /**
  150. * Overloaded assignment operator
  151. */
  152. virtual domAnimation_clip &operator=( const domAnimation_clip &cpy ) { (void)cpy; return *this; }
  153. public: // STATIC METHODS
  154. /**
  155. * Creates an instance of this class and returns a daeElementRef referencing it.
  156. * @return a daeElementRef referencing an instance of this object.
  157. */
  158. static DLLSPEC daeElementRef create(DAE& dae);
  159. /**
  160. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  161. * If a daeMetaElement already exists it will return that instead of creating a new one.
  162. * @return A daeMetaElement describing this COLLADA element.
  163. */
  164. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  165. };
  166. #endif