eqemu
annotate 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 |
rev | line source |
---|---|
nuclear@4 | 1 #ifndef BVOL_H_ |
nuclear@4 | 2 #define BVOL_H_ |
nuclear@4 | 3 |
nuclear@4 | 4 #include "vmath.h" |
nuclear@4 | 5 |
nuclear@4 | 6 struct HitPoint { |
nuclear@4 | 7 float t; |
nuclear@4 | 8 Vector3 pos; |
nuclear@4 | 9 }; |
nuclear@4 | 10 |
nuclear@4 | 11 class BVolume { |
nuclear@4 | 12 public: |
nuclear@4 | 13 virtual ~BVolume() {} |
nuclear@4 | 14 |
nuclear@4 | 15 virtual bool intersect(const Ray &ray, HitPoint *hit) const = 0; |
nuclear@4 | 16 }; |
nuclear@4 | 17 |
nuclear@4 | 18 class BSphere : public BVolume { |
nuclear@4 | 19 private: |
nuclear@4 | 20 Vector3 center; |
nuclear@4 | 21 float radius; |
nuclear@4 | 22 |
nuclear@4 | 23 public: |
nuclear@4 | 24 BSphere(); |
nuclear@4 | 25 explicit BSphere(const Vector3 &c, float rad = 1.0); |
nuclear@4 | 26 |
nuclear@4 | 27 void set_center(const Vector3 ¢er); |
nuclear@4 | 28 const Vector3 &get_center() const; |
nuclear@4 | 29 |
nuclear@4 | 30 void set_radius(float rad); |
nuclear@4 | 31 float get_radius() const; |
nuclear@4 | 32 |
nuclear@4 | 33 bool intersect(const Ray &ray, HitPoint *hit) const; |
nuclear@4 | 34 }; |
nuclear@4 | 35 |
nuclear@4 | 36 #endif // BVOL_H_ |