00001
00002
00003
00004
00005
00006 #ifndef _FCD_PHYSICS_SHAPE_H_
00007 #define _FCD_PHYSICS_SHAPE_H_
00008
00009 #include "FCDocument/FCDEntity.h"
00010 #include "FCDocument/FCDEntityInstance.h"
00011 #include "FUtils/FUDaeEnum.h"
00012
00013 class FCDocument;
00014 class FCDPhysicsRigidBody;
00015 class FCDPhysicsRigidConstraint;
00016 class FCDGeometryInstance;
00017 class FCDPhysicsAnalyticalGeometry;
00018 class FCDTransform;
00019
00020 typedef vector<FCDTransform*> FCDTransformList;
00021 typedef vector<FCDPhysicsRigidBody*> FCDPhysicsRigidBodyList;
00022
00023 class FCOLLADA_EXPORT FCDPhysicsShape : public FCDEntity
00024 {
00025 private:
00026 DeclareObjectType;
00027
00028 bool hollow;
00029 FCDPhysicsMaterial* physicsMaterial;
00030 bool ownsPhysicsMaterial;
00031
00032
00033 FCDGeometryInstance* geometry;
00034 FCDPhysicsAnalyticalGeometry* analGeom;
00035
00036 bool ownsGeometryInstance;
00037
00038 float mass;
00039 float density;
00040 FCDTransformList transforms;
00041
00042
00043 public:
00044 FCDPhysicsShape(FCDocument* document);
00045 virtual ~FCDPhysicsShape();
00046
00047
00048 virtual Type GetType() const { return PHYSICS_SHAPE; }
00049
00050 const float& GetMass() const {return mass;}
00051 void SetMass(float _mass) {mass = _mass;}
00052 const float& GetDensity() const {return density;}
00053 void SetDensity(float _density) {density = _density;}
00054 FCDPhysicsAnalyticalGeometry* GetAnalyticalGeometry() const {return analGeom;}
00055 void SetAnalyticalGeometry(FCDPhysicsAnalyticalGeometry* _analGeom) {analGeom = _analGeom;}
00056 FCDGeometryInstance* GetGeometryInstance() const {return geometry;}
00057 void SetGeometryInstance(FCDGeometryInstance* _geometry) {geometry = _geometry;}
00058 void SetGeometryInstanceOwnership(bool val) {ownsGeometryInstance = val;}
00059 FCDPhysicsMaterial* GetPhysicsMaterial() const {return physicsMaterial;}
00060 void SetPhysicsMaterial(FCDPhysicsMaterial* _physicsMaterial) {physicsMaterial = _physicsMaterial;}
00061 bool ownsItsPhysicsMaterial() const {return ownsPhysicsMaterial;}
00062 void SetOwnsPhysicsMaterial(bool _ownsPhysicsMaterial) {ownsPhysicsMaterial = _ownsPhysicsMaterial;}
00063 bool isHollow() const {return hollow;}
00064 void SetHollow(bool _hollow) {hollow = _hollow;}
00065 const FCDTransformList& GetTransforms() const {return transforms;}
00066 void AddTransform(FCDTransform* t) {transforms.push_back(t);}
00067
00068
00069 FCDPhysicsShape* Clone();
00070
00071
00072 virtual FUStatus LoadFromXML(xmlNode* node);
00073
00074
00075 virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
00076 };
00077
00078 #endif // _FCD_PHYSICS_SHAPE_H_