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 __domGeometry_h__ 10 #define __domGeometry_h__ 11 12 #include <dae/daeDocument.h> 13 #include <dom/domTypes.h> 14 #include <dom/domElements.h> 15 16 #include <dom/domAsset.h> 17 #include <dom/domConvex_mesh.h> 18 #include <dom/domMesh.h> 19 #include <dom/domSpline.h> 20 #include <dom/domExtra.h> 21 class DAE; 22 23 /** 24 * Geometry describes the visual shape and appearance of an object in the 25 * scene. The geometry element categorizes the declaration of geometric information. 26 * Geometry is a branch of mathematics that deals with the measurement, properties, 27 * and relationships of points, lines, angles, surfaces, and solids. 28 */ 29 class domGeometry : public daeElement 30 { 31 public: 32 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::GEOMETRY; } 33 static daeInt ID() { return 613; } 34 virtual daeInt typeID() const { return ID(); } 35 protected: // Attributes 36 /** 37 * The id attribute is a text string containing the unique identifier of 38 * this element. This value must be unique within the instance document. 39 * Optional attribute. 40 */ 41 xsID attrId; 42 /** 43 * The name attribute is the text string name of this element. Optional attribute. 44 */ 45 xsNCName attrName; 46 47 protected: // Elements 48 /** 49 * The geometry element may contain an asset element. @see domAsset 50 */ 51 domAssetRef elemAsset; 52 /** 53 * The geometry element may contain only one mesh or convex_mesh. @see domConvex_mesh 54 */ 55 domConvex_meshRef elemConvex_mesh; 56 /** 57 * The geometry element may contain only one mesh or convex_mesh. @see domMesh 58 */ 59 domMeshRef elemMesh; 60 domSplineRef elemSpline; 61 /** 62 * The extra element may appear any number of times. @see domExtra 63 */ 64 domExtra_Array elemExtra_array; 65 /** 66 * Used to preserve order in elements that do not specify strict sequencing of sub-elements. 67 */ 68 daeElementRefArray _contents; 69 /** 70 * Used to preserve order in elements that have a complex content model. 71 */ 72 daeUIntArray _contentsOrder; 73 74 /** 75 * Used to store information needed for some content model objects. 76 */ 77 daeTArray< daeCharArray * > _CMData; 78 79 80 public: //Accessors and Mutators 81 /** 82 * Gets the id attribute. 83 * @return Returns a xsID of the id attribute. 84 */ 85 xsID getId() const { return attrId; } 86 /** 87 * Sets the id attribute. 88 * @param atId The new value for the id attribute. 89 */ 90 void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true; 91 if( _document != NULL ) _document->changeElementID( this, attrId ); 92 } 93 94 /** 95 * Gets the name attribute. 96 * @return Returns a xsNCName of the name attribute. 97 */ 98 xsNCName getName() const { return attrName; } 99 /** 100 * Sets the name attribute. 101 * @param atName The new value for the name attribute. 102 */ 103 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; } 104 105 /** 106 * Gets the asset element. 107 * @return a daeSmartRef to the asset element. 108 */ 109 const domAssetRef getAsset() const { return elemAsset; } 110 /** 111 * Gets the convex_mesh element. 112 * @return a daeSmartRef to the convex_mesh element. 113 */ 114 const domConvex_meshRef getConvex_mesh() const { return elemConvex_mesh; } 115 /** 116 * Gets the mesh element. 117 * @return a daeSmartRef to the mesh element. 118 */ 119 const domMeshRef getMesh() const { return elemMesh; } 120 /** 121 * Gets the spline element. 122 * @return a daeSmartRef to the spline element. 123 */ 124 const domSplineRef getSpline() const { return elemSpline; } 125 /** 126 * Gets the extra element array. 127 * @return Returns a reference to the array of extra elements. 128 */ 129 domExtra_Array &getExtra_array() { return elemExtra_array; } 130 /** 131 * Gets the extra element array. 132 * @return Returns a constant reference to the array of extra elements. 133 */ 134 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 135 /** 136 * Gets the _contents array. 137 * @return Returns a reference to the _contents element array. 138 */ 139 daeElementRefArray &getContents() { return _contents; } 140 /** 141 * Gets the _contents array. 142 * @return Returns a constant reference to the _contents element array. 143 */ 144 const daeElementRefArray &getContents() const { return _contents; } 145 146 protected: 147 /** 148 * Constructor 149 */ 150 domGeometry(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemConvex_mesh(), elemMesh(), elemSpline(), elemExtra_array() {} 151 /** 152 * Destructor 153 */ 154 virtual ~domGeometry() { daeElement::deleteCMDataArray(_CMData); } 155 /** 156 * Overloaded assignment operator 157 */ 158 virtual domGeometry &operator=( const domGeometry &cpy ) { (void)cpy; return *this; } 159 160 public: // STATIC METHODS 161 /** 162 * Creates an instance of this class and returns a daeElementRef referencing it. 163 * @return a daeElementRef referencing an instance of this object. 164 */ 165 static DLLSPEC daeElementRef create(DAE& dae); 166 /** 167 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 168 * If a daeMetaElement already exists it will return that instead of creating a new one. 169 * @return A daeMetaElement describing this COLLADA element. 170 */ 171 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 172 }; 173 174 175 #endif 176