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 __domMaterial_h__ 10 #define __domMaterial_h__ 11 12 #include <dae/daeDocument.h> 13 #include <dom/domTypes.h> 14 #include <dom/domElements.h> 15 16 #include <dom/domAsset.h> 17 #include <dom/domInstance_effect.h> 18 #include <dom/domExtra.h> 19 class DAE; 20 21 /** 22 * Materials describe the visual appearance of a geometric object. 23 */ 24 class domMaterial : public daeElement 25 { 26 public: 27 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::MATERIAL; } 28 static daeInt ID() { return 644; } 29 virtual daeInt typeID() const { return ID(); } 30 protected: // Attributes 31 /** 32 * The id attribute is a text string containing the unique identifier of 33 * this element. This value must be unique within the instance document. 34 * Optional attribute. 35 */ 36 xsID attrId; 37 /** 38 * The name attribute is the text string name of this element. Optional attribute. 39 */ 40 xsNCName attrName; 41 42 protected: // Elements 43 /** 44 * The material element may contain an asset element. @see domAsset 45 */ 46 domAssetRef elemAsset; 47 /** 48 * The material must instance an effect. @see domInstance_effect 49 */ 50 domInstance_effectRef elemInstance_effect; 51 /** 52 * The extra element may appear any number of times. @see domExtra 53 */ 54 domExtra_Array elemExtra_array; 55 56 public: //Accessors and Mutators 57 /** 58 * Gets the id attribute. 59 * @return Returns a xsID of the id attribute. 60 */ 61 xsID getId() const { return attrId; } 62 /** 63 * Sets the id attribute. 64 * @param atId The new value for the id attribute. 65 */ 66 void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true; 67 if( _document != NULL ) _document->changeElementID( this, attrId ); 68 } 69 70 /** 71 * Gets the name attribute. 72 * @return Returns a xsNCName of the name attribute. 73 */ 74 xsNCName getName() const { return attrName; } 75 /** 76 * Sets the name attribute. 77 * @param atName The new value for the name attribute. 78 */ 79 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; } 80 81 /** 82 * Gets the asset element. 83 * @return a daeSmartRef to the asset element. 84 */ 85 const domAssetRef getAsset() const { return elemAsset; } 86 /** 87 * Gets the instance_effect element. 88 * @return a daeSmartRef to the instance_effect element. 89 */ 90 const domInstance_effectRef getInstance_effect() const { return elemInstance_effect; } 91 /** 92 * Gets the extra element array. 93 * @return Returns a reference to the array of extra elements. 94 */ 95 domExtra_Array &getExtra_array() { return elemExtra_array; } 96 /** 97 * Gets the extra element array. 98 * @return Returns a constant reference to the array of extra elements. 99 */ 100 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 101 protected: 102 /** 103 * Constructor 104 */ 105 domMaterial(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemInstance_effect(), elemExtra_array() {} 106 /** 107 * Destructor 108 */ 109 virtual ~domMaterial() {} 110 /** 111 * Overloaded assignment operator 112 */ 113 virtual domMaterial &operator=( const domMaterial &cpy ) { (void)cpy; return *this; } 114 115 public: // STATIC METHODS 116 /** 117 * Creates an instance of this class and returns a daeElementRef referencing it. 118 * @return a daeElementRef referencing an instance of this object. 119 */ 120 static DLLSPEC daeElementRef create(DAE& dae); 121 /** 122 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 123 * If a daeMetaElement already exists it will return that instead of creating a new one. 124 * @return A daeMetaElement describing this COLLADA element. 125 */ 126 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 127 }; 128 129 130 #endif 131