Home | History | Annotate | Download | only in dom
      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 __domCg_surface_type_h__
     10 #define __domCg_surface_type_h__
     11 
     12 #include <dae/daeDocument.h>
     13 #include <dom/domTypes.h>
     14 #include <dom/domElements.h>
     15 
     16 #include <dom/domFx_surface_common.h>
     17 #include <dom/domFx_annotate_common.h>
     18 #include <dom/domFx_code_profile.h>
     19 #include <dom/domFx_include_common.h>
     20 #include <dom/domCg_setparam_simple.h>
     21 class DAE;
     22 
     23 /**
     24  * Declares a resource that can be used both as the source for texture samples
     25  * and as the target of a rendering pass.
     26  */
     27 class domCg_surface_type_complexType  : public domFx_surface_common_complexType
     28 {
     29 public:
     30 	class domGenerator;
     31 
     32 	typedef daeSmartRef<domGenerator> domGeneratorRef;
     33 	typedef daeTArray<domGeneratorRef> domGenerator_Array;
     34 
     35 /**
     36  * A procedural surface generator for the cg profile.
     37  */
     38 	class domGenerator : public daeElement
     39 	{
     40 	public:
     41 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::GENERATOR; }
     42 		static daeInt ID() { return 137; }
     43 		virtual daeInt typeID() const { return ID(); }
     44 	public:
     45 		class domName;
     46 
     47 		typedef daeSmartRef<domName> domNameRef;
     48 		typedef daeTArray<domNameRef> domName_Array;
     49 
     50 /**
     51  * The entry symbol for the shader function.
     52  */
     53 		class domName : public daeElement
     54 		{
     55 		public:
     56 			virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::NAME; }
     57 			static daeInt ID() { return 138; }
     58 			virtual daeInt typeID() const { return ID(); }
     59 		protected:  // Attribute
     60 			xsNCName attrSource;
     61 
     62 		protected:  // Value
     63 			/**
     64 			 * The xsNCName value of the text data of this element.
     65 			 */
     66 			xsNCName _value;
     67 
     68 		public:	//Accessors and Mutators
     69 			/**
     70 			 * Gets the source attribute.
     71 			 * @return Returns a xsNCName of the source attribute.
     72 			 */
     73 			xsNCName getSource() const { return attrSource; }
     74 			/**
     75 			 * Sets the source attribute.
     76 			 * @param atSource The new value for the source attribute.
     77 			 */
     78 			void setSource( xsNCName atSource ) { *(daeStringRef*)&attrSource = atSource; _validAttributeArray[0] = true; }
     79 
     80 			/**
     81 			 * Gets the value of this element.
     82 			 * @return Returns a xsNCName of the value.
     83 			 */
     84 			xsNCName getValue() const { return _value; }
     85 			/**
     86 			 * Sets the _value of this element.
     87 			 * @param val The new value for this element.
     88 			 */
     89 			void setValue( xsNCName val ) { *(daeStringRef*)&_value = val; }
     90 
     91 		protected:
     92 			/**
     93 			 * Constructor
     94 			 */
     95 			domName(DAE& dae) : daeElement(dae), attrSource(), _value() {}
     96 			/**
     97 			 * Destructor
     98 			 */
     99 			virtual ~domName() {}
    100 			/**
    101 			 * Overloaded assignment operator
    102 			 */
    103 			virtual domName &operator=( const domName &cpy ) { (void)cpy; return *this; }
    104 
    105 		public: // STATIC METHODS
    106 			/**
    107 			 * Creates an instance of this class and returns a daeElementRef referencing it.
    108 			 * @return a daeElementRef referencing an instance of this object.
    109 			 */
    110 			static DLLSPEC daeElementRef create(DAE& dae);
    111 			/**
    112 			 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    113 			 * If a daeMetaElement already exists it will return that instead of creating a new one.
    114 			 * @return A daeMetaElement describing this COLLADA element.
    115 			 */
    116 			static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    117 		};
    118 
    119 
    120 
    121 	protected:  // Elements
    122 /**
    123  * The annotate element allows you to specify an annotation for this generator.
    124  * @see domAnnotate
    125  */
    126 		domFx_annotate_common_Array elemAnnotate_array;
    127 /**
    128  * The code element allows you to embed cg sourcecode for the surface generator.
    129  * @see domCode
    130  */
    131 		domFx_code_profile_Array elemCode_array;
    132 /**
    133  * The include element imports cg source code or precompiled binary shaders
    134  * into the FX Runtime by referencing an external resource. @see domInclude
    135  */
    136 		domFx_include_common_Array elemInclude_array;
    137 /**
    138  * The entry symbol for the shader function. @see domName
    139  */
    140 		domNameRef elemName;
    141 /**
    142  * Assigns a new value to a previously defined parameter. @see domSetparam
    143  */
    144 		domCg_setparam_simple_Array elemSetparam_array;
    145 		/**
    146 		 * Used to preserve order in elements that do not specify strict sequencing of sub-elements.
    147 		 */
    148 		daeElementRefArray _contents;
    149 		/**
    150 		 * Used to preserve order in elements that have a complex content model.
    151 		 */
    152 		daeUIntArray       _contentsOrder;
    153 
    154 		/**
    155 		 * Used to store information needed for some content model objects.
    156 		 */
    157 		daeTArray< daeCharArray * > _CMData;
    158 
    159 
    160 	public:	//Accessors and Mutators
    161 		/**
    162 		 * Gets the annotate element array.
    163 		 * @return Returns a reference to the array of annotate elements.
    164 		 */
    165 		domFx_annotate_common_Array &getAnnotate_array() { return elemAnnotate_array; }
    166 		/**
    167 		 * Gets the annotate element array.
    168 		 * @return Returns a constant reference to the array of annotate elements.
    169 		 */
    170 		const domFx_annotate_common_Array &getAnnotate_array() const { return elemAnnotate_array; }
    171 		/**
    172 		 * Gets the code element array.
    173 		 * @return Returns a reference to the array of code elements.
    174 		 */
    175 		domFx_code_profile_Array &getCode_array() { return elemCode_array; }
    176 		/**
    177 		 * Gets the code element array.
    178 		 * @return Returns a constant reference to the array of code elements.
    179 		 */
    180 		const domFx_code_profile_Array &getCode_array() const { return elemCode_array; }
    181 		/**
    182 		 * Gets the include element array.
    183 		 * @return Returns a reference to the array of include elements.
    184 		 */
    185 		domFx_include_common_Array &getInclude_array() { return elemInclude_array; }
    186 		/**
    187 		 * Gets the include element array.
    188 		 * @return Returns a constant reference to the array of include elements.
    189 		 */
    190 		const domFx_include_common_Array &getInclude_array() const { return elemInclude_array; }
    191 		/**
    192 		 * Gets the name element.
    193 		 * @return a daeSmartRef to the name element.
    194 		 */
    195 		const domNameRef getName() const { return elemName; }
    196 		/**
    197 		 * Gets the setparam element array.
    198 		 * @return Returns a reference to the array of setparam elements.
    199 		 */
    200 		domCg_setparam_simple_Array &getSetparam_array() { return elemSetparam_array; }
    201 		/**
    202 		 * Gets the setparam element array.
    203 		 * @return Returns a constant reference to the array of setparam elements.
    204 		 */
    205 		const domCg_setparam_simple_Array &getSetparam_array() const { return elemSetparam_array; }
    206 		/**
    207 		 * Gets the _contents array.
    208 		 * @return Returns a reference to the _contents element array.
    209 		 */
    210 		daeElementRefArray &getContents() { return _contents; }
    211 		/**
    212 		 * Gets the _contents array.
    213 		 * @return Returns a constant reference to the _contents element array.
    214 		 */
    215 		const daeElementRefArray &getContents() const { return _contents; }
    216 
    217 	protected:
    218 		/**
    219 		 * Constructor
    220 		 */
    221 		domGenerator(DAE& dae) : daeElement(dae), elemAnnotate_array(), elemCode_array(), elemInclude_array(), elemName(), elemSetparam_array() {}
    222 		/**
    223 		 * Destructor
    224 		 */
    225 		virtual ~domGenerator() { daeElement::deleteCMDataArray(_CMData); }
    226 		/**
    227 		 * Overloaded assignment operator
    228 		 */
    229 		virtual domGenerator &operator=( const domGenerator &cpy ) { (void)cpy; return *this; }
    230 
    231 	public: // STATIC METHODS
    232 		/**
    233 		 * Creates an instance of this class and returns a daeElementRef referencing it.
    234 		 * @return a daeElementRef referencing an instance of this object.
    235 		 */
    236 		static DLLSPEC daeElementRef create(DAE& dae);
    237 		/**
    238 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    239 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
    240 		 * @return A daeMetaElement describing this COLLADA element.
    241 		 */
    242 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    243 	};
    244 
    245 
    246 
    247 protected:  // Element
    248 /**
    249  * A procedural surface generator for the cg profile. @see domGenerator
    250  */
    251 	domGeneratorRef elemGenerator;
    252 
    253 public:	//Accessors and Mutators
    254 	/**
    255 	 * Gets the generator element.
    256 	 * @return a daeSmartRef to the generator element.
    257 	 */
    258 	const domGeneratorRef getGenerator() const { return elemGenerator; }
    259 protected:
    260 	/**
    261 	 * Constructor
    262 	 */
    263 	domCg_surface_type_complexType(DAE& dae, daeElement* elt) : domFx_surface_common_complexType(dae, elt), elemGenerator() {}
    264 	/**
    265 	 * Destructor
    266 	 */
    267 	virtual ~domCg_surface_type_complexType() {}
    268 	/**
    269 	 * Overloaded assignment operator
    270 	 */
    271 	virtual domCg_surface_type_complexType &operator=( const domCg_surface_type_complexType &cpy ) { (void)cpy; return *this; }
    272 };
    273 
    274 /**
    275  * An element of type domCg_surface_type_complexType.
    276  */
    277 class domCg_surface_type : public daeElement, public domCg_surface_type_complexType
    278 {
    279 public:
    280 	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::CG_SURFACE_TYPE; }
    281 	static daeInt ID() { return 139; }
    282 	virtual daeInt typeID() const { return ID(); }
    283 protected:
    284 	/**
    285 	 * Constructor
    286 	 */
    287 	domCg_surface_type(DAE& dae) : daeElement(dae), domCg_surface_type_complexType(dae, this) {}
    288 	/**
    289 	 * Destructor
    290 	 */
    291 	virtual ~domCg_surface_type() {}
    292 	/**
    293 	 * Overloaded assignment operator
    294 	 */
    295 	virtual domCg_surface_type &operator=( const domCg_surface_type &cpy ) { (void)cpy; return *this; }
    296 
    297 public: // STATIC METHODS
    298 	/**
    299 	 * Creates an instance of this class and returns a daeElementRef referencing it.
    300 	 * @return a daeElementRef referencing an instance of this object.
    301 	 */
    302 	static DLLSPEC daeElementRef create(DAE& dae);
    303 	/**
    304 	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    305 	 * If a daeMetaElement already exists it will return that instead of creating a new one.
    306 	 * @return A daeMetaElement describing this COLLADA element.
    307 	 */
    308 	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    309 };
    310 
    311 
    312 #endif
    313