Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

vhdSceneConverterABTTree.h

00001 00002 // Copyright : Sebastien Schertenleib 00003 // : VRLab-EPFL 00004 // 00005 // Email :Sebastien.Schertenleib@epfl.ch 00006 // 00007 // This source code is a part of the Game Programming Gems 5 Source Code 00008 // 00009 // Permission to copy, modify, reproduce or redistribute this source code is 00010 // granted provided the above copyright notice is retained in the resulting 00011 // source code. 00012 // 00013 // This file is provided 'as is' with no expressed or implied warranty. 00014 // The author accepts no liability if it causes any damage to your computer. 00015 // 00016 // Do expect bugs. 00017 // Please let me know of any bugs/mods/improvements. 00018 // and I will try to fix/incorporate them into this file. 00019 // Enjoy! 00020 // 00022 00023 00024 #ifndef VHDSCENECONVERTERABTTREE_H 00025 #define VHDSCENECONVERTERABTTREE_H 00026 00027 class vhdABTTree; 00028 00029 #include <vector> 00030 #include <map> 00031 #include <string> 00032 #include <list> 00033 #include "vhdSingleton.h" 00034 #include "vhdAxisAlignedBox.h" 00035 00041 class vhdSceneConverterABTTree : public vhdSingleton<vhdSceneConverterABTTree> 00042 { 00043 public: 00047 class NodeChildStruct 00048 { 00049 public: 00050 NodeChildStruct(const vhdAxisAlignedBox & _bbox, const std::string & _strPath):bbox(_bbox),strPath(_strPath){} 00051 vhdAxisAlignedBox bbox; 00052 std::string strPath; 00053 }; 00054 00055 typedef std::list<NodeChildStruct> ListAABB; 00056 00057 /* 00058 * Binary Tree use for the construction of the cache-oblivious ABTTree as they are more pratical for finding the data. 00059 * This class is use only during the compilation of the cache-oblivious ABTTree 00060 */ 00061 class vhdSceneABTTreeNode 00062 { 00063 public: 00064 vhdSceneABTTreeNode() 00065 { 00066 pLeft=pRight=NULL; 00067 } 00068 ListAABB listAABB; 00069 vhdSceneABTTreeNode* pLeft; 00070 vhdSceneABTTreeNode* pRight; 00071 }; 00072 00073 typedef std::map<unsigned int, vhdSceneABTTreeNode> MapNodeChild; 00074 00075 MapNodeChild mapNodeChild; 00076 00077 00078 public: 00085 static vhdAxisAlignedBox findGlobalAABB(const ListAABB & listAABB); 00086 00087 00088 00089 public: 00093 vhdSceneConverterABTTree(); 00097 ~vhdSceneConverterABTTree(); 00098 00099 00100 private: 00104 static const unsigned int ABTTREE_AXISX; 00105 static const unsigned int ABTTREE_AXISY; 00106 static const unsigned int ABTTREE_AXISZ; 00107 static const unsigned int ABTTREE_AXISINVALID; 00108 00109 00110 00121 float _findBestSplitLocation (vhdSceneABTTreeNode *pParentNode ,int axis, float& fSplitLoc,unsigned int uiNodeIndex); 00122 00123 public: 00124 00125 // ABTree Data Structures 00126 vhdSceneABTTreeNode *pDataRootNode; 00127 00128 00137 void getChildren(vhdSceneABTTreeNode *pParentNode ,unsigned int nCurrentChildPosition,vhdAxisAlignedBox & boxLeft, vhdAxisAlignedBox & boxRight); 00138 00139 }; 00140 00141 #endif

Generated on Sun Oct 3 16:32:22 2004 for vhdABTTree by doxygen 1.3.8