]> icculus.org git repositories - divverent/netradiant.git/blob - include/cullable.h
a Q3 map origin to origin brush converter to fix maps that this q3map2 no longer...
[divverent/netradiant.git] / include / cullable.h
1 /*
2 Copyright (C) 2001-2006, William Joseph.
3 All Rights Reserved.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 */
21
22 #if !defined(INCLUDED_CULLABLE_H)
23 #define INCLUDED_CULLABLE_H
24
25 #include "generic/constant.h"
26
27 template<typename Element> class BasicVector3;
28 typedef BasicVector3<float> Vector3;
29 class Plane3;
30 class Matrix4;
31 class AABB;
32 class Segment;
33
34 template<typename Enumeration> class EnumeratedValue;
35 struct VolumeIntersection;
36 typedef EnumeratedValue<VolumeIntersection> VolumeIntersectionValue;
37
38 class VolumeTest
39 {
40 public:
41
42   /// \brief Returns true if \p point intersects volume.
43   virtual bool TestPoint(const Vector3& point) const = 0;
44   /// \brief Returns true if \p segment intersects volume.
45   virtual bool TestLine(const Segment& segment) const = 0;
46   /// \brief Returns true if \p plane faces towards volume.
47   virtual bool TestPlane(const Plane3& plane) const = 0;
48   /// \brief Returns true if \p plane transformed by \p localToWorld faces the viewer.
49   virtual bool TestPlane(const Plane3& plane, const Matrix4& localToWorld) const = 0;
50   /// \brief Returns the intersection of \p aabb and volume.
51   virtual VolumeIntersectionValue TestAABB(const AABB& aabb) const = 0;
52   /// \brief Returns the intersection of \p aabb transformed by \p localToWorld and volume.
53   virtual VolumeIntersectionValue TestAABB(const AABB& aabb, const Matrix4& localToWorld) const = 0;
54
55   virtual bool fill() const = 0;
56
57   virtual const Matrix4& GetViewport() const = 0;
58   virtual const Matrix4& GetProjection() const = 0;
59   virtual const Matrix4& GetModelview() const = 0;
60 };
61
62 class Cullable
63 {
64 public:
65   STRING_CONSTANT(Name, "Cullable");
66
67   virtual VolumeIntersectionValue intersectVolume(const VolumeTest& test, const Matrix4& localToWorld) const = 0;
68 };
69
70
71 #endif