Home | History | Annotate | Download | only in dom
      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 __domPhysics_model_h__
     10 #define __domPhysics_model_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/domRigid_body.h>
     18 #include <dom/domRigid_constraint.h>
     19 #include <dom/domInstance_physics_model.h>
     20 #include <dom/domExtra.h>
     21 class DAE;
     22 
     23 /**
     24  * This element allows for building complex combinations of rigid-bodies and
     25  * constraints that  may be instantiated multiple times.
     26  */
     27 class domPhysics_model : public daeElement
     28 {
     29 public:
     30 	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::PHYSICS_MODEL; }
     31 	static daeInt ID() { return 813; }
     32 	virtual daeInt typeID() const { return ID(); }
     33 protected:  // Attributes
     34 /**
     35  *  The id attribute is a text string containing the unique identifier of
     36  * this element.  This value must be unique within the instance document.
     37  * Optional attribute.
     38  */
     39 	xsID attrId;
     40 /**
     41  *  The name attribute is the text string name of this element. Optional attribute.
     42  */
     43 	xsNCName attrName;
     44 
     45 protected:  // Elements
     46 /**
     47  *  The physics_model element may contain an asset element.  @see domAsset
     48  */
     49 	domAssetRef elemAsset;
     50 /**
     51  *  The physics_model may define any number of rigid_body elements.  @see
     52  * domRigid_body
     53  */
     54 	domRigid_body_Array elemRigid_body_array;
     55 /**
     56  *  The physics_model may define any number of rigid_constraint elements.
     57  * @see domRigid_constraint
     58  */
     59 	domRigid_constraint_Array elemRigid_constraint_array;
     60 /**
     61  *  The physics_model may instance any number of other physics_model elements.
     62  * @see domInstance_physics_model
     63  */
     64 	domInstance_physics_model_Array elemInstance_physics_model_array;
     65 /**
     66  *  The extra element may appear any number of times.  @see domExtra
     67  */
     68 	domExtra_Array elemExtra_array;
     69 
     70 public:	//Accessors and Mutators
     71 	/**
     72 	 * Gets the id attribute.
     73 	 * @return Returns a xsID of the id attribute.
     74 	 */
     75 	xsID getId() const { return attrId; }
     76 	/**
     77 	 * Sets the id attribute.
     78 	 * @param atId The new value for the id attribute.
     79 	 */
     80 	void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
     81 		if( _document != NULL ) _document->changeElementID( this, attrId );
     82 	}
     83 
     84 	/**
     85 	 * Gets the name attribute.
     86 	 * @return Returns a xsNCName of the name attribute.
     87 	 */
     88 	xsNCName getName() const { return attrName; }
     89 	/**
     90 	 * Sets the name attribute.
     91 	 * @param atName The new value for the name attribute.
     92 	 */
     93 	void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
     94 
     95 	/**
     96 	 * Gets the asset element.
     97 	 * @return a daeSmartRef to the asset element.
     98 	 */
     99 	const domAssetRef getAsset() const { return elemAsset; }
    100 	/**
    101 	 * Gets the rigid_body element array.
    102 	 * @return Returns a reference to the array of rigid_body elements.
    103 	 */
    104 	domRigid_body_Array &getRigid_body_array() { return elemRigid_body_array; }
    105 	/**
    106 	 * Gets the rigid_body element array.
    107 	 * @return Returns a constant reference to the array of rigid_body elements.
    108 	 */
    109 	const domRigid_body_Array &getRigid_body_array() const { return elemRigid_body_array; }
    110 	/**
    111 	 * Gets the rigid_constraint element array.
    112 	 * @return Returns a reference to the array of rigid_constraint elements.
    113 	 */
    114 	domRigid_constraint_Array &getRigid_constraint_array() { return elemRigid_constraint_array; }
    115 	/**
    116 	 * Gets the rigid_constraint element array.
    117 	 * @return Returns a constant reference to the array of rigid_constraint elements.
    118 	 */
    119 	const domRigid_constraint_Array &getRigid_constraint_array() const { return elemRigid_constraint_array; }
    120 	/**
    121 	 * Gets the instance_physics_model element array.
    122 	 * @return Returns a reference to the array of instance_physics_model elements.
    123 	 */
    124 	domInstance_physics_model_Array &getInstance_physics_model_array() { return elemInstance_physics_model_array; }
    125 	/**
    126 	 * Gets the instance_physics_model element array.
    127 	 * @return Returns a constant reference to the array of instance_physics_model elements.
    128 	 */
    129 	const domInstance_physics_model_Array &getInstance_physics_model_array() const { return elemInstance_physics_model_array; }
    130 	/**
    131 	 * Gets the extra element array.
    132 	 * @return Returns a reference to the array of extra elements.
    133 	 */
    134 	domExtra_Array &getExtra_array() { return elemExtra_array; }
    135 	/**
    136 	 * Gets the extra element array.
    137 	 * @return Returns a constant reference to the array of extra elements.
    138 	 */
    139 	const domExtra_Array &getExtra_array() const { return elemExtra_array; }
    140 protected:
    141 	/**
    142 	 * Constructor
    143 	 */
    144 	domPhysics_model(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemRigid_body_array(), elemRigid_constraint_array(), elemInstance_physics_model_array(), elemExtra_array() {}
    145 	/**
    146 	 * Destructor
    147 	 */
    148 	virtual ~domPhysics_model() {}
    149 	/**
    150 	 * Overloaded assignment operator
    151 	 */
    152 	virtual domPhysics_model &operator=( const domPhysics_model &cpy ) { (void)cpy; return *this; }
    153 
    154 public: // STATIC METHODS
    155 	/**
    156 	 * Creates an instance of this class and returns a daeElementRef referencing it.
    157 	 * @return a daeElementRef referencing an instance of this object.
    158 	 */
    159 	static DLLSPEC daeElementRef create(DAE& dae);
    160 	/**
    161 	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    162 	 * If a daeMetaElement already exists it will return that instead of creating a new one.
    163 	 * @return A daeMetaElement describing this COLLADA element.
    164 	 */
    165 	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    166 };
    167 
    168 
    169 #endif
    170