Changeset 12942

Show
Ignore:
Timestamp:
02/06/12 13:06:40 (3 years ago)
Author:
robert
Message:

From Brad Christiansen, "The attached files add the ability to control when a paged child becomes eligible for expiry based on time and/or elapsed frames.

I found that some of the items that had been paged in were being expired on the first frame that they were not visible (as the cache was full). This resulted in excessive paging every time the view was moved. With the following changes I could only allow children to be expired if they had not been used for e.g. 30 seconds or 60 frames."

Location:
OpenSceneGraph/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/PagedLOD

    r12056 r12942  
    7171            float                           _priorityOffset; 
    7272            float                           _priorityScale; 
     73            double                          _minExpiryTime; 
     74            unsigned int                    _minExpiryFrames; 
    7375            double                          _timeStamp; 
    7476            unsigned int                    _frameNumber; 
     
    9193        float getPriorityScale(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityScale; } 
    9294        unsigned int getNumPriorityScales() const { return _perRangeDataList.size(); } 
     95 
     96        /** Sets the minimum amount of time, in seconds, that must pass without a child being traversed before it can be expired. */ 
     97        void setMinimumExpiryTime(unsigned int childNo, double minTime) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryTime=minTime; } 
     98        double getMinimumExpiryTime(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryTime; } 
     99        unsigned int getNumMinimumExpiryTimes() const { return _perRangeDataList.size(); } 
     100 
     101         /** Sets the minimum number of frames that must be rendered without a child being traversed before it can be expired. */ 
     102        void setMinimumExpiryFrames(unsigned int childNo, unsigned int minFrames) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryFrames=minFrames; } 
     103        unsigned int getMinimumExpiryFrames(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryFrames; } 
     104        unsigned int getNumMinimumExpiryFrames() const { return _perRangeDataList.size(); } 
    93105 
    94106 
  • OpenSceneGraph/trunk/src/osg/PagedLOD.cpp

    r12271 r12942  
    2323    _priorityOffset(0.0f), 
    2424    _priorityScale(1.0f), 
     25    _minExpiryTime(0.0), 
     26    _minExpiryFrames(0), 
    2527    _timeStamp(0.0f), 
    2628    _frameNumber(0), 
     
    3133    _priorityOffset(prd._priorityOffset), 
    3234    _priorityScale(prd._priorityScale), 
     35    _minExpiryTime(prd._minExpiryTime), 
     36    _minExpiryFrames(prd._minExpiryFrames), 
    3337    _timeStamp(prd._timeStamp), 
    3438    _frameNumber(prd._frameNumber), 
     
    4650    _frameNumberOfLastReleaseGLObjects = prd._frameNumberOfLastReleaseGLObjects; 
    4751    _databaseRequest = prd._databaseRequest; 
     52    _minExpiryTime = prd._minExpiryTime; 
     53    _minExpiryFrames = prd._minExpiryFrames; 
    4854    return *this; 
    4955} 
     
    291297        unsigned cindex = _children.size() - 1; 
    292298        if (!_perRangeDataList[cindex]._filename.empty() && 
    293             _perRangeDataList[cindex]._timeStamp<expiryTime && 
    294             _perRangeDataList[cindex]._frameNumber<expiryFrame) 
     299            _perRangeDataList[cindex]._timeStamp + _perRangeDataList[cindex]._minExpiryTime < expiryTime && 
     300            _perRangeDataList[cindex]._frameNumber + _perRangeDataList[cindex]._minExpiryFrames < expiryFrame) 
    295301        {             
    296302            osg::Node* nodeToRemove = _children[cindex].get();