Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# deBoundingVolumes.hpp

Go to the documentation of this file.

    00001 #ifndef DEBOUNDINGVOLUMES_HPP
    00002 #define DEBOUNDINGVOLUMES_HPP
    00003
    00004 #include "deGlobalTypes.hpp"
    00005 #include "deScene.hpp"
    00006
    00007 #define DEBV_API DESCENE_API
    00008
    00009 /// Base class for general bounding volume implementations
    00010 //class IdeBoundingVolume : virtual public IdeRefCountBase
    00011 DE3D_INTERFACE(IdeBoundingVolume, IdeRefCountBase)
    00012 {
    00013 protected:
    00014     virtual ~IdeBoundingVolume() {};
    00015
    00016 public:
    00017     enum BVType_t
    00018     {
    00019         BVType_Unknown,
    00020         BVType_Sphere,
    00021         BVType_AABB,
    00022         BVType_OBB,
    00023         BVType_Cylinder,
    00024         BVType_Cone,
    00025         BVType_Capsule,
    00026         BVType_Hull,
    00027         BVType_Count,
    00028         BVType_32Bit
    00029     };
    00030
    00031     virtual BVType_t GetBVType() = 0;
    00032     virtual void* GetBVInterface(BVType_t iface) = 0;
    00033     virtual deBoolean TestIntersection(IdeBoundingVolume* other) = 0;
    00034     virtual deBoolean TestLineIntersect(const deVec3d& begin, const deVec3d& end) = 0;
    00035     virtual deBoolean TestSphereIntersect(const deVec3d& center, deDouble radius) = 0;
    00036     virtual deBoolean TestAABBIntersect(const deVec3d& pos, const deAABB& box) = 0;
    00037
    00038     virtual void GetPosition(deVec3d& pos) = 0;
    00039     virtual void SetPosition(const deVec3d& pos) = 0;
    00040 };
    00041
    00042 /// an abstract bounding sphere implementation
    00043 //class IdeBV_Sphere : virtual public IdeBoundingVolume
    00044 DE3D_INTERFACE(IdeBV_Sphere, IdeBoundingVolume)
    00045 {
    00046 protected:
    00047     virtual ~IdeBV_Sphere() {};
    00048
    00049 public:
    00050     virtual void SetRadius(deDouble Radius) = 0;
    00051     virtual deDouble GetRadius() = 0;
    00052 };
    00053
    00054 /// an abstract axis-aligned bounding box implementation
    00055 //class IdeBV_AABB : virtual public IdeBoundingVolume
    00056 DE3D_INTERFACE(IdeBV_AABB, IdeBoundingVolume)
    00057 {
    00058 protected:
    00059     virtual ~IdeBV_AABB() {};
    00060
    00061 public:
    00062     virtual void SetBBox(const deAABB& BBox) = 0;
    00063     virtual void GetBBox(deAABB& BBox) = 0;
    00064 };
    00065
    00066
    00067 /// Create a bounding volume of the specified type
    00068 DEBV_API IdeBoundingVolume * IdeBoundingVolume_Create(IdeBoundingVolume::BVType_t bvtype);
    00069
    00070 #endif