source: NonGTP/FCollada/FCDocument/FCDPhysicsShape.h @ 964

Revision 964, 2.6 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[964]1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5
6#ifndef _FCD_PHYSICS_SHAPE_H_
7#define _FCD_PHYSICS_SHAPE_H_
8
9#include "FCDocument/FCDEntity.h"
10#include "FCDocument/FCDEntityInstance.h"
11#include "FUtils/FUDaeEnum.h"
12
13class FCDocument;
14class FCDPhysicsRigidBody;
15class FCDPhysicsRigidConstraint;
16class FCDGeometryInstance;
17class FCDPhysicsAnalyticalGeometry;
18class FCDTransform;
19
20typedef vector<FCDTransform*> FCDTransformList;
21typedef vector<FCDPhysicsRigidBody*> FCDPhysicsRigidBodyList;
22
23class FCOLLADA_EXPORT FCDPhysicsShape : public FCDEntity
24{
25private:
26        DeclareObjectType;
27
28        bool hollow;
29        FCDPhysicsMaterial* physicsMaterial;
30        bool ownsPhysicsMaterial;
31       
32        //one of these two will define the rigid body
33        FCDGeometryInstance* geometry;
34        FCDPhysicsAnalyticalGeometry* analGeom; //pun not intended
35
36        bool ownsGeometryInstance;
37
38        float mass;
39        float density;
40        FCDTransformList transforms;
41
42
43public:
44        FCDPhysicsShape(FCDocument* document);
45        virtual ~FCDPhysicsShape();
46
47        // Returns the entity type
48        virtual Type GetType() const { return PHYSICS_SHAPE; }
49
50        const float& GetMass() const {return mass;}
51        void SetMass(float _mass) {mass = _mass;}
52        const float& GetDensity() const {return density;}
53        void SetDensity(float _density) {density = _density;}
54        FCDPhysicsAnalyticalGeometry* GetAnalyticalGeometry() const {return analGeom;}
55        void SetAnalyticalGeometry(FCDPhysicsAnalyticalGeometry* _analGeom) {analGeom = _analGeom;}
56        FCDGeometryInstance* GetGeometryInstance() const {return geometry;}
57        void SetGeometryInstance(FCDGeometryInstance* _geometry) {geometry = _geometry;}
58        void SetGeometryInstanceOwnership(bool val) {ownsGeometryInstance = val;}
59        FCDPhysicsMaterial* GetPhysicsMaterial() const {return physicsMaterial;}
60        void SetPhysicsMaterial(FCDPhysicsMaterial* _physicsMaterial) {physicsMaterial = _physicsMaterial;}
61        bool ownsItsPhysicsMaterial() const {return ownsPhysicsMaterial;}
62        void SetOwnsPhysicsMaterial(bool _ownsPhysicsMaterial) {ownsPhysicsMaterial = _ownsPhysicsMaterial;}
63        bool isHollow() const {return hollow;}
64        void SetHollow(bool _hollow) {hollow = _hollow;}
65        const FCDTransformList& GetTransforms() const {return transforms;}
66        void AddTransform(FCDTransform* t) {transforms.push_back(t);}
67
68        // Create a copy of this shape
69        FCDPhysicsShape* Clone();
70
71        // Read in the <physics_shape> node of the COLLADA document
72        virtual FUStatus LoadFromXML(xmlNode* node);
73
74        // Write out the <physics_shape> node to the COLLADA xml tree
75        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
76};
77
78#endif // _FCD_PHYSICS_SHAPE_H_
Note: See TracBrowser for help on using the repository browser.