2
0

domConvex_mesh.h 8.6 KB

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