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