- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FCDocument/FCDPhysicsModel.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008
    00014 #ifndef _FCD_PHYSICSMODEL_H_
    00015 #define _FCD_PHYSICSMODEL_H_
    00016
    00017 #ifndef _FCD_ENTITY_H_
    00018 #include "FCDocument/FCDEntity.h"
    00019 #endif // _FCD_ENTITY_H_
    00020 #ifndef _FU_URI_H_
    00021 #include "FUtils/FUUri.h"
    00022 #endif // _FU_URI_H_
    00023
    00024 class FCDocument;
    00025 class FCDPhysicsRigidBody;
    00026 class FCDPhysicsRigidConstraint;
    00027 class FCDPhysicsModelInstance;
    00028 class FUUri;
    00029
    00030 typedef FUObjectContainer<FCDPhysicsModelInstance> FCDPhysicsModelInstanceContainer;
    00031 typedef FUObjectContainer<FCDPhysicsRigidBody> FCDPhysicsRigidBodyContainer;
    00032 typedef FUObjectContainer<FCDPhysicsRigidConstraint>  FCDPhysicsRigidConstraintContainer;
    00043 class FCOLLADA_EXPORT FCDPhysicsModel : public FCDEntity
    00044 {
    00045 private:
    00046     typedef fm::map<xmlNode*, FUUri> ModelInstanceNameNodeMap;
    00047
    00048     DeclareObjectType(FCDEntity);
    00049     FCDPhysicsModelInstanceContainer instances;
    00050     FCDPhysicsRigidBodyContainer rigidBodies;
    00051     FCDPhysicsRigidConstraintContainer rigidConstraints;
    00052     ModelInstanceNameNodeMap modelInstancesMap;
    00053
    00054 public:
    00059     FCDPhysicsModel(FCDocument* document);
    00060
    00062     virtual ~FCDPhysicsModel();
    00063
    00067     virtual Type GetType() const { return FCDEntity::PHYSICS_MODEL; }
    00068
    00072     FCDPhysicsModelInstanceContainer& GetInstances() { return instances; }
    00073     const FCDPhysicsModelInstanceContainer& GetInstances() const { return instances; }
    00078     size_t GetInstanceCount() const { return instances.size(); }
    00079
    00084     FCDPhysicsModelInstance* GetInstance(size_t index) { FUAssert(index < instances.size(), return NULL); return instances.at(index); }
    00085     const FCDPhysicsModelInstance* GetInstance(size_t index) const { FUAssert(index < instances.size(), return NULL); return instances.at(index); }
    00092     FCDPhysicsModelInstance* AddPhysicsModelInstance(FCDPhysicsModel* model = NULL);
    00093
    00096     FCDPhysicsRigidBodyContainer& GetRigidBodies() { return rigidBodies; }
    00097     const FCDPhysicsRigidBodyContainer& GetRigidBodies() const { return rigidBodies; }
    00102     size_t GetRigidBodyCount() const { return rigidBodies.size(); }
    00103
    00108     FCDPhysicsRigidBody* GetRigidBody(size_t index) { FUAssert(index < rigidBodies.size(), return NULL); return rigidBodies.at(index); }
    00109     const FCDPhysicsRigidBody* GetRigidBody(size_t index) const { FUAssert(index < rigidBodies.size(), return NULL); return rigidBodies.at(index); }
    00115     inline FCDPhysicsRigidBody* FindRigidBodyFromSid(const fm::string& sid) { return const_cast<FCDPhysicsRigidBody*>(const_cast<const FCDPhysicsModel*>(this)->FindRigidBodyFromSid(sid)); }
    00116     const FCDPhysicsRigidBody* FindRigidBodyFromSid(const fm::string& sid) const;
    00120     FCDPhysicsRigidBody* AddRigidBody();
    00121
    00124     FCDPhysicsRigidConstraintContainer& GetRigidConstraints() { return rigidConstraints; }
    00125     const FCDPhysicsRigidConstraintContainer& GetRigidConstraints() const { return rigidConstraints; }
    00130     size_t GetRigidConstraintCount() const { return rigidConstraints.size(); }
    00131
    00136     FCDPhysicsRigidConstraint* GetRigidConstraint(size_t index) { FUAssert(index < GetRigidConstraintCount(), return NULL); return rigidConstraints.at(index); }
    00137     const FCDPhysicsRigidConstraint* GetRigidConstraint(size_t index) const { FUAssert(index < GetRigidConstraintCount(), return NULL); return rigidConstraints.at(index); }
    00143     inline FCDPhysicsRigidConstraint* FindRigidConstraintFromSid(const fm::string& sid) { return const_cast<FCDPhysicsRigidConstraint*>(const_cast<const FCDPhysicsModel*>(this)->FindRigidConstraintFromSid(sid)); }
    00144     const FCDPhysicsRigidConstraint* FindRigidConstraintFromSid(const fm::string& sid) const;
    00148     FCDPhysicsRigidConstraint* AddRigidConstraint();
    00149
    00157     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00158
    00162     bool AttachModelInstances();
    00163
    00166     virtual void CleanSubId();
    00167 };
    00168
    00169 #endif // _FCD_PHYSICSMODEL_H_