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:
@@ -46,6 +46,9 @@ class OSG_EXPORT FrameStamp : public Referenced
|
||||
void setReferenceTime(double refTime) { _referenceTime = refTime; }
|
||||
double getReferenceTime() const { return _referenceTime; }
|
||||
|
||||
void setSimulationTime(double refTime) { _simulationTime = refTime; }
|
||||
double getSimulationTime() const { return _simulationTime; }
|
||||
|
||||
void setCalendarTime(const tm& calendarTime);
|
||||
void getCalendarTime(tm& calendarTime) const;
|
||||
|
||||
@@ -62,7 +65,7 @@ class OSG_EXPORT FrameStamp : public Referenced
|
||||
|
||||
int _frameNumber;
|
||||
double _referenceTime;
|
||||
|
||||
double _simulationTime;
|
||||
|
||||
// member variables of time.h's tm structure, copied here to
|
||||
// ensure that all data is not dynamic. The tm structure itself
|
||||
|
||||
@@ -133,14 +133,18 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
enum ActiveUniforms
|
||||
{
|
||||
FRAME_NUMBER_UNIFORM = 0x1,
|
||||
FRAME_TIME_UNIFORM = 0x2,
|
||||
DELTA_FRAME_TIME_UNIFORM = 0x4,
|
||||
VIEW_MATRIX_UNIFORM = 0x8,
|
||||
VIEW_MATRIX_INVERSE_UNIFORM = 0x10,
|
||||
FRAME_NUMBER_UNIFORM = 1,
|
||||
FRAME_TIME_UNIFORM = 2,
|
||||
DELTA_FRAME_TIME_UNIFORM = 4,
|
||||
SIMULATION_TIME_UNIFORM = 8,
|
||||
DELTA_SIMULATION_TIME_UNIFORM = 16,
|
||||
VIEW_MATRIX_UNIFORM = 32,
|
||||
VIEW_MATRIX_INVERSE_UNIFORM = 64,
|
||||
DEFAULT_UNIFORMS = FRAME_NUMBER_UNIFORM |
|
||||
FRAME_TIME_UNIFORM |
|
||||
DELTA_FRAME_TIME_UNIFORM |
|
||||
SIMULATION_TIME_UNIFORM |
|
||||
DELTA_SIMULATION_TIME_UNIFORM |
|
||||
VIEW_MATRIX_UNIFORM |
|
||||
VIEW_MATRIX_INVERSE_UNIFORM,
|
||||
ALL_UNIFORMS = 0xFFFFFFFF
|
||||
@@ -505,6 +509,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
int _activeUniforms;
|
||||
double _previousFrameTime;
|
||||
double _previousSimulationTime;
|
||||
|
||||
bool _redrawInterlacedStereoStencilMask;
|
||||
int _interlacedStereoStencilWidth;
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace osgViewer {
|
||||
|
||||
// WARNING ** Under development do not use, yet :-)
|
||||
|
||||
/** CompsiteViewer holds a or more views to a one more scenes.*/
|
||||
class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced
|
||||
{
|
||||
@@ -113,9 +111,9 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced
|
||||
|
||||
/** Render a complete new frame.
|
||||
* Calls advance(), eventTraversal(), updateTraversal(), renderingTraversals(). */
|
||||
virtual void frame();
|
||||
virtual void frame(double simulationTime=USE_REFERENCE_TIME);
|
||||
|
||||
virtual void advance();
|
||||
virtual void advance(double simulationTime=USE_REFERENCE_TIME);
|
||||
|
||||
virtual void eventTraversal();
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#ifndef OSGVIEWER_EXPORT_
|
||||
#define OSGVIEWER_EXPORT_ 1
|
||||
|
||||
#define USE_REFERENCE_TIME DBL_MAX
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
|
||||
@@ -61,9 +61,9 @@ class OSGVIEWER_EXPORT SimpleViewer : public virtual osgViewer::GraphicsWindow
|
||||
/** Render a complete new frame.
|
||||
* Calls frameAdvance(), frameEventTraversal(), frameUpateTraversal(), frameCullTraversal() and frameDrawTraversal().
|
||||
* Note, no internal makeCurrent() is issued before, or swap buffers called after frame(), these operations are the responsibility of the calling code.*/
|
||||
virtual void frame();
|
||||
virtual void frame(double simulationTime=USE_REFERENCE_TIME);
|
||||
|
||||
virtual void advance();
|
||||
virtual void advance(double simulationTime=USE_REFERENCE_TIME);
|
||||
virtual void eventTraversal();
|
||||
virtual void updateTraversal();
|
||||
virtual void renderingTraversal();
|
||||
|
||||
@@ -103,9 +103,9 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
|
||||
|
||||
/** Render a complete new frame.
|
||||
* Calls advance(), eventTraversal(), updateTraversal(), renderingTraversals(). */
|
||||
virtual void frame();
|
||||
virtual void frame(double simulationTime=USE_REFERENCE_TIME);
|
||||
|
||||
virtual void advance();
|
||||
virtual void advance(double simulationTime=USE_REFERENCE_TIME);
|
||||
|
||||
virtual void eventTraversal();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user