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 __domConvex_mesh_h__ 10 #define __domConvex_mesh_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/domVertices.h> 18 #include <dom/domLines.h> 19 #include <dom/domLinestrips.h> 20 #include <dom/domPolygons.h> 21 #include <dom/domPolylist.h> 22 #include <dom/domTriangles.h> 23 #include <dom/domTrifans.h> 24 #include <dom/domTristrips.h> 25 #include <dom/domExtra.h> 26 class DAE; 27 28 /** 29 * The definition of the convex_mesh element is identical to the mesh element 30 * with the exception that instead of a complete description (source, vertices, 31 * polygons etc.), it may simply point to another geometry to derive its 32 * shape. The latter case means that the convex hull of that geometry should 33 * be computed and is indicated by the optional convex_hull_of attribute. 34 */ 35 class domConvex_mesh : public daeElement 36 { 37 public: 38 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::CONVEX_MESH; } 39 static daeInt ID() { return 789; } 40 virtual daeInt typeID() const { return ID(); } 41 protected: // Attribute 42 /** 43 * The convex_hull_of attribute is a URI string of geometry to compute the 44 * convex hull of. Optional attribute. 45 */ 46 xsAnyURI attrConvex_hull_of; 47 48 protected: // Elements 49 domSource_Array elemSource_array; 50 domVerticesRef elemVertices; 51 domLines_Array elemLines_array; 52 domLinestrips_Array elemLinestrips_array; 53 domPolygons_Array elemPolygons_array; 54 domPolylist_Array elemPolylist_array; 55 domTriangles_Array elemTriangles_array; 56 domTrifans_Array elemTrifans_array; 57 domTristrips_Array elemTristrips_array; 58 /** 59 * The extra element may appear any number of times. @see domExtra 60 */ 61 domExtra_Array elemExtra_array; 62 /** 63 * Used to preserve order in elements that do not specify strict sequencing of sub-elements. 64 */ 65 daeElementRefArray _contents; 66 /** 67 * Used to preserve order in elements that have a complex content model. 68 */ 69 daeUIntArray _contentsOrder; 70 71 /** 72 * Used to store information needed for some content model objects. 73 */ 74 daeTArray< daeCharArray * > _CMData; 75 76 77 public: //Accessors and Mutators 78 /** 79 * Gets the convex_hull_of attribute. 80 * @return Returns a xsAnyURI reference of the convex_hull_of attribute. 81 */ 82 xsAnyURI &getConvex_hull_of() { return attrConvex_hull_of; } 83 /** 84 * Gets the convex_hull_of attribute. 85 * @return Returns a constant xsAnyURI reference of the convex_hull_of attribute. 86 */ 87 const xsAnyURI &getConvex_hull_of() const { return attrConvex_hull_of; } 88 /** 89 * Sets the convex_hull_of attribute. 90 * @param atConvex_hull_of The new value for the convex_hull_of attribute. 91 */ 92 void setConvex_hull_of( const xsAnyURI &atConvex_hull_of ) { attrConvex_hull_of = atConvex_hull_of; _validAttributeArray[0] = true; } 93 /** 94 * Sets the convex_hull_of attribute. 95 * @param atConvex_hull_of The new value for the convex_hull_of attribute. 96 */ 97 void setConvex_hull_of( xsString atConvex_hull_of ) { attrConvex_hull_of = atConvex_hull_of; _validAttributeArray[0] = true; } 98 99 /** 100 * Gets the source element array. 101 * @return Returns a reference to the array of source elements. 102 */ 103 domSource_Array &getSource_array() { return elemSource_array; } 104 /** 105 * Gets the source element array. 106 * @return Returns a constant reference to the array of source elements. 107 */ 108 const domSource_Array &getSource_array() const { return elemSource_array; } 109 /** 110 * Gets the vertices element. 111 * @return a daeSmartRef to the vertices element. 112 */ 113 const domVerticesRef getVertices() const { return elemVertices; } 114 /** 115 * Gets the lines element array. 116 * @return Returns a reference to the array of lines elements. 117 */ 118 domLines_Array &getLines_array() { return elemLines_array; } 119 /** 120 * Gets the lines element array. 121 * @return Returns a constant reference to the array of lines elements. 122 */ 123 const domLines_Array &getLines_array() const { return elemLines_array; } 124 /** 125 * Gets the linestrips element array. 126 * @return Returns a reference to the array of linestrips elements. 127 */ 128 domLinestrips_Array &getLinestrips_array() { return elemLinestrips_array; } 129 /** 130 * Gets the linestrips element array. 131 * @return Returns a constant reference to the array of linestrips elements. 132 */ 133 const domLinestrips_Array &getLinestrips_array() const { return elemLinestrips_array; } 134 /** 135 * Gets the polygons element array. 136 * @return Returns a reference to the array of polygons elements. 137 */ 138 domPolygons_Array &getPolygons_array() { return elemPolygons_array; } 139 /** 140 * Gets the polygons element array. 141 * @return Returns a constant reference to the array of polygons elements. 142 */ 143 const domPolygons_Array &getPolygons_array() const { return elemPolygons_array; } 144 /** 145 * Gets the polylist element array. 146 * @return Returns a reference to the array of polylist elements. 147 */ 148 domPolylist_Array &getPolylist_array() { return elemPolylist_array; } 149 /** 150 * Gets the polylist element array. 151 * @return Returns a constant reference to the array of polylist elements. 152 */ 153 const domPolylist_Array &getPolylist_array() const { return elemPolylist_array; } 154 /** 155 * Gets the triangles element array. 156 * @return Returns a reference to the array of triangles elements. 157 */ 158 domTriangles_Array &getTriangles_array() { return elemTriangles_array; } 159 /** 160 * Gets the triangles element array. 161 * @return Returns a constant reference to the array of triangles elements. 162 */ 163 const domTriangles_Array &getTriangles_array() const { return elemTriangles_array; } 164 /** 165 * Gets the trifans element array. 166 * @return Returns a reference to the array of trifans elements. 167 */ 168 domTrifans_Array &getTrifans_array() { return elemTrifans_array; } 169 /** 170 * Gets the trifans element array. 171 * @return Returns a constant reference to the array of trifans elements. 172 */ 173 const domTrifans_Array &getTrifans_array() const { return elemTrifans_array; } 174 /** 175 * Gets the tristrips element array. 176 * @return Returns a reference to the array of tristrips elements. 177 */ 178 domTristrips_Array &getTristrips_array() { return elemTristrips_array; } 179 /** 180 * Gets the tristrips element array. 181 * @return Returns a constant reference to the array of tristrips elements. 182 */ 183 const domTristrips_Array &getTristrips_array() const { return elemTristrips_array; } 184 /** 185 * Gets the extra element array. 186 * @return Returns a reference to the array of extra elements. 187 */ 188 domExtra_Array &getExtra_array() { return elemExtra_array; } 189 /** 190 * Gets the extra element array. 191 * @return Returns a constant reference to the array of extra elements. 192 */ 193 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 194 /** 195 * Gets the _contents array. 196 * @return Returns a reference to the _contents element array. 197 */ 198 daeElementRefArray &getContents() { return _contents; } 199 /** 200 * Gets the _contents array. 201 * @return Returns a constant reference to the _contents element array. 202 */ 203 const daeElementRefArray &getContents() const { return _contents; } 204 205 protected: 206 /** 207 * Constructor 208 */ 209 domConvex_mesh(DAE& dae) : daeElement(dae), attrConvex_hull_of(dae, *this), elemSource_array(), elemVertices(), elemLines_array(), elemLinestrips_array(), elemPolygons_array(), elemPolylist_array(), elemTriangles_array(), elemTrifans_array(), elemTristrips_array(), elemExtra_array() {} 210 /** 211 * Destructor 212 */ 213 virtual ~domConvex_mesh() { daeElement::deleteCMDataArray(_CMData); } 214 /** 215 * Overloaded assignment operator 216 */ 217 virtual domConvex_mesh &operator=( const domConvex_mesh &cpy ) { (void)cpy; return *this; } 218 219 public: // STATIC METHODS 220 /** 221 * Creates an instance of this class and returns a daeElementRef referencing it. 222 * @return a daeElementRef referencing an instance of this object. 223 */ 224 static DLLSPEC daeElementRef create(DAE& dae); 225 /** 226 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 227 * If a daeMetaElement already exists it will return that instead of creating a new one. 228 * @return A daeMetaElement describing this COLLADA element. 229 */ 230 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 231 }; 232 233 234 #endif 235