]> 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 332176bb3379b98cd9184eee535a919d1c7cc1c4..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 <Math/mat3.h>
 
 #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 
@@ -48,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;
 
@@ -96,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
@@ -127,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;
@@ -137,20 +161,19 @@ public:
     // Transformation matrix for the view direction offset relative to
     // the AIRCRAFT matrix
     MAT3mat VIEW_OFFSET;
+    sgMat4 sgVIEW_OFFSET;
 
-    // Transformation matrix for aircraft coordinates to world
-    // coordinates
-    MAT3mat WORLD;
+    // Current model view matrix;
+    GLfloat MODEL_VIEW[16];
 
-    // Combined transformation from eye coordinates to world coordinates
-    MAT3mat EYE_TO_WORLD;
+    // view mode
+    fgViewMode view_mode;
 
-    // Inverse of EYE_TO_WORLD which is a transformation from world
-    // coordinates to eye coordinates
-    MAT3mat WORLD_TO_EYE;
+    // sg versions of our friendly matrices
+    sgMat4 sgLOCAL, sgUP, sgVIEW_ROT, sgTRANS, sgVIEW, sgLARC_TO_SSG;
 
-    // Current model view matrix;
-    GLfloat MODEL_VIEW[16];
+    // queue of view matrices so we can have a follow view
+    sgMat4_list follow;
 
 public:
 
@@ -163,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 );
 
@@ -181,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; }
@@ -242,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; }
 };