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

added assumed visibility

Location:
trunk/VUT/GtpVisibility
Files:
4 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 
Note: See TracChangeset for help on using the changeset viewer.