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