[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_ANALYTICAL_GEOM_H_
|
---|
| 7 | #define _FCD_PHYSICS_ANALYTICAL_GEOM_H_
|
---|
| 8 |
|
---|
| 9 | #include "FCDocument/FCDEntity.h"
|
---|
| 10 | #include "FCDocument/FCDEntityInstance.h"
|
---|
| 11 | #include "FUtils/FUDaeEnum.h"
|
---|
| 12 |
|
---|
| 13 | class FCDocument;
|
---|
| 14 | class FCDPhysicsParameterGeneric;
|
---|
| 15 |
|
---|
| 16 | typedef vector<FCDPhysicsParameterGeneric*> FCDPhysicsParameterList;
|
---|
| 17 |
|
---|
| 18 | class FCOLLADA_EXPORT FCDPhysicsAnalyticalGeometry : public FCDEntity
|
---|
| 19 | {
|
---|
| 20 | private:
|
---|
| 21 | DeclareObjectType;
|
---|
| 22 |
|
---|
| 23 | public:
|
---|
| 24 | enum GeomType { BOX, PLANE, SPHERE, CYLINDER, CAPSULE, TAPERED_CYLINDER, TAPERED_CAPSULE };
|
---|
| 25 |
|
---|
| 26 | FCDPhysicsAnalyticalGeometry(FCDocument* document);
|
---|
| 27 | virtual ~FCDPhysicsAnalyticalGeometry();
|
---|
| 28 |
|
---|
| 29 | virtual Type GetType() const {return PHYSICS_ANALYTICAL_GEOMETRY;}
|
---|
| 30 |
|
---|
| 31 | // Returns the entity type
|
---|
| 32 | virtual GeomType GetGeomType() const = 0;
|
---|
| 33 |
|
---|
| 34 | // Create a copy of this analyticalGeometry
|
---|
| 35 | virtual FCDPhysicsAnalyticalGeometry* Clone() = 0;
|
---|
| 36 |
|
---|
| 37 | // Read in the <physics_analyticalGeometry> node of the COLLADA document
|
---|
| 38 | virtual FUStatus LoadFromXML(xmlNode* node);
|
---|
| 39 |
|
---|
| 40 | // Write out the <physics_analyticalGeometry> node to the COLLADA xml tree
|
---|
| 41 | virtual xmlNode* WriteToXML(xmlNode* parentNode) const = 0;
|
---|
| 42 | };
|
---|
| 43 |
|
---|
| 44 | class FCOLLADA_EXPORT FCDPASBox : public FCDPhysicsAnalyticalGeometry
|
---|
| 45 | {
|
---|
| 46 | private:
|
---|
| 47 | DeclareObjectType;
|
---|
| 48 |
|
---|
| 49 | public:
|
---|
| 50 | FCDPASBox(FCDocument* document);
|
---|
| 51 | virtual ~FCDPASBox() {}
|
---|
| 52 |
|
---|
| 53 | virtual FUStatus LoadFromXML(xmlNode* node);
|
---|
| 54 | virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
|
---|
| 55 | virtual GeomType GetGeomType() const {return BOX;}
|
---|
| 56 | virtual FCDPhysicsAnalyticalGeometry* Clone();
|
---|
| 57 |
|
---|
| 58 | public:
|
---|
| 59 | FMVector3 halfExtents;
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 | class FCOLLADA_EXPORT FCDPASPlane : public FCDPhysicsAnalyticalGeometry
|
---|
| 63 | {
|
---|
| 64 | private:
|
---|
| 65 | DeclareObjectType;
|
---|
| 66 |
|
---|
| 67 | public:
|
---|
| 68 | FCDPASPlane(FCDocument* document);
|
---|
| 69 | virtual ~FCDPASPlane() {}
|
---|
| 70 |
|
---|
| 71 | virtual FUStatus LoadFromXML(xmlNode* node);
|
---|
| 72 | virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
|
---|
| 73 | virtual GeomType GetGeomType() const {return PLANE;}
|
---|
| 74 | virtual FCDPhysicsAnalyticalGeometry* Clone();
|
---|
| 75 |
|
---|
| 76 | public:
|
---|
| 77 | FMVector3 normal;
|
---|
| 78 | float d;
|
---|
| 79 | };
|
---|
| 80 |
|
---|
| 81 | class FCOLLADA_EXPORT FCDPASSphere : public FCDPhysicsAnalyticalGeometry
|
---|
| 82 | {
|
---|
| 83 | private:
|
---|
| 84 | DeclareObjectType;
|
---|
| 85 |
|
---|
| 86 | public:
|
---|
| 87 | FCDPASSphere(FCDocument* document);
|
---|
| 88 | virtual ~FCDPASSphere() {}
|
---|
| 89 |
|
---|
| 90 | virtual FUStatus LoadFromXML(xmlNode* node);
|
---|
| 91 | virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
|
---|
| 92 | virtual GeomType GetGeomType() const {return SPHERE;}
|
---|
| 93 | virtual FCDPhysicsAnalyticalGeometry* Clone();
|
---|
| 94 |
|
---|
| 95 | public:
|
---|
| 96 | float radius;
|
---|
| 97 | };
|
---|
| 98 |
|
---|
| 99 | class FCOLLADA_EXPORT FCDPASCylinder : public FCDPhysicsAnalyticalGeometry
|
---|
| 100 | {
|
---|
| 101 | private:
|
---|
| 102 | DeclareObjectType;
|
---|
| 103 |
|
---|
| 104 | public:
|
---|
| 105 | FCDPASCylinder(FCDocument* document);
|
---|
| 106 | virtual ~FCDPASCylinder() {}
|
---|
| 107 |
|
---|
| 108 | virtual FUStatus LoadFromXML(xmlNode* node);
|
---|
| 109 | virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
|
---|
| 110 | virtual GeomType GetGeomType() const {return CYLINDER;}
|
---|
| 111 | virtual FCDPhysicsAnalyticalGeometry* Clone();
|
---|
| 112 |
|
---|
| 113 | public:
|
---|
| 114 | float height;
|
---|
| 115 | float radius;
|
---|
| 116 | };
|
---|
| 117 |
|
---|
| 118 | class FCOLLADA_EXPORT FCDPASCapsule : public FCDPhysicsAnalyticalGeometry
|
---|
| 119 | {
|
---|
| 120 | private:
|
---|
| 121 | DeclareObjectType;
|
---|
| 122 |
|
---|
| 123 | public:
|
---|
| 124 | FCDPASCapsule(FCDocument* document);
|
---|
| 125 | virtual ~FCDPASCapsule() {}
|
---|
| 126 |
|
---|
| 127 | virtual FUStatus LoadFromXML(xmlNode* node);
|
---|
| 128 | virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
|
---|
| 129 | virtual GeomType GetGeomType() const {return CAPSULE;}
|
---|
| 130 | virtual FCDPhysicsAnalyticalGeometry* Clone();
|
---|
| 131 |
|
---|
| 132 | public:
|
---|
| 133 | float height;
|
---|
| 134 | float radius;
|
---|
| 135 | };
|
---|
| 136 |
|
---|
| 137 | class FCOLLADA_EXPORT FCDPASTaperedCapsule : public FCDPASCapsule
|
---|
| 138 | {
|
---|
| 139 | private:
|
---|
| 140 | DeclareObjectType;
|
---|
| 141 |
|
---|
| 142 | public:
|
---|
| 143 | FCDPASTaperedCapsule(FCDocument* document);
|
---|
| 144 | virtual ~FCDPASTaperedCapsule() {}
|
---|
| 145 |
|
---|
| 146 | virtual FUStatus LoadFromXML(xmlNode* node);
|
---|
| 147 | virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
|
---|
| 148 | virtual GeomType GetGeomType() const {return TAPERED_CAPSULE;}
|
---|
| 149 | virtual FCDPhysicsAnalyticalGeometry* Clone();
|
---|
| 150 |
|
---|
| 151 | public:
|
---|
| 152 | //inherits all other attributes from Capsule
|
---|
| 153 | float radius2;
|
---|
| 154 | };
|
---|
| 155 |
|
---|
| 156 | class FCOLLADA_EXPORT FCDPASTaperedCylinder : public FCDPASCylinder
|
---|
| 157 | {
|
---|
| 158 | private:
|
---|
| 159 | DeclareObjectType;
|
---|
| 160 |
|
---|
| 161 | public:
|
---|
| 162 | FCDPASTaperedCylinder(FCDocument* document);
|
---|
| 163 | virtual ~FCDPASTaperedCylinder() {}
|
---|
| 164 |
|
---|
| 165 | virtual FUStatus LoadFromXML(xmlNode* node);
|
---|
| 166 | virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
|
---|
| 167 | virtual GeomType GetGeomType() const {return TAPERED_CYLINDER;}
|
---|
| 168 | virtual FCDPhysicsAnalyticalGeometry* Clone();
|
---|
| 169 |
|
---|
| 170 | public:
|
---|
| 171 | //inherits all other attributes from Cylinder
|
---|
| 172 | float radius2;
|
---|
| 173 | };
|
---|
| 174 |
|
---|
| 175 |
|
---|
| 176 | #endif // _FCD_PHYSICS_ANALYTICAL_GEOMETRY_H_
|
---|