domEffect.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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 __domEffect_h__
  14. #define __domEffect_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domAsset.h>
  19. #include <dom/domImage.h>
  20. #include <dom/domFx_profile_abstract.h>
  21. #include <dom/domExtra.h>
  22. #include <dom/domFx_annotate_common.h>
  23. #include <dom/domFx_newparam_common.h>
  24. class DAE;
  25. /**
  26. * A self contained description of a shader effect.
  27. */
  28. class domEffect : public daeElement
  29. {
  30. public:
  31. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::EFFECT; }
  32. static daeInt ID() { return 728; }
  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 effect element may contain an asset element. @see domAsset
  48. */
  49. domAssetRef elemAsset;
  50. /**
  51. * The annotate element allows you to specify an annotation on this effect.
  52. * @see domAnnotate
  53. */
  54. domFx_annotate_common_Array elemAnnotate_array;
  55. /**
  56. * The image element allows you to create image resources which can be shared
  57. * by multipe profiles. @see domImage
  58. */
  59. domImage_Array elemImage_array;
  60. /**
  61. * The newparam element allows you to create new effect parameters which can
  62. * be shared by multipe profiles. @see domNewparam
  63. */
  64. domFx_newparam_common_Array elemNewparam_array;
  65. /**
  66. * This is the substituion group hook which allows you to swap in other COLLADA
  67. * FX profiles. @see domFx_profile_abstract
  68. */
  69. domFx_profile_abstract_Array elemFx_profile_abstract_array;
  70. /**
  71. * The extra element may appear any number of times. @see domExtra
  72. */
  73. domExtra_Array elemExtra_array;
  74. /**
  75. * Used to preserve order in elements that do not specify strict sequencing of sub-elements.
  76. */
  77. daeElementRefArray _contents;
  78. /**
  79. * Used to preserve order in elements that have a complex content model.
  80. */
  81. daeUIntArray _contentsOrder;
  82. public: //Accessors and Mutators
  83. /**
  84. * Gets the id attribute.
  85. * @return Returns a xsID of the id attribute.
  86. */
  87. xsID getId() const { return attrId; }
  88. /**
  89. * Sets the id attribute.
  90. * @param atId The new value for the id attribute.
  91. */
  92. void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
  93. if( _document != NULL ) _document->changeElementID( this, attrId );
  94. }
  95. /**
  96. * Gets the name attribute.
  97. * @return Returns a xsNCName of the name attribute.
  98. */
  99. xsNCName getName() const { return attrName; }
  100. /**
  101. * Sets the name attribute.
  102. * @param atName The new value for the name attribute.
  103. */
  104. void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
  105. /**
  106. * Gets the asset element.
  107. * @return a daeSmartRef to the asset element.
  108. */
  109. const domAssetRef getAsset() const { return elemAsset; }
  110. /**
  111. * Gets the annotate element array.
  112. * @return Returns a reference to the array of annotate elements.
  113. */
  114. domFx_annotate_common_Array &getAnnotate_array() { return elemAnnotate_array; }
  115. /**
  116. * Gets the annotate element array.
  117. * @return Returns a constant reference to the array of annotate elements.
  118. */
  119. const domFx_annotate_common_Array &getAnnotate_array() const { return elemAnnotate_array; }
  120. /**
  121. * Gets the image element array.
  122. * @return Returns a reference to the array of image elements.
  123. */
  124. domImage_Array &getImage_array() { return elemImage_array; }
  125. /**
  126. * Gets the image element array.
  127. * @return Returns a constant reference to the array of image elements.
  128. */
  129. const domImage_Array &getImage_array() const { return elemImage_array; }
  130. /**
  131. * Gets the newparam element array.
  132. * @return Returns a reference to the array of newparam elements.
  133. */
  134. domFx_newparam_common_Array &getNewparam_array() { return elemNewparam_array; }
  135. /**
  136. * Gets the newparam element array.
  137. * @return Returns a constant reference to the array of newparam elements.
  138. */
  139. const domFx_newparam_common_Array &getNewparam_array() const { return elemNewparam_array; }
  140. /**
  141. * Gets the fx_profile_abstract element array.
  142. * @return Returns a reference to the array of fx_profile_abstract elements.
  143. */
  144. domFx_profile_abstract_Array &getFx_profile_abstract_array() { return elemFx_profile_abstract_array; }
  145. /**
  146. * Gets the fx_profile_abstract element array.
  147. * @return Returns a constant reference to the array of fx_profile_abstract elements.
  148. */
  149. const domFx_profile_abstract_Array &getFx_profile_abstract_array() const { return elemFx_profile_abstract_array; }
  150. /**
  151. * Gets the extra element array.
  152. * @return Returns a reference to the array of extra elements.
  153. */
  154. domExtra_Array &getExtra_array() { return elemExtra_array; }
  155. /**
  156. * Gets the extra element array.
  157. * @return Returns a constant reference to the array of extra elements.
  158. */
  159. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  160. /**
  161. * Gets the _contents array.
  162. * @return Returns a reference to the _contents element array.
  163. */
  164. daeElementRefArray &getContents() { return _contents; }
  165. /**
  166. * Gets the _contents array.
  167. * @return Returns a constant reference to the _contents element array.
  168. */
  169. const daeElementRefArray &getContents() const { return _contents; }
  170. protected:
  171. /**
  172. * Constructor
  173. */
  174. domEffect(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemAnnotate_array(), elemImage_array(), elemNewparam_array(), elemFx_profile_abstract_array(), elemExtra_array() {}
  175. /**
  176. * Destructor
  177. */
  178. virtual ~domEffect() {}
  179. /**
  180. * Overloaded assignment operator
  181. */
  182. virtual domEffect &operator=( const domEffect &cpy ) { (void)cpy; return *this; }
  183. public: // STATIC METHODS
  184. /**
  185. * Creates an instance of this class and returns a daeElementRef referencing it.
  186. * @return a daeElementRef referencing an instance of this object.
  187. */
  188. static DLLSPEC daeElementRef create(DAE& dae);
  189. /**
  190. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  191. * If a daeMetaElement already exists it will return that instead of creating a new one.
  192. * @return A daeMetaElement describing this COLLADA element.
  193. */
  194. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  195. };
  196. #endif