Ignore:
Timestamp:
03/18/07 00:26:49 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyInterface.h

    r1320 r2258  
    6161        @param visible the visible flag 
    6262        */ 
    63         virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) const; 
     63        virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node,  
     64                                                                const bool visible) const; 
    6465        /** Returns true if node has the visible flag set. See set 
    6566        */ 
     
    6970        @param frameId the current frame id 
    7071        */ 
    71         virtual void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId) const; 
     72        virtual void SetLastVisited(GtpVisibility::HierarchyNode *node,  
     73                                                                const unsigned int frameId) const; 
    7274        /** Returns frame id when this node was last visited by the traverser. See set 
    7375        */ 
     
    8082        */ 
    8183        virtual void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,  
    82                 GtpVisibility::CullingType type) const; 
     84                                                                         GtpVisibility::CullingType type) const; 
    8385 
    8486 
     
    8991        */ 
    9092        virtual void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,     
    91                 GtpVisibility::GeometryVector *geometryList,  
    92                 bool includeChildren); 
     93                                                                         GtpVisibility::GeometryVector *geometryList,  
     94                                                                         bool includeChildren); 
    9395 
    94  
     96        void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 
     97        void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 
     98        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 
    9599}; 
    96100 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeHierarchyInterface.h

    r1170 r2258  
    6161        @param visible the visible flag 
    6262        */ 
    63         virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) const; 
     63        virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node,  
     64                                                                const bool visible) const; 
    6465        /** Returns true if node has the visible flag set. See set 
    6566        */ 
     
    6970        @param frameId the current frame id 
    7071        */ 
    71         virtual void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId) const; 
     72        virtual void SetLastVisited(GtpVisibility::HierarchyNode *node,  
     73                                                                const unsigned int frameId) const; 
    7274        /** Returns frame id when this node was last visited by the traverser. See set 
    7375        */ 
     
    8082        */ 
    8183        virtual void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,  
    82                 GtpVisibility::CullingType type) const; 
     84                                                                         GtpVisibility::CullingType type) const; 
    8385 
    8486 
     
    8991        */ 
    9092        virtual void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,     
    91                 GtpVisibility::GeometryVector *geometryList,  
    92                 bool includeChildren); 
     93                                                                         GtpVisibility::GeometryVector *geometryList,  
     94                                                                         bool includeChildren); 
    9395 
     96        void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 
    9497 
     98        void TraverseNode2(GtpVisibility::HierarchyNode *node); 
     99 
     100        HierarchyNode *GetRandomLeaf() { return NULL;} 
     101 
     102        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 
    95103}; 
    96104 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOctreeHierarchyInterface.h

    r370 r2258  
    5151                                                         bool includeChildren); 
    5252         
     53        void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const; 
     54 
     55        void TraverseNode2(GtpVisibility::HierarchyNode *node); 
     56 
     57        HierarchyNode *GetRandomLeaf(); 
     58 
     59        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const; 
     60 
    5361protected: 
    5462        /** Returns pointer to the bounding box of the node. 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreSceneNodeHierarchyInterface.h

    r370 r2258  
    4646                                         bool includeChildren); 
    4747 
     48        void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 
     49        void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 
     50        HierarchyNode *GetRandomLeaf() { return NULL;} 
     51        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 
     52 
    4853}; 
    4954 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBvHierarchyInterface.cpp

    r2066 r2258  
    4949} 
    5050 
     51 
    5152void BvHierarchyInterface::RenderNode(GtpVisibility::HierarchyNode *node) 
    5253{ 
     
    6263        } 
    6364} 
     65 
    6466 
    6567void BvHierarchyInterface::PullUpVisibility(GtpVisibility::HierarchyNode *node) const 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r2255 r2258  
    1212#include <OgreIteratorWrappers.h> 
    1313#include <OgreHeightmapTerrainPageSource.h> 
    14 #include "VspBspTree.h" 
    15 #include "Containers.h" 
     14//#include "Containers.h" 
    1615#include "ViewCellsManager.h" 
    1716#include <OgreConfigFile.h> 
    1817#include "OgreTypeConverter.h" 
    1918#include "OgreMeshInstance.h" 
    20 #include "common.h" 
     19//#include "common.h" 
    2120#include "OgreBoundingBoxConverter.h" 
    2221#include <OgreManualObject.h> 
     
    775774                                                                                                                bool onlyShadowCasters) 
    776775{ 
    777         // clear render queue 
    778         // fully reset it after some frames 
    779         const bool flushQueue =  
    780                 mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0); 
    781         getRenderQueue()->clear(flushQueue); 
    782  
    783         ++ mCurrentFrame; 
    784  
    785776        if (mShowVisualization) 
    786777    { 
     
    790781                PrepareVisualization(cam); 
    791782                 
    792                         // lists only used for visualization 
     783                // lists only used for visualization 
    793784                mVisible.clear(); 
    794785                mBoxes.clear(); 
     
    797788        } 
    798789         
    799  
    800         mVisible.clear(); 
    801         mBoxes.clear(); 
    802  
    803790        /////////// 
    804791        //-- set visibility according to pvs of current view cell 
     
    820807        else if (mUseDepthPass) 
    821808        { 
     809                mVisible.clear(); 
     810                mBoxes.clear(); 
     811 
     812                // clear render queue before depth pass 
     813                getRenderQueue()->clear(); 
     814 
    822815                // render scene once in order to fill depth buffer 
    823816                RenderHierarchicalCulling(); 
    824817        } 
    825          
    826         // only shadow casters will be rendered in shadow texture pass 
    827         //if (0) mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 
    828818} 
    829819//----------------------------------------------------------------------- 
     
    838828        } 
    839829 
    840         //const bool flushQueue = mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0); 
    841         //++ mCurrentFrame; 
     830        // clear render queue 
     831        // fully reset it after some frames 
     832        const bool flushQueue =  
     833                mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0); 
     834         
     835        ++ mCurrentFrame; 
    842836 
    843837        // create material for item buffer pass 
     
    956950 
    957951        // remove rest from queue 
    958 #if 0 
    959952        getRenderQueue()->clear(flushQueue); 
    960 #endif 
     953 
    961954         
    962955        if (0) WriteLog(); // write out stats 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp

    r2066 r2258  
    99 
    1010//----------------------------------------------------------------------- 
    11 OctreeHierarchyInterface::OctreeHierarchyInterface(OctreeSceneManager *sm, RenderSystem *rsys):  
     11OctreeHierarchyInterface::OctreeHierarchyInterface(OctreeSceneManager *sm,  
     12                                                                                                   RenderSystem *rsys):  
    1213SceneNodeHierarchyInterface(sm, rsys) 
    13 { 
    14 } 
     14{} 
    1515//----------------------------------------------------------------------- 
    1616void OctreeHierarchyInterface::TraverseNode(GtpVisibility::HierarchyNode *node) 
     
    2727         
    2828         
     29        // if not all subtrees are empty 
     30        if (!IsLeaf(node)) 
     31        { 
     32                Octree *nextChild; 
     33 
     34                if ((nextChild = octree->mChildren[0][0][0]) != NULL) 
     35                        mDistanceQueue->push(nextChild); 
     36                if ((nextChild = octree->mChildren[0][0][1]) != NULL) 
     37                        mDistanceQueue->push(nextChild); 
     38                if ((nextChild = octree->mChildren[0][1][0]) != NULL) 
     39                        mDistanceQueue->push(nextChild); 
     40                if ((nextChild = octree->mChildren[0][1][1]) != NULL) 
     41                mDistanceQueue->push(nextChild); 
     42                if ((nextChild = octree->mChildren[1][0][0]) != NULL) 
     43                        mDistanceQueue->push(nextChild); 
     44                if ((nextChild = octree->mChildren[1][0][1]) != NULL) 
     45                        mDistanceQueue->push(nextChild); 
     46                if ((nextChild = octree->mChildren[1][1][0]) != NULL) 
     47                        mDistanceQueue->push(nextChild); 
     48                if ((nextChild = octree->mChildren[1][1][1]) != NULL) 
     49                        mDistanceQueue->push(nextChild); 
     50        } 
     51} 
     52//----------------------------------------------------------------------- 
     53HierarchyNode *OctreeHierarchyInterface::GetRandomLeaf()  
     54{  
     55        return NULL; 
     56} 
     57//----------------------------------------------------------------------- 
     58bool OctreeHierarchyInterface::GIsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const 
     59{ 
     60        return static_cast<Octree *>(node)->isOctreeFullyVisible(); 
     61} 
     62//----------------------------------------------------------------------- 
     63void OctreeHierarchyInterface::TraverseNode2(GtpVisibility::HierarchyNode *node) 
     64{ 
     65        ++ mNumTraversedNodes; 
     66 
     67        Octree *octree = static_cast<Octree *>(node); 
     68 
     69        // if we come across some renderable geometry => render it 
     70        if (!octree->mNodes.empty()) 
     71        { 
     72                // render everything from here 
     73                if (octree->isOctreeFullyVisible()) 
     74                {                
     75                        RenderNodeRecursive(node); 
     76                        return; 
     77                } 
     78 
     79                RenderNode(node); 
     80        } 
     81                 
    2982        // if not all subtrees are empty 
    3083        if (!IsLeaf(node)) 
     
    107160} 
    108161//----------------------------------------------------------------------- 
     162void OctreeHierarchyInterface::DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const 
     163{                
     164        Octree *octant = static_cast<Octree *>(node); 
     165 
     166        // leaf node: terminate recursion 
     167        if (IsLeaf(node)) 
     168        { 
     169                octant->setOctreeFullyVisible(octant->isOctreeVisible()); 
     170                return; 
     171        } 
     172 
     173        octant->setOctreeFullyVisible(false); 
     174 
     175        Octree *nextChild; 
     176 
     177        for (int i = 0; i < 8; ++ i) 
     178        { 
     179                int x = i & 4; 
     180                int y = i & 2; 
     181                int z = i & 1; 
     182 
     183                if ((nextChild = octant->mChildren[x][y][z]) != NULL) 
     184                { 
     185                        DetermineFullVisibility(nextChild); 
     186                        if (!nextChild->isOctreeFullyVisible()) 
     187                        return; 
     188                } 
     189        } 
     190 
     191        // all children fully visible => pull up 
     192        octant->setOctreeFullyVisible(true); 
     193} 
     194//----------------------------------------------------------------------- 
    109195void OctreeHierarchyInterface::RenderNode(GtpVisibility::HierarchyNode *node) 
    110196{ 
     
    118204                        static_cast<OctreeSceneManager *>(mSceneManager); 
    119205 
    120                 ocm->_renderOctant(mCamera, octant, mOnlyShadowCasters, mLeavePassesInQueue); 
     206                ocm->_renderOctant(mCamera,  
     207                                                   octant,  
     208                                                   mOnlyShadowCasters,  
     209                                                   mLeavePassesInQueue); 
    121210 
    122211                mVisibleNodes.push_back(node); 
    123212        } 
    124 #endif 
    125          
     213#endif   
    126214} 
    127215//----------------------------------------------------------------------- 
     
    189277} 
    190278 
     279 
    191280} // namespace Ogre 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h

    r925 r2258  
    8484                @param intersects returns true if the current node intersects the near plane 
    8585        */ 
    86         virtual bool CheckFrustumVisible(HierarchyNode *node, bool &intersects) = 0; 
     86        virtual bool CheckFrustumVisible(HierarchyNode *node,  
     87                                                                         bool &intersects) = 0; 
    8788        /** Checks if the node is visible from the current view frustum. 
    8889                @param node the current node 
     
    102103                @param visible the visible flag 
    103104        */ 
    104         virtual void SetNodeVisible(HierarchyNode *node, const bool visible) const = 0; 
     105        virtual void SetNodeVisible(HierarchyNode *node,  
     106                                                                const bool visible) const = 0; 
    105107        /** Returns true if node has the visible flag set. See set 
    106108        */ 
     
    143145        */ 
    144146        virtual void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,     
    145                                                         GeometryVector *geometryList,  
    146                                                         bool includeChildren) = 0; 
     147                                                                        GeometryVector *geometryList,  
     148                                                                        bool includeChildren) = 0; 
    147149 
    148150         
     
    156158        void TestGeometryForVisibleLeaves(bool testGeometry); 
    157159 
     160 
     161        virtual void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const = 0; 
     162 
     163        virtual void TraverseNode2(GtpVisibility::HierarchyNode *node) = 0; 
     164 
     165        virtual HierarchyNode *GetRandomLeaf() = 0; 
     166        virtual bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const; 
    158167 
    159168protected: 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp

    r2184 r2258  
    1212} 
    1313//----------------------------------------------------------------------- 
    14 CoherentHierarchicalCullingManager::CoherentHierarchicalCullingManager(const unsigned int  
    15                                                                                                                                           assumedVisibility) 
     14CoherentHierarchicalCullingManager::CoherentHierarchicalCullingManager( 
     15                                                                                                                const unsigned int assumedVisibility) 
    1616{ 
    1717        SetAssumedVisibility(assumedVisibility); 
     
    6767                if (!mHierarchyInterface->GetQueue()->empty()) 
    6868                { 
    69                         //Ogre::LogManager::getSingleton().logMessage("traversal"); 
    7069                        HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); 
    7170                        mHierarchyInterface->GetQueue()->pop(); 
     
    9695                                        DecideVisible(node) && mHierarchyInterface->HasGeometry(node); 
    9796 
    98                                 //if (mHierarchyInterface->LastVisited(node) >= mHierarchyInterface->GetFrameId()) 
    99                                 //      Ogre::LogManager::getSingleton().logMessage("error"); 
    100                                  
    10197                                if (skipQuery) 
    10298                                { 
     
    115111                                // update node's visited flag 
    116112                                mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 
    117                                 //Ogre::LogManager::getSingleton().logMessage("here999"); 
     113                                 
    118114                                // skip testing previously visible nodes without geometry 
    119115                                if (issueQuery) 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj

    r2183 r2258  
    315315                        </File> 
    316316                        <File 
     317                                RelativePath=".\RandomUpdateCullingManager.cpp"> 
     318                        </File> 
     319                        <File 
    317320                                RelativePath="..\src\StopAndWaitCullingManager.cpp"> 
    318321                        </File> 
     
    360363                        <File 
    361364                                RelativePath="..\include\QueryManager.h"> 
     365                        </File> 
     366                        <File 
     367                                RelativePath="..\include\RandomUpdateCullingManager.h"> 
    362368                        </File> 
    363369                        <File 
Note: See TracChangeset for help on using the changeset viewer.