eqemu
view src/bvol.h @ 5:9b5bb05ae53a
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 18 Jul 2014 00:42:15 +0300 |
parents | |
children | 2656099aff12 |
line source
1 #ifndef BVOL_H_
2 #define BVOL_H_
4 #include "vmath.h"
6 struct HitPoint {
7 float t;
8 Vector3 pos;
9 };
11 class BVolume {
12 public:
13 virtual ~BVolume() {}
15 virtual bool intersect(const Ray &ray, HitPoint *hit) const = 0;
16 };
18 class BSphere : public BVolume {
19 private:
20 Vector3 center;
21 float radius;
23 public:
24 BSphere();
25 explicit BSphere(const Vector3 &c, float rad = 1.0);
27 void set_center(const Vector3 ¢er);
28 const Vector3 &get_center() const;
30 void set_radius(float rad);
31 float get_radius() const;
33 bool intersect(const Ray &ray, HitPoint *hit) const;
34 };
36 #endif // BVOL_H_