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 __domMorph_h__
     10 #define __domMorph_h__
     11 
     12 #include <dae/daeDocument.h>
     13 #include <dom/domTypes.h>
     14 #include <dom/domElements.h>
     15 
     16 #include <dom/domSource.h>
     17 #include <dom/domExtra.h>
     18 #include <dom/domInputLocal.h>
     19 class DAE;
     20 
     21 /**
     22  * The morph element describes the data required to blend between sets of
     23  * static meshes. Each  possible mesh that can be blended (a morph target)
     24  * must be specified.
     25  */
     26 class domMorph : public daeElement
     27 {
     28 public:
     29 	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::MORPH; }
     30 	static daeInt ID() { return 662; }
     31 	virtual daeInt typeID() const { return ID(); }
     32 public:
     33 	class domTargets;
     34 
     35 	typedef daeSmartRef<domTargets> domTargetsRef;
     36 	typedef daeTArray<domTargetsRef> domTargets_Array;
     37 
     38 /**
     39  * The targets element declares the morph targets, their weights and any user
     40  * defined attributes  associated with them.
     41  */
     42 	class domTargets : public daeElement
     43 	{
     44 	public:
     45 		virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::TARGETS; }
     46 		static daeInt ID() { return 663; }
     47 		virtual daeInt typeID() const { return ID(); }
     48 
     49 	protected:  // Elements
     50 /**
     51  * The input element must occur at least twice. These inputs are local inputs.
     52  * @see domInput
     53  */
     54 		domInputLocal_Array elemInput_array;
     55 /**
     56  *  The extra element may appear any number of times.  @see domExtra
     57  */
     58 		domExtra_Array elemExtra_array;
     59 
     60 	public:	//Accessors and Mutators
     61 		/**
     62 		 * Gets the input element array.
     63 		 * @return Returns a reference to the array of input elements.
     64 		 */
     65 		domInputLocal_Array &getInput_array() { return elemInput_array; }
     66 		/**
     67 		 * Gets the input element array.
     68 		 * @return Returns a constant reference to the array of input elements.
     69 		 */
     70 		const domInputLocal_Array &getInput_array() const { return elemInput_array; }
     71 		/**
     72 		 * Gets the extra element array.
     73 		 * @return Returns a reference to the array of extra elements.
     74 		 */
     75 		domExtra_Array &getExtra_array() { return elemExtra_array; }
     76 		/**
     77 		 * Gets the extra element array.
     78 		 * @return Returns a constant reference to the array of extra elements.
     79 		 */
     80 		const domExtra_Array &getExtra_array() const { return elemExtra_array; }
     81 	protected:
     82 		/**
     83 		 * Constructor
     84 		 */
     85 		domTargets(DAE& dae) : daeElement(dae), elemInput_array(), elemExtra_array() {}
     86 		/**
     87 		 * Destructor
     88 		 */
     89 		virtual ~domTargets() {}
     90 		/**
     91 		 * Overloaded assignment operator
     92 		 */
     93 		virtual domTargets &operator=( const domTargets &cpy ) { (void)cpy; return *this; }
     94 
     95 	public: // STATIC METHODS
     96 		/**
     97 		 * Creates an instance of this class and returns a daeElementRef referencing it.
     98 		 * @return a daeElementRef referencing an instance of this object.
     99 		 */
    100 		static DLLSPEC daeElementRef create(DAE& dae);
    101 		/**
    102 		 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    103 		 * If a daeMetaElement already exists it will return that instead of creating a new one.
    104 		 * @return A daeMetaElement describing this COLLADA element.
    105 		 */
    106 		static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    107 	};
    108 
    109 
    110 protected:  // Attributes
    111 /**
    112  *  The method attribute specifies the which blending technique to use. The
    113  * accepted values are  NORMALIZED, and RELATIVE. The default value if not
    114  * specified is NORMALIZED.  Optional attribute.
    115  */
    116 	domMorphMethodType attrMethod;
    117 /**
    118  *  The source attribute indicates the base mesh. Required attribute.
    119  */
    120 	xsAnyURI attrSource;
    121 
    122 protected:  // Elements
    123 /**
    124  *  The morph element must contain at least two source elements.  @see domSource
    125  */
    126 	domSource_Array elemSource_array;
    127 /**
    128  * The targets element declares the morph targets, their weights and any user
    129  * defined attributes  associated with them. @see domTargets
    130  */
    131 	domTargetsRef elemTargets;
    132 /**
    133  *  The extra element may appear any number of times.  @see domExtra
    134  */
    135 	domExtra_Array elemExtra_array;
    136 
    137 public:	//Accessors and Mutators
    138 	/**
    139 	 * Gets the method attribute.
    140 	 * @return Returns a domMorphMethodType of the method attribute.
    141 	 */
    142 	domMorphMethodType getMethod() const { return attrMethod; }
    143 	/**
    144 	 * Sets the method attribute.
    145 	 * @param atMethod The new value for the method attribute.
    146 	 */
    147 	void setMethod( domMorphMethodType atMethod ) { attrMethod = atMethod; _validAttributeArray[0] = true; }
    148 
    149 	/**
    150 	 * Gets the source attribute.
    151 	 * @return Returns a xsAnyURI reference of the source attribute.
    152 	 */
    153 	xsAnyURI &getSource() { return attrSource; }
    154 	/**
    155 	 * Gets the source attribute.
    156 	 * @return Returns a constant xsAnyURI reference of the source attribute.
    157 	 */
    158 	const xsAnyURI &getSource() const { return attrSource; }
    159 	/**
    160 	 * Sets the source attribute.
    161 	 * @param atSource The new value for the source attribute.
    162 	 */
    163 	void setSource( const xsAnyURI &atSource ) { attrSource = atSource; _validAttributeArray[1] = true; }
    164 	/**
    165 	 * Sets the source attribute.
    166 	 * @param atSource The new value for the source attribute.
    167 	 */
    168 	void setSource( xsString atSource ) { attrSource = atSource; _validAttributeArray[1] = true; }
    169 
    170 	/**
    171 	 * Gets the source element array.
    172 	 * @return Returns a reference to the array of source elements.
    173 	 */
    174 	domSource_Array &getSource_array() { return elemSource_array; }
    175 	/**
    176 	 * Gets the source element array.
    177 	 * @return Returns a constant reference to the array of source elements.
    178 	 */
    179 	const domSource_Array &getSource_array() const { return elemSource_array; }
    180 	/**
    181 	 * Gets the targets element.
    182 	 * @return a daeSmartRef to the targets element.
    183 	 */
    184 	const domTargetsRef getTargets() const { return elemTargets; }
    185 	/**
    186 	 * Gets the extra element array.
    187 	 * @return Returns a reference to the array of extra elements.
    188 	 */
    189 	domExtra_Array &getExtra_array() { return elemExtra_array; }
    190 	/**
    191 	 * Gets the extra element array.
    192 	 * @return Returns a constant reference to the array of extra elements.
    193 	 */
    194 	const domExtra_Array &getExtra_array() const { return elemExtra_array; }
    195 protected:
    196 	/**
    197 	 * Constructor
    198 	 */
    199 	domMorph(DAE& dae) : daeElement(dae), attrMethod(), attrSource(dae, *this), elemSource_array(), elemTargets(), elemExtra_array() {}
    200 	/**
    201 	 * Destructor
    202 	 */
    203 	virtual ~domMorph() {}
    204 	/**
    205 	 * Overloaded assignment operator
    206 	 */
    207 	virtual domMorph &operator=( const domMorph &cpy ) { (void)cpy; return *this; }
    208 
    209 public: // STATIC METHODS
    210 	/**
    211 	 * Creates an instance of this class and returns a daeElementRef referencing it.
    212 	 * @return a daeElementRef referencing an instance of this object.
    213 	 */
    214 	static DLLSPEC daeElementRef create(DAE& dae);
    215 	/**
    216 	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    217 	 * If a daeMetaElement already exists it will return that instead of creating a new one.
    218 	 * @return A daeMetaElement describing this COLLADA element.
    219 	 */
    220 	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    221 };
    222 
    223 
    224 #endif
    225