NLS Engine  v0.1
The Next Logical Step in game engine design.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
ColliderSphere.h
Go to the documentation of this file.
00001 
00011 #pragma once
00012 
00013 #include <threading.h>
00014 
00015 #include "../InterfaceCollider.h"
00016 
00017 namespace Physics {
00018   struct ColliderSphereData {
00019     float radius;
00020     mutable Threading::ReadWriteMutex mutex;
00021   };
00022   typedef std::shared_ptr<ColliderSphereData> ColliderSphereDataPointer;
00023 }
00024 
00025 namespace Physics {
00026   class ColliderSphere : public InterfaceCollider {
00027   public:
00028     ColliderSphere(EntitySPTR, ModuleInterface*);
00029     virtual ~ColliderSphere();
00030     
00031   public: // API methods
00032     bool SetRadius(float);
00033     
00034   private: // overridden methods
00035     BoundingSphere GetBoundingSphere() const;
00036     AABB GetAABB() const;
00037     
00038     bool CollideRay(const Vector3D&, const Vector3D&) const;
00039     
00040     EntitySPTR GetOwnerEntity() const;
00041     
00042   private: // member data
00043     ColliderSphereDataPointer primaryBuffer;
00044     ColliderSphereDataPointer secondaryBuffer;
00045   };
00046 }