00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2003 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef __Frustum_H__ 00026 #define __Frustum_H__ 00027 00028 #include "OgrePrerequisites.h" 00029 #include "OgreMovableObject.h" 00030 #include "OgreRenderable.h" 00031 #include "OgreAxisAlignedBox.h" 00032 #include "OgreVertexIndexData.h" 00033 00034 namespace Ogre 00035 { 00038 enum FrustumPlane 00039 { 00040 FRUSTUM_PLANE_NEAR = 0, 00041 FRUSTUM_PLANE_FAR = 1, 00042 FRUSTUM_PLANE_LEFT = 2, 00043 FRUSTUM_PLANE_RIGHT = 3, 00044 FRUSTUM_PLANE_TOP = 4, 00045 FRUSTUM_PLANE_BOTTOM = 5 00046 }; 00047 00052 class _OgreExport Frustum : public MovableObject, public Renderable 00053 { 00054 protected: 00056 Real mFOVy; 00058 Real mFarDist; 00060 Real mNearDist; 00062 Real mAspect; 00063 00065 mutable Plane mFrustumPlanes[6]; 00066 00068 mutable Quaternion mLastParentOrientation; 00069 mutable Vector3 mLastParentPosition; 00070 00072 mutable Matrix4 mProjMatrix; 00074 mutable Matrix4 mStandardProjMatrix; 00076 mutable Matrix4 mViewMatrix; 00078 mutable bool mRecalcFrustum; 00080 mutable bool mRecalcView; 00081 00082 00086 mutable Real mCoeffL[2], mCoeffR[2], mCoeffB[2], mCoeffT[2]; 00087 00088 00089 // Internal functions for calcs 00090 void updateFrustum(void) const; 00091 void updateView(void) const; 00092 bool isViewOutOfDate(void) const; 00093 bool isFrustumOutOfDate(void) const; 00094 00096 static String msMovableType; 00097 00098 mutable AxisAlignedBox mBoundingBox; 00099 mutable VertexData mVertexData; 00100 00101 Material* mMaterial; 00102 00103 00104 public: 00105 00106 Frustum(); 00107 virtual ~Frustum(); 00120 void setFOVy(Real fovy); 00121 00124 Real getFOVy(void) const; 00125 00137 void setNearClipDistance(Real nearDist); 00138 00141 Real getNearClipDistance(void) const; 00142 00159 void setFarClipDistance(Real farDist); 00160 00163 Real getFarClipDistance(void) const; 00164 00173 void setAspectRatio(Real ratio); 00174 00177 Real getAspectRatio(void) const; 00178 00186 const Matrix4& getProjectionMatrix(void) const; 00198 const Matrix4& getStandardProjectionMatrix(void) const; 00199 00202 const Matrix4& getViewMatrix(void) const; 00203 00208 const Plane& getFrustumPlane( FrustumPlane plane ); 00209 00221 bool isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy = 0); 00222 00234 bool isVisible(const Sphere& bound, FrustumPlane* culledBy = 0); 00235 00247 bool isVisible(const Vector3& vert, FrustumPlane* culledBy = 0); 00248 00249 00251 const AxisAlignedBox& getBoundingBox(void) const; 00252 00254 Real getBoundingRadius(void) const; 00255 00257 void _updateRenderQueue(RenderQueue* queue); 00258 00260 const String& getMovableType(void) const; 00261 00263 const String& getName(void) const; 00264 00266 void _notifyCurrentCamera(Camera* cam); 00267 00269 Material* getMaterial(void) const; 00270 00272 void getRenderOperation(RenderOperation& op); 00273 00275 void getWorldTransforms(Matrix4* xform) const; 00276 00278 const Quaternion& getWorldOrientation(void) const; 00279 00281 const Vector3& getWorldPosition(void) const; 00282 00284 Real getSquaredViewDepth(const Camera* cam) const; 00285 00287 const LightList& getLights(void) const; 00288 00289 00290 }; 00291 00292 00293 } 00294 00295 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:11 2004