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

- File List
- File Members

# FCDocument/FCDPhysicsAnalyticalGeometry.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
    00015 #ifndef _FCD_PHYSICS_ANALYTICAL_GEOM_H_
    00016 #define _FCD_PHYSICS_ANALYTICAL_GEOM_H_
    00017
    00018 #ifndef _FCD_ENTITY_H_
    00019 #include "FCDocument/FCDEntity.h"
    00020 #endif // _FCD_ENTITY_H_
    00021
    00022 class FCDocument;
    00023 class FCDPhysicsShape;
    00024
    00030 class FCOLLADA_EXPORT FCDPhysicsAnalyticalGeometry : public FCDEntity
    00031 {
    00032 private:
    00033     DeclareObjectType(FCDEntity);
    00034
    00035 public:
    00038     enum GeomType {
    00039         BOX,
    00040         PLANE,
    00041         SPHERE,
    00042         CYLINDER,
    00043         CAPSULE,
    00044         TAPERED_CYLINDER,
    00045         TAPERED_CAPSULE
    00046     };
    00047
    00052     FCDPhysicsAnalyticalGeometry(FCDocument* document);
    00053
    00055     virtual ~FCDPhysicsAnalyticalGeometry();
    00056
    00060     virtual Type GetType() const {return PHYSICS_ANALYTICAL_GEOMETRY;}
    00061
    00064     virtual GeomType GetGeomType() const = 0;
    00065
    00068     virtual float CalculateVolume() const = 0;
    00069
    00077     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00078 };
    00079
    00085 class FCOLLADA_EXPORT FCDPASBox : public FCDPhysicsAnalyticalGeometry
    00086 {
    00087 private:
    00088     DeclareObjectType(FCDPhysicsAnalyticalGeometry);
    00089
    00090 public:
    00094     FCDPASBox(FCDocument* document);
    00095
    00097     virtual ~FCDPASBox() {}
    00098
    00101     virtual GeomType GetGeomType() const {return BOX;}
    00102
    00105     virtual float CalculateVolume() const;
    00106
    00114     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00115
    00116 public:
    00117     FMVector3 halfExtents;
    00118 };
    00119
    00125 class FCOLLADA_EXPORT FCDPASPlane : public FCDPhysicsAnalyticalGeometry
    00126 {
    00127 private:
    00128     DeclareObjectType(FCDPhysicsAnalyticalGeometry);
    00129
    00130 public:
    00135     FCDPASPlane(FCDocument* document);
    00136
    00138     virtual ~FCDPASPlane() {}
    00139
    00142     virtual GeomType GetGeomType() const {return PLANE;}
    00143
    00146     virtual float CalculateVolume() const;
    00147
    00155     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00156
    00157 public:
    00158     FMVector3 normal;
    00159     float d;
    00160 };
    00161
    00167 class FCOLLADA_EXPORT FCDPASSphere : public FCDPhysicsAnalyticalGeometry
    00168 {
    00169 private:
    00170     DeclareObjectType(FCDPhysicsAnalyticalGeometry);
    00171
    00172 public:
    00177     FCDPASSphere(FCDocument* document);
    00178
    00180     virtual ~FCDPASSphere() {}
    00181
    00184     virtual GeomType GetGeomType() const {return SPHERE;}
    00185
    00188     virtual float CalculateVolume() const;
    00189
    00197     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00198
    00199 public:
    00200     float radius;
    00201 };
    00202
    00208 class FCOLLADA_EXPORT FCDPASCylinder : public FCDPhysicsAnalyticalGeometry
    00209 {
    00210 private:
    00211     DeclareObjectType(FCDPhysicsAnalyticalGeometry);
    00212
    00213 public:
    00218     FCDPASCylinder(FCDocument* document);
    00219
    00221     virtual ~FCDPASCylinder() {}
    00222
    00225     virtual GeomType GetGeomType() const {return CYLINDER;}
    00226
    00229     virtual float CalculateVolume() const;
    00230
    00238     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00239
    00240 public:
    00241     float height;
    00242     FMVector2 radius;
    00243 };
    00244
    00250 class FCOLLADA_EXPORT FCDPASCapsule : public FCDPhysicsAnalyticalGeometry
    00251 {
    00252 private:
    00253     DeclareObjectType(FCDPhysicsAnalyticalGeometry);
    00254
    00255 public:
    00260     FCDPASCapsule(FCDocument* document);
    00261
    00263     virtual ~FCDPASCapsule() {}
    00264
    00267     virtual GeomType GetGeomType() const {return CAPSULE;}
    00268
    00271     virtual float CalculateVolume() const;
    00272
    00280     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00281
    00282 public:
    00283     float height;
    00284     FMVector2 radius;
    00285 };
    00286
    00292 class FCOLLADA_EXPORT FCDPASTaperedCapsule : public FCDPASCapsule
    00293 {
    00294 private:
    00295     DeclareObjectType(FCDPASCapsule);
    00296
    00297 public:
    00302     FCDPASTaperedCapsule(FCDocument* document);
    00303
    00305     virtual ~FCDPASTaperedCapsule() {}
    00306
    00309     virtual GeomType GetGeomType() const {return TAPERED_CAPSULE;}
    00310
    00313     virtual float CalculateVolume() const;
    00314
    00322     virtual FCDPhysicsAnalyticalGeometry* Clone(FCDPhysicsAnalyticalGeometry* clone = NULL, bool cloneChildren = false) const;
    00323
    00324 public:
    00325     //inherits all other attributes from Capsule
    00326     FMVector2 radius2;
    00327 };
    00328
    00334 class FCOLLADA_EXPORT FCDPASTaperedCylinder : public FCDPASCylinder
    00335 {
    00336 private:
    00337     DeclareObjectType(FCDPASCylinder);
    00338
    00339 public:
    00344     FCDPASTaperedCylinder(FCDocument* document);
    00345
    00347     virtual ~FCDPASTaperedCylinder() {}
    00348
    00351     virtual GeomType GetGeomType() const {return TAPERED_CYLINDER;}
    00352
    00355     virtual float CalculateVolume() const;
    00356
    00364     virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
    00365
    00366 public:
    00367     //inherits all other attributes from Cylinder
    00368     FMVector2 radius2;
    00369 };
    00370
    00378 class FCOLLADA_EXPORT FCDPASFactory
    00379 {
    00380 private:
    00381     FCDPASFactory() {}
    00382
    00383 public:
    00389     static FCDPhysicsAnalyticalGeometry* CreatePAS(FCDocument* document, FCDPhysicsAnalyticalGeometry::GeomType type);
    00390 };
    00391
    00392 #endif // _FCD_PHYSICS_ANALYTICAL_GEOMETRY_H_