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 __domFx_surface_common_h__
     10 #define __domFx_surface_common_h__
     11 
     12 #include <dae/daeDocument.h>
     13 #include <dom/domTypes.h>
     14 #include <dom/domElements.h>
     15 
     16 #include <dom/domFx_surface_init_common.h>
     17 #include <dom/domExtra.h>
     18 #include <dom/domFx_surface_format_hint_common.h>
     19 class DAE;
     20 
     21 /**
     22  * The fx_surface_common type is used to declare a resource that can be used
     23  * both as the source for texture samples and as the target of a rendering
     24  * pass.
     25  */
     26 class domFx_surface_common_complexType
     27 {
     28 public:
     29 	class domFormat;
     30 
     31 	typedef daeSmartRef<domFormat> domFormatRef;
     32 	typedef daeTArray<domFormatRef> domFormat_Array;
     33 
     34 /**
     35  * Contains a string representing the profile and platform specific texel
     36  * format that the author would like this surface to use.  If this element
     37  * is not specified then the application will use a common format R8G8B8A8
     38  * with linear color gradient, not  sRGB.
     39  */
     40 	class domFormat : public daeElement
     41 	{
     42 	public:
     43 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FORMAT; }
     44 		static daeInt ID() { return 22; }
     45 		virtual daeInt typeID() const { return ID(); }
     46 
     47 	protected:  // Value
     48 		/**
     49 		 * The xsToken value of the text data of this element.
     50 		 */
     51 		xsToken _value;
     52 
     53 	public:	//Accessors and Mutators
     54 		/**
     55 		 * Gets the value of this element.
     56 		 * @return Returns a xsToken of the value.
     57 		 */
     58 		xsToken getValue() const { return _value; }
     59 		/**
     60 		 * Sets the _value of this element.
     61 		 * @param val The new value for this element.
     62 		 */
     63 		void setValue( xsToken val ) { *(daeStringRef*)&_value = val; }
     64 
     65 	protected:
     66 		/**
     67 		 * Constructor
     68 		 */
     69 		domFormat(DAE& dae) : daeElement(dae), _value() {}
     70 		/**
     71 		 * Destructor
     72 		 */
     73 		virtual ~domFormat() {}
     74 		/**
     75 		 * Overloaded assignment operator
     76 		 */
     77 		virtual domFormat &operator=( const domFormat &cpy ) { (void)cpy; return *this; }
     78 
     79 	public: // STATIC METHODS
     80 		/**
     81 		 * Creates an instance of this class and returns a daeElementRef referencing it.
     82 		 * @return a daeElementRef referencing an instance of this object.
     83 		 */
     84 		static DLLSPEC daeElementRef create(DAE& dae);
     85 		/**
     86 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
     87 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
     88 		 * @return A daeMetaElement describing this COLLADA element.
     89 		 */
     90 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
     91 	};
     92 
     93 	class domSize;
     94 
     95 	typedef daeSmartRef<domSize> domSizeRef;
     96 	typedef daeTArray<domSizeRef> domSize_Array;
     97 
     98 /**
     99  * The surface should be sized to these exact dimensions
    100  */
    101 	class domSize : public daeElement
    102 	{
    103 	public:
    104 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::SIZE; }
    105 		static daeInt ID() { return 23; }
    106 		virtual daeInt typeID() const { return ID(); }
    107 
    108 	protected:  // Value
    109 		/**
    110 		 * The domInt3 value of the text data of this element.
    111 		 */
    112 		domInt3 _value;
    113 
    114 	public:	//Accessors and Mutators
    115 		/**
    116 		 * Gets the _value array.
    117 		 * @return Returns a domInt3 reference of the _value array.
    118 		 */
    119 		domInt3 &getValue() { return _value; }
    120 		/**
    121 		 * Gets the _value array.
    122 		 * @return Returns a constant domInt3 reference of the _value array.
    123 		 */
    124 		const domInt3 &getValue() const { return _value; }
    125 		/**
    126 		 * Sets the _value array.
    127 		 * @param val The new value for the _value array.
    128 		 */
    129 		void setValue( const domInt3 &val ) { _value = val; }
    130 
    131 	protected:
    132 		/**
    133 		 * Constructor
    134 		 */
    135 		domSize(DAE& dae) : daeElement(dae), _value() {}
    136 		/**
    137 		 * Destructor
    138 		 */
    139 		virtual ~domSize() {}
    140 		/**
    141 		 * Overloaded assignment operator
    142 		 */
    143 		virtual domSize &operator=( const domSize &cpy ) { (void)cpy; return *this; }
    144 
    145 	public: // STATIC METHODS
    146 		/**
    147 		 * Creates an instance of this class and returns a daeElementRef referencing it.
    148 		 * @return a daeElementRef referencing an instance of this object.
    149 		 */
    150 		static DLLSPEC daeElementRef create(DAE& dae);
    151 		/**
    152 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    153 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
    154 		 * @return A daeMetaElement describing this COLLADA element.
    155 		 */
    156 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    157 	};
    158 
    159 	class domViewport_ratio;
    160 
    161 	typedef daeSmartRef<domViewport_ratio> domViewport_ratioRef;
    162 	typedef daeTArray<domViewport_ratioRef> domViewport_ratio_Array;
    163 
    164 /**
    165  * The surface should be sized to a dimension based on this ratio of the viewport's
    166  * dimensions in pixels
    167  */
    168 	class domViewport_ratio : public daeElement
    169 	{
    170 	public:
    171 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::VIEWPORT_RATIO; }
    172 		static daeInt ID() { return 24; }
    173 		virtual daeInt typeID() const { return ID(); }
    174 
    175 	protected:  // Value
    176 		/**
    177 		 * The domFloat2 value of the text data of this element.
    178 		 */
    179 		domFloat2 _value;
    180 
    181 	public:	//Accessors and Mutators
    182 		/**
    183 		 * Gets the _value array.
    184 		 * @return Returns a domFloat2 reference of the _value array.
    185 		 */
    186 		domFloat2 &getValue() { return _value; }
    187 		/**
    188 		 * Gets the _value array.
    189 		 * @return Returns a constant domFloat2 reference of the _value array.
    190 		 */
    191 		const domFloat2 &getValue() const { return _value; }
    192 		/**
    193 		 * Sets the _value array.
    194 		 * @param val The new value for the _value array.
    195 		 */
    196 		void setValue( const domFloat2 &val ) { _value = val; }
    197 
    198 	protected:
    199 		/**
    200 		 * Constructor
    201 		 */
    202 		domViewport_ratio(DAE& dae) : daeElement(dae), _value() {}
    203 		/**
    204 		 * Destructor
    205 		 */
    206 		virtual ~domViewport_ratio() {}
    207 		/**
    208 		 * Overloaded assignment operator
    209 		 */
    210 		virtual domViewport_ratio &operator=( const domViewport_ratio &cpy ) { (void)cpy; return *this; }
    211 
    212 	public: // STATIC METHODS
    213 		/**
    214 		 * Creates an instance of this class and returns a daeElementRef referencing it.
    215 		 * @return a daeElementRef referencing an instance of this object.
    216 		 */
    217 		static DLLSPEC daeElementRef create(DAE& dae);
    218 		/**
    219 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    220 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
    221 		 * @return A daeMetaElement describing this COLLADA element.
    222 		 */
    223 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    224 	};
    225 
    226 	class domMip_levels;
    227 
    228 	typedef daeSmartRef<domMip_levels> domMip_levelsRef;
    229 	typedef daeTArray<domMip_levelsRef> domMip_levels_Array;
    230 
    231 /**
    232  * the surface should contain the following number of MIP levels.  If this
    233  * element is not present it is assumed that all miplevels exist until a dimension
    234  * becomes 1 texel.  To create a surface that has only one level of mip maps
    235  * (mip=0) set this to 1.  If the value is 0 the result is the same as if
    236  * mip_levels was unspecified, all possible mip_levels will exist.
    237  */
    238 	class domMip_levels : public daeElement
    239 	{
    240 	public:
    241 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::MIP_LEVELS; }
    242 		static daeInt ID() { return 25; }
    243 		virtual daeInt typeID() const { return ID(); }
    244 
    245 	protected:  // Value
    246 		/**
    247 		 * The xsUnsignedInt value of the text data of this element.
    248 		 */
    249 		xsUnsignedInt _value;
    250 
    251 	public:	//Accessors and Mutators
    252 		/**
    253 		 * Gets the value of this element.
    254 		 * @return a xsUnsignedInt of the value.
    255 		 */
    256 		xsUnsignedInt getValue() const { return _value; }
    257 		/**
    258 		 * Sets the _value of this element.
    259 		 * @param val The new value for this element.
    260 		 */
    261 		void setValue( xsUnsignedInt val ) { _value = val; }
    262 
    263 	protected:
    264 		/**
    265 		 * Constructor
    266 		 */
    267 		domMip_levels(DAE& dae) : daeElement(dae), _value() {}
    268 		/**
    269 		 * Destructor
    270 		 */
    271 		virtual ~domMip_levels() {}
    272 		/**
    273 		 * Overloaded assignment operator
    274 		 */
    275 		virtual domMip_levels &operator=( const domMip_levels &cpy ) { (void)cpy; return *this; }
    276 
    277 	public: // STATIC METHODS
    278 		/**
    279 		 * Creates an instance of this class and returns a daeElementRef referencing it.
    280 		 * @return a daeElementRef referencing an instance of this object.
    281 		 */
    282 		static DLLSPEC daeElementRef create(DAE& dae);
    283 		/**
    284 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    285 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
    286 		 * @return A daeMetaElement describing this COLLADA element.
    287 		 */
    288 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    289 	};
    290 
    291 	class domMipmap_generate;
    292 
    293 	typedef daeSmartRef<domMipmap_generate> domMipmap_generateRef;
    294 	typedef daeTArray<domMipmap_generateRef> domMipmap_generate_Array;
    295 
    296 /**
    297  * By default it is assumed that mipmaps are supplied by the author so, if
    298  * not all subsurfaces are initialized, it is invalid and will result in profile
    299  * and platform specific behavior unless mipmap_generate is responsible for
    300  * initializing the remainder of the sub-surfaces
    301  */
    302 	class domMipmap_generate : public daeElement
    303 	{
    304 	public:
    305 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::MIPMAP_GENERATE; }
    306 		static daeInt ID() { return 26; }
    307 		virtual daeInt typeID() const { return ID(); }
    308 
    309 	protected:  // Value
    310 		/**
    311 		 * The xsBoolean value of the text data of this element.
    312 		 */
    313 		xsBoolean _value;
    314 
    315 	public:	//Accessors and Mutators
    316 		/**
    317 		 * Gets the value of this element.
    318 		 * @return a xsBoolean of the value.
    319 		 */
    320 		xsBoolean getValue() const { return _value; }
    321 		/**
    322 		 * Sets the _value of this element.
    323 		 * @param val The new value for this element.
    324 		 */
    325 		void setValue( xsBoolean val ) { _value = val; }
    326 
    327 	protected:
    328 		/**
    329 		 * Constructor
    330 		 */
    331 		domMipmap_generate(DAE& dae) : daeElement(dae), _value() {}
    332 		/**
    333 		 * Destructor
    334 		 */
    335 		virtual ~domMipmap_generate() {}
    336 		/**
    337 		 * Overloaded assignment operator
    338 		 */
    339 		virtual domMipmap_generate &operator=( const domMipmap_generate &cpy ) { (void)cpy; return *this; }
    340 
    341 	public: // STATIC METHODS
    342 		/**
    343 		 * Creates an instance of this class and returns a daeElementRef referencing it.
    344 		 * @return a daeElementRef referencing an instance of this object.
    345 		 */
    346 		static DLLSPEC daeElementRef create(DAE& dae);
    347 		/**
    348 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    349 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
    350 		 * @return A daeMetaElement describing this COLLADA element.
    351 		 */
    352 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    353 	};
    354 
    355 
    356 protected:  // Attribute
    357 /**
    358  * Specifying the type of a surface is mandatory though the type may be "UNTYPED".
    359  * When a surface is typed as UNTYPED, it is said to be temporarily untyped
    360  * and instead will be typed later by the context it is used in such as which
    361  * samplers reference it in that are used in a particular technique or pass.
    362  * If there is a type mismatch between what is set into it later and what
    363  * the runtime decides the type should be the result in profile and platform
    364  * specific behavior.
    365  */
    366 	domFx_surface_type_enum attrType;
    367 
    368 protected:  // Elements
    369 /**
    370  * The common set of initalization options for surfaces.  Choose which is
    371  * appropriate for your surface based on the type attribute and other characteristics
    372  * described by the annotation docs on the choiced child elements of this
    373  * type. @see domFx_surface_init_common
    374  */
    375 	domFx_surface_init_commonRef elemFx_surface_init_common;
    376 /**
    377  * Contains a string representing the profile and platform specific texel
    378  * format that the author would like this surface to use.  If this element
    379  * is not specified then the application will use a common format R8G8B8A8
    380  * with linear color gradient, not  sRGB. @see domFormat
    381  */
    382 	domFormatRef elemFormat;
    383 /**
    384  * If the exact format cannot be resolved via the "format" element then the
    385  * format_hint will describe the important features of the format so that
    386  * the application may select a compatable or close format @see domFormat_hint
    387  */
    388 	domFx_surface_format_hint_commonRef elemFormat_hint;
    389 /**
    390  * The surface should be sized to these exact dimensions @see domSize
    391  */
    392 	domSizeRef elemSize;
    393 /**
    394  * The surface should be sized to a dimension based on this ratio of the viewport's
    395  * dimensions in pixels @see domViewport_ratio
    396  */
    397 	domViewport_ratioRef elemViewport_ratio;
    398 /**
    399  * the surface should contain the following number of MIP levels.  If this
    400  * element is not present it is assumed that all miplevels exist until a dimension
    401  * becomes 1 texel.  To create a surface that has only one level of mip maps
    402  * (mip=0) set this to 1.  If the value is 0 the result is the same as if
    403  * mip_levels was unspecified, all possible mip_levels will exist. @see domMip_levels
    404  */
    405 	domMip_levelsRef elemMip_levels;
    406 /**
    407  * By default it is assumed that mipmaps are supplied by the author so, if
    408  * not all subsurfaces are initialized, it is invalid and will result in profile
    409  * and platform specific behavior unless mipmap_generate is responsible for
    410  * initializing the remainder of the sub-surfaces @see domMipmap_generate
    411  */
    412 	domMipmap_generateRef elemMipmap_generate;
    413 	domExtra_Array elemExtra_array;
    414 	/**
    415 	 * Used to preserve order in elements that do not specify strict sequencing of sub-elements.
    416 	 */
    417 	daeElementRefArray _contents;
    418 	/**
    419 	 * Used to preserve order in elements that have a complex content model.
    420 	 */
    421 	daeUIntArray       _contentsOrder;
    422 
    423 	/**
    424 	 * Used to store information needed for some content model objects.
    425 	 */
    426 	daeTArray< daeCharArray * > _CMData;
    427 
    428 
    429 public:	//Accessors and Mutators
    430 	/**
    431 	 * Gets the type attribute.
    432 	 * @return Returns a domFx_surface_type_enum of the type attribute.
    433 	 */
    434 	domFx_surface_type_enum getType() const { return attrType; }
    435 	/**
    436 	 * Sets the type attribute.
    437 	 * @param atType The new value for the type attribute.
    438 	 */
    439 	void setType( domFx_surface_type_enum atType ) { attrType = atType; }
    440 
    441 	/**
    442 	 * Gets the fx_surface_init_common element.
    443 	 * @return a daeSmartRef to the fx_surface_init_common element.
    444 	 */
    445 	const domFx_surface_init_commonRef getFx_surface_init_common() const { return elemFx_surface_init_common; }
    446 	/**
    447 	 * Gets the format element.
    448 	 * @return a daeSmartRef to the format element.
    449 	 */
    450 	const domFormatRef getFormat() const { return elemFormat; }
    451 	/**
    452 	 * Gets the format_hint element.
    453 	 * @return a daeSmartRef to the format_hint element.
    454 	 */
    455 	const domFx_surface_format_hint_commonRef getFormat_hint() const { return elemFormat_hint; }
    456 	/**
    457 	 * Gets the size element.
    458 	 * @return a daeSmartRef to the size element.
    459 	 */
    460 	const domSizeRef getSize() const { return elemSize; }
    461 	/**
    462 	 * Gets the viewport_ratio element.
    463 	 * @return a daeSmartRef to the viewport_ratio element.
    464 	 */
    465 	const domViewport_ratioRef getViewport_ratio() const { return elemViewport_ratio; }
    466 	/**
    467 	 * Gets the mip_levels element.
    468 	 * @return a daeSmartRef to the mip_levels element.
    469 	 */
    470 	const domMip_levelsRef getMip_levels() const { return elemMip_levels; }
    471 	/**
    472 	 * Gets the mipmap_generate element.
    473 	 * @return a daeSmartRef to the mipmap_generate element.
    474 	 */
    475 	const domMipmap_generateRef getMipmap_generate() const { return elemMipmap_generate; }
    476 	/**
    477 	 * Gets the extra element array.
    478 	 * @return Returns a reference to the array of extra elements.
    479 	 */
    480 	domExtra_Array &getExtra_array() { return elemExtra_array; }
    481 	/**
    482 	 * Gets the extra element array.
    483 	 * @return Returns a constant reference to the array of extra elements.
    484 	 */
    485 	const domExtra_Array &getExtra_array() const { return elemExtra_array; }
    486 	/**
    487 	 * Gets the _contents array.
    488 	 * @return Returns a reference to the _contents element array.
    489 	 */
    490 	daeElementRefArray &getContents() { return _contents; }
    491 	/**
    492 	 * Gets the _contents array.
    493 	 * @return Returns a constant reference to the _contents element array.
    494 	 */
    495 	const daeElementRefArray &getContents() const { return _contents; }
    496 
    497 protected:
    498 	/**
    499 	 * Constructor
    500 	 */
    501 	domFx_surface_common_complexType(DAE& dae, daeElement* elt) : attrType(), elemFx_surface_init_common(), elemFormat(), elemFormat_hint(), elemSize(), elemViewport_ratio(), elemMip_levels(), elemMipmap_generate(), elemExtra_array() {}
    502 	/**
    503 	 * Destructor
    504 	 */
    505 	virtual ~domFx_surface_common_complexType() { daeElement::deleteCMDataArray(_CMData); }
    506 	/**
    507 	 * Overloaded assignment operator
    508 	 */
    509 	virtual domFx_surface_common_complexType &operator=( const domFx_surface_common_complexType &cpy ) { (void)cpy; return *this; }
    510 };
    511 
    512 /**
    513  * An element of type domFx_surface_common_complexType.
    514  */
    515 class domFx_surface_common : public daeElement, public domFx_surface_common_complexType
    516 {
    517 public:
    518 	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FX_SURFACE_COMMON; }
    519 	static daeInt ID() { return 27; }
    520 	virtual daeInt typeID() const { return ID(); }
    521 
    522 public:	//Accessors and Mutators
    523 	/**
    524 	 * Gets the type attribute.
    525 	 * @return Returns a domFx_surface_type_enum of the type attribute.
    526 	 */
    527 	domFx_surface_type_enum getType() const { return attrType; }
    528 	/**
    529 	 * Sets the type attribute.
    530 	 * @param atType The new value for the type attribute.
    531 	 */
    532 	void setType( domFx_surface_type_enum atType ) { attrType = atType; _validAttributeArray[0] = true; }
    533 
    534 protected:
    535 	/**
    536 	 * Constructor
    537 	 */
    538 	domFx_surface_common(DAE& dae) : daeElement(dae), domFx_surface_common_complexType(dae, this) {}
    539 	/**
    540 	 * Destructor
    541 	 */
    542 	virtual ~domFx_surface_common() {}
    543 	/**
    544 	 * Overloaded assignment operator
    545 	 */
    546 	virtual domFx_surface_common &operator=( const domFx_surface_common &cpy ) { (void)cpy; return *this; }
    547 
    548 public: // STATIC METHODS
    549 	/**
    550 	 * Creates an instance of this class and returns a daeElementRef referencing it.
    551 	 * @return a daeElementRef referencing an instance of this object.
    552 	 */
    553 	static DLLSPEC daeElementRef create(DAE& dae);
    554 	/**
    555 	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    556 	 * If a daeMetaElement already exists it will return that instead of creating a new one.
    557 	 * @return A daeMetaElement describing this COLLADA element.
    558 	 */
    559 	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    560 };
    561 
    562 
    563 #endif
    564