1/* 2* Copyright 2006 Sony Computer Entertainment Inc. 3* 4* Licensed under the MIT Open Source License, for details please see license.txt or the website 5* http://www.opensource.org/licenses/mit-license.php 6* 7*/ 8 9#ifndef __domEffect_h__ 10#define __domEffect_h__ 11 12#include <dae/daeDocument.h> 13#include <dom/domTypes.h> 14#include <dom/domElements.h> 15 16#include <dom/domAsset.h> 17#include <dom/domImage.h> 18#include <dom/domFx_profile_abstract.h> 19#include <dom/domExtra.h> 20#include <dom/domFx_annotate_common.h> 21#include <dom/domFx_newparam_common.h> 22class DAE; 23 24/** 25 * A self contained description of a shader effect. 26 */ 27class domEffect : public daeElement 28{ 29public: 30 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::EFFECT; } 31 static daeInt ID() { return 728; } 32 virtual daeInt typeID() const { return ID(); } 33protected: // Attributes 34/** 35 * The id attribute is a text string containing the unique identifier of 36 * this element. This value must be unique within the instance document. 37 * Optional attribute. 38 */ 39 xsID attrId; 40/** 41 * The name attribute is the text string name of this element. Optional attribute. 42 */ 43 xsNCName attrName; 44 45protected: // 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 83 84public: //Accessors and Mutators 85 /** 86 * Gets the id attribute. 87 * @return Returns a xsID of the id attribute. 88 */ 89 xsID getId() const { return attrId; } 90 /** 91 * Sets the id attribute. 92 * @param atId The new value for the id attribute. 93 */ 94 void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true; 95 if( _document != NULL ) _document->changeElementID( this, attrId ); 96 } 97 98 /** 99 * Gets the name attribute. 100 * @return Returns a xsNCName of the name attribute. 101 */ 102 xsNCName getName() const { return attrName; } 103 /** 104 * Sets the name attribute. 105 * @param atName The new value for the name attribute. 106 */ 107 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; } 108 109 /** 110 * Gets the asset element. 111 * @return a daeSmartRef to the asset element. 112 */ 113 const domAssetRef getAsset() const { return elemAsset; } 114 /** 115 * Gets the annotate element array. 116 * @return Returns a reference to the array of annotate elements. 117 */ 118 domFx_annotate_common_Array &getAnnotate_array() { return elemAnnotate_array; } 119 /** 120 * Gets the annotate element array. 121 * @return Returns a constant reference to the array of annotate elements. 122 */ 123 const domFx_annotate_common_Array &getAnnotate_array() const { return elemAnnotate_array; } 124 /** 125 * Gets the image element array. 126 * @return Returns a reference to the array of image elements. 127 */ 128 domImage_Array &getImage_array() { return elemImage_array; } 129 /** 130 * Gets the image element array. 131 * @return Returns a constant reference to the array of image elements. 132 */ 133 const domImage_Array &getImage_array() const { return elemImage_array; } 134 /** 135 * Gets the newparam element array. 136 * @return Returns a reference to the array of newparam elements. 137 */ 138 domFx_newparam_common_Array &getNewparam_array() { return elemNewparam_array; } 139 /** 140 * Gets the newparam element array. 141 * @return Returns a constant reference to the array of newparam elements. 142 */ 143 const domFx_newparam_common_Array &getNewparam_array() const { return elemNewparam_array; } 144 /** 145 * Gets the fx_profile_abstract element array. 146 * @return Returns a reference to the array of fx_profile_abstract elements. 147 */ 148 domFx_profile_abstract_Array &getFx_profile_abstract_array() { return elemFx_profile_abstract_array; } 149 /** 150 * Gets the fx_profile_abstract element array. 151 * @return Returns a constant reference to the array of fx_profile_abstract elements. 152 */ 153 const domFx_profile_abstract_Array &getFx_profile_abstract_array() const { return elemFx_profile_abstract_array; } 154 /** 155 * Gets the extra element array. 156 * @return Returns a reference to the array of extra elements. 157 */ 158 domExtra_Array &getExtra_array() { return elemExtra_array; } 159 /** 160 * Gets the extra element array. 161 * @return Returns a constant reference to the array of extra elements. 162 */ 163 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 164 /** 165 * Gets the _contents array. 166 * @return Returns a reference to the _contents element array. 167 */ 168 daeElementRefArray &getContents() { return _contents; } 169 /** 170 * Gets the _contents array. 171 * @return Returns a constant reference to the _contents element array. 172 */ 173 const daeElementRefArray &getContents() const { return _contents; } 174 175protected: 176 /** 177 * Constructor 178 */ 179 domEffect(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemAnnotate_array(), elemImage_array(), elemNewparam_array(), elemFx_profile_abstract_array(), elemExtra_array() {} 180 /** 181 * Destructor 182 */ 183 virtual ~domEffect() {} 184 /** 185 * Overloaded assignment operator 186 */ 187 virtual domEffect &operator=( const domEffect &cpy ) { (void)cpy; return *this; } 188 189public: // STATIC METHODS 190 /** 191 * Creates an instance of this class and returns a daeElementRef referencing it. 192 * @return a daeElementRef referencing an instance of this object. 193 */ 194 static DLLSPEC daeElementRef create(DAE& dae); 195 /** 196 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 197 * If a daeMetaElement already exists it will return that instead of creating a new one. 198 * @return A daeMetaElement describing this COLLADA element. 199 */ 200 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 201}; 202 203 204#endif 205