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

- File List
- File Members

# FCDocument/FCDPhysicsRigidBodyParameters.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_PHYSICS_RIGID_BODY_PARAMETERS_H_
    00015 #define _FCD_PHYSICS_RIGID_BODY_PARAMETERS_H_
    00016
    00017 #ifndef __FCD_OBJECT_H_
    00018 #include "FCDocument/FCDObject.h"
    00019 #endif // __FCD_OBJECT_H_
    00020 #ifndef _FCD_PARAMETER_ANIMATABLE_H_
    00021 #include "FCDocument/FCDParameterAnimatable.h"
    00022 #endif // _FCD_PARAMETER_ANIMATABLE_H_
    00023
    00024 class FCDPhysicsMaterial;
    00025 class FCDPhysicsShape;
    00026 class FCDPhysicsRigidBody;
    00027 class FCDPhysicsRigidBodyInstance;
    00028 class FCDEntityInstance;
    00029
    00040 class FCOLLADA_EXPORT FCDPhysicsRigidBodyParameters : public FCDObject
    00041 {
    00042 private:
    00043     DeclareObjectType(FCDObject);
    00044
    00045     bool ownsPhysicsMaterial;
    00046     FUTrackedPtr<FCDPhysicsMaterial> physicsMaterial;
    00047     FUTrackedPtr<FCDEntityInstance> instanceMaterialRef;
    00048
    00049     FCDObject* parent;
    00050
    00051     DeclareParameterContainer(FCDPhysicsShape, physicsShape, FC("Shapes"));
    00052     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, dynamic, FC("IsDynamic"));
    00053     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, mass, FC("Mass"));
    00054     DeclareParameter(float, FUParameterQualifiers::SIMPLE, density, FC("Density"));
    00055     DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::VECTOR, inertia, FC("Inertia"));
    00056     DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::VECTOR, massFrameTranslate, FC("Center of Mass Position"));
    00057     DeclareParameterAnimatable(FMAngleAxis, FUParameterQualifiers::SIMPLE, massFrameOrientation, FC("Center of Mass Orientation"));
    00058
    00059     FUTrackedPtr<FCDPhysicsRigidBody> entityOwner;
    00060     FUTrackedPtr<FCDPhysicsRigidBodyInstance> instanceOwner;
    00061
    00062     DeclareParameter(bool, FUParameterQualifiers::SIMPLE, isDensityMoreAccurate, FC("Use Density"));
    00063     DeclareParameter(bool, FUParameterQualifiers::SIMPLE, isInertiaAccurate, FC("Use Inertia"));
    00064
    00065 public:
    00069     FCDPhysicsRigidBodyParameters(FCDocument* document, FCDPhysicsRigidBody* owner);
    00070     FCDPhysicsRigidBodyParameters(FCDocument* document, FCDPhysicsRigidBodyInstance* owner);
    00073     virtual ~FCDPhysicsRigidBodyParameters();
    00074
    00078     FCDParameterAnimatableFloat& GetDynamic() { return dynamic; }
    00079     const FCDParameterAnimatableFloat& GetDynamic() const { return dynamic; }
    00080     bool IsDynamic() { return dynamic >= 0.5f; }
    00085     void SetDynamic(bool dynamic);
    00086
    00092     bool IsDensityMoreAccurate() { return isDensityMoreAccurate; }
    00093
    00097     void SetDensityMoreAccurate(bool value){ isDensityMoreAccurate = value; }
    00098
    00101     FUParameterFloat& GetDensity() { return density; }
    00102     const FUParameterFloat& GetDensity() const { return density; }
    00107     void SetDensity(float dens) { density = dens; }
    00108
    00111     FCDParameterAnimatableFloat& GetMass() { return mass; }
    00112     const FCDParameterAnimatableFloat& GetMass() const { return mass; }
    00116     inline void SetMass(float _mass) { mass = _mass; parent->SetDirtyFlag(); }
    00117
    00120     FCDParameterAnimatableVector3& GetInertia() { return inertia; }
    00121     const FCDParameterAnimatableVector3& GetInertia() const { return inertia; }
    00127     bool IsInertiaAccurate() { return isInertiaAccurate; }
    00128
    00131     void SetInertiaAccurate(bool value){ isInertiaAccurate = value; }
    00132
    00135     inline void SetInertia(const FMVector3& _inertia)
    00136             { inertia = _inertia; isInertiaAccurate = true; parent->SetDirtyFlag(); }
    00137
    00140     FCDParameterAnimatableVector3& GetMassFrameTranslate() { return massFrameTranslate; }
    00141     const FCDParameterAnimatableVector3& GetMassFrameTranslate() const { return massFrameTranslate; }
    00145     inline void SetMassFrameTranslate(const FMVector3& position) { massFrameTranslate = position; parent->SetDirtyFlag(); }
    00146
    00149     inline FCDParameterAnimatableAngleAxis& GetMassFrameOrientation() { return massFrameOrientation; }
    00150     inline const FCDParameterAnimatableAngleAxis& GetMassFrameOrientation() const { return massFrameOrientation; }
    00154     inline void SetMassFrameOrientation(const FMAngleAxis& angleAxis) { massFrameOrientation = angleAxis; }
    00155
    00158     inline FMVector3& GetMassFrameRotateAxis() { return massFrameOrientation->axis; }
    00159     inline const FMVector3& GetMassFrameRotateAxis() const { return massFrameOrientation->axis; }
    00163     inline void SetMassFrameRotateAxis(const FMVector3& axis) { massFrameOrientation->axis = axis; parent->SetDirtyFlag(); }
    00164
    00168     float& GetMassFrameRotateAngle() { return massFrameOrientation->angle; }
    00169     const float& GetMassFrameRotateAngle() const { return massFrameOrientation->angle; }
    00174     inline void SetMassFrameRotateAngle(float angle) { massFrameOrientation->angle = angle; parent->SetDirtyFlag(); }
    00175
    00178     FCDPhysicsMaterial* GetPhysicsMaterial() { return physicsMaterial; }
    00179     const FCDPhysicsMaterial* GetPhysicsMaterial() const { return physicsMaterial; }
    00183     void SetPhysicsMaterial(FCDPhysicsMaterial* physicsMaterial);
    00184
    00188     FCDPhysicsMaterial* AddOwnPhysicsMaterial();
    00189
    00192     DEPRECATED(3.05A, GetPhysicsShapeCount and GetPhysicsShape(index)) void GetPhysicsShapeList() const {}
    00193
    00196     size_t GetPhysicsShapeCount() const { return physicsShape.size(); }
    00197
    00201     FCDPhysicsShape* GetPhysicsShape(size_t index) { FUAssert(index < physicsShape.size(), return NULL) return physicsShape.at(index); }
    00202     const FCDPhysicsShape* GetPhysicsShape(size_t index) const { FUAssert(index < physicsShape.size(), return NULL) return physicsShape.at(index); }
    00206     FCDPhysicsShape* AddPhysicsShape();
    00207
    00210     virtual void CopyFrom(const FCDPhysicsRigidBodyParameters& original);
    00211
    00214     DEPRECATED(3.05A, GetParent) FCDObject* GetOwner() { return parent; }
    00215     FCDObject* GetParent() { return parent; }
    00216     const FCDObject* GetParent() const { return parent; }
    00220     FCDPhysicsRigidBody* GetEntityOwner(){ return entityOwner; }
    00221
    00224     FCDPhysicsRigidBodyInstance* GetInstanceOwner(){ return instanceOwner; }
    00225
    00228     bool OwnsPhysicsMaterial() { return ownsPhysicsMaterial; }
    00229
    00232     void SetInstanceMaterial(FCDEntityInstance* instance) { instanceMaterialRef = instance; }
    00233
    00236     FCDEntityInstance* GetInstanceMaterial(){ return instanceMaterialRef; }
    00237 };
    00238
    00239 #endif // _FCD_PHYSICS_RIGID_BODY_PARAMETERS_H_