]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/views.hxx
Updated to support new weather subsystem (visibility variable determins
[flightgear.git] / src / Main / views.hxx
index 378bf587617e1695353ce4c4c98fd0aaf57cc8da..764f6fd2c208fb4d28bbd66d5b507c648aecefac 100644 (file)
 # error This library requires C++
 #endif                                   
 
+#include <Include/compiler.h>
+
+#include <list>
+
 #include <sg.h>                        // plib include
 
 #include <FDM/flight.hxx>
 
 #include "options.hxx"
 
+FG_USING_STD(list);
+
+
+class FGMat4Wrapper {
+public:
+    sgMat4 m;
+};
+
+typedef list < FGMat4Wrapper > sgMat4_list;
+typedef sgMat4_list::iterator sgMat4_list_iterator;
+typedef sgMat4_list::const_iterator const_sgMat4_list_iterator;
+
 
 // used in views.cxx and tilemgr.cxx
 #define USE_FAST_FOV_CLIP 
@@ -49,6 +65,12 @@ class FGView {
 
 public:
 
+    enum fgViewMode
+    {
+       FG_VIEW_FIRST_PERSON = 0,
+       FG_VIEW_FOLLOW  = 1
+    };
+
     // the current offset from forward for viewing
     double view_offset;
 
@@ -97,7 +119,7 @@ public:
     Point3D view_pos;
 
     // cartesion coordinates of current lon/lat if at sea level
-    // translated to scenery.center*/
+    // translated to scenery.center
     Point3D cur_zero_elev;
 
     // vector in cartesian coordinates from current position to the
@@ -128,6 +150,7 @@ public:
     // up vector for the view (usually point straight up through the
     // top of the aircraft
     MAT3vec view_up;
+    sgVec3 sgview_up;
 
     // the vector pointing straight out the nose of the aircraft
     MAT3vec view_forward;
@@ -138,22 +161,19 @@ public:
     // Transformation matrix for the view direction offset relative to
     // the AIRCRAFT matrix
     MAT3mat VIEW_OFFSET;
-
-    // Transformation matrix for aircraft coordinates to world
-    // coordinates
-    MAT3mat WORLD;
-
-    // Combined transformation from eye coordinates to world coordinates
-    MAT3mat EYE_TO_WORLD;
-
-    // Inverse of EYE_TO_WORLD which is a transformation from world
-    // coordinates to eye coordinates
-    MAT3mat WORLD_TO_EYE;
+    sgMat4 sgVIEW_OFFSET;
 
     // Current model view matrix;
     GLfloat MODEL_VIEW[16];
 
-    sgMat4 sgLOCAL, sgUP, sgVIEW, sgLARC_TO_SSG;
+    // view mode
+    fgViewMode view_mode;
+
+    // sg versions of our friendly matrices
+    sgMat4 sgLOCAL, sgUP, sgVIEW_ROT, sgTRANS, sgVIEW, sgLARC_TO_SSG;
+
+    // queue of view matrices so we can have a follow view
+    sgMat4_list follow;
 
 public:
 
@@ -166,14 +186,6 @@ public:
     // Initialize a view class
     void Init( void );
 
-    // Basically, this is a modified version of the Mesa gluLookAt()
-    // function that's been modified slightly so we can capture the
-    // result (and use it later) otherwise this all gets calculated in
-    // OpenGL land and we don't have access to the results.
-    void LookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
-                GLdouble centerx, GLdouble centery, GLdouble centerz,
-                GLdouble upx, GLdouble upy, GLdouble upz );
-
     // Update the view volume, position, and orientation
     void UpdateViewParams( void );
 
@@ -184,12 +196,12 @@ public:
     // Update the view parameters
     void UpdateViewMath( FGInterface *f );
 
-    // Update the "World to Eye" transformation matrix
-    void UpdateWorldToEye( FGInterface *f );
-
     // Update the field of view coefficients
     void UpdateFOV( const fgOPTIONS& o );
 
+    // Cycle view mode
+    void cycle_view_mode();
+
     // accessor functions
     inline double get_view_offset() const { return view_offset; }
     inline void set_view_offset( double a ) { view_offset = a; }
@@ -245,7 +257,6 @@ public:
     inline double *get_surface_east() { return surface_east; }
     inline double *get_local_up() { return local_up; }
     inline double *get_view_forward() { return view_forward; }
-    inline const MAT3mat *get_WORLD_TO_EYE() const { return &WORLD_TO_EYE; }
     inline GLfloat *get_MODEL_VIEW() { return MODEL_VIEW; }
 };