domGeometry.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Copyright 2006 Sony Computer Entertainment Inc.
  3. *
  4. * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this
  5. * file except in compliance with the License. You may obtain a copy of the License at:
  6. * http://research.scea.com/scea_shared_source_license.html
  7. *
  8. * Unless required by applicable law or agreed to in writing, software distributed under the License
  9. * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10. * implied. See the License for the specific language governing permissions and limitations under the
  11. * License.
  12. */
  13. #ifndef __domGeometry_h__
  14. #define __domGeometry_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domAsset.h>
  19. #include <dom/domConvex_mesh.h>
  20. #include <dom/domMesh.h>
  21. #include <dom/domSpline.h>
  22. #include <dom/domExtra.h>
  23. class DAE;
  24. /**
  25. * Geometry describes the visual shape and appearance of an object in the
  26. * scene. The geometry element categorizes the declaration of geometric information.
  27. * Geometry is a branch of mathematics that deals with the measurement, properties,
  28. * and relationships of points, lines, angles, surfaces, and solids.
  29. */
  30. class domGeometry : public daeElement
  31. {
  32. public:
  33. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::GEOMETRY; }
  34. static daeInt ID() { return 613; }
  35. virtual daeInt typeID() const { return ID(); }
  36. protected: // Attributes
  37. /**
  38. * The id attribute is a text string containing the unique identifier of
  39. * this element. This value must be unique within the instance document.
  40. * Optional attribute.
  41. */
  42. xsID attrId;
  43. /**
  44. * The name attribute is the text string name of this element. Optional attribute.
  45. */
  46. xsNCName attrName;
  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. * Used to store information needed for some content model objects.
  75. */
  76. daeTArray< daeCharArray * > _CMData;
  77. public: //Accessors and Mutators
  78. /**
  79. * Gets the id attribute.
  80. * @return Returns a xsID of the id attribute.
  81. */
  82. xsID getId() const { return attrId; }
  83. /**
  84. * Sets the id attribute.
  85. * @param atId The new value for the id attribute.
  86. */
  87. void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
  88. if( _document != NULL ) _document->changeElementID( this, attrId );
  89. }
  90. /**
  91. * Gets the name attribute.
  92. * @return Returns a xsNCName of the name attribute.
  93. */
  94. xsNCName getName() const { return attrName; }
  95. /**
  96. * Sets the name attribute.
  97. * @param atName The new value for the name attribute.
  98. */
  99. void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
  100. /**
  101. * Gets the asset element.
  102. * @return a daeSmartRef to the asset element.
  103. */
  104. const domAssetRef getAsset() const { return elemAsset; }
  105. /**
  106. * Gets the convex_mesh element.
  107. * @return a daeSmartRef to the convex_mesh element.
  108. */
  109. const domConvex_meshRef getConvex_mesh() const { return elemConvex_mesh; }
  110. /**
  111. * Gets the mesh element.
  112. * @return a daeSmartRef to the mesh element.
  113. */
  114. const domMeshRef getMesh() const { return elemMesh; }
  115. /**
  116. * Gets the spline element.
  117. * @return a daeSmartRef to the spline element.
  118. */
  119. const domSplineRef getSpline() const { return elemSpline; }
  120. /**
  121. * Gets the extra element array.
  122. * @return Returns a reference to the array of extra elements.
  123. */
  124. domExtra_Array &getExtra_array() { return elemExtra_array; }
  125. /**
  126. * Gets the extra element array.
  127. * @return Returns a constant reference to the array of extra elements.
  128. */
  129. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  130. /**
  131. * Gets the _contents array.
  132. * @return Returns a reference to the _contents element array.
  133. */
  134. daeElementRefArray &getContents() { return _contents; }
  135. /**
  136. * Gets the _contents array.
  137. * @return Returns a constant reference to the _contents element array.
  138. */
  139. const daeElementRefArray &getContents() const { return _contents; }
  140. protected:
  141. /**
  142. * Constructor
  143. */
  144. domGeometry(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemConvex_mesh(), elemMesh(), elemSpline(), elemExtra_array() {}
  145. /**
  146. * Destructor
  147. */
  148. virtual ~domGeometry() { daeElement::deleteCMDataArray(_CMData); }
  149. /**
  150. * Overloaded assignment operator
  151. */
  152. virtual domGeometry &operator=( const domGeometry &cpy ) { (void)cpy; return *this; }
  153. public: // STATIC METHODS
  154. /**
  155. * Creates an instance of this class and returns a daeElementRef referencing it.
  156. * @return a daeElementRef referencing an instance of this object.
  157. */
  158. static DLLSPEC daeElementRef create(DAE& dae);
  159. /**
  160. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  161. * If a daeMetaElement already exists it will return that instead of creating a new one.
  162. * @return A daeMetaElement describing this COLLADA element.
  163. */
  164. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  165. };
  166. #endif