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

- File List
- File Members

# FCDocument/FCDPhysicsRigidConstraint.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_CONSTRAINT_H_
    00015 #define _FCD_PHYSICS_RIGID_CONSTRAINT_H_
    00016
    00017 #ifndef _FCD_ENTITY_H_
    00018 #include "FCDocument/FCDEntity.h"
    00019 #endif // _FCD_ENTITY_H_
    00020 #ifndef _FCD_TRANSFORM_H_
    00021 #include "FCDocument/FCDTransform.h"
    00022 #endif // _FCD_TRANSFORM_H_
    00023 #ifndef _FU_DAE_ENUM_H_
    00024 #include "FUtils/FUDaeEnum.h"
    00025 #endif // _FU_DAE_ENUM_H_
    00026
    00027 class FCDocument;
    00028 class FCDTransform;
    00029 class FCDPhysicsModel;
    00030 class FCDPhysicsRigidBody;
    00031 class FCDSceneNode;
    00032
    00033 typedef FUObjectContainer<FCDTransform> FCDTransformContainer;
    00043 class FCOLLADA_EXPORT FCDPhysicsRigidConstraint : public FCDEntity
    00044 {
    00045 private:
    00046     DeclareObjectType(FCDEntity);
    00047     FCDPhysicsModel* parent;
    00048
    00049     fm::string sid;
    00050
    00051     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, enabled, FC("Enabled"));
    00052     DeclareParameterAnimatable(float, FUParameterQualifiers::SIMPLE, interpenetrate, FC("Inter-penetrate"));
    00053
    00054     FUTrackedPtr<FCDPhysicsRigidBody> referenceRigidBody;
    00055     FUTrackedPtr<FCDSceneNode> referenceNode;
    00056     FUTrackedPtr<FCDPhysicsRigidBody> targetRigidBody;
    00057     FUTrackedPtr<FCDSceneNode> targetNode;
    00058
    00059     DeclareParameter(FMVector3, FUParameterQualifiers::VECTOR, limitsLinearMin, FC("Minimum Linear Limit"));
    00060     DeclareParameter(FMVector3, FUParameterQualifiers::VECTOR, limitsLinearMax, FC("Maximum Linear Limit"));
    00061     DeclareParameter(FMVector3, FUParameterQualifiers::VECTOR, limitsSCTMin, FC("Minimum SCT? Limit"));
    00062     DeclareParameter(FMVector3, FUParameterQualifiers::VECTOR, limitsSCTMax, FC("Maximum SCT? Limit"));
    00063
    00064     DeclareParameter(float, FUParameterQualifiers::SIMPLE, springLinearStiffness, FC("Spring Linear Stiffness"));
    00065     DeclareParameter(float, FUParameterQualifiers::SIMPLE, springLinearDamping, FC("Spring Linear Damping"));
    00066     DeclareParameter(float, FUParameterQualifiers::SIMPLE, springLinearTargetValue, FC("Spring Linear Target"));
    00067
    00068     DeclareParameter(float, FUParameterQualifiers::SIMPLE, springAngularStiffness, FC("Spring Angular Stiffness"));
    00069     DeclareParameter(float, FUParameterQualifiers::SIMPLE, springAngularDamping, FC("Spring Angular Damping"));
    00070     DeclareParameter(float, FUParameterQualifiers::SIMPLE, springAngularTargetValue, FC("Spring Angular Target"));
    00071
    00072     FCDTransformContainer transformsRef;
    00073     FCDTransformContainer transformsTar;
    00074
    00075 public:
    00082     FCDPhysicsRigidConstraint(FCDocument* document, FCDPhysicsModel* _parent);
    00083
    00085     virtual ~FCDPhysicsRigidConstraint();
    00086
    00090     virtual Type GetType() const { return PHYSICS_RIGID_CONSTRAINT; }
    00091
    00094     FCDPhysicsModel* GetParent() { return parent; }
    00095     const FCDPhysicsModel* GetParent() const { return parent; }
    00101     inline const fm::string& GetSubId() const { return sid; }
    00102
    00107     inline void SetSubId(const fm::string& subId) { sid = CleanSubId(subId); SetDirtyFlag(); }
    00108     inline void SetSubId(const char* subId) { sid = CleanSubId(subId); SetDirtyFlag(); }
    00112     FCDPhysicsRigidBody* GetReferenceRigidBody() { return referenceRigidBody; }
    00113     const FCDPhysicsRigidBody* GetReferenceRigidBody() const { return referenceRigidBody; }
    00117     void SetReferenceRigidBody(FCDPhysicsRigidBody* _referenceRigidBody) { referenceRigidBody = _referenceRigidBody; referenceNode = NULL; SetNewChildFlag(); }
    00118
    00121     FCDPhysicsRigidBody* GetTargetRigidBody() { return targetRigidBody; }
    00122     const FCDPhysicsRigidBody* GetTargetRigidBody() const { return targetRigidBody; }
    00126     void SetTargetRigidBody(FCDPhysicsRigidBody* _targetRigidBody) { targetRigidBody = _targetRigidBody; targetNode = NULL; SetNewChildFlag(); }
    00127
    00132     FCDSceneNode* GetReferenceNode() { return referenceNode; }
    00133     const FCDSceneNode* GetReferenceNode() const { return referenceNode; }
    00139     void SetReferenceNode(FCDSceneNode* _referenceNode) { referenceNode = _referenceNode; referenceRigidBody = NULL; SetNewChildFlag(); }
    00140
    00145     FCDSceneNode* GetTargetNode() { return targetNode; }
    00146     const FCDSceneNode* GetTargetNode() const { return targetNode; }
    00152     void SetTargetNode(FCDSceneNode* _targetNode) { targetNode = _targetNode; targetRigidBody = NULL; SetNewChildFlag(); }
    00153
    00157     FCDTransformContainer& GetTransformsRef() { return transformsRef; }
    00158     const FCDTransformContainer& GetTransformsRef() const { return transformsRef; }
    00163     FCDTransformContainer& GetTransformsTar() { return transformsTar; }
    00164     const FCDTransformContainer& GetTransformsTar() const { return transformsTar; }
    00169     FCDTransform* AddTransformRef(FCDTransform::Type type, size_t index = (size_t)-1);
    00170
    00175     FCDTransform* AddTransformTar(FCDTransform::Type type, size_t index = (size_t)-1);
    00176
    00179     FCDParameterAnimatableFloat& GetEnabled() { return enabled; }
    00180     const FCDParameterAnimatableFloat& GetEnabled() const { return enabled; }
    00181     bool IsEnabled() const { return enabled > 0.5f; }
    00185     void SetEnabled(bool _enabled) { enabled = _enabled ? 1.0f : 0.0f; SetDirtyFlag(); }
    00186
    00189     FCDParameterAnimatableFloat& GetInterpenetrate() { return interpenetrate; }
    00190     const FCDParameterAnimatableFloat& GetInterpenetrate() const { return interpenetrate; }
    00191     bool IsInterpenetrate() const { return interpenetrate > 0.5f; }
    00195     void SetInterpenetrate(bool _interpenetrate) { interpenetrate = _interpenetrate ? 1.0f : 0.0f; SetDirtyFlag(); }
    00196
    00199     FUParameterVector3& GetLimitsLinearMin() { return limitsLinearMin; }
    00200     const FUParameterVector3& GetLimitsLinearMin() const { return limitsLinearMin; }
    00204     void SetLimitsLinearMin(const FMVector3& _limitsLinearMin) { limitsLinearMin = _limitsLinearMin; SetDirtyFlag(); }
    00205
    00208     FUParameterVector3& GetLimitsLinearMax() { return limitsLinearMax; }
    00209     const FUParameterVector3& GetLimitsLinearMax() const { return limitsLinearMax; }
    00213     void SetLimitsLinearMax(const FMVector3& _limitsLinearMax) { limitsLinearMax = _limitsLinearMax; SetDirtyFlag(); }
    00214
    00217     FUParameterVector3& GetLimitsSCTMin() { return limitsSCTMin; }
    00218     const FUParameterVector3& GetLimitsSCTMin() const { return limitsSCTMin; }
    00222     void SetLimitsSCTMin(const FMVector3& _limitsSCTMin) { limitsSCTMin = _limitsSCTMin; SetDirtyFlag(); }
    00223
    00226     FUParameterVector3& GetLimitsSCTMax() { return limitsSCTMax; }
    00227     const FUParameterVector3& GetLimitsSCTMax() const { return limitsSCTMax; }
    00231     void SetLimitsSCTMax(const FMVector3& _limitsSCTMax) { limitsSCTMax = _limitsSCTMax; SetDirtyFlag(); }
    00232
    00236     FUParameterFloat& GetSpringLinearStiffness() { return springLinearStiffness; }
    00237     const FUParameterFloat& GetSpringLinearStiffness() const { return springLinearStiffness; }
    00242     void SetSpringLinearStiffness(float _springLinearStiffness) { springLinearStiffness = _springLinearStiffness; SetDirtyFlag(); }
    00243
    00247     FUParameterFloat& GetSpringLinearDamping() { return springLinearDamping; }
    00248     const FUParameterFloat& GetSpringLinearDamping() const { return springLinearDamping; }
    00253     void SetSpringLinearDamping(float _springLinearDamping) { springLinearDamping = _springLinearDamping; SetDirtyFlag(); }
    00254
    00258     FUParameterFloat& GetSpringLinearTargetValue() { return springLinearTargetValue; }
    00259     const FUParameterFloat& GetSpringLinearTargetValue() const { return springLinearTargetValue; }
    00264     void SetSpringLinearTargetValue(float _springLinearTargetValue) { springLinearTargetValue = _springLinearTargetValue; SetDirtyFlag(); }
    00265
    00269     FUParameterFloat& GetSpringAngularStiffness() { return springAngularStiffness; }
    00270     const FUParameterFloat& GetSpringAngularStiffness() const { return springAngularStiffness; }
    00275     void SetSpringAngularStiffness(float _springAngularStiffness) { springAngularStiffness = _springAngularStiffness; SetDirtyFlag(); }
    00276
    00280     FUParameterFloat& GetSpringAngularDamping() { return springAngularDamping; }
    00281     const FUParameterFloat& GetSpringAngularDamping() const { return springAngularDamping; }
    00286     void SetSpringAngularDamping(float _springAngularDamping) { springAngularDamping = _springAngularDamping; SetDirtyFlag(); }
    00287
    00291     FUParameterFloat& GetSpringAngularTargetValue() { return springAngularTargetValue; }
    00292     const FUParameterFloat& GetSpringAngularTargetValue() const { return springAngularTargetValue; }
    00297     void SetSpringAngularTargetValue(float _springAngularTargetValue) { springAngularTargetValue = _springAngularTargetValue; SetDirtyFlag(); }
    00298
    00301     DEPRECATED(3.05A, GetEnabled().GetAnimated) FCDAnimated* GetAnimatedEnabled() { return GetEnabled().GetAnimated(); }
    00302     DEPRECATED(3.05A, GetEnabled().GetAnimated) const FCDAnimated* GetAnimatedEnabled() const { return GetEnabled().GetAnimated(); }
    00306     DEPRECATED(3.05A, GetInterpenetrate().GetAnimated) FCDAnimated* GetAnimatedInterpenetrate() { return GetInterpenetrate().GetAnimated(); }
    00307     DEPRECATED(3.05A, GetInterpenetrate().GetAnimated) const FCDAnimated* GetAnimatedInterpenetrate() const { return GetInterpenetrate().GetAnimated(); }
    00315     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00316 };
    00317
    00318 #endif // _FCD_PHYSICS_RIGID_CONSTRAINT_H_