Changeset 2557


Ignore:
Timestamp:
10/22/07 16:42:43 (17 years ago)
Author:
mattausch
Message:

started with new hybrid visibility method

Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC
Files:
2 added
4 edited

Legend:

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

    r2532 r2557  
    55 
    66#include "OgreOcclusionQueriesQueryManager.h" 
    7 //#include "OgrePlatformHierarchyInterface.h" 
    87#include "OgreOcclusionCullingSceneManager.h" 
    98#include "VisibilityEnvironment.h" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj

    r2532 r2557  
    525525                        </File> 
    526526                        <File 
     527                                RelativePath="..\include\OgreVisibilityPredictor.h"> 
     528                        </File> 
     529                        <File 
    527530                                RelativePath="..\include\VisibilityMesh.h"> 
    528531                        </File> 
     
    563566                        <File 
    564567                                RelativePath="..\src\OgreVisibilityOptionsManager.cpp"> 
     568                        </File> 
     569                        <File 
     570                                RelativePath=".\OgreVisibilityPredictor.cpp"> 
    565571                        </File> 
    566572                        <File 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/include/CoherentHierarchicalCullingPlusPlusManager.h

    r2555 r2557  
    6666        inline void IssueQuery(HierarchyNode *node, const bool testGeometry); 
    6767 
     68        //void IssueOptimalBatches(QueryHeap &nodes); 
     69 
    6870 
    6971        ////////////////////// 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingPlusPlusManager.cpp

    r2556 r2557  
    5252                ////////// 
    5353                //-- only wait for result if there are no nodes to process 
    54 #if 0 
    55                 bool resultAvailable = true; 
    56                 while (!mQueryQueue.empty() &&  
    57                            (NodeInvalid(mQueryQueue.front().first) || 
    58                             mQueryQueue.front().second->GetQueryResult( 
    59                                              visiblePixels, mHierarchyInterface->GetQueue()->empty()))) 
    60 #else 
    6154                bool resultAvailable = false; 
    6255 
     
    6760                           (resultAvailable = mQueryQueue.front().second->GetQueryResult(visiblePixels, false))) 
    6861                           ) 
    69 #endif 
    7062                { 
    7163                        HierarchyNode *node = mQueryQueue.front().first; 
     
    7567                        if (NodeInvalid(node)) {mQueryQueue.pop(); continue;} 
    7668 
    77                         // during the wait time issue nodes from visible queue 
     69                        // during the wait time we issue nodes from visible queue 
    7870                        while (1 && !mVisibleNodes.empty() && !resultAvailable) 
    7971                        { 
     
    114106                                if (mVisualizeCulledNodes) 
    115107                                        mHierarchyInterface->VisualizeCulledNode(node, QUERY_CULLED); 
    116                                 } 
     108                        } 
    117109                         
    118110                        // update node's visited flag 
     
    221213 
    222214        // issue rest of nodes from nodes from visible queue 
    223                 if (0 && mHierarchyInterface->GetQueue()->empty() && mQueryQueue.empty() && !mVisibleNodes.empty()) 
     215                if (0 &&  
     216                        mHierarchyInterface->GetQueue()->empty() && mQueryQueue.empty() && !mVisibleNodes.empty()) 
    224217                { 
    225218                        while (!mVisibleNodes.empty()) 
     
    230223                } 
    231224        } 
    232  
    233  
    234         if (0 && !mVisibleNodes.empty()) 
    235         { 
    236                 std::stringstream d; 
    237                 d << "queries: " << (int)mQueryQueue.size() << " vis: " << (int)mVisibleNodes.size() << " inv: " << (int)mInvisibleNodes.size(); 
    238                 CullingLogManager::GetSingleton()->LogMessage(d.str()); 
    239         } 
    240225         
    241     // render rest 
     226    // render what is left in the render queue 
    242227        mHierarchyInterface->RenderQueue(); 
    243228 
     
    279264                mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId());    
    280265        } 
    281  
    282         if (0) 
    283         { 
    284                 std::stringstream d; 
    285                 d << "tested: " << i << " nodes"; 
    286                 CullingLogManager::GetSingleton()->LogMessage(d.str()); 
    287         } 
    288266} 
    289267//----------------------------------------------------------------------- 
     
    357335        nodes.clear(); 
    358336} 
     337//----------------------------------------------------------------------- 
     338#if 0 
     339void CoherentHierarchicalCullingPlusPlusManager::IssueOptimalBatches(QueryHeap &nodes) 
     340{ 
     341        while (!nodes.Empty()) 
     342        {        
     343                QueryQueueEntry *entry = GetNextQueryQueueEntry(); 
     344                entry->mIsVisibleQuery = false; 
     345         
     346                float pFail = 1.0f;  
     347                float maxBatchVal = 0.0f; 
     348                float newPBatch = 1.0f; 
     349                float newBatchVal; 
    359350                 
    360 } 
     351                // issue next query 
     352                while (!nodes.Empty()) 
     353                { 
     354                        HierarchyNode *node = nodes.Top(); 
     355         
     356                        newPBatch *= mNodePredictor.GetProbability(node); 
     357 
     358                        if (entry->mNodes.empty()) 
     359                                newBatchVal = 1.0f; 
     360                        else 
     361                        { 
     362                                const float newSize = float(entry->mNodes.size() + 1); 
     363                                newBatchVal = newSize / (1.0f + (1.0f - newPBatch) * newSize); 
     364                        } 
     365 
     366                        if (newBatchVal <= maxBatchVal) 
     367                                break; 
     368 
     369                        pFail = entry->mNodes.empty() ? 0.0f : (1.0f - newPBatch); 
     370 
     371                        nodes.Pop(); 
     372                        entry->AddNode(node); 
     373 
     374                        maxBatchVal = newBatchVal; 
     375                } 
     376 
     377                entry->mPFail = pFail; 
     378 
     379                IssueQuery(*entry, false); 
     380                mQueries.push(entry); 
     381        } 
     382} 
     383#endif 
     384} 
Note: See TracChangeset for help on using the changeset viewer.