00001 /*************************************************************************** 00002 glshape.h - description 00003 ------------------- 00004 begin : Thu Jul 10 2003 00005 copyright : (C) 2003 by Gabor Torok 00006 email : cctorok@yahoo.com 00007 00008 This code was originally written by: 00009 Ben Humphrey (DigiBen) 00010 Game Programmer 00011 DigiBen@GameTutorials.com 00012 Co-Web Host of www.GameTutorials.com 00013 00014 ***************************************************************************/ 00015 00016 /*************************************************************************** 00017 * * 00018 * This program is free software; you can redistribute it and/or modify * 00019 * it under the terms of the GNU General Public License as published by * 00020 * the Free Software Foundation; either version 2 of the License, or * 00021 * (at your option) any later version. * 00022 * * 00023 ***************************************************************************/ 00024 00025 #ifndef FRUSTUM_H 00026 #define FRUSTUM_H 00027 00028 #include "constants.h" 00029 00034 // This will allow us to create an object to keep track of our frustum 00035 class CFrustum { 00036 00037 public: 00038 00039 // Call this every time the camera moves to update the frustum 00040 void CalculateFrustum(); 00041 00042 // This takes a 3D point and returns TRUE if it's inside of the frustum 00043 bool PointInFrustum(float x, float y, float z); 00044 00045 // This takes a 3D point and a radius and returns TRUE if the sphere is inside of the frustum 00046 bool SphereInFrustum(float x, float y, float z, float radius); 00047 00048 // This takes the center and half the length of the cube. 00049 bool CubeInFrustum( float x, float y, float z, float size ); 00050 00051 private: 00052 00053 // This holds the A B C and D values for each side of our frustum. 00054 float m_Frustum[6][4]; 00055 }; 00056 00057 #endif
1.4.0