- Timestamp:
- 03/31/06 17:29:32 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBsp.h
r700 r721 9 9 class Bsp { 10 10 public: 11 inline Bsp() : root(NULL), countleaf(0), counttotal(0){};11 Bsp(); 12 12 13 inline void SetRoot(NodeBsp * node) { 14 root = node; 15 counttotal++; 16 }; 13 virtual ~Bsp(); 17 14 18 inline void Print() { 19 printf("\nImprimint Arbre BSP, num nodes leaf: %d, totals: %d", countleaf, counttotal); 20 Print(root); 21 }; 15 void SetRoot(NodeBspPtr node); 22 16 23 inline void PrintLeaf() { 24 PrintLeaf(root); 25 }; 17 void Print(); 26 18 27 inline NodeBsp * Insert(int w, int h, int idcluster) { 28 //printf("\nInsret dins Bsp: %d, %d", w, h); 29 30 NodeBsp *node = root->Insert (w,h); 31 32 //printf("\nNode on s'insertarà finalment éS: "); node->Print(); 33 34 if (idcluster != -1) 35 { 36 node->SetId (idcluster); 37 countleaf++; 38 } 39 else counttotal++; 40 41 //Copiar pixels de la imatge al node 42 43 return node; 44 }; 19 void PrintLeaf(); 45 20 46 inline NodeBsp * Get(int i) { 47 return root->Get (root, i); 48 }; 21 NodeBspPtr Insert(int w, int h, int idcluster); 49 22 23 NodeBspPtr Get(int i); 50 24 51 pr ivate:52 NodeBsp *root;25 protected: 26 NodeBspPtr root; 53 27 54 28 int countleaf; … … 56 30 int counttotal; 57 31 58 inline void Print(NodeBsp * node) { 59 if (!node) return; 60 node->Print(); 61 Print(node->GetChild(0)); 62 Print(node->GetChild(1)); 63 }; 32 void Print(NodeBspPtr node); 64 33 65 inline void PrintLeaf(NodeBsp * node) { 66 if (!node) return; 67 68 69 if (node->GetChild(0) == NULL && node->GetChild(1) == NULL) node->Print(); 70 71 PrintLeaf (node->GetChild(0)); 72 PrintLeaf (node->GetChild(1)); 73 74 }; 75 76 77 public: 78 ~Bsp(); 34 void PrintLeaf(NodeBspPtr node); 79 35 80 36 };
Note: See TracChangeset
for help on using the changeset viewer.