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/include/IMG/IMGBsp.h

    r700 r721  
    99class Bsp { 
    1010  public: 
    11     inline Bsp() : root(NULL), countleaf(0), counttotal(0){}; 
     11    Bsp(); 
    1212 
    13     inline void SetRoot(NodeBsp * node) { 
    14                 root = node; 
    15                 counttotal++; 
    16         }; 
     13    virtual ~Bsp(); 
    1714 
    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); 
    2216 
    23     inline void PrintLeaf() { 
    24                 PrintLeaf(root); 
    25         }; 
     17    void Print(); 
    2618 
    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();  
    4520 
    46     inline NodeBsp * Get(int i) { 
    47                 return root->Get (root, i); 
    48         }; 
     21    NodeBspPtr Insert(int w, int h, int idcluster); 
    4922 
     23    NodeBspPtr Get(int i); 
    5024 
    51   private: 
    52     NodeBsp * root; 
     25  protected: 
     26    NodeBspPtr root; 
    5327 
    5428    int countleaf; 
     
    5630    int counttotal; 
    5731 
    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); 
    6433 
    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); 
    7935 
    8036}; 
Note: See TracChangeset for help on using the changeset viewer.