00001 /**************************************************************************** 00002 00003 This file is part of the GLC-lib library. 00004 Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net) 00005 http://glc-lib.sourceforge.net 00006 00007 GLC-lib is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 GLC-lib is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with GLC-lib; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 00021 *****************************************************************************/ 00023 00024 #ifndef GLC_OCTREE_H_ 00025 #define GLC_OCTREE_H_ 00026 00027 #include "glc_spacepartitioning.h" 00028 #include "../glc_config.h" 00029 00030 class GLC_OctreeNode; 00031 class GLC_Material; 00032 class GLC_3DViewInstance; 00033 00036 00037 00038 class GLC_LIB_EXPORT GLC_Octree : public GLC_SpacePartitioning 00039 { 00041 00043 00044 public: 00046 GLC_Octree(GLC_3DViewCollection*); 00047 00049 GLC_Octree(const GLC_Octree&); 00050 00052 virtual ~GLC_Octree(); 00053 00055 00057 00059 00060 public: 00062 static int defaultDepth(); 00063 00065 virtual QList<GLC_3DViewInstance*> listOfIntersectedInstances(const GLC_BoundingBox& bBox); 00066 00068 00069 00071 00072 public: 00073 00075 virtual void updateViewableInstances(const GLC_Frustum&); 00076 00078 virtual void updateSpacePartitioning(); 00079 00081 virtual void clear(); 00082 00084 00085 void setDepth(int); 00086 00088 void createBox(GLC_Material*, GLC_3DViewCollection* pCol= NULL); 00089 00091 static void setDefaultDepth(int depth); 00092 00094 00096 // Private services function 00098 private: 00099 00101 00102 void createBoxWithMaterial(GLC_3DViewCollection*, GLC_OctreeNode*, GLC_Material*); 00103 00105 // Private members 00107 private: 00109 GLC_OctreeNode* m_pRootNode; 00110 00112 int m_OctreeDepth; 00113 00115 static int m_DefaultOctreeDepth; 00116 }; 00117 00118 #endif /* GLC_OCTREE_H_ */