Ignore:
Timestamp:
03/31/06 17:29:32 (18 years ago)
Author:
igarcia
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBsp.cpp

    r709 r721  
    11 
    2 #include "IMGBsp.h" 
     2#include <IMGBsp.h> 
    33 
    4 namespace IMG { 
     4namespace IMG  
     5{ 
     6 
     7Bsp::Bsp() : root(NULL), countleaf(0), counttotal(0) 
     8{ 
     9} 
    510 
    611Bsp::~Bsp()  
    712{ 
    8         delete root; 
     13 
    914} 
    1015 
     16void Bsp::SetRoot(NodeBspPtr node)  
     17{ 
     18    root = node; 
     19    counttotal++; 
     20} 
     21 
     22void 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 
     28void Bsp::PrintLeaf() 
     29{ 
     30        PrintLeaf(root); 
     31} 
     32 
     33NodeBspPtr 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 
     50NodeBspPtr Bsp::Get(int i)  
     51{ 
     52        return root->Get(root, i); 
     53} 
     54 
     55void Bsp::Print(NodeBspPtr node)  
     56{ 
     57    node->Print(); 
     58    Print(node->GetChild(0)); 
     59    Print(node->GetChild(1)); 
     60} 
     61 
     62void 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} 
    1172 
    1273} 
Note: See TracChangeset for help on using the changeset viewer.