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