Changeset 2254


Ignore:
Timestamp:
03/16/07 13:08:00 (17 years ago)
Author:
mattausch
Message:

fixed problems of particle demo + visibility manager

Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj

    r2228 r2254  
    9696                                Name="VCMIDLTool"/> 
    9797                        <Tool 
    98                                 Name="VCPostBuildEventTool" 
    99                                 CommandLine="copy $(OutDir)\$(TargetFileName) &quot;$(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)&quot;"/> 
     98                                Name="VCPostBuildEventTool"/> 
    10099                        <Tool 
    101100                                Name="VCPreBuildEventTool"/> 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h

    r2184 r2254  
    187187        void loadConfig(DataStreamPtr& stream); 
    188188 
    189         void RenderDepthPass(const bool fillRenderQueue = true); 
     189        void RenderHierarchicalCulling(const bool fillRenderQueue = true); 
    190190 
    191191        void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays); 
     
    196196                                                                const bool nodeVisibility);      
    197197 
    198         void AddVisibleMeshGeometryToQueue(const GtpVisibility::MeshInfoContainer &visibleGeometry, Camera *cam); 
    199         void AddVisibleNodeGeometryToQueue(const GtpVisibility::NodeInfoContainer &visibleNodes, Camera *cam); 
     198        void AddVisibleMeshGeometryToQueue(const GtpVisibility::MeshInfoContainer &visibleGeometry,  
     199                                                                           Camera *cam); 
     200        void AddVisibleNodeGeometryToQueue(const GtpVisibility::NodeInfoContainer &visibleNodes,  
     201                                                                           Camera *cam); 
    200202 
    201203        ////////////////////////////////////////// 
     
    299301        ObjReader *mObjReader; 
    300302 
    301         Camera *mDummyCamera; 
     303        bool mUseVisibilityQueries; 
     304 
     305        bool mUseFromPointQueries; 
     306 
     307        bool mUseExactQueries; 
     308         
     309        bool mUseDepthPassForQueries; 
    302310}; 
    303311 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r2253 r2254  
    5959mElementaryViewCell(NULL), 
    6060mDeleteQueueAfterRendering(true), 
    61 mNormalExecution(true), 
     61mNormalExecution(false), 
    6262mShowViewCells(false), 
    6363mViewCellsGeometryLoaded(false), 
     
    6666mFilename("terrain"), 
    6767mFlushRate(10), 
    68 mCurrentFrame(0) 
     68mCurrentFrame(0), 
     69mUseVisibilityQueries(false), 
     70mUseFromPointQueries(false), 
     71mUseExactQueries(false), 
     72mUseDepthPassForQueries(false) 
    6973{ 
    7074        Ogre::LogManager::getSingleton(). 
     
    8084        } 
    8185 
    82         // TODO: set maxdepth to reasonable value 
     86        // set maxdepth to reasonable value 
    8387        mMaxDepth = 50; 
    8488 
     
    110114OcclusionCullingSceneManager::~OcclusionCullingSceneManager() 
    111115{ 
     116        CLEAR_CONTAINER(mObjects); 
     117 
    112118        OGRE_DELETE(mHierarchyInterface); 
    113         CLEAR_CONTAINER(mObjects); 
    114119        OGRE_DELETE(mCurrentViewCell); 
    115120 
     
    195200        ConfigFile config; 
    196201        String val; 
    197  
    198         LogManager::getSingleton(). 
    199                 logMessage("****** OcclusionCullingSceneManager Options ********"); 
     202         
    200203        config.load(stream); 
    201  
    202         std::stringstream d;  
    203                  
     204         
     205        LogManager::getSingleton().logMessage("****** OcclusionCullingSceneManager Options ********"); 
     206 
    204207        val = config.getSetting("DepthPass"); 
    205208 
    206209    if (!val.empty()) 
    207210        { 
    208                 mUseDepthPass = atoi(val.c_str()); 
    209         } 
    210  
    211         if (mUseDepthPass) 
    212                 LogManager::getSingleton().logMessage("using depth"); 
    213         else 
    214                 LogManager::getSingleton().logMessage("not using depth"); 
    215          
     211                if ( val == "yes" ) 
     212                        mUseDepthPass = true; 
     213                else 
     214                        mUseDepthPass = false; 
     215        } 
     216 
     217        val = config.getSetting("ExecuteVertexProgramForDepth"); 
     218 
     219        if (!val.empty()) 
     220        { 
     221                if ( val == "yes" ) 
     222                        mExecuteVertexProgramForAllPasses = true; 
     223                else 
     224                        mExecuteVertexProgramForAllPasses = false; 
     225        } 
     226 
     227        val = config.getSetting("UseVisibilityQueries"); 
     228 
     229        if (!val.empty()) 
     230        { 
     231                if ( val == "yes" ) 
     232                        mUseVisibilityQueries = true; 
     233                else 
     234                        mUseVisibilityQueries = false; 
     235        } 
     236 
     237        val = config.getSetting("UseFromPointQueries"); 
     238         
     239        if (!val.empty()) 
     240        { 
     241                if (val == "yes") 
     242                        mUseFromPointQueries = true; 
     243                else  
     244                        mUseFromPointQueries = false; 
     245        } 
     246 
     247        val = config.getSetting("UseExactQueries"); 
     248 
     249        if (!val.empty()) 
     250        { 
     251                if (val == "yes") 
     252                        mUseExactQueries = true; 
     253                else 
     254                        mUseExactQueries = false; 
     255        } 
     256 
     257        val = config.getSetting("UseDepthPassForQueries"); 
     258 
     259        if (!val.empty()) 
     260        { 
     261                if (val == "yes") 
     262                        mUseDepthPassForQueries = true; 
     263                else 
     264                        mUseDepthPassForQueries = false; 
     265        } 
     266 
    216267        val = config.getSetting("FlushQueue"); 
    217268         
    218269        if (!val.empty()) 
    219270        { 
    220                 mDeleteQueueAfterRendering = atoi(val.c_str()); 
    221         } 
    222  
    223         if (mDeleteQueueAfterRendering) 
    224                 LogManager::getSingleton().logMessage("flushing queue"); 
    225         else 
    226                 LogManager::getSingleton().logMessage("not flushing queue"); 
    227          
    228         val = config.getSetting("Scene"); 
     271                if ( val == "yes" ) 
     272                        mDeleteQueueAfterRendering = true; 
     273                else 
     274                        mDeleteQueueAfterRendering = false; 
     275        } 
     276 
     277        val = config.getSetting("Scene"); 
    229278 
    230279    if (!val.empty()) 
     
    286335                 mVisibilityManager->SetCullingManager(algorithm); 
    287336 
     337                 stringstream d; 
    288338                 d << "setting algorithm to: " << algorithm; 
    289339                 LogManager::getSingleton().logMessage(d.str()); 
     
    399449        selectPageSource(pageSourceName, optlist); 
    400450 
    401         LogManager::getSingleton().logMessage("****** Finished OcclusionCullingSceneManager Options ********"); 
     451        if (mUseDepthPass) 
     452                LogManager::getSingleton().logMessage("using depth"); 
     453        else 
     454                LogManager::getSingleton().logMessage("not using depth"); 
     455         
     456        if (mExecuteVertexProgramForAllPasses) 
     457                LogManager::getSingleton().logMessage("executing vertex program for passes"); 
     458        else 
     459                LogManager::getSingleton().logMessage("not executing vertex program for passes"); 
     460 
     461        if (mUseVisibilityQueries) 
     462                LogManager::getSingleton().logMessage("using visibility queries"); 
     463        else 
     464                LogManager::getSingleton().logMessage("not using visibility queries"); 
     465 
     466        if (mUseFromPointQueries) 
     467                LogManager::getSingleton().logMessage("using from point queries"); 
     468        else 
     469                LogManager::getSingleton().logMessage("not using from point queries"); 
     470 
     471        if (mUseExactQueries) 
     472                LogManager::getSingleton().logMessage("using exact queries"); 
     473        else 
     474                LogManager::getSingleton().logMessage("not using exact queries"); 
     475 
     476        if (mUseDepthPassForQueries) 
     477                LogManager::getSingleton().logMessage("using depth pass for queries"); 
     478        else 
     479                LogManager::getSingleton().logMessage("not using depth pass for queries"); 
     480 
     481        if (mDeleteQueueAfterRendering) 
     482                LogManager::getSingleton().logMessage("flushing queue after rendering"); 
     483        else 
     484                LogManager::getSingleton().logMessage("not flushing queue after rendering"); 
     485 
     486        LogManager::getSingleton().logMessage("****** OcclusionCullingSceneManager Options Finished ********"); 
    402487} 
    403488//----------------------------------------------------------------------- 
     
    588673 
    589674                                // add bounding boxes instead of node itself 
    590                                 if (0) 
    591                                         (*it)->_addBoundingBoxToQueue(getRenderQueue()); 
     675                                if (0) (*it)->_addBoundingBoxToQueue(getRenderQueue()); 
    592676                        } 
    593677 
     
    606690        if (mNormalExecution) 
    607691        { 
    608                 return TerrainSceneManager::_setPass(pass); 
    609         } 
    610  
    611         // TODO: setting vertex program is not efficient 
     692                return TerrainSceneManager::_setPass(pass, evenIfSuppressed); 
     693        } 
     694 
     695        // problem: setting vertex program is not efficient 
    612696        //Pass *usedPass = ((mIsDepthPassPhase && !pass->hasVertexProgram()) ? mDepthPass : pass);  
    613697         
     
    627711                } 
    628712         
    629                 //--- set vertex program of current pass in order to set correct depth 
     713                ////////////////// 
     714                //-- set vertex program of current pass in order to set correct depth 
    630715                if (mExecuteVertexProgramForAllPasses &&  
    631716                        mIsDepthPassPhase &&  
     
    651736        } 
    652737 
     738        // using depth pass instead 
    653739        const Pass *usedPass = useDepthPass ? mDepthPass : pass; 
    654740 
     741#if 0 // tmp matt: pass is now const 
    655742        // save old depth write: needed for item buffer 
    656         const bool IsDepthWrite = usedPass->getDepthWriteEnabled(); 
     743        const bool isDepthWrite = usedPass->getDepthWriteEnabled(); 
    657744 
    658745        // global option which enables / disables depth writes 
    659746        if (!mEnableDepthWrite) 
    660         { 
    661                 //usedPass->setDepthWriteEnabled(false); 
    662         } 
    663         //else if (mIsItemBufferPass) {usedPass = mItemBufferPass;} 
    664  
     747                usedPass->setDepthWriteEnabled(false); 
     748#endif 
     749 
     750        /////////////// 
    665751        //-- set actual pass here 
    666         const Pass *result = SceneManager::_setPass(usedPass); 
     752 
     753        const Pass *result = SceneManager::_setPass(usedPass, evenIfSuppressed); 
    667754 
    668755 
    669756        // reset depth write 
     757#if 0 // tmp matt: this is now a const function 
    670758        if (!mEnableDepthWrite) 
    671         { 
    672                 //usedPass->setDepthWriteEnabled(IsDepthWrite); 
    673         } 
    674  
     759                usedPass->setDepthWriteEnabled(isDepthWrite); 
     760#endif 
    675761        // reset illumination stage 
    676762        mIlluminationStage = savedStage; 
     
    682768                                                                                                                bool onlyShadowCasters) 
    683769{ 
     770        // clear render queue 
     771        // fully reset it after some frames 
     772        const bool flushQueue =  
     773                mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0); 
     774        getRenderQueue()->clear(flushQueue); 
     775 
     776        ++ mCurrentFrame; 
     777 
    684778        if (mShowVisualization) 
    685779    { 
     
    689783                PrepareVisualization(cam); 
    690784                 
    691                 // lists only used for visualization 
     785                        // lists only used for visualization 
    692786                mVisible.clear(); 
    693787                mBoxes.clear(); 
     
    696790        } 
    697791         
    698         // lists only used for visualization 
     792 
    699793        mVisible.clear(); 
    700794        mBoxes.clear(); 
     
    719813        else if (mUseDepthPass) 
    720814        { 
    721                 RenderDepthPass(); 
     815                // render scene once in order to fill depth buffer 
     816                RenderHierarchicalCulling(); 
    722817        } 
    723818         
     
    736831        } 
    737832 
    738         const bool flushQueue =  
    739                 mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0); 
    740         ++ mCurrentFrame; 
     833        //const bool flushQueue = mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0); 
     834        //++ mCurrentFrame; 
    741835 
    742836        // create material for item buffer pass 
     
    750844        //-- (e.g., the visualization mode, the shadow pass) 
    751845 
    752         if (//!mFindVisibleObjects ||  
     846        // also go here if find visible object is disabled  
     847        // (then the render queue is already filled) 
     848        if (!mFindVisibleObjects ||  
    753849                mUseDepthPass || mShowVisualization || 
    754850            (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE &&  
     
    758854         
    759855                if (mShowVisualization)  
    760                 { 
    761856                        // disable illumination stage to prevent rendering shadows 
    762857                        mIlluminationStage = IRS_NONE; 
    763                 } 
    764  
     858                 
    765859                // standard rendering for shadow maps because of performance 
    766860                TerrainSceneManager::_renderVisibleObjects(); 
     
    811905                // set all necessary parameters for  
    812906                // hierarchical visibility culling and rendering 
    813                 InitVisibilityCulling(mDummyCamera); 
     907                InitVisibilityCulling(mCameraInProgress); 
    814908 
    815909 
     
    854948        setAmbientLight(savedAmbient); 
    855949 
    856         // almost same effect as below 
     950        // remove rest from queue 
     951#if 0 
    857952        getRenderQueue()->clear(flushQueue); 
     953#endif 
    858954         
    859955        if (0) WriteLog(); // write out stats 
     
    10181114                return true; 
    10191115        } 
    1020         if (key == "ViewCellsLoaded") 
     1116        if (key == "UseVisibilityQueries") 
     1117        { 
     1118                mUseVisibilityQueries = *static_cast<const bool *>(val); 
     1119 
     1120                return true; 
     1121        } 
     1122        if (key == "UseFromPointQueries") 
     1123        { 
     1124                mUseFromPointQueries = *static_cast<const bool *>(val); 
     1125 
     1126                return true; 
     1127        } 
     1128        if (key == "UseExactQueries") 
     1129        { 
     1130                mUseExactQueries = *static_cast<const bool *>(val); 
     1131 
     1132                return true; 
     1133        } 
     1134        if (key == "UseDepthPassForQueries") 
     1135        { 
     1136                mUseDepthPassForQueries = *static_cast<const bool *>(val); 
     1137        } 
     1138        if (key == "UseFromPointQueries") 
    10211139        {  
    1022                 return mViewCellsLoaded; 
     1140                mUseFromPointQueries = *static_cast<const bool *>(val); 
     1141                return true; 
    10231142        } 
    10241143 
     
    11421261                return TerrainSceneManager::renderBasicQueueGroupObjects(pGroup, om); 
    11431262        } 
     1263 
    11441264    // Basic render loop 
    11451265    // Iterate through priorities 
     
    11591279                // after hierarchical culling => don't render them now 
    11601280 
    1161         if (mNormalExecution || !mSkipTransparents) 
     1281        if (!mSkipTransparents) 
    11621282                { 
    11631283                        // Do transparents (always descending) 
     
    11671287    } // for each priority 
    11681288} 
    1169  
    11701289//----------------------------------------------------------------------- 
    11711290bool OcclusionCullingSceneManager::validatePassForRendering(Pass* pass) 
     
    11771296 
    11781297        // skip all but first pass if we are doing the depth pass 
    1179         if ((mIsDepthPassPhase || mIsItemBufferPhase) && (pass->getIndex() > 0)) 
     1298        if ((mIsDepthPassPhase || mIsItemBufferPhase) &&  
     1299                (pass->getIndex() > 0)) 
    11801300        { 
    11811301                return false; 
     
    11981318                return; 
    11991319        } 
     1320 
    12001321#ifdef  ITEM_BUFFER 
    1201         //-- item buffer 
    1202         //-- render objects using false colors 
     1322 
     1323        /////////////////// 
     1324        //-- item buffer: render objects using false colors 
    12031325 
    12041326    // Iterate through priorities 
     
    13501472 
    13511473        // if we have the depth pass or use an item buffer, we leave no passes in the queue 
    1352         if (1 && !mUseDepthPass && !mUseItemBuffer) 
     1474        if (!mUseDepthPass && !mUseItemBuffer) 
    13531475        { 
    13541476                if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 
     
    14251547        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    14261548{ 
     1549        if (mNormalExecution || !mIsHierarchicalCulling)  
     1550        { 
     1551                // render the rest of the passes 
     1552                TerrainSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 
     1553                return; 
     1554        } 
     1555         
    14271556        // only render solid passes during hierarchical culling 
    1428         if (mNormalExecution || mIsHierarchicalCulling) 
    1429         { 
    1430                 RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
    1431             LightList lightList; 
    1432  
    1433                 while (groupIt.hasMoreElements()) 
    1434                 { 
    1435                         RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 
    1436  
    1437                         // Sort the queue first 
    1438                         pPriorityGrp->sort(mCameraInProgress); 
    1439  
    1440                         // Clear light list 
    1441                         lightList.clear(); 
    1442  
    1443                         // Render all the ambient passes first, no light iteration, no lights 
    1444                         /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
    1445                         // mIlluminationStage = IRS_AMBIENT; 
    1446  
    1447                         OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, false, &lightList); 
    1448                         // Also render any objects which have receive shadows disabled 
    1449                         OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true); 
     1557        RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
     1558        LightList lightList; 
     1559 
     1560        while (groupIt.hasMoreElements()) 
     1561        { 
     1562                RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 
     1563 
     1564                // Sort the queue first 
     1565                pPriorityGrp->sort(mCameraInProgress); 
     1566 
     1567                // Clear light list 
     1568                lightList.clear(); 
     1569 
     1570                // Render all the ambient passes first, no light iteration, no lights 
     1571                /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     1572                // mIlluminationStage = IRS_AMBIENT; 
     1573 
     1574                OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, false, &lightList); 
     1575                // Also render any objects which have receive shadows disabled 
     1576                OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true); 
    14501577#if 0            
    1451                         std::stringstream d;  
    1452                         d << " solid size: " << (int)pPriorityGrp->_getSolidPasses().size() 
    1453                                 << " solid no shadow size: " << (int)pPriorityGrp->_getSolidPassesNoShadow().size() 
    1454                                 << "difspec size: " << (int)pPriorityGrp->_getSolidPassesDiffuseSpecular().size() 
    1455                                 << " decal size: " << (int)pPriorityGrp->_getSolidPassesDecal().size(); 
    1456                         LogManager::getSingleton().logMessage(d.str()); 
     1578                std::stringstream d;  
     1579                d << " solid size: " << (int)pPriorityGrp->_getSolidPasses().size() 
     1580                        << " solid no shadow size: " << (int)pPriorityGrp->_getSolidPassesNoShadow().size() 
     1581                        << "difspec size: " << (int)pPriorityGrp->_getSolidPassesDiffuseSpecular().size() 
     1582                        << " decal size: " << (int)pPriorityGrp->_getSolidPassesDecal().size(); 
     1583                LogManager::getSingleton().logMessage(d.str()); 
    14571584#endif 
    1458                 } 
    1459         } 
    1460         else // render the rest of the passes 
    1461         { 
    1462                 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 
    14631585        } 
    14641586} 
     
    14671589        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    14681590{ 
    1469    if (mNormalExecution || mIsHierarchicalCulling) 
    1470    { 
    1471            // Iterate through priorities 
    1472            RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
    1473  
    1474            while (groupIt.hasMoreElements()) 
    1475            { 
    1476                    RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 
    1477  
    1478                    // Sort the queue first 
    1479                    pPriorityGrp->sort(mCameraInProgress); 
    1480                    // Do (shadowable) solids 
    1481                    OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
    1482            } 
    1483    } 
    1484    else 
     1591   if (mNormalExecution || !mIsHierarchicalCulling) 
    14851592   { 
    14861593           TerrainSceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup, om); 
     1594           return; 
     1595   } 
     1596 
     1597   // Iterate through priorities 
     1598   RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
     1599 
     1600   while (groupIt.hasMoreElements()) 
     1601   { 
     1602           RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 
     1603 
     1604           // Sort the queue first 
     1605           pPriorityGrp->sort(mCameraInProgress); 
     1606           // Do (shadowable) solids 
     1607           OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
    14871608   } 
    14881609} 
     
    18271948} 
    18281949//----------------------------------------------------------------------- 
    1829 void OcclusionCullingSceneManager::RenderDepthPass(const bool fillRenderQueue) 
    1830 { 
    1831         if (mNormalExecution) 
    1832         { 
    1833                 // problems using this function in the normal workflow 
    1834                 return; 
    1835         } 
    1836  
     1950void OcclusionCullingSceneManager::RenderHierarchicalCulling(const bool fillRenderQueue) 
     1951{ 
    18371952        // create material for depth pass 
    18381953        InitDepthPass(); 
     
    19072022                                                                                                bool includeOverlays) 
    19082023{ 
    1909         if (0 && mNormalExecution) 
     2024        if (mNormalExecution) 
    19102025        { 
    19112026                TerrainSceneManager::_renderScene(camera, vp, includeOverlays); 
     
    20402155 
    20412156        // Prepare render queue for receiving new objects 
    2042         prepareRenderQueue(); 
     2157        //prepareRenderQueue(); 
    20432158 
    20442159        mDestRenderSystem->_beginGeometryCount(); 
     
    20532168        mDestRenderSystem->_setViewMatrix(mCameraInProgress->getViewMatrix(true)); 
    20542169 
     2170        // Prepare render queue for receiving new objects 
     2171#ifdef GAMETOOLS_ILLUMINATION_MODULE  
     2172        if (mFindVisibleObjects) 
     2173                prepareRenderQueue(); 
     2174#else 
     2175                prepareRenderQueue(); 
     2176#endif 
    20552177 
    20562178    if (mFindVisibleObjects) 
    20572179    { 
    20582180        // Parse the scene and tag visibles 
    2059         _findVisibleObjects(camera,  
     2181        myFindVisibleObjects(camera,  
    20602182            mIlluminationStage == IRS_RENDER_TO_TEXTURE? true : false); 
    20612183    } 
     
    20712193    } 
    20722194 
    2073  mDummyCamera = camera; 
    20742195    // Render scene content  
    20752196    _renderVisibleObjects(); 
     
    22712392        mDestRenderSystem->_setViewMatrix(mCameraInProgress->getViewMatrix(true)); 
    22722393 
    2273         // // Render scene content in order fill depth buffer 
    2274         bool savedUseDepthPass = mUseDepthPass; 
    2275         if (1) mUseDepthPass = true; 
    2276  
    2277         // don't need shading, render only depth pass 
     2394        ////////////// 
     2395        //-- Render scene in order fill depth buffer 
     2396 
     2397        // don't have to fill queue, just render depth 
    22782398        const bool fillQueue = false; 
    2279         RenderDepthPass(fillQueue); 
     2399 
     2400        RenderHierarchicalCulling(fillQueue); 
    22802401        // _renderVisibleObjects(); 
    2281      
    2282         mUseDepthPass = savedUseDepthPass; 
    22832402    
    22842403    // End frame 
     
    23102429} 
    23112430//----------------------------------------------------------------------- 
    2312 void OcclusionCullingSceneManager::AddVisibleMeshGeometryToQueue(const GtpVisibility::MeshInfoContainer &visibleGeometry, 
    2313                                                                                                                                  Camera *cam) 
     2431void OcclusionCullingSceneManager::AddVisibleMeshGeometryToQueue( 
     2432                                                const GtpVisibility::MeshInfoContainer &visibleGeometry, 
     2433                                                Camera *cam) 
    23142434{ 
    23152435        GtpVisibility::MeshInfoContainer::const_iterator geomIt, geomIt_end = visibleGeometry.end(); 
     
    23322452} 
    23332453//----------------------------------------------------------------------- 
    2334 void OcclusionCullingSceneManager::AddVisibleNodeGeometryToQueue(const GtpVisibility::NodeInfoContainer &visibleNodes, 
    2335                                                                                                                                  Camera *cam) 
     2454void OcclusionCullingSceneManager::AddVisibleNodeGeometryToQueue( 
     2455                                                const GtpVisibility::NodeInfoContainer &visibleNodes, 
     2456                                                Camera *cam) 
    23362457{ 
    23372458        //////////////// 
     
    23592480                                                                                                           bool onlyShadowCasters)                                                                                
    23602481{ 
    2361         if (mNormalExecution) 
     2482        if (mNormalExecution || (!mUseVisibilityQueries == 0)) 
    23622483        { 
    23632484                TerrainSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 
     
    23652486        } 
    23662487 
     2488        // don't need shading, render only depth 
     2489        // note:have to disable deph write for nodes! 
     2490    bool savedUseDepthPass = mUseDepthPass; 
     2491        if (mUseDepthPassForQueries) mUseDepthPass = true; 
     2492 
    23672493        // lists only used for visualization 
     2494        getRenderQueue()->clear(); 
    23682495        mVisible.clear(); 
    23692496        mBoxes.clear(); 
    23702497 
    2371         const bool fromPoint = false; 
    2372         const bool nodeVisibility = false; 
    2373  
    23742498        const int itemBufferMode = 0; 
    23752499        const bool relativeVisibility = false; 
     
    23772501        int queryModes = 0; 
    23782502 
    2379         if (nodeVisibility) 
     2503        if (mUseExactQueries) 
     2504                queryModes |= GtpVisibility::QueryManager::GEOMETRY_VISIBILITY; 
     2505        else 
    23802506                queryModes |= GtpVisibility::QueryManager::NODE_VISIBILITY; 
    2381         else 
    2382                 queryModes |= GtpVisibility::QueryManager::GEOMETRY_VISIBILITY; 
     2507                         
    23832508 
    23842509        OcclusionQueriesQueryManager *queryManager =  
    23852510                new OcclusionQueriesQueryManager(mHierarchyInterface, 
    2386                 cam->getViewport(),//mCurrentViewport, 
     2511                                                                                 cam->getViewport(), 
     2512                                                                                 //mCurrentViewport, 
    23872513                                                                                 queryModes,  
    23882514                                                                                 itemBufferMode); 
     
    23942520        GtpVisibility::PatchInfoContainer visiblePatches; 
    23952521 
    2396         if (fromPoint) 
     2522        if (mUseFromPointQueries) 
    23972523        { 
    23982524                queryManager->ComputeFromPointVisibility(cam->getDerivedPosition(),  
     
    24232549        /////////////////////// 
    24242550        //-- put items in render queue 
    2425         ////////// 
    2426  
    2427         //getRenderQueue()->clear(); 
    2428  
    2429         ////////////////////// 
    2430         //-- apply queries on geometry level 
    2431  
    2432         if (!nodeVisibility) 
    2433         { 
     2551         
     2552        if (mUseExactQueries) 
     2553        { 
     2554                //////////// 
     2555                //-- apply queries on geometry level 
     2556 
    24342557                AddVisibleMeshGeometryToQueue(visibleGeometry, cam); 
    24352558        } 
     
    24382561                AddVisibleNodeGeometryToQueue(visibleNodes, cam); 
    24392562        } 
    2440                  
     2563 
     2564        // reset depth pass 
     2565        mUseDepthPass = savedUseDepthPass; 
     2566 
    24412567        delete queryManager; 
    24422568} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionQueriesQueryManager.cpp

    r2183 r2254  
    9494 
    9595         
    96         /*      Two query lists for projected pixels and for visibile pixels: 
     96        /**     Two query lists for projected pixels and for visibile pixels: 
    9797                We test queries after a rendering pass  
    9898                to get exact visibility with regard to the current camera. 
     
    191191                } 
    192192 
    193                 //////////////////////////// 
    194                 //-- queries for geometry: if item buffer, capture only projected visibility 
     193                /////////////// 
     194                //-- queries for geometry 
     195                 
     196                // note: for item buffer we can capture only projected visibility 
    195197 
    196198                if ((mItemBufferMode != GEOMETRY_VISIBILITY) || (i == 1)) 
     
    202204                } 
    203205                 
    204                 //////////////////////// 
    205                 //-- queries for patches: if item buffer, capture only projected visibility 
     206                /////////////// 
     207                //-- queries for patches 
    206208 
    207209                if ((mItemBufferMode != PATCH_VISIBILITY) || (i == 1)) 
     
    421423 
    422424                // WARNING: approximate depth ordering during rendering =>  
    423                 // geometry maybe occluded 
     425                // visibility approximate 
    424426                if (visiblePixels > 0) 
    425427                {                         
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp

    r2184 r2254  
    229229//----------------------------------------------------------------------- 
    230230GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueMeshOcclusionQuery( 
    231         GtpVisibility::Mesh *mesh) 
     231                                                                                                                GtpVisibility::Mesh *mesh) 
    232232{ 
    233233        // get next available test id 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj

    r2253 r2254  
    5353                                Name="VCPostBuildEventTool" 
    5454                                CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName) 
    55 copy $(OutDir)\$(TargetFileName) D:\svn\gametools\GTP\trunk\App\Demos\Illum\Ogre\bin\$(ConfigurationName) 
     55copy $(OutDir)\$(TargetFileName) E:\svn\gametools\GTP\trunk\App\Demos\Illum\Ogre\bin\$(ConfigurationName) 
    5656"/> 
    5757                        <Tool 
     
    8989                                OmitFramePointers="TRUE" 
    9090                                EnableFiberSafeOptimizations="TRUE" 
    91                                 OptimizeForProcessor="3" 
     91                                OptimizeForProcessor="0" 
    9292                                OptimizeForWindowsApplication="TRUE" 
    9393                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include" 
     
    124124                        <Tool 
    125125                                Name="VCPostBuildEventTool" 
    126                                 CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)"/> 
     126                                CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName) 
     127copy $(OutDir)\$(TargetFileName) E:\svn\gametools\GTP\trunk\App\Demos\Illum\Ogre\bin\$(ConfigurationName) 
     128"/> 
    127129                        <Tool 
    128130                                Name="VCPreBuildEventTool"/> 
     
    299301                                OptimizeForProcessor="3" 
    300302                                OptimizeForWindowsApplication="TRUE" 
    301                                 AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include;Timer" 
     303                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include" 
    302304                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTP_VISIBILITY_MODIFIED_OGRE;PLUGIN_KD_TERRAIN_EXPORTS" 
    303305                                StringPooling="TRUE" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.vcproj

    r2199 r2254  
    9696                                Name="VCMIDLTool"/> 
    9797                        <Tool 
    98                                 Name="VCPostBuildEventTool" 
    99                                 CommandLine="copy $(OutDir)\$(TargetFileName) &quot;$(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)&quot;"/> 
     98                                Name="VCPostBuildEventTool"/> 
    10099                        <Tool 
    101100                                Name="VCPreBuildEventTool"/> 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/scripts/terrainCulling.cfg

    r2177 r2254  
    99 
    1010# 
    11 # Should depth first pass be used? 
     11# Should depth first pass be used? depth pass renders depth first, then rerenders geometry with all parameters 
    1212# 
    1313 
    14 DepthPass=1 
     14DepthPass=0 
     15 
     16# 
     17# render queue is flushed after some frames 
     18# 
     19 
     20FlushQueue=1 
     21 
     22 
    1523 
    1624###################################################################### 
     
    2937#Scene=../../../../../resources/media/city1.iv;../../../../../resources/media/roofs_1500.iv;../../../../../resources/media/CityRoads60.iv;../../../../../resources/media/CityPlane60.iv 
    3038 
     39#Scene=vienna_cropped.obj 
     40 
    3141# 
    32 # The view cells 
     42# Visibility solution 
    3343# 
    3444 
    3545#ViewCells=../../../../../../../GTP/trunk/Lib/Vis/Preprocessing/scripts/vienna-visibility.xml.gz 
    36  
    37  
    38 # 
    39 # render queue is flushed after some frames 
    40 # 
    41  
    42 FlushQueue=1 
    43  
    44 # 
    45 # depth pass must be used together with illumination model 
    46 # 
    47  
    48 UseDepthPass=0 
    4946 
    5047 
Note: See TracChangeset for help on using the changeset viewer.