]> git.mxchange.org Git - flightgear.git/commitdiff
Modified FGSubsystem::update() to take an int parameter for delta time
authordavid <david>
Sat, 22 Dec 2001 23:18:28 +0000 (23:18 +0000)
committerdavid <david>
Sat, 22 Dec 2001 23:18:28 +0000 (23:18 +0000)
(i.e. multiloop).  Most subsystems currently ignore the parameter, but
eventually, it will allow all subsystems to update by time rather than
by framerate.

src/Main/viewer.cxx
src/Main/viewer.hxx
src/Main/viewer_rph.hxx

index b723733ffd771c25d8ab8ae2b3c52a426a694cc3..c13e17806cd80f35813c9bb469890e574aa58357 100644 (file)
@@ -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 );
+      }
+    }
+  }
+}
index ccb51e5c0665900a639503dda26dc835457a0409..e5307f3de3e633bd027c6bd3e2c8d4b4faa9274a 100644 (file)
@@ -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
     //////////////////////////////////////////////////////////////////////
index fc8a580a59b0e5245c1402b9f084fdcc4151eec8..dbd4cbb7a540c99df538168335b04d750cafc208 100644 (file)
@@ -69,7 +69,7 @@ public:
     ~FGViewerRPH( void );
 
     // Initialize a view class
-    void init( void );
+//      void init( void );
 
     //////////////////////////////////////////////////////////////////////
     // setter functions