00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- 00002 00003 this file is part of rcssserver3D 00004 Fri May 9 2003 00005 Copyright (C) 2002,2003 Koblenz University 00006 Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group 00007 $Id: frustum.h,v 1.5 2003/11/14 14:05:54 fruit Exp $ 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; version 2 of the License. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 00022 NOTE: 00023 00024 HISTORY: 00025 11.06.01 - MK 00026 - Initial version 00027 23.03.02 - MK 00028 - Intersection/Inclusion-tests 00029 00030 TODO: 00031 - Create frustum from a (view)point and a polygon 00032 - Create a view frustum given field-of-views 00033 00034 TOFIX: 00035 */ 00036 #ifndef SALT_FRUSTUM_H 00037 #define SALT_FRUSTUM_H 00038 00039 #include "defines.h" 00040 #include "plane.h" 00041 #include "bounds.h" 00042 00043 namespace salt 00044 { 00045 00050 class Frustum 00051 { 00052 // Members 00053 public: 00055 enum ePlaneID 00056 { 00057 PI_NEAR = 0, 00058 PI_LEFT = 1, 00059 PI_RIGHT = 2, 00060 PI_FAR = 3, 00061 PI_BOTTOM = 4, 00062 PI_TOP = 5 00063 }; 00064 00066 enum eFrustumSide 00067 { 00068 FS_INSIDE = 0, 00069 FS_OUTSIDE = 1, 00070 FS_SPLIT = 2 00071 }; 00072 00074 Vector3f mBasePos; 00075 00077 Plane mPlanes[6]; 00078 00079 // Methods 00080 public: 00082 void Dump() const; 00083 00091 void Set(const Matrix& worldTransform, float fov=60.0f, float zNear=0.1f, float zFar=2000.0f, float aspect=0.75f); 00092 00097 eFrustumSide Intersects(const AABB3& bb) const; 00098 }; 00099 00100 } // namespace salt 00101 00102 #endif //SALT_FRUSTUM_H