domMesh.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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 __domMesh_h__
  14. #define __domMesh_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domSource.h>
  19. #include <dom/domVertices.h>
  20. #include <dom/domLines.h>
  21. #include <dom/domLinestrips.h>
  22. #include <dom/domPolygons.h>
  23. #include <dom/domPolylist.h>
  24. #include <dom/domTriangles.h>
  25. #include <dom/domTrifans.h>
  26. #include <dom/domTristrips.h>
  27. #include <dom/domExtra.h>
  28. class DAE;
  29. /**
  30. * The mesh element contains vertex and primitive information sufficient to
  31. * describe basic geometric meshes.
  32. */
  33. class domMesh : public daeElement
  34. {
  35. public:
  36. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::MESH; }
  37. static daeInt ID() { return 614; }
  38. virtual daeInt typeID() const { return ID(); }
  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. * Used to store information needed for some content model objects.
  91. */
  92. daeTArray< daeCharArray * > _CMData;
  93. public: //Accessors and Mutators
  94. /**
  95. * Gets the source element array.
  96. * @return Returns a reference to the array of source elements.
  97. */
  98. domSource_Array &getSource_array() { return elemSource_array; }
  99. /**
  100. * Gets the source element array.
  101. * @return Returns a constant reference to the array of source elements.
  102. */
  103. const domSource_Array &getSource_array() const { return elemSource_array; }
  104. /**
  105. * Gets the vertices element.
  106. * @return a daeSmartRef to the vertices element.
  107. */
  108. const domVerticesRef getVertices() const { return elemVertices; }
  109. /**
  110. * Gets the lines element array.
  111. * @return Returns a reference to the array of lines elements.
  112. */
  113. domLines_Array &getLines_array() { return elemLines_array; }
  114. /**
  115. * Gets the lines element array.
  116. * @return Returns a constant reference to the array of lines elements.
  117. */
  118. const domLines_Array &getLines_array() const { return elemLines_array; }
  119. /**
  120. * Gets the linestrips element array.
  121. * @return Returns a reference to the array of linestrips elements.
  122. */
  123. domLinestrips_Array &getLinestrips_array() { return elemLinestrips_array; }
  124. /**
  125. * Gets the linestrips element array.
  126. * @return Returns a constant reference to the array of linestrips elements.
  127. */
  128. const domLinestrips_Array &getLinestrips_array() const { return elemLinestrips_array; }
  129. /**
  130. * Gets the polygons element array.
  131. * @return Returns a reference to the array of polygons elements.
  132. */
  133. domPolygons_Array &getPolygons_array() { return elemPolygons_array; }
  134. /**
  135. * Gets the polygons element array.
  136. * @return Returns a constant reference to the array of polygons elements.
  137. */
  138. const domPolygons_Array &getPolygons_array() const { return elemPolygons_array; }
  139. /**
  140. * Gets the polylist element array.
  141. * @return Returns a reference to the array of polylist elements.
  142. */
  143. domPolylist_Array &getPolylist_array() { return elemPolylist_array; }
  144. /**
  145. * Gets the polylist element array.
  146. * @return Returns a constant reference to the array of polylist elements.
  147. */
  148. const domPolylist_Array &getPolylist_array() const { return elemPolylist_array; }
  149. /**
  150. * Gets the triangles element array.
  151. * @return Returns a reference to the array of triangles elements.
  152. */
  153. domTriangles_Array &getTriangles_array() { return elemTriangles_array; }
  154. /**
  155. * Gets the triangles element array.
  156. * @return Returns a constant reference to the array of triangles elements.
  157. */
  158. const domTriangles_Array &getTriangles_array() const { return elemTriangles_array; }
  159. /**
  160. * Gets the trifans element array.
  161. * @return Returns a reference to the array of trifans elements.
  162. */
  163. domTrifans_Array &getTrifans_array() { return elemTrifans_array; }
  164. /**
  165. * Gets the trifans element array.
  166. * @return Returns a constant reference to the array of trifans elements.
  167. */
  168. const domTrifans_Array &getTrifans_array() const { return elemTrifans_array; }
  169. /**
  170. * Gets the tristrips element array.
  171. * @return Returns a reference to the array of tristrips elements.
  172. */
  173. domTristrips_Array &getTristrips_array() { return elemTristrips_array; }
  174. /**
  175. * Gets the tristrips element array.
  176. * @return Returns a constant reference to the array of tristrips elements.
  177. */
  178. const domTristrips_Array &getTristrips_array() const { return elemTristrips_array; }
  179. /**
  180. * Gets the extra element array.
  181. * @return Returns a reference to the array of extra elements.
  182. */
  183. domExtra_Array &getExtra_array() { return elemExtra_array; }
  184. /**
  185. * Gets the extra element array.
  186. * @return Returns a constant reference to the array of extra elements.
  187. */
  188. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  189. /**
  190. * Gets the _contents array.
  191. * @return Returns a reference to the _contents element array.
  192. */
  193. daeElementRefArray &getContents() { return _contents; }
  194. /**
  195. * Gets the _contents array.
  196. * @return Returns a constant reference to the _contents element array.
  197. */
  198. const daeElementRefArray &getContents() const { return _contents; }
  199. protected:
  200. /**
  201. * Constructor
  202. */
  203. domMesh(DAE& dae) : daeElement(dae), elemSource_array(), elemVertices(), elemLines_array(), elemLinestrips_array(), elemPolygons_array(), elemPolylist_array(), elemTriangles_array(), elemTrifans_array(), elemTristrips_array(), elemExtra_array() {}
  204. /**
  205. * Destructor
  206. */
  207. virtual ~domMesh() { daeElement::deleteCMDataArray(_CMData); }
  208. /**
  209. * Overloaded assignment operator
  210. */
  211. virtual domMesh &operator=( const domMesh &cpy ) { (void)cpy; return *this; }
  212. public: // STATIC METHODS
  213. /**
  214. * Creates an instance of this class and returns a daeElementRef referencing it.
  215. * @return a daeElementRef referencing an instance of this object.
  216. */
  217. static DLLSPEC daeElementRef create(DAE& dae);
  218. /**
  219. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  220. * If a daeMetaElement already exists it will return that instead of creating a new one.
  221. * @return A daeMetaElement describing this COLLADA element.
  222. */
  223. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  224. };
  225. #endif