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_init_common_h__
     10 #define __domFx_surface_init_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_cube_common.h>
     17 #include <dom/domFx_surface_init_volume_common.h>
     18 #include <dom/domFx_surface_init_planar_common.h>
     19 #include <dom/domFx_surface_init_from_common.h>
     20 class DAE;
     21 
     22 /**
     23  * The common set of initalization options for surfaces.  Choose which is
     24  * appropriate for your surface based on type and other characteristics. described
     25  * by the annotation docs on the child elements.
     26  */
     27 class domFx_surface_init_common : public daeElement
     28 {
     29 public:
     30 	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FX_SURFACE_INIT_COMMON; }
     31 	static daeInt ID() { return 168; }
     32 	virtual daeInt typeID() const { return ID(); }
     33 public:
     34 	class domInit_as_null;
     35 
     36 	typedef daeSmartRef<domInit_as_null> domInit_as_nullRef;
     37 	typedef daeTArray<domInit_as_nullRef> domInit_as_null_Array;
     38 
     39 /**
     40  * This surface is intended to be initialized later externally by a "setparam"
     41  * element.  If it is used before being initialized there is profile and platform
     42  * specific behavior.  Most elements on the surface element containing this
     43  * will be ignored including mip_levels, mipmap_generate, size, viewport_ratio,
     44  * and format.
     45  */
     46 	class domInit_as_null : public daeElement
     47 	{
     48 	public:
     49 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::INIT_AS_NULL; }
     50 		static daeInt ID() { return 169; }
     51 		virtual daeInt typeID() const { return ID(); }
     52 
     53 	protected:
     54 		/**
     55 		 * Constructor
     56 		 */
     57 		domInit_as_null(DAE& dae) : daeElement(dae) {}
     58 		/**
     59 		 * Destructor
     60 		 */
     61 		virtual ~domInit_as_null() {}
     62 		/**
     63 		 * Overloaded assignment operator
     64 		 */
     65 		virtual domInit_as_null &operator=( const domInit_as_null &cpy ) { (void)cpy; return *this; }
     66 
     67 	public: // STATIC METHODS
     68 		/**
     69 		 * Creates an instance of this class and returns a daeElementRef referencing it.
     70 		 * @return a daeElementRef referencing an instance of this object.
     71 		 */
     72 		static DLLSPEC daeElementRef create(DAE& dae);
     73 		/**
     74 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
     75 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
     76 		 * @return A daeMetaElement describing this COLLADA element.
     77 		 */
     78 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
     79 	};
     80 
     81 	class domInit_as_target;
     82 
     83 	typedef daeSmartRef<domInit_as_target> domInit_as_targetRef;
     84 	typedef daeTArray<domInit_as_targetRef> domInit_as_target_Array;
     85 
     86 /**
     87  * Init as a target for depth, stencil, or color.  It does not need image
     88  * data. Surface should not have mipmap_generate when using this.
     89  */
     90 	class domInit_as_target : public daeElement
     91 	{
     92 	public:
     93 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::INIT_AS_TARGET; }
     94 		static daeInt ID() { return 170; }
     95 		virtual daeInt typeID() const { return ID(); }
     96 
     97 	protected:
     98 		/**
     99 		 * Constructor
    100 		 */
    101 		domInit_as_target(DAE& dae) : daeElement(dae) {}
    102 		/**
    103 		 * Destructor
    104 		 */
    105 		virtual ~domInit_as_target() {}
    106 		/**
    107 		 * Overloaded assignment operator
    108 		 */
    109 		virtual domInit_as_target &operator=( const domInit_as_target &cpy ) { (void)cpy; return *this; }
    110 
    111 	public: // STATIC METHODS
    112 		/**
    113 		 * Creates an instance of this class and returns a daeElementRef referencing it.
    114 		 * @return a daeElementRef referencing an instance of this object.
    115 		 */
    116 		static DLLSPEC daeElementRef create(DAE& dae);
    117 		/**
    118 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    119 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
    120 		 * @return A daeMetaElement describing this COLLADA element.
    121 		 */
    122 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    123 	};
    124 
    125 
    126 
    127 protected:  // Elements
    128 /**
    129  * This surface is intended to be initialized later externally by a "setparam"
    130  * element.  If it is used before being initialized there is profile and platform
    131  * specific behavior.  Most elements on the surface element containing this
    132  * will be ignored including mip_levels, mipmap_generate, size, viewport_ratio,
    133  * and format. @see domInit_as_null
    134  */
    135 	domInit_as_nullRef elemInit_as_null;
    136 /**
    137  * Init as a target for depth, stencil, or color.  It does not need image
    138  * data. Surface should not have mipmap_generate when using this. @see domInit_as_target
    139  */
    140 	domInit_as_targetRef elemInit_as_target;
    141 /**
    142  * Init a CUBE from a compound image such as DDS @see domInit_cube
    143  */
    144 	domFx_surface_init_cube_commonRef elemInit_cube;
    145 /**
    146  * Init a 3D from a compound image such as DDS @see domInit_volume
    147  */
    148 	domFx_surface_init_volume_commonRef elemInit_volume;
    149 /**
    150  * Init a 1D,2D,RECT,DEPTH from a compound image such as DDS @see domInit_planar
    151  */
    152 	domFx_surface_init_planar_commonRef elemInit_planar;
    153 /**
    154  * Initialize the surface one sub-surface at a time by specifying combinations
    155  * of mip, face, and slice which make sense for a particular surface type.
    156  * Each sub-surface is initialized by a common 2D image, not a complex compound
    157  * image such as DDS. If not all subsurfaces are initialized, it is invalid
    158  * and will result in profile and platform specific behavior unless mipmap_generate
    159  * is responsible for initializing the remainder of the sub-surfaces @see
    160  * domInit_from
    161  */
    162 	domFx_surface_init_from_common_Array elemInit_from_array;
    163 	/**
    164 	 * Used to preserve order in elements that do not specify strict sequencing of sub-elements.
    165 	 */
    166 	daeElementRefArray _contents;
    167 	/**
    168 	 * Used to preserve order in elements that have a complex content model.
    169 	 */
    170 	daeUIntArray       _contentsOrder;
    171 
    172 	/**
    173 	 * Used to store information needed for some content model objects.
    174 	 */
    175 	daeTArray< daeCharArray * > _CMData;
    176 
    177 
    178 public:	//Accessors and Mutators
    179 	/**
    180 	 * Gets the init_as_null element.
    181 	 * @return a daeSmartRef to the init_as_null element.
    182 	 */
    183 	const domInit_as_nullRef getInit_as_null() const { return elemInit_as_null; }
    184 	/**
    185 	 * Gets the init_as_target element.
    186 	 * @return a daeSmartRef to the init_as_target element.
    187 	 */
    188 	const domInit_as_targetRef getInit_as_target() const { return elemInit_as_target; }
    189 	/**
    190 	 * Gets the init_cube element.
    191 	 * @return a daeSmartRef to the init_cube element.
    192 	 */
    193 	const domFx_surface_init_cube_commonRef getInit_cube() const { return elemInit_cube; }
    194 	/**
    195 	 * Gets the init_volume element.
    196 	 * @return a daeSmartRef to the init_volume element.
    197 	 */
    198 	const domFx_surface_init_volume_commonRef getInit_volume() const { return elemInit_volume; }
    199 	/**
    200 	 * Gets the init_planar element.
    201 	 * @return a daeSmartRef to the init_planar element.
    202 	 */
    203 	const domFx_surface_init_planar_commonRef getInit_planar() const { return elemInit_planar; }
    204 	/**
    205 	 * Gets the init_from element array.
    206 	 * @return Returns a reference to the array of init_from elements.
    207 	 */
    208 	domFx_surface_init_from_common_Array &getInit_from_array() { return elemInit_from_array; }
    209 	/**
    210 	 * Gets the init_from element array.
    211 	 * @return Returns a constant reference to the array of init_from elements.
    212 	 */
    213 	const domFx_surface_init_from_common_Array &getInit_from_array() const { return elemInit_from_array; }
    214 	/**
    215 	 * Gets the _contents array.
    216 	 * @return Returns a reference to the _contents element array.
    217 	 */
    218 	daeElementRefArray &getContents() { return _contents; }
    219 	/**
    220 	 * Gets the _contents array.
    221 	 * @return Returns a constant reference to the _contents element array.
    222 	 */
    223 	const daeElementRefArray &getContents() const { return _contents; }
    224 
    225 protected:
    226 	/**
    227 	 * Constructor
    228 	 */
    229 	domFx_surface_init_common(DAE& dae) : daeElement(dae), elemInit_as_null(), elemInit_as_target(), elemInit_cube(), elemInit_volume(), elemInit_planar(), elemInit_from_array() {}
    230 	/**
    231 	 * Destructor
    232 	 */
    233 	virtual ~domFx_surface_init_common() { daeElement::deleteCMDataArray(_CMData); }
    234 	/**
    235 	 * Overloaded assignment operator
    236 	 */
    237 	virtual domFx_surface_init_common &operator=( const domFx_surface_init_common &cpy ) { (void)cpy; return *this; }
    238 
    239 public: // STATIC METHODS
    240 	/**
    241 	 * Creates an instance of this class and returns a daeElementRef referencing it.
    242 	 * @return a daeElementRef referencing an instance of this object.
    243 	 */
    244 	static DLLSPEC daeElementRef create(DAE& dae);
    245 	/**
    246 	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    247 	 * If a daeMetaElement already exists it will return that instead of creating a new one.
    248 	 * @return A daeMetaElement describing this COLLADA element.
    249 	 */
    250 	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    251 };
    252 
    253 
    254 #endif
    255