Converted FrameStamp::g/setFrameNumber from int to uint

This commit is contained in:
Robert Osfield 2010-12-22 20:11:05 +00:00
parent b5d4d9954a
commit 410b4fd109
49 changed files with 201 additions and 209 deletions

View File

@ -31,7 +31,7 @@ PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 2)
SET(OPENSCENEGRAPH_MINOR_VERSION 9)
SET(OPENSCENEGRAPH_PATCH_VERSION 11)
SET(OPENSCENEGRAPH_SOVERSION 69)
SET(OPENSCENEGRAPH_SOVERSION 70)
# set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number

View File

@ -88,7 +88,7 @@
osg::Timer_t _startTime;
osg::Timer_t _currentTime;
bool _playing;
int _lastUpdate;
unsigned int _lastUpdate;
};
@ -150,7 +150,7 @@ public:
osg::Timer_t _startTime;
osg::Timer_t _currentTime;
bool _playing;
int _lastUpdate;
unsigned int _lastUpdate;
};
// This won't really give good results in any situation, but it does demonstrate

View File

@ -80,7 +80,7 @@ public:
osg::Timer_t _startTime;
osg::Timer_t _currentTime;
bool _playing;
int _lastUpdate;
unsigned int _lastUpdate;
};
@ -143,7 +143,7 @@ public:
osg::Timer_t _startTime;
osg::Timer_t _currentTime;
bool _playing;
int _lastUpdate;
unsigned int _lastUpdate;
};

View File

@ -91,7 +91,7 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
typedef std::vector<double> Elevations;
ElevationLayerBlendingCallback(osgFX::MultiTextureControl* mtc, const Elevations& elevations, float animationTime=4.0f):
_previousFrame(-1),
_previousFrame(0),
_previousTime(0.0),
_animationTime(animationTime),
_currentElevation(0.0),
@ -105,7 +105,7 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
{
float deltaTime = 0.01f;
if (_previousFrame!=-1)
if (_previousFrame!=0)
{
deltaTime = float(nv->getFrameStamp()->getReferenceTime() - _previousTime);
}
@ -171,7 +171,7 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
traverse(node,nv);
}
int _previousFrame;
unsigned int _previousFrame;
double _previousTime;
float _animationTime;
double _currentElevation;

View File

@ -43,7 +43,7 @@ public:
if ( nv->getFrameStamp() && updateTimeStamp )
{
double timeStamp = nv->getFrameStamp()?nv->getFrameStamp()->getReferenceTime():0.0;
int frameNumber = nv->getFrameStamp()?nv->getFrameStamp()->getFrameNumber():0;
unsigned int frameNumber = nv->getFrameStamp()?nv->getFrameStamp()->getFrameNumber():0;
pagedLOD->setFrameNumberOfLastTraversal( frameNumber );
pagedLOD->setTimeStamp( numChildren-1, timeStamp );

View File

@ -142,7 +142,7 @@ protected:
bool _isRunning;
bool _isFinishing;
int _lastBindingFrame;
unsigned int _lastBindingFrame;
int _tileRows;
int _tileColumns;
int _currentRow;

View File

@ -87,7 +87,7 @@ void updateUserStats(osgViewer::Viewer& viewer)
// use that frame's timings because it's probably not finished
// rendering yet (in multithreaded viewer modes). So we'll use the
// timings for framenumber-2 for this demo.
int framenumber = viewer.getFrameStamp()->getFrameNumber();
unsigned int framenumber = viewer.getFrameStamp()->getFrameNumber();
// Get the update time and the viewer main camera's cull time. We use
// getAveragedAttribute() in order to get the actual time elapsed as
@ -131,7 +131,7 @@ void startTiming(osgViewer::Viewer& viewer, const std::string& name)
{
osg::Timer_t tick = osg::Timer::instance()->tick();
double currentTime = osg::Timer::instance()->delta_s(viewer.getStartTick(), tick);
int framenumber = viewer.getFrameStamp()->getFrameNumber();
unsigned int framenumber = viewer.getFrameStamp()->getFrameNumber();
viewer.getViewerStats()->setAttribute(framenumber, name + " begin", currentTime);
}
@ -142,7 +142,7 @@ void endTiming(osgViewer::Viewer& viewer, const std::string& name)
{
osg::Timer_t tick = osg::Timer::instance()->tick();
double currentTime = osg::Timer::instance()->delta_s(viewer.getStartTick(), tick);
int framenumber = viewer.getFrameStamp()->getFrameNumber();
unsigned int framenumber = viewer.getFrameStamp()->getFrameNumber();
viewer.getViewerStats()->setAttribute(framenumber, name + " end", currentTime);

View File

@ -32,7 +32,7 @@ class OSG_EXPORT DeleteHandler
{
public:
typedef std::pair<int, const osg::Referenced*> FrameNumberObjectPair;
typedef std::pair<unsigned int, const osg::Referenced*> FrameNumberObjectPair;
typedef std::list<FrameNumberObjectPair> ObjectsToDeleteList;
DeleteHandler(int numberOfFramesToRetainObjects=0);
@ -44,15 +44,15 @@ class OSG_EXPORT DeleteHandler
* The ability to retain objects for several frames is useful to prevent premature deletion when objects
* are still be used the graphics threads that are using double buffering of rendering data structures with
* non ref_ptr<> pointers to scene graph elements.*/
void setNumFramesToRetainObjects(int numberOfFramesToRetainObjects) { _numFramesToRetainObjects = numberOfFramesToRetainObjects; }
void setNumFramesToRetainObjects(unsigned int numberOfFramesToRetainObjects) { _numFramesToRetainObjects = numberOfFramesToRetainObjects; }
int getNumFramesToRetainObjects() const { return _numFramesToRetainObjects; }
unsigned int getNumFramesToRetainObjects() const { return _numFramesToRetainObjects; }
/** Set the current frame number so that subsequent deletes get tagged as associated with this frame.*/
void setFrameNumber(int frameNumber) { _currentFrameNumber = frameNumber; }
void setFrameNumber(unsigned int frameNumber) { _currentFrameNumber = frameNumber; }
/** Get the current frame number.*/
int getFrameNumber() const { return _currentFrameNumber; }
unsigned int getFrameNumber() const { return _currentFrameNumber; }
inline void doDelete(const Referenced* object) { delete object; }
@ -76,8 +76,8 @@ class OSG_EXPORT DeleteHandler
_currentFrameNumber(0) {}
DeleteHandler operator = (const DeleteHandler&) { return *this; }
int _numFramesToRetainObjects;
int _currentFrameNumber;
unsigned int _numFramesToRetainObjects;
unsigned int _currentFrameNumber;
OpenThreads::Mutex _mutex;
ObjectsToDeleteList _objectsToDelete;

View File

@ -40,8 +40,8 @@ class OSG_EXPORT FrameStamp : public Referenced
FrameStamp& operator = (const FrameStamp& fs);
void setFrameNumber(int fnum) { _frameNumber = fnum; }
int getFrameNumber() const { return _frameNumber; }
void setFrameNumber(unsigned int fnum) { _frameNumber = fnum; }
unsigned int getFrameNumber() const { return _frameNumber; }
void setReferenceTime(double refTime) { _referenceTime = refTime; }
double getReferenceTime() const { return _referenceTime; }
@ -63,7 +63,7 @@ class OSG_EXPORT FrameStamp : public Referenced
// via a simple memory copy or within a data packet across
// the network.
int _frameNumber;
unsigned int _frameNumber;
double _referenceTime;
double _simulationTime;

View File

@ -42,6 +42,8 @@ class Transform;
class Camera;
class CameraView;
const unsigned int UNINITIALIZED_FRAME_NUMBER=0xffffffff;
#define META_NodeVisitor(library,name) \
virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; }
@ -109,10 +111,10 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
inline VisitorType getVisitorType() const { return _visitorType; }
/** Set the traversal number. Typically used to denote the frame count.*/
inline void setTraversalNumber(int fn) { _traversalNumber = fn; }
inline void setTraversalNumber(unsigned int fn) { _traversalNumber = fn; }
/** Get the traversal number. Typically used to denote the frame count.*/
inline int getTraversalNumber() const { return _traversalNumber; }
inline unsigned int getTraversalNumber() const { return _traversalNumber; }
/** Set the FrameStamp that this traversal is associated with.*/
inline void setFrameStamp(FrameStamp* fs) { _frameStamp = fs; }
@ -326,7 +328,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
protected:
VisitorType _visitorType;
int _traversalNumber;
unsigned int _traversalNumber;
ref_ptr<FrameStamp> _frameStamp;

View File

@ -122,8 +122,8 @@ public:
unsigned int getVisibilityThreshold() const { return _visThreshold; }
// Specifies how many frames to wait before issuing another query.
void setQueryFrameCount( int frames ) { _queryFrameCount = frames; }
int getQueryFrameCount() const { return _queryFrameCount; }
void setQueryFrameCount( unsigned int frames ) { _queryFrameCount = frames; }
unsigned int getQueryFrameCount() const { return _queryFrameCount; }
// Indicate whether or not the bounding box used in the occlusion query test
// should be rendered. Handy for debugging and development.
@ -179,7 +179,7 @@ protected:
// Tracks the last frame number that we performed a query.
// User can set how many times (See setQueryFrameCount).
typedef std::map< const osg::Camera*, int > FrameCountMap;
typedef std::map< const osg::Camera*, unsigned int > FrameCountMap;
FrameCountMap _frameCountMap;
mutable OpenThreads::Mutex _frameCountMutex;
@ -188,7 +188,7 @@ protected:
// User-settable variables
unsigned int _visThreshold;
int _queryFrameCount;
unsigned int _queryFrameCount;
bool _debugBB;

View File

@ -71,8 +71,8 @@ class OSG_EXPORT PagedLOD : public LOD
float _priorityOffset;
float _priorityScale;
double _timeStamp;
int _frameNumber;
int _frameNumberOfLastReleaseGLObjects;
unsigned int _frameNumber;
unsigned int _frameNumberOfLastReleaseGLObjects;
osg::ref_ptr<osg::Referenced> _databaseRequest;
};
@ -96,8 +96,8 @@ class OSG_EXPORT PagedLOD : public LOD
double getTimeStamp(unsigned int childNo) const { return _perRangeDataList[childNo]._timeStamp; }
unsigned int getNumTimeStamps() const { return _perRangeDataList.size(); }
void setFrameNumber(unsigned int childNo, int frameNumber) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._frameNumber=frameNumber; }
double getFrameNumber(unsigned int childNo) const { return _perRangeDataList[childNo]._frameNumber; }
void setFrameNumber(unsigned int childNo, unsigned int frameNumber) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._frameNumber=frameNumber; }
unsigned getFrameNumber(unsigned int childNo) const { return _perRangeDataList[childNo]._frameNumber; }
unsigned int getNumFrameNumbers() const { return _perRangeDataList.size(); }
@ -114,10 +114,10 @@ class OSG_EXPORT PagedLOD : public LOD
/** Set the frame number of the last time that this PageLOD node was traversed.
* Note, this frame number is automatically set by the traverse() method for all traversals (update, cull etc.).
*/
inline void setFrameNumberOfLastTraversal(int frameNumber) { _frameNumberOfLastTraversal=frameNumber; }
inline void setFrameNumberOfLastTraversal(unsigned int frameNumber) { _frameNumberOfLastTraversal=frameNumber; }
/** Get the frame number of the last time that this PageLOD node was traversed.*/
inline int getFrameNumberOfLastTraversal() const { return _frameNumberOfLastTraversal; }
inline unsigned int getFrameNumberOfLastTraversal() const { return _frameNumberOfLastTraversal; }
/** Set the number of children that the PagedLOD must keep around, even if they are older than their expiry time.*/
@ -137,11 +137,7 @@ class OSG_EXPORT PagedLOD : public LOD
* The removed children are added to the removeChildren list passed into the method,
* this allows the children to be deleted later at the caller's discretion.
* Return true if children are removed, false otherwise. */
virtual bool removeExpiredChildren(double expiryTime, int expiryFrame, NodeList& removedChildren);
/** Release the GL Objects of the children from the PagedLOD which haven't been visited since specified expiry time and expiry frame number.
* Return true if any children have release called upon them, false otherwise. */
virtual bool releaseGLObjectsOnExpiredChildren(double releaseTime, int releaseFrame);
virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList& removedChildren);
protected :
@ -152,7 +148,7 @@ class OSG_EXPORT PagedLOD : public LOD
ref_ptr<Referenced> _databaseOptions;
std::string _databasePath;
int _frameNumberOfLastTraversal;
unsigned int _frameNumberOfLastTraversal;
unsigned int _numChildrenThatCannotBeExpired;
bool _disableExternalChildrenPaging;

View File

@ -38,15 +38,15 @@ class OSG_EXPORT Stats : public osg::Referenced
void allocate(unsigned int numberOfFrames);
int getEarliestFrameNumber() const { return _latestFrameNumber < static_cast<int>(_attributeMapList.size()) ? 0 : _latestFrameNumber - static_cast<int>(_attributeMapList.size()) + 1; }
int getLatestFrameNumber() const { return _latestFrameNumber; }
unsigned int getEarliestFrameNumber() const { return _latestFrameNumber < static_cast<unsigned int>(_attributeMapList.size()) ? 0 : _latestFrameNumber - static_cast<unsigned int>(_attributeMapList.size()) + 1; }
unsigned int getLatestFrameNumber() const { return _latestFrameNumber; }
typedef std::map<std::string, double> AttributeMap;
typedef std::vector<AttributeMap> AttributeMapList;
bool setAttribute(int frameNumber, const std::string& attributeName, double value);
bool setAttribute(unsigned int frameNumber, const std::string& attributeName, double value);
inline bool getAttribute(int frameNumber, const std::string& attributeName, double& value) const
inline bool getAttribute(unsigned int frameNumber, const std::string& attributeName, double& value) const
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
return getAttributeNoMutex(frameNumber, attributeName, value);
@ -54,15 +54,15 @@ class OSG_EXPORT Stats : public osg::Referenced
bool getAveragedAttribute(const std::string& attributeName, double& value, bool averageInInverseSpace=false) const;
bool getAveragedAttribute(int startFrameNumber, int endFrameNumber, const std::string& attributeName, double& value, bool averageInInverseSpace=false) const;
bool getAveragedAttribute(unsigned int startFrameNumber, unsigned int endFrameNumber, const std::string& attributeName, double& value, bool averageInInverseSpace=false) const;
inline AttributeMap& getAttributeMap(int frameNumber)
inline AttributeMap& getAttributeMap(unsigned int frameNumber)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
return getAttributeMapNoMutex(frameNumber);
}
inline const AttributeMap& getAttributeMap(int frameNumber) const
inline const AttributeMap& getAttributeMap(unsigned int frameNumber) const
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
return getAttributeMapNoMutex(frameNumber);
@ -87,13 +87,13 @@ class OSG_EXPORT Stats : public osg::Referenced
virtual ~Stats() {}
bool getAttributeNoMutex(int frameNumber, const std::string& attributeName, double& value) const;
bool getAttributeNoMutex(unsigned int frameNumber, const std::string& attributeName, double& value) const;
AttributeMap& getAttributeMapNoMutex(int frameNumber);
const AttributeMap& getAttributeMapNoMutex(int frameNumber) const;
AttributeMap& getAttributeMapNoMutex(unsigned int frameNumber);
const AttributeMap& getAttributeMapNoMutex(unsigned int frameNumber) const;
int getIndex(int frameNumber) const
int getIndex(unsigned int frameNumber) const
{
// reject frame that are in the future
if (frameNumber > _latestFrameNumber) return -1;
@ -109,8 +109,8 @@ class OSG_EXPORT Stats : public osg::Referenced
mutable OpenThreads::Mutex _mutex;
int _baseFrameNumber;
int _latestFrameNumber;
unsigned int _baseFrameNumber;
unsigned int _latestFrameNumber;
AttributeMapList _attributeMapList;
AttributeMap _invalidAttributeMap;

View File

@ -21,7 +21,7 @@ extern "C" {
#define OPENSCENEGRAPH_MAJOR_VERSION 2
#define OPENSCENEGRAPH_MINOR_VERSION 9
#define OPENSCENEGRAPH_PATCH_VERSION 11
#define OPENSCENEGRAPH_SOVERSION 69
#define OPENSCENEGRAPH_SOVERSION 70
/* Convenience macro that can be used to decide whether a feature is present or not i.e.
* #if OSG_MIN_VERSION_REQUIRED(2,9,5)

View File

@ -104,8 +104,8 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
void setName(const std::string& name) { _name = name; }
const std::string& getName() const { return _name; }
void setDone(bool done) { _done = done; }
bool getDone() const { return _done; }
void setDone(bool done) { _done.exchange(done?1:0); }
bool getDone() const { return _done!=0; }
void setActive(bool active) { _active = active; }
bool getActive() const { return _active; }
@ -118,7 +118,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
virtual ~DatabaseThread();
volatile bool _done;
OpenThreads::Atomic _done;
volatile bool _active;
DatabasePager* _pager;
Mode _mode;
@ -163,7 +163,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
/** Find all PagedLOD nodes in a subgraph and register them with
* the DatabasePager so it can keep track of expired nodes.
* note, should be only be called from the update thread. */
virtual void registerPagedLODs(osg::Node* subgraph, int frameNumber = 0);
virtual void registerPagedLODs(osg::Node* subgraph, unsigned int frameNumber = 0);
/** Set the incremental compile operation.
* Used to manage the OpenGL object compilation and merging of subgraphs in a way that avoids overloading
@ -273,7 +273,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
virtual PagedLODList* clone() = 0;
virtual void clear() = 0;
virtual unsigned int size() = 0;
virtual void removeExpiredChildren(int numberChildrenToRemove, double expiryTime, int expiryFrame, ObjectList& childrenRemoved, bool visitActive) = 0;
virtual void removeExpiredChildren(int numberChildrenToRemove, double expiryTime, unsigned int expiryFrame, ObjectList& childrenRemoved, bool visitActive) = 0;
virtual void removeNodes(osg::NodeList& nodesToRemove) = 0;
virtual void insertPagedLOD(const osg::observer_ptr<osg::PagedLOD>& plod) = 0;
virtual bool containsPagedLOD(const osg::observer_ptr<osg::PagedLOD>& plod) const = 0;
@ -309,10 +309,10 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
bool _valid;
std::string _fileName;
int _frameNumberFirstRequest;
unsigned int _frameNumberFirstRequest;
double _timestampFirstRequest;
float _priorityFirstRequest;
int _frameNumberLastRequest;
unsigned int _frameNumberLastRequest;
double _timestampLastRequest;
float _priorityLastRequest;
unsigned int _numOfRequests;
@ -362,7 +362,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
DatabasePager* _pager;
RequestList _requestList;
OpenThreads::Mutex _requestMutex;
int _frameNumberLastPruned;
unsigned int _frameNumberLastPruned;
protected:
virtual ~RequestQueue();
@ -427,7 +427,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
int _numFramesActive;
mutable OpenThreads::Mutex _numFramesActiveMutex;
volatile int _frameNumber;
OpenThreads::Atomic _frameNumber;
osg::ref_ptr<ReadQueue> _fileRequestQueue;
osg::ref_ptr<ReadQueue> _httpRequestQueue;

View File

@ -172,7 +172,7 @@ namespace osgParticle
//added- 1/17/06- bgandere@nps.edu
//a var to keep from doing multiple updates
int _frameNumber;
unsigned int _frameNumber;
};
// INLINE FUNCTIONS

View File

@ -176,7 +176,7 @@ namespace osgParticle
inline virtual void reuseParticle(int i) { _deadparts.push(&(_particles[i])); }
/// Get the last frame number.
inline int getLastFrameNumber() const;
inline unsigned int getLastFrameNumber() const;
/// Get the unique delta time for emitters and updaters to use
inline double& getDeltaTime( double currentTime );
@ -294,7 +294,7 @@ namespace osgParticle
bool _bounds_computed;
Particle _def_ptemp;
mutable int _last_frame;
mutable unsigned int _last_frame;
mutable bool _dirty_dt;
bool _freeze_on_cull;
@ -403,7 +403,7 @@ namespace osgParticle
_particles[i].kill();
}
inline int ParticleSystem::getLastFrameNumber() const
inline unsigned int ParticleSystem::getLastFrameNumber() const
{
return _last_frame;
}

View File

@ -89,7 +89,7 @@ namespace osgParticle
//added 1/17/06- bgandere@nps.edu
//a var to keep from doing multiple updates per frame
int _frameNumber;
unsigned int _frameNumber;
};
// INLINE FUNCTIONS

View File

@ -35,7 +35,7 @@ class OSGPRESENTATION_EXPORT CompileSlideCallback : public osg::Camera::DrawCall
virtual ~CompileSlideCallback() {}
mutable bool _needCompile;
mutable int _frameNumber;
mutable unsigned int _frameNumber;
osg::ref_ptr<osg::Node> _sceneToCompile;
};

View File

@ -91,7 +91,7 @@ class OSGQT_EXPORT QGraphicsViewAdapter : public QObject
OpenThreads::Mutex _qimagesMutex;
OpenThreads::Mutex _qresizeMutex;
int _previousFrameNumber;
unsigned int _previousFrameNumber;
bool _newImageAvailable;
unsigned int _currentRead;
unsigned int _currentWrite;

View File

@ -116,7 +116,7 @@ class OSGSIM_EXPORT DOFTransform : public osg::Transform
virtual ~DOFTransform() {}
int _previousTraversalNumber;
unsigned int _previousTraversalNumber;
double _previousTime;
osg::Vec3 _minHPR;

View File

@ -71,10 +71,10 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable
inline const osg::Vec3& getStoredLocalEyePoint() const { return _storedLocalEyePoint; }
/** Set the frame number for when the ImpostorSprite was last used in rendering. */
inline void setLastFrameUsed(int frameNumber) { _lastFrameUsed = frameNumber; }
inline void setLastFrameUsed(unsigned int frameNumber) { _lastFrameUsed = frameNumber; }
/** Get the frame number for when the ImpostorSprite was last used in rendering. */
inline int getLastFrameUsed() const { return _lastFrameUsed; }
inline unsigned int getLastFrameUsed() const { return _lastFrameUsed; }
/** Get the coordinates of the corners of the quad.
@ -180,7 +180,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable
ImpostorSprite* _previous;
ImpostorSprite* _next;
int _lastFrameUsed;
unsigned int _lastFrameUsed;
osg::Vec3 _storedLocalEyePoint;
@ -212,7 +212,7 @@ class OSGSIM_EXPORT ImpostorSpriteManager : public osg::Referenced
void remove(ImpostorSprite* is);
ImpostorSprite* createOrReuseImpostorSprite(int s,int t,int frameNumber);
ImpostorSprite* createOrReuseImpostorSprite(int s,int t,unsigned int frameNumber);
osg::StateSet* createOrReuseStateSet();

View File

@ -40,7 +40,7 @@ class OSGUTIL_EXPORT TransformCallback : public osg::NodeCallback
osg::Vec3 _pivot;
osg::Vec3 _axis;
int _previousTraversalNumber;
unsigned int _previousTraversalNumber;
double _previousTime;
bool _pause;

View File

@ -29,7 +29,7 @@ class OSGVIEWER_EXPORT OpenGLQuerySupport : public osg::Referenced
virtual void checkQuery(osg::Stats* stats, osg::State* state,
osg::Timer_t startTick) = 0;
virtual void beginQuery(int frameNumber, osg::State* state) = 0;
virtual void beginQuery(unsigned int frameNumber, osg::State* state) = 0;
virtual void endQuery(osg::State* state) = 0;
virtual void initialize(osg::State* state, osg::Timer_t startTick);
protected:

View File

@ -37,7 +37,7 @@ void DeleteHandler::flush()
// list, but delete the objects outside this scoped lock so that if any objects deleted
// unref their children then no deadlock happens.
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
int frameNumberToClearTo = _currentFrameNumber - _numFramesToRetainObjects;
unsigned int frameNumberToClearTo = _currentFrameNumber - _numFramesToRetainObjects;
ObjectsToDeleteList::iterator itr;
for(itr = _objectsToDelete.begin();
@ -65,7 +65,7 @@ void DeleteHandler::flush()
void DeleteHandler::flushAll()
{
int temp_numFramesToRetainObjects = _numFramesToRetainObjects;
unsigned int temp_numFramesToRetainObjects = _numFramesToRetainObjects;
_numFramesToRetainObjects = 0;
typedef std::list<const osg::Referenced*> DeletionList;

View File

@ -512,7 +512,7 @@ OcclusionQueryNode::getPassed( const osg::Camera* camera, osg::NodeVisitor& nv )
// 2) we haven't rendered for an abnormally long time (probably because we're an out-of-range LOD child)
// In these cases, assume we're visible to avoid blinking.
OpenThreads::ScopedLock<OpenThreads::Mutex> lock( _frameCountMutex );
const int& lastQueryFrame( _frameCountMap[ camera ] );
const unsigned int& lastQueryFrame( _frameCountMap[ camera ] );
if( ( lastQueryFrame == 0 ) ||
( (nv.getTraversalNumber() - lastQueryFrame) > (_queryFrameCount + 1) ) )
return true;
@ -559,7 +559,7 @@ OcclusionQueryNode::traverseQuery( const osg::Camera* camera, osg::NodeVisitor&
const int curFrame = nv.getTraversalNumber();
OpenThreads::ScopedLock<OpenThreads::Mutex> lock( _frameCountMutex );
int& lastQueryFrame = _frameCountMap[ camera ];
unsigned int& lastQueryFrame = _frameCountMap[ camera ];
issueQuery = (curFrame - lastQueryFrame >= _queryFrameCount);
if (issueQuery)
lastQueryFrame = curFrame;

View File

@ -127,7 +127,7 @@ void PagedLOD::traverse(NodeVisitor& nv)
}
double timeStamp = nv.getFrameStamp()?nv.getFrameStamp()->getReferenceTime():0.0;
int frameNumber = nv.getFrameStamp()?nv.getFrameStamp()->getFrameNumber():0;
unsigned int frameNumber = nv.getFrameStamp()?nv.getFrameStamp()->getFrameNumber():0;
bool updateTimeStamp = nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR;
switch(nv.getTraversalMode())
@ -284,7 +284,7 @@ bool PagedLOD::removeChildren( unsigned int pos,unsigned int numChildrenToRemove
return Group::removeChildren(pos,numChildrenToRemove);
}
bool PagedLOD::removeExpiredChildren(double expiryTime, int expiryFrame, NodeList& removedChildren)
bool PagedLOD::removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList& removedChildren)
{
if (_children.size()>_numChildrenThatCannotBeExpired)
{
@ -299,23 +299,3 @@ bool PagedLOD::removeExpiredChildren(double expiryTime, int expiryFrame, NodeLis
}
return false;
}
bool PagedLOD::releaseGLObjectsOnExpiredChildren(double releaseTime, int releaseFrame)
{
unsigned int numChildrenReleased = 0;
unsigned int numChildren = osg::minimum(_perRangeDataList.size(), _children.size());
for(unsigned int i=_numChildrenThatCannotBeExpired; i<numChildren; ++i)
{
if (_perRangeDataList[i]._frameNumberOfLastReleaseGLObjects != _perRangeDataList[i]._frameNumber &&
_perRangeDataList[i]._timeStamp<releaseTime &&
_perRangeDataList[i]._frameNumber<releaseFrame)
{
_perRangeDataList[i]._frameNumberOfLastReleaseGLObjects = _perRangeDataList[i]._frameNumber;
_children[i]->releaseGLObjects();
++numChildrenReleased;
}
}
return numChildrenReleased>0;
}

View File

@ -40,7 +40,7 @@ void Stats::allocate(unsigned int numberOfFrames)
}
bool Stats::setAttribute(int frameNumber, const std::string& attributeName, double value)
bool Stats::setAttribute(unsigned int frameNumber, const std::string& attributeName, double value)
{
if (frameNumber<getEarliestFrameNumber()) return false;
@ -51,13 +51,13 @@ bool Stats::setAttribute(int frameNumber, const std::string& attributeName, doub
// need to advance
// first clear the entries up to and including the new frameNumber
for(int i = _latestFrameNumber+1; i<= frameNumber; ++i)
for(unsigned int i = _latestFrameNumber+1; i<= frameNumber; ++i)
{
int index = (i - _baseFrameNumber) % _attributeMapList.size();
unsigned int index = (i - _baseFrameNumber) % _attributeMapList.size();
_attributeMapList[index].clear();
}
if ( (frameNumber-_baseFrameNumber) >= static_cast<int>(_attributeMapList.size()))
if ( (frameNumber-_baseFrameNumber) >= static_cast<unsigned int>(_attributeMapList.size()))
{
_baseFrameNumber = (frameNumber/_attributeMapList.size())*_attributeMapList.size();
}
@ -79,7 +79,7 @@ bool Stats::setAttribute(int frameNumber, const std::string& attributeName, doub
return true;
}
bool Stats::getAttributeNoMutex(int frameNumber, const std::string& attributeName, double& value) const
bool Stats::getAttributeNoMutex(unsigned int frameNumber, const std::string& attributeName, double& value) const
{
int index = getIndex(frameNumber);
if (index<0) return false;
@ -97,7 +97,7 @@ bool Stats::getAveragedAttribute(const std::string& attributeName, double& value
return getAveragedAttribute(getEarliestFrameNumber(), getLatestFrameNumber(), attributeName, value, averageInInverseSpace);
}
bool Stats::getAveragedAttribute(int startFrameNumber, int endFrameNumber, const std::string& attributeName, double& value, bool averageInInverseSpace) const
bool Stats::getAveragedAttribute(unsigned int startFrameNumber, unsigned int endFrameNumber, const std::string& attributeName, double& value, bool averageInInverseSpace) const
{
if (endFrameNumber<startFrameNumber)
{
@ -108,7 +108,7 @@ bool Stats::getAveragedAttribute(int startFrameNumber, int endFrameNumber, const
double total = 0.0;
double numValidSamples = 0.0;
for(int i = startFrameNumber; i<=endFrameNumber; ++i)
for(unsigned int i = startFrameNumber; i<=endFrameNumber; ++i)
{
double v = 0.0;
if (getAttributeNoMutex(i,attributeName,v))
@ -127,7 +127,7 @@ bool Stats::getAveragedAttribute(int startFrameNumber, int endFrameNumber, const
else return false;
}
Stats::AttributeMap& Stats::getAttributeMapNoMutex(int frameNumber)
Stats::AttributeMap& Stats::getAttributeMapNoMutex(unsigned int frameNumber)
{
int index = getIndex(frameNumber);
if (index<0) return _invalidAttributeMap;
@ -135,7 +135,7 @@ Stats::AttributeMap& Stats::getAttributeMapNoMutex(int frameNumber)
return _attributeMapList[index];
}
const Stats::AttributeMap& Stats::getAttributeMapNoMutex(int frameNumber) const
const Stats::AttributeMap& Stats::getAttributeMapNoMutex(unsigned int frameNumber) const
{
int index = getIndex(frameNumber);
if (index<0) return _invalidAttributeMap;
@ -149,7 +149,7 @@ void Stats::report(std::ostream& out, const char* indent) const
if (indent) out<<indent;
out<<"Stats "<<_name<<std::endl;
for(int i = getEarliestFrameNumber(); i<= getLatestFrameNumber(); ++i)
for(unsigned int i = getEarliestFrameNumber(); i<= getLatestFrameNumber(); ++i)
{
out<<" FrameNumber "<<i<<std::endl;
const osg::Stats::AttributeMap& attributes = getAttributeMapNoMutex(i);

View File

@ -150,7 +150,7 @@ struct StatsGraph : public osg::MatrixTransform
const float _max;
const std::string _nameBegin;
const std::string _nameEnd;
mutable int _frameNumber;
mutable unsigned int _frameNumber;
GraphUpdateCallback(float width, float height, osg::Stats* viewerStats, osg::Stats* stats,
float max, const std::string& nameBegin, const std::string& nameEnd = "")
@ -168,7 +168,7 @@ struct StatsGraph : public osg::MatrixTransform
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray());
if (!vertices) return;
int frameNumber = nv->getFrameStamp()->getFrameNumber();
unsigned int frameNumber = nv->getFrameStamp()->getFrameNumber();
if (frameNumber == _frameNumber)
return;
@ -253,7 +253,7 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
{
osgText::Text* text = (osgText::Text*)drawable;
int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
unsigned int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
if (frameNumber == _frameNumber) {
text->drawImplementation(renderInfo);
return;
@ -276,7 +276,7 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
osg::ref_ptr<osg::Stats> _stats;
std::string _attributeName;
mutable char _tmpText[128];
mutable int _frameNumber;
mutable unsigned int _frameNumber;
};
@ -562,10 +562,10 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
typedef std::vector<osg::Stats*> StatsList;
StatsList statsList;
for (int i = 0; i < (int)finder._timelines.size(); i++)
for (unsigned int i = 0; i < finder._timelines.size(); i++)
statsList.push_back(finder._timelines[i]->getStats());
for(int i = statsList[0]->getEarliestFrameNumber(); i<= statsList[0]->getLatestFrameNumber()-1; ++i)
for(unsigned int i = statsList[0]->getEarliestFrameNumber(); i< statsList[0]->getLatestFrameNumber(); ++i)
{
for(StatsList::iterator itr = statsList.begin();
itr != statsList.end();

View File

@ -46,10 +46,6 @@ using namespace OpenThreads;
static osg::ApplicationUsageProxy DatabasePager_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_DO_PRE_COMPILE <ON/OFF>","Switch on or off the pre compile of OpenGL object database pager.");
static osg::ApplicationUsageProxy DatabasePager_e3(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_DATABASE_PAGER_DRAWABLE <mode>","Set the drawable policy for setting of loaded drawable to specified type. mode can be one of DoNotModify, DisplayList, VBO or VertexArrays>.");
static osg::ApplicationUsageProxy DatabasePager_e4(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_DATABASE_PAGER_PRIORITY <mode>", "Set the thread priority to DEFAULT, MIN, LOW, NOMINAL, HIGH or MAX.");
static osg::ApplicationUsageProxy DatabasePager_e7(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_EXPIRY_DELAY <float> ","Set the length of time a PagedLOD child is kept in memory, without being used, before its tagged as expired, and ear marked to deletion.");
static osg::ApplicationUsageProxy DatabasePager_e8(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_EXPIRY_FRAMES <int> ","Set number of frames a PagedLOD child is kept in memory, without being used, before its tagged as expired, and ear marked to deletion.");
static osg::ApplicationUsageProxy DatabasePager_e9(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_RELEASE_DELAY <float> ","Set the length of time a PagedLOD child's OpenGL objects are kept in memory, without being used, before be released (setting to OFF disables this feature.)");
static osg::ApplicationUsageProxy DatabasePager_e10(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_RELEASE_FRAMES <int> ","Set number of frames a PagedLOD child's OpenGL objects are kept in memory, without being used, before be released.");
static osg::ApplicationUsageProxy DatabasePager_e11(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_MAX_PAGEDLOD <num>","Set the target maximum number of PagedLOD to maintain.");
// Convert function objects that take pointer args into functions that a
@ -154,10 +150,12 @@ public:
traverse(plod);
}
bool removeExpiredChildrenAndCountPagedLODs(osg::PagedLOD* plod, double expiryTime, int expiryFrame, osg::NodeList& removedChildren)
bool removeExpiredChildrenAndCountPagedLODs(osg::PagedLOD* plod, double expiryTime, unsigned int expiryFrame, osg::NodeList& removedChildren)
{
size_t sizeBefore = removedChildren.size();
plod->removeExpiredChildren(expiryTime, expiryFrame, removedChildren);
for(size_t i = sizeBefore; i<removedChildren.size(); ++i)
{
removedChildren[i]->accept(*this);
@ -197,7 +195,7 @@ public:
virtual unsigned int size() { return _pagedLODs.size(); }
virtual void removeExpiredChildren(
int numberChildrenToRemove, double expiryTime, int expiryFrame,
int numberChildrenToRemove, double expiryTime, unsigned int expiryFrame,
DatabasePager::ObjectList& childrenRemoved, bool visitActive)
{
int leftToRemove = numberChildrenToRemove;
@ -208,12 +206,9 @@ public:
osg::ref_ptr<osg::PagedLOD> plod;
if (itr->lock(plod))
{
int delta = expiryFrame - plod->getFrameNumberOfLastTraversal();
if ((visitActive && delta > 0) || (!visitActive && delta <= 0))
bool plodActive = expiryFrame < plod->getFrameNumberOfLastTraversal();
if (visitActive==plodActive) // true if (visitActive && plodActive) OR (!visitActive &&!plodActive)
{
++itr;
continue;
}
DatabasePager::CountPagedLODsVisitor countPagedLODsVisitor;
osg::NodeList expiredChildren; // expired PagedLODs
countPagedLODsVisitor.removeExpiredChildrenAndCountPagedLODs(
@ -236,6 +231,8 @@ public:
childrenRemoved.insert(childrenRemoved.end(),
expiredChildren.begin(),
expiredChildren.end());
}
// advance the iterator to the next element
++itr;
}
@ -485,7 +482,7 @@ bool DatabasePager::RequestQueue::pruneOldRequestsAndCheckIfEmpty()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_requestMutex);
int frameNumber = _pager->_frameNumber;
unsigned int frameNumber = _pager->_frameNumber;
if (_frameNumberLastPruned != frameNumber)
{
for(RequestQueue::RequestList::iterator citr = _requestList.begin();
@ -686,8 +683,7 @@ int DatabasePager::DatabaseThread::cancel()
if( isRunning() )
{
_done = true;
setDone(true);
switch(_mode)
{
@ -713,6 +709,7 @@ int DatabasePager::DatabaseThread::cancel()
// _startThreadCalled = false;
}
//OSG_NOTICE<<"DatabasePager::DatabaseThread stopped running"<<std::endl;
return result;
@ -1013,7 +1010,7 @@ DatabasePager::DatabasePager()
_databasePagerThreadPaused = false;
_numFramesActive = 0;
_frameNumber = 0;
_frameNumber.exchange(0);
#if __APPLE__
@ -1139,7 +1136,7 @@ DatabasePager::DatabasePager(const DatabasePager& rhs)
_databasePagerThreadPaused = false;
_numFramesActive = 0;
_frameNumber = 0;
_frameNumber.exchange(0);
_drawablePolicy = rhs._drawablePolicy;
@ -1387,7 +1384,7 @@ void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* grou
double timestamp = framestamp?framestamp->getReferenceTime():0.0;
int frameNumber = framestamp?framestamp->getFrameNumber():_frameNumber;
unsigned int frameNumber = framestamp?framestamp->getFrameNumber():static_cast<unsigned int>(_frameNumber);
// #define WITH_REQUESTNODEFILE_TIMING
#ifdef WITH_REQUESTNODEFILE_TIMING
@ -1521,7 +1518,7 @@ void DatabasePager::signalBeginFrame(const osg::FrameStamp* framestamp)
_dataToCompileList->pruneOldRequestsAndCheckIfEmpty();
//OSG_INFO << "signalBeginFrame "<<framestamp->getFrameNumber()<<">>>>>>>>>>>>>>>>"<<std::endl;
_frameNumber = framestamp->getFrameNumber();
_frameNumber.exchange(framestamp->getFrameNumber());
} //else OSG_INFO << "signalBeginFrame >>>>>>>>>>>>>>>>"<<std::endl;
}
@ -1594,7 +1591,7 @@ void DatabasePager::updateSceneGraph(const osg::FrameStamp& frameStamp)
void DatabasePager::addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp)
{
double timeStamp = frameStamp.getReferenceTime();
int frameNumber = frameStamp.getFrameNumber();
unsigned int frameNumber = frameStamp.getFrameNumber();
osg::Timer_t before = osg::Timer::instance()->tick(), mid, last;
@ -1702,6 +1699,13 @@ void DatabasePager::removeExpiredSubgraphs(const osg::FrameStamp& frameStamp)
static double s_total_time_stage_c = 0.0;
static double s_total_max_stage_c = 0.0;
if (frameStamp.getFrameNumber()==0)
{
// No need to remove anything on first frame.
return;
}
osg::Timer_t startTick = osg::Timer::instance()->tick();
// numPagedLODs >= actual number of PagedLODs. There can be
@ -1727,7 +1731,7 @@ void DatabasePager::removeExpiredSubgraphs(const osg::FrameStamp& frameStamp)
ObjectList childrenRemoved;
double expiryTime = frameStamp.getReferenceTime() - 0.1;
int expiryFrame = frameStamp.getFrameNumber() - 1;
unsigned int expiryFrame = frameStamp.getFrameNumber() - 1;
// First traverse inactive PagedLODs, as their children will
// certainly have expired. Then traverse active nodes if we still
@ -1783,7 +1787,7 @@ class DatabasePager::FindPagedLODsVisitor : public osg::NodeVisitor
{
public:
FindPagedLODsVisitor(DatabasePager::PagedLODList& pagedLODList, int frameNumber):
FindPagedLODsVisitor(DatabasePager::PagedLODList& pagedLODList, unsigned int frameNumber):
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
_activePagedLODList(pagedLODList),
_frameNumber(frameNumber)
@ -1803,7 +1807,7 @@ public:
}
DatabasePager::PagedLODList& _activePagedLODList;
int _frameNumber;
unsigned int _frameNumber;
protected:
@ -1811,7 +1815,7 @@ protected:
};
void DatabasePager::registerPagedLODs(osg::Node* subgraph, int frameNumber)
void DatabasePager::registerPagedLODs(osg::Node* subgraph, unsigned int frameNumber)
{
if (!subgraph) return;

View File

@ -101,7 +101,7 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv)
if (alive &&
_enabled &&
!_ps->isFrozen() &&
(_ps->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !_ps->getFreezeOnCull()))
((_ps->getLastFrameNumber()+1) >= (nv.getFrameStamp()->getFrameNumber()) || !_ps->getFreezeOnCull()))
{
// initialize matrix flags
_need_ltw_matrix = true;

View File

@ -11,7 +11,7 @@ PendulumCallback::PendulumCallback(const osg::Vec3& axis,
_endAngle = endAngle;
_frequency = frequency;
_previousTraversalNumber = -1;
_previousTraversalNumber = osg::UNINITIALIZED_FRAME_NUMBER;
_previousTime = -1.0;
_angle = 0.0;
}

View File

@ -21,7 +21,7 @@ class PendulumCallback : public osg::NodeCallback
float _frequency;
osg::Vec3 _axis;
int _previousTraversalNumber;
unsigned int _previousTraversalNumber;
double _previousTime;
float _angle;
};

View File

@ -10,7 +10,7 @@ ShuttleCallback::ShuttleCallback(const osg::Vec3& startPos,
_endPos = endPos;
_frequency = frequency;
_previousTraversalNumber = -1;
_previousTraversalNumber = osg::UNINITIALIZED_FRAME_NUMBER;
_previousTime = -1.0;
_angle = 0.0;
}

View File

@ -20,7 +20,7 @@ class ShuttleCallback : public osg::NodeCallback
osg::Vec3 _endPos;
float _frequency;
int _previousTraversalNumber;
unsigned int _previousTraversalNumber;
double _previousTime;
float _angle;
};

View File

@ -30,7 +30,7 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv)
double timeStamp = nv.getFrameStamp()?nv.getFrameStamp()->getReferenceTime():0.0;
bool updateTimeStamp = nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR;
int frameNumber = nv.getFrameStamp()?nv.getFrameStamp()->getFrameNumber():0;
unsigned int frameNumber = nv.getFrameStamp()?nv.getFrameStamp()->getFrameNumber():0;
// set the frame number of the traversal so that external nodes can find out how active this
// node is.

View File

@ -19,6 +19,7 @@
#include <osg/Version>
#include <osgGA/GUIEventAdapter>
#include <osg/NodeVisitor>
#include <osg/io_utils>
#include <QtGui/QGraphicsItem>
#include <QtGui/QGraphicsProxyWidget>
@ -100,7 +101,7 @@ QGraphicsViewAdapter::QGraphicsViewAdapter(osg::Image* image, QWidget* widget):
_currentRead = 0;
_currentWrite = 1;
_previousWrite = 2;
_previousFrameNumber = 0;
_previousFrameNumber = osg::UNINITIALIZED_FRAME_NUMBER;
_newImageAvailable = false;
connect(_graphicsScene, SIGNAL(changed(const QList<QRectF> &)),

View File

@ -27,7 +27,7 @@ static const unsigned int SCALE_Z_LIMIT_BIT = 0x80000000u >> 8;
DOFTransform::DOFTransform():
_previousTraversalNumber(-1),
_previousTraversalNumber(osg::UNINITIALIZED_FRAME_NUMBER),
_previousTime(0.0),
_limitationFlags(0),
_animationOn(false),

View File

@ -39,6 +39,8 @@ ImpostorSprite::ImpostorSprite()
_previous = NULL;
_next = NULL;
_lastFrameUsed = osg::UNINITIALIZED_FRAME_NUMBER;
_texture = NULL;
_s = 0;
_t = 0;
@ -238,7 +240,7 @@ void ImpostorSpriteManager::remove(ImpostorSprite* is)
if (_last==is) _last = is->_previous;
}
ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,int frameNumber)
ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,unsigned int frameNumber)
{
if (!empty())
{

View File

@ -1212,7 +1212,7 @@ void Text::drawImplementation(osg::State& state, const osg::Vec4& colorMultiplie
#endif
if (_characterSizeMode!=OBJECT_COORDS || _autoRotateToScreen)
{
int frameNumber = state.getFrameStamp()?state.getFrameStamp()->getFrameNumber():0;
unsigned int frameNumber = state.getFrameStamp()?state.getFrameStamp()->getFrameNumber():0;
AutoTransformCache& atc = _autoTransformCache[contextID];
const osg::Matrix& modelview = state.getModelViewMatrix();
const osg::Matrix& projection = state.getProjectionMatrix();

View File

@ -379,7 +379,7 @@ void SceneView::updateUniforms()
if ((_activeUniforms & FRAME_NUMBER_UNIFORM) && _frameStamp.valid())
{
osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_FrameNumber",osg::Uniform::INT);
osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_FrameNumber",osg::Uniform::UNSIGNED_INT);
uniform->set(_frameStamp->getFrameNumber());
}

View File

@ -22,7 +22,7 @@ TransformCallback::TransformCallback(const osg::Vec3& pivot,const osg::Vec3& axi
_axis = axis;
_angular_velocity = angularVelocity;
_previousTraversalNumber = -1;
_previousTraversalNumber = osg::UNINITIALIZED_FRAME_NUMBER;
_previousTime = -1.0;
_pause = false;

View File

@ -619,7 +619,7 @@ void CompositeViewer::advance(double simulationTime)
if (_done) return;
double prevousReferenceTime = _frameStamp->getReferenceTime();
int previousFrameNumber = _frameStamp->getFrameNumber();
unsigned int previousFrameNumber = _frameStamp->getFrameNumber();
_frameStamp->setFrameNumber(_frameStamp->getFrameNumber()+1);

View File

@ -45,12 +45,12 @@ class OSGVIEWER_EXPORT EXTQuerySupport : public OpenGLQuerySupport
public:
EXTQuerySupport();
void checkQuery(osg::Stats* stats, osg::State* state, osg::Timer_t startTick);
virtual void beginQuery(int frameNumber, osg::State* state);
virtual void beginQuery(unsigned int frameNumber, osg::State* state);
virtual void endQuery(osg::State* state);
virtual void initialize(osg::State* state, osg::Timer_t startTick);
protected:
GLuint createQueryObject();
typedef std::pair<GLuint, int> QueryFrameNumberPair;
typedef std::pair<GLuint, unsigned int> QueryFrameNumberPair;
typedef std::list<QueryFrameNumberPair> QueryFrameNumberList;
typedef std::vector<GLuint> QueryList;
@ -118,7 +118,7 @@ GLuint EXTQuerySupport::createQueryObject()
}
}
void EXTQuerySupport::beginQuery(int frameNumber, osg::State* state)
void EXTQuerySupport::beginQuery(unsigned int frameNumber, osg::State* state)
{
GLuint query = createQueryObject();
_extensions->glBeginQuery(GL_TIME_ELAPSED, query);
@ -148,7 +148,7 @@ public:
virtual void checkQuery(osg::Stats* stats, osg::State* state,
osg::Timer_t startTick);
virtual void beginQuery(int frameNumber, osg::State* state);
virtual void beginQuery(unsigned int frameNumber, osg::State* state);
virtual void endQuery(osg::State* state);
virtual void initialize(osg::State* state, osg::Timer_t startTick);
protected:
@ -159,12 +159,12 @@ protected:
: queries(start_, end_), frameNumber(frameNumber_)
{
}
ActiveQuery(const QueryPair& queries_, int frameNumber_)
ActiveQuery(const QueryPair& queries_, unsigned int frameNumber_)
: queries(queries_), frameNumber(frameNumber_)
{
}
QueryPair queries;
int frameNumber;
unsigned int frameNumber;
};
typedef std::list<ActiveQuery> QueryFrameList;
typedef std::vector<QueryPair> QueryList;
@ -177,7 +177,7 @@ void ARBQuerySupport::initialize(osg::State* state, osg::Timer_t startTick)
OpenGLQuerySupport::initialize(state, startTick);
}
void ARBQuerySupport::beginQuery(int frameNumber, osg::State* state)
void ARBQuerySupport::beginQuery(unsigned int frameNumber, osg::State* state)
{
QueryPair query;
if (_availableQueryObjects.empty())
@ -531,7 +531,7 @@ void Renderer::cull()
osg::Stats* stats = sceneView->getCamera()->getStats();
osg::State* state = sceneView->getState();
const osg::FrameStamp* fs = state->getFrameStamp();
int frameNumber = fs ? fs->getFrameNumber() : 0;
unsigned int frameNumber = fs ? fs->getFrameNumber() : 0;
// do cull traversal
osg::Timer_t beforeCullTick = osg::Timer::instance()->tick();
@ -643,7 +643,7 @@ void Renderer::draw()
osg::Stats* stats = sceneView->getCamera()->getStats();
osg::State* state = sceneView->getState();
int frameNumber = state->getFrameStamp()->getFrameNumber();
unsigned int frameNumber = state->getFrameStamp()->getFrameNumber();
if (!_initialized)
{
@ -747,7 +747,7 @@ void Renderer::cull_draw()
osg::Stats* stats = sceneView->getCamera()->getStats();
osg::State* state = sceneView->getState();
const osg::FrameStamp* fs = state->getFrameStamp();
int frameNumber = fs ? fs->getFrameNumber() : 0;
unsigned int frameNumber = fs ? fs->getFrameNumber() : 0;
if (!_initialized)
{

View File

@ -219,7 +219,7 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
}
}
for(int i = viewer->getViewerStats()->getEarliestFrameNumber(); i<= viewer->getViewerStats()->getLatestFrameNumber()-1; ++i)
for(unsigned int i = viewer->getViewerStats()->getEarliestFrameNumber(); i<= viewer->getViewerStats()->getLatestFrameNumber()-1; ++i)
{
for(StatsList::iterator itr = statsList.begin();
itr != statsList.end();
@ -402,7 +402,7 @@ struct RawValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
{
_tickLastUpdated = tick;
int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
unsigned int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
double value;
if (_stats->getAttribute(frameNumber, _attributeName, value))
{
@ -469,7 +469,7 @@ struct CameraSceneStatsTextDrawCallback : public virtual osg::Drawable::DrawCall
viewStr << _camera->getName();
viewStr << std::endl;
int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
unsigned int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
if (!(renderer->getGraphicsThreadDoesCull()))
{
--frameNumber;
@ -556,7 +556,7 @@ struct ViewSceneStatsTextDrawCallback : public virtual osg::Drawable::DrawCallba
viewStr << ": " << _view->getName();
viewStr << std::endl;
int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
unsigned int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
// if (!(renderer->getGraphicsThreadDoesCull()))
{
--frameNumber;
@ -625,7 +625,6 @@ struct BlockDrawCallback : public virtual osg::Drawable::DrawCallback
osg::Vec3Array* vertices = (osg::Vec3Array*)geom->getVertexArray();
int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
int startFrame = frameNumber + _frameDelta - _numFrames + 1;
int endFrame = frameNumber + _frameDelta;
double referenceTime;
@ -755,7 +754,7 @@ protected:
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray());
if (!vertices) return;
int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
unsigned int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
// Get stats
double value;
@ -837,11 +836,11 @@ protected:
const float _max;
const std::string _nameBegin;
const std::string _nameEnd;
static int _frameNumber;
static unsigned int _frameNumber;
};
};
int StatsGraph::GraphUpdateCallback::_frameNumber = 0;
unsigned int StatsGraph::GraphUpdateCallback::_frameNumber = 0;
osg::Geometry* StatsHandler::createGeometry(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numBlocks)

View File

@ -569,7 +569,7 @@ void Viewer::advance(double simulationTime)
if (_done) return;
double prevousReferenceTime = _frameStamp->getReferenceTime();
int previousFrameNumber = _frameStamp->getFrameNumber();
unsigned int previousFrameNumber = _frameStamp->getFrameNumber();
_frameStamp->setFrameNumber(_frameStamp->getFrameNumber()+1);

View File

@ -584,10 +584,10 @@ int ViewerBase::run()
realize();
}
const char* str = getenv("OSG_RUN_FRAME_COUNT");
int runTillFrameNumber = str==0 ? -1 : atoi(str);
const char* run_frame_count_str = getenv("OSG_RUN_FRAME_COUNT");
unsigned int runTillFrameNumber = run_frame_count_str==0 ? osg::UNINITIALIZED_FRAME_NUMBER : atoi(run_frame_count_str);
while(!done() && (runTillFrameNumber<0 || getViewerFrameStamp()->getFrameNumber()<runTillFrameNumber))
while(!done() && (run_frame_count_str==0 || getViewerFrameStamp()->getFrameNumber()<runTillFrameNumber))
{
double minFrameTime = _runMaxFrameRate>0.0 ? 1.0/_runMaxFrameRate : 0.0;
osg::Timer_t startFrameTick = osg::Timer::instance()->tick();
@ -676,7 +676,7 @@ void ViewerBase::renderingTraversals()
if (getViewerStats() && getViewerStats()->collectStats("scene"))
{
int frameNumber = frameStamp ? frameStamp->getFrameNumber() : 0;
unsigned int frameNumber = frameStamp ? frameStamp->getFrameNumber() : 0;
Views views;
getViews(views);

View File

@ -10,6 +10,6 @@ REGISTER_OBJECT_WRAPPER( OcclusionQueryNode,
{
ADD_BOOL_SERIALIZER( QueriesEnabled, true ); // _enabled
ADD_UINT_SERIALIZER( VisibilityThreshold, 0 ); // _visThreshold
ADD_INT_SERIALIZER( QueryFrameCount, 0 ); // _queryFrameCount
ADD_UINT_SERIALIZER( QueryFrameCount, 0 ); // _queryFrameCount
ADD_BOOL_SERIALIZER( DebugDisplay, false ); // _debugBB
}

View File

@ -139,9 +139,17 @@ REGISTER_OBJECT_WRAPPER( PagedLOD,
// Note: osg::Group is not in the list to prevent recording dynamic loaded children
ADD_USER_SERIALIZER( DatabasePath ); // _databasePath
ADD_INT_SERIALIZER( FrameNumberOfLastTraversal, 0 ); // _frameNumberOfLastTraversal
ADD_UINT_SERIALIZER( FrameNumberOfLastTraversal, 0 ); // _frameNumberOfLastTraversal, note, not required, removed from soversion 70 onwwards, see below
ADD_UINT_SERIALIZER( NumChildrenThatCannotBeExpired, 0 ); // _numChildrenThatCannotBeExpired
ADD_BOOL_SERIALIZER( DisableExternalChildrenPaging, false ); // _disableExternalChildrenPaging
ADD_USER_SERIALIZER( RangeDataList ); // _perRangeDataList
ADD_USER_SERIALIZER( Children ); // _children (which are not loaded from external)
UPDATE_TO_VERSION( 70 )
{
REMOVE_SERIALIZER( FrameNumberOfLastTraversal );
}
}