Modified FGSubsystem::update() to take an int parameter for delta time
(i.e. multiloop). Most subsystems currently ignore the parameter, but eventually, it will allow all subsystems to update by time rather than by framerate.
This commit is contained in:
parent
22c472bb17
commit
2b34388ea6
3 changed files with 56 additions and 1 deletions
|
@ -57,3 +57,51 @@ void FGViewer::update() {
|
|||
// Destructor
|
||||
FGViewer::~FGViewer( void ) {
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::init ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::bind ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::unbind ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::update (int dt)
|
||||
{
|
||||
for ( int i = 0; i < dt; i++ ) {
|
||||
if ( fabs(get_goal_view_offset() - get_view_offset()) < 0.05 ) {
|
||||
set_view_offset( get_goal_view_offset() );
|
||||
break;
|
||||
} else {
|
||||
// move current_view.view_offset towards
|
||||
// current_view.goal_view_offset
|
||||
if ( get_goal_view_offset() > get_view_offset() )
|
||||
{
|
||||
if ( get_goal_view_offset() - get_view_offset() < SGD_PI ){
|
||||
inc_view_offset( 0.01 );
|
||||
} else {
|
||||
inc_view_offset( -0.01 );
|
||||
}
|
||||
} else {
|
||||
if ( get_view_offset() - get_goal_view_offset() < SGD_PI ){
|
||||
inc_view_offset( -0.01 );
|
||||
} else {
|
||||
inc_view_offset( 0.01 );
|
||||
}
|
||||
}
|
||||
if ( get_view_offset() > SGD_2PI ) {
|
||||
inc_view_offset( -SGD_2PI );
|
||||
} else if ( get_view_offset() < 0 ) {
|
||||
inc_view_offset( SGD_2PI );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include <plib/sg.h> // plib include
|
||||
|
||||
#include "fgfs.hxx"
|
||||
|
||||
|
||||
#define FG_FOV_MIN 0.1
|
||||
#define FG_FOV_MAX 179.9
|
||||
|
@ -129,6 +131,11 @@ public:
|
|||
// Destructor
|
||||
virtual ~FGViewer( void );
|
||||
|
||||
virtual void init ();
|
||||
virtual void bind ();
|
||||
virtual void unbind ();
|
||||
virtual void update (int dt);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// setter functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
~FGViewerRPH( void );
|
||||
|
||||
// Initialize a view class
|
||||
void init( void );
|
||||
// void init( void );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// setter functions
|
||||
|
|
Loading…
Add table
Reference in a new issue