- Timestamp:
- 03/31/06 17:29:32 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBsp.cpp
r709 r721 1 1 2 #include "IMGBsp.h"2 #include <IMGBsp.h> 3 3 4 namespace IMG { 4 namespace IMG 5 { 6 7 Bsp::Bsp() : root(NULL), countleaf(0), counttotal(0) 8 { 9 } 5 10 6 11 Bsp::~Bsp() 7 12 { 8 delete root; 13 9 14 } 10 15 16 void Bsp::SetRoot(NodeBspPtr node) 17 { 18 root = node; 19 counttotal++; 20 } 21 22 void Bsp::Print() 23 { 24 Ogre::LogManager::getSingleton().logMessage("\nImprimint Arbre BSP, num nodes leaf: " + Ogre::StringConverter::toString(countleaf) + ", totals: " + Ogre::StringConverter::toString(counttotal)); 25 Print(root); 26 } 27 28 void Bsp::PrintLeaf() 29 { 30 PrintLeaf(root); 31 } 32 33 NodeBspPtr Bsp::Insert(int w, int h, int idcluster) 34 { 35 NodeBspPtr node = root->Insert(w,h); 36 37 if (idcluster != -1) 38 { 39 node->SetId (idcluster); 40 countleaf++; 41 } 42 else 43 { 44 counttotal++; 45 } 46 47 return node; 48 } 49 50 NodeBspPtr Bsp::Get(int i) 51 { 52 return root->Get(root, i); 53 } 54 55 void Bsp::Print(NodeBspPtr node) 56 { 57 node->Print(); 58 Print(node->GetChild(0)); 59 Print(node->GetChild(1)); 60 } 61 62 void Bsp::PrintLeaf(NodeBspPtr node) 63 { 64 if (node->GetChild(0) == NULL && node->GetChild(1) == NULL) 65 { 66 node->Print(); 67 } 68 69 PrintLeaf (node->GetChild(0)); 70 PrintLeaf (node->GetChild(1)); 71 } 11 72 12 73 }
Note: See TracChangeset
for help on using the changeset viewer.