00001 /****************************************************************************\ 00002 * * 00003 * 29.03.2006 * 00004 * CFrustum - Header File * 00005 * * 00006 * (c) Robert Hausmair * 00007 * * 00008 \****************************************************************************/ 00009 00010 #ifndef __CFRUSTUM_H__ 00011 #define __CFRUSTUM_H__ 00012 00013 /****************************************************************************\ 00014 * REQUIRED HEADERS * 00015 \****************************************************************************/ 00016 #include <Definitions.h> 00017 #include <Memory/mmgr.h> 00018 #include <Math/TPlane.h> 00019 #include <Math/CMatrix44.h> 00020 #include <Math/TAABox3.h> 00021 #include <Math/TSphere.h> 00022 00023 /****************************************************************************\ 00024 * DEFINITIONS * 00025 \****************************************************************************/ 00026 #define FRUSTUM_OUTSIDE -1 00027 #define FRUSTUM_INSIDE 1 00028 #define FRUSTUM_INTERSECTS 0 00029 00030 /****************************************************************************\ 00031 * CLASS * 00032 \****************************************************************************/ 00033 class CFrustum 00034 { 00035 /**************************************************************************\ 00036 * PUBLIC CLASS FUNCTIONS * 00037 \**************************************************************************/ 00038 public: 00039 CFrustum() {} 00040 00041 void CalculateFrustum(const CMatrix44 &projection, const CMatrix44 &view); //Calculates the frustum 00042 00043 sbyte SphereInFrustum(const CSpheref &sphere) const; 00044 bool BoxInFrustum(const CAABox3f &box) const; 00045 bool BoxInFrustum(const CBox3f &box) const; 00046 00047 virtual ~CFrustum() {} 00048 00049 /**************************************************************************\ 00050 * PROTECTED CLASS FUNCTIONS * 00051 \**************************************************************************/ 00052 protected: 00053 00054 /**************************************************************************\ 00055 * PRIVATE CLASS FUNCTIONS * 00056 \**************************************************************************/ 00057 private: 00058 //Private copy constructor and assignment operator to prevent mistakes: 00059 CFrustum(const CFrustum &); 00060 CFrustum &operator =(const CFrustum &); 00061 00062 /**************************************************************************\ 00063 * PROTECTED CLASS MEMBERS * 00064 \**************************************************************************/ 00065 protected: 00066 00067 /**************************************************************************\ 00068 * PRIVATE CLASS MEMBERS * 00069 \**************************************************************************/ 00070 private: 00071 CPlanef m_Planes[6]; 00072 }; 00073 00074 #endif