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 __domPolylist_h__ 10 #define __domPolylist_h__ 11 12 #include <dae/daeDocument.h> 13 #include <dom/domTypes.h> 14 #include <dom/domElements.h> 15 16 #include <dom/domP.h> 17 #include <dom/domExtra.h> 18 #include <dom/domInputLocalOffset.h> 19 class DAE; 20 21 /** 22 * The polylist element provides the information needed to bind vertex attributes 23 * together and then organize those vertices into individual polygons. The 24 * polygons described in polylist can contain arbitrary numbers of vertices. 25 * Unlike the polygons element, the polylist element cannot contain polygons 26 * with holes. 27 */ 28 class domPolylist : public daeElement 29 { 30 public: 31 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::POLYLIST; } 32 static daeInt ID() { return 623; } 33 virtual daeInt typeID() const { return ID(); } 34 public: 35 class domVcount; 36 37 typedef daeSmartRef<domVcount> domVcountRef; 38 typedef daeTArray<domVcountRef> domVcount_Array; 39 40 /** 41 * The vcount element contains a list of integers describing the number of 42 * sides for each polygon described by the polylist element. The vcount element 43 * may occur once. 44 */ 45 class domVcount : public daeElement 46 { 47 public: 48 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::VCOUNT; } 49 static daeInt ID() { return 624; } 50 virtual daeInt typeID() const { return ID(); } 51 52 protected: // Value 53 /** 54 * The domListOfUInts value of the text data of this element. 55 */ 56 domListOfUInts _value; 57 58 public: //Accessors and Mutators 59 /** 60 * Gets the _value array. 61 * @return Returns a domListOfUInts reference of the _value array. 62 */ 63 domListOfUInts &getValue() { return _value; } 64 /** 65 * Gets the _value array. 66 * @return Returns a constant domListOfUInts reference of the _value array. 67 */ 68 const domListOfUInts &getValue() const { return _value; } 69 /** 70 * Sets the _value array. 71 * @param val The new value for the _value array. 72 */ 73 void setValue( const domListOfUInts &val ) { _value = val; } 74 75 protected: 76 /** 77 * Constructor 78 */ 79 domVcount(DAE& dae) : daeElement(dae), _value() {} 80 /** 81 * Destructor 82 */ 83 virtual ~domVcount() {} 84 /** 85 * Overloaded assignment operator 86 */ 87 virtual domVcount &operator=( const domVcount &cpy ) { (void)cpy; return *this; } 88 89 public: // STATIC METHODS 90 /** 91 * Creates an instance of this class and returns a daeElementRef referencing it. 92 * @return a daeElementRef referencing an instance of this object. 93 */ 94 static DLLSPEC daeElementRef create(DAE& dae); 95 /** 96 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 97 * If a daeMetaElement already exists it will return that instead of creating a new one. 98 * @return A daeMetaElement describing this COLLADA element. 99 */ 100 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 101 }; 102 103 104 protected: // Attributes 105 /** 106 * The name attribute is the text string name of this element. Optional attribute. 107 */ 108 xsNCName attrName; 109 /** 110 * The count attribute indicates the number of polygon primitives. Required 111 * attribute. 112 */ 113 domUint attrCount; 114 /** 115 * The material attribute declares a symbol for a material. This symbol is 116 * bound to a material at the time of instantiation. If the material attribute 117 * is not specified then the lighting and shading results are application 118 * defined. Optional attribute. 119 */ 120 xsNCName attrMaterial; 121 122 protected: // Elements 123 /** 124 * The input element may occur any number of times. This input is a local 125 * input with the offset and set attributes. @see domInput 126 */ 127 domInputLocalOffset_Array elemInput_array; 128 /** 129 * The vcount element contains a list of integers describing the number of 130 * sides for each polygon described by the polylist element. The vcount element 131 * may occur once. @see domVcount 132 */ 133 domVcountRef elemVcount; 134 /** 135 * The p element may occur once. @see domP 136 */ 137 domPRef elemP; 138 /** 139 * The extra element may appear any number of times. @see domExtra 140 */ 141 domExtra_Array elemExtra_array; 142 143 public: //Accessors and Mutators 144 /** 145 * Gets the name attribute. 146 * @return Returns a xsNCName of the name attribute. 147 */ 148 xsNCName getName() const { return attrName; } 149 /** 150 * Sets the name attribute. 151 * @param atName The new value for the name attribute. 152 */ 153 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[0] = true; } 154 155 /** 156 * Gets the count attribute. 157 * @return Returns a domUint of the count attribute. 158 */ 159 domUint getCount() const { return attrCount; } 160 /** 161 * Sets the count attribute. 162 * @param atCount The new value for the count attribute. 163 */ 164 void setCount( domUint atCount ) { attrCount = atCount; _validAttributeArray[1] = true; } 165 166 /** 167 * Gets the material attribute. 168 * @return Returns a xsNCName of the material attribute. 169 */ 170 xsNCName getMaterial() const { return attrMaterial; } 171 /** 172 * Sets the material attribute. 173 * @param atMaterial The new value for the material attribute. 174 */ 175 void setMaterial( xsNCName atMaterial ) { *(daeStringRef*)&attrMaterial = atMaterial; _validAttributeArray[2] = true; } 176 177 /** 178 * Gets the input element array. 179 * @return Returns a reference to the array of input elements. 180 */ 181 domInputLocalOffset_Array &getInput_array() { return elemInput_array; } 182 /** 183 * Gets the input element array. 184 * @return Returns a constant reference to the array of input elements. 185 */ 186 const domInputLocalOffset_Array &getInput_array() const { return elemInput_array; } 187 /** 188 * Gets the vcount element. 189 * @return a daeSmartRef to the vcount element. 190 */ 191 const domVcountRef getVcount() const { return elemVcount; } 192 /** 193 * Gets the p element. 194 * @return a daeSmartRef to the p element. 195 */ 196 const domPRef getP() const { return elemP; } 197 /** 198 * Gets the extra element array. 199 * @return Returns a reference to the array of extra elements. 200 */ 201 domExtra_Array &getExtra_array() { return elemExtra_array; } 202 /** 203 * Gets the extra element array. 204 * @return Returns a constant reference to the array of extra elements. 205 */ 206 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 207 protected: 208 /** 209 * Constructor 210 */ 211 domPolylist(DAE& dae) : daeElement(dae), attrName(), attrCount(), attrMaterial(), elemInput_array(), elemVcount(), elemP(), elemExtra_array() {} 212 /** 213 * Destructor 214 */ 215 virtual ~domPolylist() {} 216 /** 217 * Overloaded assignment operator 218 */ 219 virtual domPolylist &operator=( const domPolylist &cpy ) { (void)cpy; return *this; } 220 221 public: // STATIC METHODS 222 /** 223 * Creates an instance of this class and returns a daeElementRef referencing it. 224 * @return a daeElementRef referencing an instance of this object. 225 */ 226 static DLLSPEC daeElementRef create(DAE& dae); 227 /** 228 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 229 * If a daeMetaElement already exists it will return that instead of creating a new one. 230 * @return A daeMetaElement describing this COLLADA element. 231 */ 232 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 233 }; 234 235 236 #endif 237