2 Copyright (C) 2001-2006, William Joseph.
5 This file is part of GtkRadiant.
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.
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.
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
22 #if !defined(INCLUDED_CULLABLE_H)
23 #define INCLUDED_CULLABLE_H
25 #include "generic/constant.h"
27 template<typename Element> class BasicVector3;
28 typedef BasicVector3<float> Vector3;
34 template<typename Enumeration> class EnumeratedValue;
35 struct VolumeIntersection;
36 typedef EnumeratedValue<VolumeIntersection> VolumeIntersectionValue;
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;
55 virtual bool fill() const = 0;
57 virtual const Matrix4& GetViewport() const = 0;
58 virtual const Matrix4& GetProjection() const = 0;
59 virtual const Matrix4& GetModelview() const = 0;
65 STRING_CONSTANT(Name, "Cullable");
67 virtual VolumeIntersectionValue intersectVolume(const VolumeTest& test, const Matrix4& localToWorld) const = 0;