domTriangles.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 __domTriangles_h__
  14. #define __domTriangles_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domP.h>
  19. #include <dom/domExtra.h>
  20. #include <dom/domInputLocalOffset.h>
  21. class DAE;
  22. /**
  23. * The triangles element provides the information needed to bind vertex attributes
  24. * together and then organize those vertices into individual triangles.Each
  25. * triangle described by the mesh has three vertices. The first triangle
  26. * is formed from the first, second, and third vertices. The second triangle
  27. * is formed from the fourth, fifth, and sixth vertices, and so on.
  28. */
  29. class domTriangles : public daeElement
  30. {
  31. public:
  32. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::TRIANGLES; }
  33. static daeInt ID() { return 625; }
  34. virtual daeInt typeID() const { return ID(); }
  35. protected: // Attributes
  36. /**
  37. * The name attribute is the text string name of this element. Optional attribute.
  38. */
  39. xsNCName attrName;
  40. /**
  41. * The count attribute indicates the number of triangle primitives. Required
  42. * attribute.
  43. */
  44. domUint attrCount;
  45. /**
  46. * The material attribute declares a symbol for a material. This symbol is
  47. * bound to a material at the time of instantiation. Optional attribute.
  48. * If the material attribute is not specified then the lighting and shading
  49. * results are application defined.
  50. */
  51. xsNCName attrMaterial;
  52. protected: // Elements
  53. /**
  54. * The input element may occur any number of times. This input is a local
  55. * input with the offset and set attributes. @see domInput
  56. */
  57. domInputLocalOffset_Array elemInput_array;
  58. /**
  59. * The triangles element may have any number of p elements. @see domP
  60. */
  61. domPRef elemP;
  62. /**
  63. * The extra element may appear any number of times. @see domExtra
  64. */
  65. domExtra_Array elemExtra_array;
  66. public: //Accessors and Mutators
  67. /**
  68. * Gets the name attribute.
  69. * @return Returns a xsNCName of the name attribute.
  70. */
  71. xsNCName getName() const { return attrName; }
  72. /**
  73. * Sets the name attribute.
  74. * @param atName The new value for the name attribute.
  75. */
  76. void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[0] = true; }
  77. /**
  78. * Gets the count attribute.
  79. * @return Returns a domUint of the count attribute.
  80. */
  81. domUint getCount() const { return attrCount; }
  82. /**
  83. * Sets the count attribute.
  84. * @param atCount The new value for the count attribute.
  85. */
  86. void setCount( domUint atCount ) { attrCount = atCount; _validAttributeArray[1] = true; }
  87. /**
  88. * Gets the material attribute.
  89. * @return Returns a xsNCName of the material attribute.
  90. */
  91. xsNCName getMaterial() const { return attrMaterial; }
  92. /**
  93. * Sets the material attribute.
  94. * @param atMaterial The new value for the material attribute.
  95. */
  96. void setMaterial( xsNCName atMaterial ) { *(daeStringRef*)&attrMaterial = atMaterial; _validAttributeArray[2] = true; }
  97. /**
  98. * Gets the input element array.
  99. * @return Returns a reference to the array of input elements.
  100. */
  101. domInputLocalOffset_Array &getInput_array() { return elemInput_array; }
  102. /**
  103. * Gets the input element array.
  104. * @return Returns a constant reference to the array of input elements.
  105. */
  106. const domInputLocalOffset_Array &getInput_array() const { return elemInput_array; }
  107. /**
  108. * Gets the p element.
  109. * @return a daeSmartRef to the p element.
  110. */
  111. const domPRef getP() const { return elemP; }
  112. /**
  113. * Gets the extra element array.
  114. * @return Returns a reference to the array of extra elements.
  115. */
  116. domExtra_Array &getExtra_array() { return elemExtra_array; }
  117. /**
  118. * Gets the extra element array.
  119. * @return Returns a constant reference to the array of extra elements.
  120. */
  121. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  122. protected:
  123. /**
  124. * Constructor
  125. */
  126. domTriangles(DAE& dae) : daeElement(dae), attrName(), attrCount(), attrMaterial(), elemInput_array(), elemP(), elemExtra_array() {}
  127. /**
  128. * Destructor
  129. */
  130. virtual ~domTriangles() {}
  131. /**
  132. * Overloaded assignment operator
  133. */
  134. virtual domTriangles &operator=( const domTriangles &cpy ) { (void)cpy; return *this; }
  135. public: // STATIC METHODS
  136. /**
  137. * Creates an instance of this class and returns a daeElementRef referencing it.
  138. * @return a daeElementRef referencing an instance of this object.
  139. */
  140. static DLLSPEC daeElementRef create(DAE& dae);
  141. /**
  142. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  143. * If a daeMetaElement already exists it will return that instead of creating a new one.
  144. * @return A daeMetaElement describing this COLLADA element.
  145. */
  146. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  147. };
  148. #endif