Changeset 2281


Ignore:
Timestamp:
03/22/07 18:51:14 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp

    r2280 r2281  
    5858        Octree *octree = static_cast<Octree *>(root); 
    5959 
    60         int mask = (int) (rand() * 8.0f); 
    61          
    6260        // random decision 
    6361        Octree *child = NULL; 
    6462         
    65         while (!child) 
     63        std::vector<Octree *> nodes; 
     64 
     65        //LogManager::getSingleton().logMessage("***"); 
     66        for (int i = 0; i < 8; ++ i) 
     67        { 
     68                int x = (i & 4) / 4; 
     69                int y = (i & 2) / 2; 
     70                int z = i & 1; 
     71         
     72                if ((child = octree->mChildren[x][y][z]) != NULL) 
     73                { 
     74                        nodes.push_back(child); 
     75                } 
     76        } 
     77 
     78        if (nodes.empty()) 
     79                return NULL; 
     80 
     81        int r = (int) (rand() * (float)nodes.size()); 
     82 
     83        return GetRandomLeaf(nodes[r]); 
     84        // assume that at least one child is not NULL ... 
     85        /*while (!child) 
     86        { 
     87                int mask = (int) (rand() * 8.0f); 
    6688                child = octree->mChildren[(mask & 4) / 4][(mask & 2) / 2][mask & 1]; 
    67  
    68         return GetRandomLeaf(child); 
     89        } 
     90 
     91        return GetRandomLeaf(child);*/ 
    6992} 
    7093//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/RandomUpdateCullingManager.cpp

    r2280 r2281  
    3333        ///////////// 
    3434        //-- PART 1: process finished occlusion queries 
    35         CullingLogManager::GetSingleton()->LogMessage("here55"); 
     35         
    3636        while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 
    3737        { 
     
    111111                                { 
    112112                                        if (mHierarchyInterface->IsNodeVisible(node)) 
    113                                                 Ogre::LogManager::getSingleton().logMessage("u"); 
     113                                                CullingLogManager::GetSingleton()->LogMessage("u"); 
    114114                                        else 
    115                                                 Ogre::LogManager::getSingleton().logMessage("g"); 
     115                                                CullingLogManager::GetSingleton()->LogMessage("g"); 
    116116                                } 
    117117                                 
    118118                                if (mHierarchyInterface->IsNodeFullyVisible(node)) 
    119                                 {Ogre::LogManager::getSingleton().logMessage("here8"); 
     119                                { 
     120                                        CullingLogManager::GetSingleton()->LogMessage("here8"); 
    120121                                        // node fully visible => test only random leaves 
    121122                                        for (int i = 0; i < mRandomCandidates; ++ i) 
    122123                                        { 
    123                                                 Ogre::LogManager::getSingleton().logMessage("z"); 
     124                                                CullingLogManager::GetSingleton()->LogMessage("z"); 
    124125                                                HierarchyNode *randomLeaf = mHierarchyInterface->GetRandomLeaf(node); 
     126                                                CullingLogManager::GetSingleton()->LogMessage("c"); 
     127                                                if (!randomLeaf) 
     128                                                        continue; 
    125129 
    126130                                                mHierarchyInterface->SetNodeVisible(randomLeaf, false); 
     
    133137                                                        mHierarchyInterface->IssueNodeOcclusionQuery(node))); 
    134138                                                 
     139                                                        CullingLogManager::GetSingleton()->LogMessage("a"); 
    135140                                                mHierarchyInterface->TraverseNode2(node); 
     141                                                        CullingLogManager::GetSingleton()->LogMessage("b"); 
    136142                                        } 
    137143 
Note: See TracChangeset for help on using the changeset viewer.