Added osg::FrameStamp::set/getSimulationTime().

Added setting of osg_SimulationTime and osg_DeltaSimulationTime to the uniforms set by SceneView

Added frame(double simulationTime) and advance(double simulationTime) parameters to
osgViewer::SimpleViewer, Vewer and CompositeViewer.

Updated various examples and Nodes to use SimulationTime where appropriate.
This commit is contained in:
Robert Osfield
2007-01-25 12:02:51 +00:00
parent 13dd5acb63
commit 7232a831da
48 changed files with 321 additions and 138 deletions

View File

@@ -72,7 +72,7 @@ void DOFTransform::traverse(osg::NodeVisitor& nv)
// can be shared between multiple parents.
if ((nv.getTraversalNumber()!=_previousTraversalNumber) && nv.getFrameStamp())
{
double newTime = nv.getFrameStamp()->getReferenceTime();
double newTime = nv.getFrameStamp()->getSimulationTime();
animate((float)(newTime-_previousTime));

View File

@@ -20,8 +20,8 @@ using namespace osgSim;
LightPointDrawable::LightPointDrawable():
osg::Drawable(),
_endian(osg::getCpuByteOrder()),
_referenceTime(0.0),
_referenceTimeInterval(0.0)
_simulationTime(0.0),
_simulationTimeInterval(0.0)
{
setSupportsDisplayList(false);
@@ -45,8 +45,8 @@ LightPointDrawable::LightPointDrawable():
LightPointDrawable::LightPointDrawable(const LightPointDrawable& lpd,const osg::CopyOp& copyop):
osg::Drawable(lpd,copyop),
_referenceTime(lpd._referenceTime),
_referenceTimeInterval(lpd._referenceTimeInterval),
_simulationTime(lpd._simulationTime),
_simulationTimeInterval(lpd._simulationTimeInterval),
_sizedOpaqueLightPointList(lpd._sizedOpaqueLightPointList),
_sizedAdditiveLightPointList(lpd._sizedAdditiveLightPointList),
_sizedBlendedLightPointList(lpd._sizedBlendedLightPointList)

View File

@@ -83,20 +83,20 @@ class OSGSIM_EXPORT LightPointDrawable : public osg::Drawable
virtual void drawImplementation(osg::State& state) const;
void setReferenceTime(double time)
void setSimulationTime(double time)
{
_referenceTime = time;
_referenceTimeInterval = 0.0;
_simulationTime = time;
_simulationTimeInterval = 0.0;
}
void updateReferenceTime(double time)
void updateSimulationTime(double time)
{
_referenceTimeInterval = osg::clampAbove(time-_referenceTime,0.0);
_referenceTime = time;
_simulationTimeInterval = osg::clampAbove(time-_simulationTime,0.0);
_simulationTime = time;
}
double getReferenceTime() const { return _referenceTime; }
double getReferenceTimeInterval() const { return _referenceTimeInterval; }
double getSimulationTime() const { return _simulationTime; }
double getSimulationTimeInterval() const { return _simulationTimeInterval; }
virtual osg::BoundingBox computeBound() const;
@@ -106,8 +106,8 @@ class OSGSIM_EXPORT LightPointDrawable : public osg::Drawable
osg::Endian _endian;
double _referenceTime;
double _referenceTimeInterval;
double _simulationTime;
double _simulationTimeInterval;
typedef std::vector<ColorPosition> LightPointList;
typedef std::vector<LightPointList> SizedLightPointList;

View File

@@ -200,7 +200,7 @@ void LightPointNode::traverse(osg::NodeVisitor& nv)
if (cv->getFrameStamp())
{
drawable->setReferenceTime(cv->getFrameStamp()->getReferenceTime());
drawable->setSimulationTime(cv->getFrameStamp()->getSimulationTime());
}
}
@@ -224,7 +224,7 @@ void LightPointNode::traverse(osg::NodeVisitor& nv)
// need to update the drawable's frame count.
if (cv->getFrameStamp())
{
drawable->updateReferenceTime(cv->getFrameStamp()->getReferenceTime());
drawable->updateSimulationTime(cv->getFrameStamp()->getSimulationTime());
}
}
@@ -246,8 +246,8 @@ void LightPointNode::traverse(osg::NodeVisitor& nv)
const float minimumIntensity = 1.0f/256.0f;
const osg::Vec3 eyePoint = cv->getEyeLocal();
double time=drawable->getReferenceTime();
double timeInterval=drawable->getReferenceTimeInterval();
double time=drawable->getSimulationTime();
double timeInterval=drawable->getSimulationTimeInterval();
const osg::Polytope clipvol(cv->getCurrentCullingSet().getFrustum());
const bool computeClipping = false;//(clipvol.getCurrentMask()!=0);