ac2bdbda30
2) cleaned up osg::Timer, still in progress. My intent has been to pave the way for support for other OS's. 3) new osg::FrameStamp class which has a frame number, reference time for each frame to be app, culled and drawn. The FrameStamp also can be passed to other machines (i.e. cluster) and the FrameStamp can be used with the slaves own app,cull and draw. I've also added the beginings of a calander time data to the FrameStamp to allow time or day and year to be used in setting up position of sun/moon etc. etc. 4) The osg::State now has contains a pointer to the last applied osg::Camera and the current osg::FrameStamp, so that drawables can use both pieces of information for creating effects such CLOD, earth/sky etc. The osg::NodeVisitor also now allows you to attach a FrameStamp to support syncronization of actions on the scene graph.
67 lines
2.2 KiB
Plaintext
67 lines
2.2 KiB
Plaintext
#ifndef OSG_FRAMESTAMP
|
|
#define OSG_FRAMESTAMP 1
|
|
|
|
#include <osg/Referenced>
|
|
|
|
#include <ctime>
|
|
|
|
namespace osg
|
|
{
|
|
|
|
/** Class which encapsulates the frame number, reference time and calander
|
|
* time of specific frame, used to synchonize operations on the scene graph
|
|
* and other machines when using a graphics cluster. Note the calander
|
|
* time can be an artificial simulation time or capture the real time
|
|
* of day etc.*/
|
|
class SG_EXPORT FrameStamp : public Referenced
|
|
{
|
|
public:
|
|
|
|
FrameStamp();
|
|
FrameStamp(const FrameStamp& fs);
|
|
~FrameStamp();
|
|
|
|
FrameStamp& operator = (const FrameStamp& fs);
|
|
|
|
void setFrameNumber(int fnum) { _frameNumber = fnum; }
|
|
int getFrameNumber() const { return _frameNumber; }
|
|
|
|
void setReferenceTime(double refTime) { _referenceTime = refTime; }
|
|
double getReferenceTime() const { return _referenceTime; }
|
|
|
|
void setCalanderTime(const tm& calanderTime);
|
|
void getCalanderTime(tm& calanderTime) const;
|
|
|
|
protected:
|
|
|
|
// note no dynamic memory is used so that data can be passed
|
|
// via a simple memory copy or within a data packet across
|
|
// the network.
|
|
|
|
int _frameNumber;
|
|
double _referenceTime;
|
|
|
|
|
|
// member varaibles of time.h's tm structure, copied here to
|
|
// ensure that all data is no dynamic. The tm structure itself
|
|
// is not completely consistent betweem implementations, which
|
|
// could be a problem when sending the FrameStamp across a network
|
|
// with differnt versions of tm (i.e mixing Unix and Windows.)
|
|
int tm_sec; /* Seconds. [0-60] (1 leap second) */
|
|
int tm_min; /* Minutes. [0-59] */
|
|
int tm_hour; /* Hours. [0-23] */
|
|
int tm_mday; /* Day. [1-31] */
|
|
int tm_mon; /* Month. [0-11] */
|
|
int tm_year; /* Year - 1900. */
|
|
int tm_wday; /* Day of week. [0-6] */
|
|
int tm_yday; /* Days in year. [0-365] */
|
|
int tm_isdst; /* DST. [-1/0/1]*/
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
#endif
|