Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
bsptree.h
00001 /* 00002 Copyright (C) 2004 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_BSPTREE_H__ 00020 #define __CS_BSPTREE_H__ 00021 00022 #include "csextern.h" 00023 #include "plane3.h" 00024 #include "csutil/array.h" 00025 #include "csutil/dirtyaccessarray.h" 00026 #include "csutil/hash.h" 00027 #include "csutil/blockallocator.h" 00028 00029 struct iGraphics3D; 00030 struct csTriangle; 00031 class csBSPTree; 00032 00038 class CS_CSGEOM_EXPORT csBSPTree 00039 { 00040 private: 00041 static csBlockAllocator<csBSPTree> tree_nodes; 00042 static csDirtyAccessArray<int> b2f_array; 00043 00044 csBSPTree* child1; // If child1 is not 0 then child2 will 00045 csBSPTree* child2; // also be not 0. 00046 00047 csPlane3 split_plane; 00048 csArray<int> splitters; 00049 00050 size_t FindBestSplitter (csTriangle* triangles, csPlane3* planes, 00051 int num_triangles, csVector3* vertices, 00052 const csArray<int>& triidx); 00053 void Build (csTriangle* triangles, csPlane3* planes, 00054 int num_triangles, csVector3* vertices, 00055 const csArray<int>& triidx); 00056 void Back2Front (const csVector3& pos, csDirtyAccessArray<int>& arr, 00057 csSet<int>& used_indices); 00058 public: 00060 csBSPTree (); 00062 ~csBSPTree (); 00063 00065 void Clear (); 00066 00070 void Build (csTriangle* triangles, int num_triangles, 00071 csVector3* vertices); 00072 00078 const csDirtyAccessArray<int>& Back2Front (const csVector3& pos); 00079 }; 00080 00081 #endif // __CS_BSPTREE_H__ 00082
Generated for Crystal Space by doxygen 1.3.9.1