eqemu

annotate src/bvol.h @ 12:2656099aff12

added copyright notices and license
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 18 Jul 2014 07:04:21 +0300
parents 3d3656360a82
children
rev   line source
nuclear@12 1 /*
nuclear@12 2 eqemu - electronic queue system emulator
nuclear@12 3 Copyright (C) 2014 John Tsiombikas <nuclear@member.fsf.org>,
nuclear@12 4 Eleni-Maria Stea <eleni@mutantstargoat.com>
nuclear@12 5
nuclear@12 6 This program is free software: you can redistribute it and/or modify
nuclear@12 7 it under the terms of the GNU General Public License as published by
nuclear@12 8 the Free Software Foundation, either version 3 of the License, or
nuclear@12 9 (at your option) any later version.
nuclear@12 10
nuclear@12 11 This program is distributed in the hope that it will be useful,
nuclear@12 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
nuclear@12 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nuclear@12 14 GNU General Public License for more details.
nuclear@12 15
nuclear@12 16 You should have received a copy of the GNU General Public License
nuclear@12 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
nuclear@12 18 */
nuclear@4 19 #ifndef BVOL_H_
nuclear@4 20 #define BVOL_H_
nuclear@4 21
nuclear@4 22 #include "vmath.h"
nuclear@4 23
nuclear@4 24 struct HitPoint {
nuclear@4 25 float t;
nuclear@4 26 Vector3 pos;
nuclear@4 27 };
nuclear@4 28
nuclear@4 29 class BVolume {
nuclear@4 30 public:
nuclear@4 31 virtual ~BVolume() {}
nuclear@4 32
nuclear@4 33 virtual bool intersect(const Ray &ray, HitPoint *hit) const = 0;
nuclear@4 34 };
nuclear@4 35
nuclear@4 36 class BSphere : public BVolume {
nuclear@4 37 private:
nuclear@4 38 Vector3 center;
nuclear@4 39 float radius;
nuclear@4 40
nuclear@4 41 public:
nuclear@4 42 BSphere();
nuclear@4 43 explicit BSphere(const Vector3 &c, float rad = 1.0);
nuclear@4 44
nuclear@4 45 void set_center(const Vector3 &center);
nuclear@4 46 const Vector3 &get_center() const;
nuclear@4 47
nuclear@4 48 void set_radius(float rad);
nuclear@4 49 float get_radius() const;
nuclear@4 50
nuclear@4 51 bool intersect(const Ray &ray, HitPoint *hit) const;
nuclear@4 52 };
nuclear@4 53
nuclear@4 54 #endif // BVOL_H_