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 __domInstance_physics_model_h__ 10 #define __domInstance_physics_model_h__ 11 12 #include <dae/daeDocument.h> 13 #include <dom/domTypes.h> 14 #include <dom/domElements.h> 15 16 #include <dom/domInstance_force_field.h> 17 #include <dom/domInstance_rigid_body.h> 18 #include <dom/domInstance_rigid_constraint.h> 19 #include <dom/domExtra.h> 20 class DAE; 21 22 /** 23 * This element allows instancing physics model within another physics model, 24 * or in a physics scene. 25 */ 26 class domInstance_physics_model : public daeElement 27 { 28 public: getElementType()29 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::INSTANCE_PHYSICS_MODEL; } ID()30 static daeInt ID() { return 702; } typeID()31 virtual daeInt typeID() const { return ID(); } 32 protected: // Attributes 33 /** 34 * The url attribute refers to resource. This may refer to a local resource 35 * using a relative URL fragment identifier that begins with the “#” 36 * character. The url attribute may refer to an external resource using an 37 * absolute or relative URL. 38 */ 39 xsAnyURI attrUrl; 40 /** 41 * The sid attribute is a text string value containing the sub-identifier 42 * of this element. This value must be unique within the scope of the parent 43 * element. Optional attribute. 44 */ 45 xsNCName attrSid; 46 /** 47 * The name attribute is the text string name of this element. Optional attribute. 48 */ 49 xsNCName attrName; 50 /** 51 * The parent attribute points to the id of a node in the visual scene. This 52 * allows a physics model to be instantiated under a specific transform node, 53 * which will dictate the initial position and orientation, and could be 54 * animated to influence kinematic rigid bodies. 55 */ 56 xsAnyURI attrParent; 57 58 protected: // Elements 59 /** 60 * The instance_physics_model element may instance any number of force_field 61 * elements. @see domInstance_force_field 62 */ 63 domInstance_force_field_Array elemInstance_force_field_array; 64 /** 65 * The instance_physics_model element may instance any number of rigid_body 66 * elements. @see domInstance_rigid_body 67 */ 68 domInstance_rigid_body_Array elemInstance_rigid_body_array; 69 /** 70 * The instance_physics_model element may instance any number of rigid_constraint 71 * elements. @see domInstance_rigid_constraint 72 */ 73 domInstance_rigid_constraint_Array elemInstance_rigid_constraint_array; 74 /** 75 * The extra element may appear any number of times. @see domExtra 76 */ 77 domExtra_Array elemExtra_array; 78 79 public: //Accessors and Mutators 80 /** 81 * Gets the url attribute. 82 * @return Returns a xsAnyURI reference of the url attribute. 83 */ getUrl()84 xsAnyURI &getUrl() { return attrUrl; } 85 /** 86 * Gets the url attribute. 87 * @return Returns a constant xsAnyURI reference of the url attribute. 88 */ getUrl()89 const xsAnyURI &getUrl() const { return attrUrl; } 90 /** 91 * Sets the url attribute. 92 * @param atUrl The new value for the url attribute. 93 */ setUrl(const xsAnyURI & atUrl)94 void setUrl( const xsAnyURI &atUrl ) { attrUrl = atUrl; _validAttributeArray[0] = true; } 95 /** 96 * Sets the url attribute. 97 * @param atUrl The new value for the url attribute. 98 */ setUrl(xsString atUrl)99 void setUrl( xsString atUrl ) { attrUrl = atUrl; _validAttributeArray[0] = true; } 100 101 /** 102 * Gets the sid attribute. 103 * @return Returns a xsNCName of the sid attribute. 104 */ getSid()105 xsNCName getSid() const { return attrSid; } 106 /** 107 * Sets the sid attribute. 108 * @param atSid The new value for the sid attribute. 109 */ setSid(xsNCName atSid)110 void setSid( xsNCName atSid ) { *(daeStringRef*)&attrSid = atSid; _validAttributeArray[1] = true; } 111 112 /** 113 * Gets the name attribute. 114 * @return Returns a xsNCName of the name attribute. 115 */ getName()116 xsNCName getName() const { return attrName; } 117 /** 118 * Sets the name attribute. 119 * @param atName The new value for the name attribute. 120 */ setName(xsNCName atName)121 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[2] = true; } 122 123 /** 124 * Gets the parent attribute. 125 * @return Returns a xsAnyURI reference of the parent attribute. 126 */ getParent()127 xsAnyURI &getParent() { return attrParent; } 128 /** 129 * Gets the parent attribute. 130 * @return Returns a constant xsAnyURI reference of the parent attribute. 131 */ getParent()132 const xsAnyURI &getParent() const { return attrParent; } 133 /** 134 * Sets the parent attribute. 135 * @param atParent The new value for the parent attribute. 136 */ setParent(const xsAnyURI & atParent)137 void setParent( const xsAnyURI &atParent ) { attrParent = atParent; _validAttributeArray[3] = true; } 138 /** 139 * Sets the parent attribute. 140 * @param atParent The new value for the parent attribute. 141 */ setParent(xsString atParent)142 void setParent( xsString atParent ) { attrParent = atParent; _validAttributeArray[3] = true; } 143 144 /** 145 * Gets the instance_force_field element array. 146 * @return Returns a reference to the array of instance_force_field elements. 147 */ getInstance_force_field_array()148 domInstance_force_field_Array &getInstance_force_field_array() { return elemInstance_force_field_array; } 149 /** 150 * Gets the instance_force_field element array. 151 * @return Returns a constant reference to the array of instance_force_field elements. 152 */ getInstance_force_field_array()153 const domInstance_force_field_Array &getInstance_force_field_array() const { return elemInstance_force_field_array; } 154 /** 155 * Gets the instance_rigid_body element array. 156 * @return Returns a reference to the array of instance_rigid_body elements. 157 */ getInstance_rigid_body_array()158 domInstance_rigid_body_Array &getInstance_rigid_body_array() { return elemInstance_rigid_body_array; } 159 /** 160 * Gets the instance_rigid_body element array. 161 * @return Returns a constant reference to the array of instance_rigid_body elements. 162 */ getInstance_rigid_body_array()163 const domInstance_rigid_body_Array &getInstance_rigid_body_array() const { return elemInstance_rigid_body_array; } 164 /** 165 * Gets the instance_rigid_constraint element array. 166 * @return Returns a reference to the array of instance_rigid_constraint elements. 167 */ getInstance_rigid_constraint_array()168 domInstance_rigid_constraint_Array &getInstance_rigid_constraint_array() { return elemInstance_rigid_constraint_array; } 169 /** 170 * Gets the instance_rigid_constraint element array. 171 * @return Returns a constant reference to the array of instance_rigid_constraint elements. 172 */ getInstance_rigid_constraint_array()173 const domInstance_rigid_constraint_Array &getInstance_rigid_constraint_array() const { return elemInstance_rigid_constraint_array; } 174 /** 175 * Gets the extra element array. 176 * @return Returns a reference to the array of extra elements. 177 */ getExtra_array()178 domExtra_Array &getExtra_array() { return elemExtra_array; } 179 /** 180 * Gets the extra element array. 181 * @return Returns a constant reference to the array of extra elements. 182 */ getExtra_array()183 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 184 protected: 185 /** 186 * Constructor 187 */ domInstance_physics_model(DAE & dae)188 domInstance_physics_model(DAE& dae) : daeElement(dae), attrUrl(dae, *this), attrSid(), attrName(), attrParent(dae, *this), elemInstance_force_field_array(), elemInstance_rigid_body_array(), elemInstance_rigid_constraint_array(), elemExtra_array() {} 189 /** 190 * Destructor 191 */ ~domInstance_physics_model()192 virtual ~domInstance_physics_model() {} 193 /** 194 * Overloaded assignment operator 195 */ 196 virtual domInstance_physics_model &operator=( const domInstance_physics_model &cpy ) { (void)cpy; return *this; } 197 198 public: // STATIC METHODS 199 /** 200 * Creates an instance of this class and returns a daeElementRef referencing it. 201 * @return a daeElementRef referencing an instance of this object. 202 */ 203 static DLLSPEC daeElementRef create(DAE& dae); 204 /** 205 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 206 * If a daeMetaElement already exists it will return that instead of creating a new one. 207 * @return A daeMetaElement describing this COLLADA element. 208 */ 209 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 210 }; 211 212 213 #endif 214