Changeset 146


Ignore:
Timestamp:
06/22/05 11:04:20 (20 years ago)
Author:
mattausch
Message:

added assumed visibility

Location:
trunk/VUT
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h

    r142 r146  
    1616        CoherentHierarchicalCullingManager(); 
    1717        void RenderScene(); 
    18         /** Sets assumed visibility which is a decition variable  
    19                 wether an occlusion query should be issued or not. 
    20                 @param assumedVisibility indicates that same visibility should be assumed 
    21                  for approximately assumedVisibility frames.  
    22                  if 0, no assumedVisibility will be tested. 
     18        /** Sets assumed visibility which is a an estimation for e  
     19                how many frames the visibility is considered to be valied 
     20                @param assumedVisibility indicates for how many frames the  
     21                same visibility is be assumed. 
     22                if 0, the visibility is tested deterministically for each frame. 
    2323        */ 
    24         void SetAssumedVisibility(int assumedVisibility); 
     24        void SetAssumedVisibility(unsigned int assumedVisibility); 
     25 
    2526protected: 
    2627        /** Decides wether occlusion query should be issued depending on some  
     
    2930        */ 
    3031        bool DecideQueryTest(HierarchyNode *node) const; 
    31         int mAssumedVisibility; 
     32 
     33        unsigned int mAssumedVisibility; 
     34        /** Threshold for rand function to return positive result with respect to 
     35                mAssumedVisibility. 
     36        */ 
     37        unsigned int mThreshold; 
    3238}; 
    3339 
  • trunk/VUT/GtpVisibility/include/VisibilityManager.h

    r130 r146  
    5555        */ 
    5656        void SetUseChcOptimization(bool useOptimization); 
     57        /** Indicates for how long a frame is considered to be visible. 
     58                @param assumedVisibility estimation for how long visibility is assumed to be valid. 
     59        */ 
     60        void SetAssumedVisibility(unsigned int assumedVisibility); 
    5761        /** Sets pointer to a query manager.  
    5862        */ 
     
    7175 
    7276        unsigned int mVisibilityThreshold; 
    73  
     77        unsigned int mAssumedVisibility; 
    7478}; 
    7579} // namespace GtpVisibility 
  • trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp

    r142 r146  
    66//----------------------------------------------------------------------- 
    77CoherentHierarchicalCullingManager:: CoherentHierarchicalCullingManager(): 
    8 mAssumedVisibility(0) 
     8mAssumedVisibility(0), mThreshold(0) 
    99{ 
    1010        // initialise random generator because of assumed visibility 
     
    111111} 
    112112//----------------------------------------------------------------------- 
    113 void CoherentHierarchicalCullingManager::SetAssumedVisibility(int assumedVisibility) 
     113void CoherentHierarchicalCullingManager::SetAssumedVisibility(unsigned int assumedVisibility) 
    114114{ 
    115115        mAssumedVisibility = assumedVisibility; 
     116         
     117        mThreshold = 0; 
     118 
     119        if (mAssumedVisibility) 
     120        { 
     121                mThreshold =  RAND_MAX / mAssumedVisibility; 
     122        } 
    116123} 
    117124//----------------------------------------------------------------------- 
    118125bool CoherentHierarchicalCullingManager::DecideQueryTest(HierarchyNode *node) const 
    119126{ 
    120         bool result = false; 
    121         rand(); 
    122         return result; 
     127        return rand() < mThreshold; 
    123128} 
    124129} // namespace GtpVisibility 
  • trunk/VUT/GtpVisibility/src/VisibilityManager.cpp

    r130 r146  
    4646                case VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING: 
    4747                        mCullingManager = new CoherentHierarchicalCullingManager(); 
     48                        dynamic_cast<CoherentHierarchicalCullingManager *>(mCullingManager)-> 
     49                                SetAssumedVisibility(mAssumedVisibility); 
    4850                        break; 
    4951 
     
    9395        return mQueryManager; 
    9496} 
     97void VisibilityManager::SetAssumedVisibility(unsigned int assumedVisibility) 
     98{ 
     99        mAssumedVisibility = assumedVisibility; 
     100 
     101        if (VisibilityManager::GetCullingManagerType() ==  
     102                VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 
     103        { 
     104                dynamic_cast<CoherentHierarchicalCullingManager *>(mCullingManager)-> 
     105                                SetAssumedVisibility(mAssumedVisibility); 
     106        } 
     107} 
    95108} // namespace GtpVisibility 
  • trunk/VUT/Ogre/resources/VisibilityDemo.overlay

    r135 r146  
    2323                top 5 
    2424                width 400 
    25                 height 75 
     25                height 90 
    2626                material Core/StatsBlockCenter 
    2727                border_size 1 1 1 1 
     
    101101                        caption : 
    102102                } 
    103  
     103                element TextArea(Example/Visibility/AssumedVisibility): Example/Visibility/Templates/BasicText 
     104                { 
     105                        left 5 
     106                        top 65 
     107                        width 90 
     108                        height 30 
     109                        caption [A] Assumed Visibility 
     110                } 
     111                 
     112                element TextArea(Example/Visibility/AssumedVisibilityInfo): Example/Visibility/Templates/BasicText 
     113                { 
     114                        left 155 
     115                        top 65 
     116                        width 90 
     117                        height 30 
     118                        caption : 
     119                } 
    104120        } 
    105121 
  • trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp

    r100 r146  
    2222        { 
    2323                mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val)); 
     24                return true; 
     25        } 
     26        if (key == "AssumedVisibility") 
     27        { 
     28                mVisibilityManager->SetAssumedVisibility(*static_cast<const int *>(val)); 
    2429                return true; 
    2530        } 
  • trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp

    r145 r146  
    5454mTerrainContentGenerator(sceneGenerator), 
    5555mVisibilityThreshold(0), 
     56mAssumedVisibility(0), 
    5657mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING), 
    5758//mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING), 
     
    109110        mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo"); 
    110111        mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo"); 
    111          
     112        mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 
     113        mUseDepthPassInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseDepthPassInfo"); 
     114        mAssumedVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AssumedVisibilityInfo"); 
     115 
    112116        mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo"); 
    113117        mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo"); 
     
    116120        mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 
    117121        mObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ObjectsInfo"); 
    118         mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 
    119         mUseDepthPassInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseDepthPassInfo"); 
    120122        mQueriesIssuedInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueriesIssuedInfo"); 
    121123         
     
    131133        mUseDepthPassInfo->setCaption(": false"); 
    132134        mQueriesIssuedInfo->setCaption(": 0"); 
     135        mAssumedVisibilityInfo->setCaption(": 0"); 
    133136 
    134137 
     
    596599} 
    597600//----------------------------------------------------------------------- 
     601void TerrainFrameListener::changeAssumedVisibility(int incr) 
     602{ 
     603        mAssumedVisibility += incr;  
     604        if(mAssumedVisibility < 0) mAssumedVisibility = 0; 
     605         
     606        char str[100]; sprintf(str,": %d", mAssumedVisibility); 
     607 
     608        mSceneMgr->setOption("AssumedVisibility", &mAssumedVisibility);  
     609        mAssumedVisibilityInfo->setCaption(str); 
     610} 
     611//----------------------------------------------------------------------- 
    598612void TerrainFrameListener::zoomVizCamera(int zoom) 
    599613{ 
     
    869883                break; 
    870884 
     885        case KC_8: 
     886                changeAssumedVisibility(-1); 
     887                break; 
     888        case KC_9: 
     889                changeAssumedVisibility(1); 
     890                break; 
    871891        case KC_LSHIFT: 
    872892                mShiftPressed = true; 
  • trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h

    r144 r146  
    107107        void nextAppState(); 
    108108    void changeThreshold(int incr); 
    109          
     109        void changeAssumedVisibility(int incr); 
    110110        void toggleUseOptimization(); 
    111111        void toggleShowOctree(); 
     
    136136        int mCurrentAlgorithm; 
    137137        int mVisibilityThreshold; 
     138        int mAssumedVisibility; 
    138139        // the current frame number 
    139140        int mCurrentFrame; 
     
    149150        OverlayElement *mAlgorithmInfo; 
    150151        OverlayElement *mThresholdInfo; 
     152        OverlayElement *mAssumedVisibilityInfo; 
    151153        OverlayElement *mFrustumCulledNodesInfo; 
    152154        OverlayElement *mQueryCulledNodesInfo; 
Note: See TracChangeset for help on using the changeset viewer.