domMorph.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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 __domMorph_h__
  14. #define __domMorph_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domSource.h>
  19. #include <dom/domExtra.h>
  20. #include <dom/domInputLocal.h>
  21. class DAE;
  22. /**
  23. * The morph element describes the data required to blend between sets of
  24. * static meshes. Each possible mesh that can be blended (a morph target)
  25. * must be specified.
  26. */
  27. class domMorph : public daeElement
  28. {
  29. public:
  30. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::MORPH; }
  31. static daeInt ID() { return 662; }
  32. virtual daeInt typeID() const { return ID(); }
  33. public:
  34. class domTargets;
  35. typedef daeSmartRef<domTargets> domTargetsRef;
  36. typedef daeTArray<domTargetsRef> domTargets_Array;
  37. /**
  38. * The targets element declares the morph targets, their weights and any user
  39. * defined attributes associated with them.
  40. */
  41. class domTargets : public daeElement
  42. {
  43. public:
  44. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::TARGETS; }
  45. static daeInt ID() { return 663; }
  46. virtual daeInt typeID() const { return ID(); }
  47. protected: // Elements
  48. /**
  49. * The input element must occur at least twice. These inputs are local inputs.
  50. * @see domInput
  51. */
  52. domInputLocal_Array elemInput_array;
  53. /**
  54. * The extra element may appear any number of times. @see domExtra
  55. */
  56. domExtra_Array elemExtra_array;
  57. public: //Accessors and Mutators
  58. /**
  59. * Gets the input element array.
  60. * @return Returns a reference to the array of input elements.
  61. */
  62. domInputLocal_Array &getInput_array() { return elemInput_array; }
  63. /**
  64. * Gets the input element array.
  65. * @return Returns a constant reference to the array of input elements.
  66. */
  67. const domInputLocal_Array &getInput_array() const { return elemInput_array; }
  68. /**
  69. * Gets the extra element array.
  70. * @return Returns a reference to the array of extra elements.
  71. */
  72. domExtra_Array &getExtra_array() { return elemExtra_array; }
  73. /**
  74. * Gets the extra element array.
  75. * @return Returns a constant reference to the array of extra elements.
  76. */
  77. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  78. protected:
  79. /**
  80. * Constructor
  81. */
  82. domTargets(DAE& dae) : daeElement(dae), elemInput_array(), elemExtra_array() {}
  83. /**
  84. * Destructor
  85. */
  86. virtual ~domTargets() {}
  87. /**
  88. * Overloaded assignment operator
  89. */
  90. virtual domTargets &operator=( const domTargets &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 method attribute specifies the which blending technique to use. The
  107. * accepted values are NORMALIZED, and RELATIVE. The default value if not
  108. * specified is NORMALIZED. Optional attribute.
  109. */
  110. domMorphMethodType attrMethod;
  111. /**
  112. * The source attribute indicates the base mesh. Required attribute.
  113. */
  114. xsAnyURI attrSource;
  115. protected: // Elements
  116. /**
  117. * The morph element must contain at least two source elements. @see domSource
  118. */
  119. domSource_Array elemSource_array;
  120. /**
  121. * The targets element declares the morph targets, their weights and any user
  122. * defined attributes associated with them. @see domTargets
  123. */
  124. domTargetsRef elemTargets;
  125. /**
  126. * The extra element may appear any number of times. @see domExtra
  127. */
  128. domExtra_Array elemExtra_array;
  129. public: //Accessors and Mutators
  130. /**
  131. * Gets the method attribute.
  132. * @return Returns a domMorphMethodType of the method attribute.
  133. */
  134. domMorphMethodType getMethod() const { return attrMethod; }
  135. /**
  136. * Sets the method attribute.
  137. * @param atMethod The new value for the method attribute.
  138. */
  139. void setMethod( domMorphMethodType atMethod ) { attrMethod = atMethod; _validAttributeArray[0] = true; }
  140. /**
  141. * Gets the source attribute.
  142. * @return Returns a xsAnyURI reference of the source attribute.
  143. */
  144. xsAnyURI &getSource() { return attrSource; }
  145. /**
  146. * Gets the source attribute.
  147. * @return Returns a constant xsAnyURI reference of the source attribute.
  148. */
  149. const xsAnyURI &getSource() const { return attrSource; }
  150. /**
  151. * Sets the source attribute.
  152. * @param atSource The new value for the source attribute.
  153. */
  154. void setSource( const xsAnyURI &atSource ) { attrSource = atSource; _validAttributeArray[1] = true; }
  155. /**
  156. * Sets the source attribute.
  157. * @param atSource The new value for the source attribute.
  158. */
  159. void setSource( xsString atSource ) { attrSource = atSource; _validAttributeArray[1] = true; }
  160. /**
  161. * Gets the source element array.
  162. * @return Returns a reference to the array of source elements.
  163. */
  164. domSource_Array &getSource_array() { return elemSource_array; }
  165. /**
  166. * Gets the source element array.
  167. * @return Returns a constant reference to the array of source elements.
  168. */
  169. const domSource_Array &getSource_array() const { return elemSource_array; }
  170. /**
  171. * Gets the targets element.
  172. * @return a daeSmartRef to the targets element.
  173. */
  174. const domTargetsRef getTargets() const { return elemTargets; }
  175. /**
  176. * Gets the extra element array.
  177. * @return Returns a reference to the array of extra elements.
  178. */
  179. domExtra_Array &getExtra_array() { return elemExtra_array; }
  180. /**
  181. * Gets the extra element array.
  182. * @return Returns a constant reference to the array of extra elements.
  183. */
  184. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  185. protected:
  186. /**
  187. * Constructor
  188. */
  189. domMorph(DAE& dae) : daeElement(dae), attrMethod(), attrSource(dae, *this), elemSource_array(), elemTargets(), elemExtra_array() {}
  190. /**
  191. * Destructor
  192. */
  193. virtual ~domMorph() {}
  194. /**
  195. * Overloaded assignment operator
  196. */
  197. virtual domMorph &operator=( const domMorph &cpy ) { (void)cpy; return *this; }
  198. public: // STATIC METHODS
  199. /**
  200. * Creates an instance of this class and returns a daeElementRef referencing it.
  201. * @return a daeElementRef referencing an instance of this object.
  202. */
  203. static DLLSPEC daeElementRef create(DAE& dae);
  204. /**
  205. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  206. * If a daeMetaElement already exists it will return that instead of creating a new one.
  207. * @return A daeMetaElement describing this COLLADA element.
  208. */
  209. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  210. };
  211. #endif