]> git.mxchange.org Git - flightgear.git/blobdiff - Main/views.hxx
Modifications to incorporate Jon S. Berndts flight model code.
[flightgear.git] / Main / views.hxx
index 22b5f1c5f03e759c3e114ead0deb3b8253aee8cb..f3de02a8460a341935988c8e2ec79c960a6492b0 100644 (file)
@@ -31,7 +31,7 @@
 #endif                                   
 
 
-#include <Flight/flight.hxx>
+#include <FDM/flight.hxx>
 #include <Math/mat3.h>
 #include <Math/point3d.hxx>
 #include <Time/fg_time.hxx>
@@ -45,7 +45,7 @@
 
 
 // Define a structure containing view information
-class fgVIEW {
+class FGView {
 
 public:
 
@@ -127,6 +127,10 @@ public:
     // Transformation matrix for eye coordinates to aircraft coordinates
     MAT3mat AIRCRAFT;
 
+    // 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;
@@ -141,17 +145,21 @@ public:
     // Current model view matrix;
     GLdouble MODEL_VIEW[16];
 
+public:
+
     // Constructor
-    fgVIEW( void );
+    FGView( void );
+
+    // Destructor
+    ~FGView( void );
 
     // Initialize a view class
     void Init( void );
 
-    void update_globals( fgFLIGHT *f );
-
     // Basically, this is a modified version of the Mesa gluLookAt()
     // function that's been modified slightly so we can capture the
-    // result before sending it off to OpenGL land.
+    // 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 );
@@ -159,27 +167,105 @@ public:
     // Update the view volume, position, and orientation
     void UpdateViewParams( void );
 
+    // Flag to request that UpdateFOV() be called next time
+    // UpdateViewMath() is run.
+    inline void force_update_fov_math() { update_fov = true; }
+
     // Update the view parameters
-    void UpdateViewMath( fgFLIGHT *f );
+    void UpdateViewMath( FGInterface *f );
 
     // Update the "World to Eye" transformation matrix
-    void UpdateWorldToEye(  fgFLIGHT *f );
-
-    // Update the field of view parameters
-    void UpdateFOV( fgOPTIONS *o );
-       
-    // Destructor
-    ~fgVIEW( void );
+    void UpdateWorldToEye( FGInterface *f );
+
+    // Update the field of view coefficients
+    void UpdateFOV( const fgOPTIONS& o );
+
+    // accessor functions
+    inline double get_view_offset() const { return view_offset; }
+    inline void set_view_offset( double a ) { view_offset = a; }
+    inline void inc_view_offset( double amt ) { view_offset += amt; }
+    inline double get_goal_view_offset() const { return goal_view_offset; }
+    inline void set_goal_view_offset( double a) { goal_view_offset = a; }
+    inline double get_win_ratio() const { return win_ratio; }
+    inline void set_win_ratio( double r ) { win_ratio = r; }
+    inline int get_winWidth() const { return winWidth; }
+    inline void set_winWidth( int w ) { winWidth = w; }
+    inline int get_winHeight() const { return winHeight; }
+    inline void set_winHeight( int h ) { winHeight = h; }
+    inline double get_slope_y() const { return slope_y; }
+    inline double get_slope_x() const { return slope_x; }
+#if defined( USE_FAST_FOV_CLIP )
+    inline double get_fov_x_clip() const { return fov_x_clip; }
+    inline double get_fov_y_clip() const { return fov_y_clip; }
+#endif // USE_FAST_FOV_CLIP
+    inline double get_vfc_ratio() const { return vfc_ratio; }
+    inline void set_vfc_ratio(double r) { vfc_ratio = r; }
+    inline int get_tris_rendered() const { return tris_rendered; }
+    inline void set_tris_rendered( int tris) { tris_rendered = tris; }
+    inline Point3D get_abs_view_pos() const { return abs_view_pos; }
+    inline Point3D get_view_pos() const { return view_pos; }
+    inline Point3D get_cur_zero_elev() const { return cur_zero_elev; }
+    inline double *get_to_sun() { return to_sun; }
+    inline void set_to_sun( double x, double y, double z) {
+       to_sun[0] = x;
+       to_sun[1] = y;
+       to_sun[2] = z;
+    }
+    inline double *get_surface_to_sun() { return surface_to_sun; }
+    inline void set_surface_to_sun( double x, double y, double z) {
+       surface_to_sun[0] = x;
+       surface_to_sun[1] = y;
+       surface_to_sun[2] = z;
+    }
+    inline double *get_surface_south() { return surface_south; }
+    inline double *get_surface_east() { return surface_east; }
+    inline double *get_local_up() { return local_up; }
+    inline const MAT3mat *get_WORLD_TO_EYE() const { return &WORLD_TO_EYE; }
+    inline GLdouble *get_MODEL_VIEW() { return MODEL_VIEW; }
 };
 
 
-extern fgVIEW current_view;
+extern FGView current_view;
 
 
 #endif // _VIEWS_HXX
 
 
 // $Log$
+// Revision 1.21  1999/02/05 21:29:15  curt
+// Modifications to incorporate Jon S. Berndts flight model code.
+//
+// Revision 1.20  1999/02/02 20:13:38  curt
+// MSVC++ portability changes by Bernie Bright:
+//
+// Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
+// Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
+// Simulator/Cockpit/hud.cxx: Added Standard headers
+// Simulator/Cockpit/panel.cxx: Redefinition of default parameter
+// Simulator/Flight/flight.cxx: Replaced cout with FG_LOG.  Deleted <stdio.h>
+// Simulator/Main/fg_init.cxx:
+// Simulator/Main/GLUTmain.cxx:
+// Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
+// Simulator/Objects/material.hxx:
+// Simulator/Time/timestamp.hxx: VC++ friend kludge
+// Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
+// Simulator/Main/views.hxx: Added a constant
+//
+// Revision 1.19  1999/02/01 21:33:36  curt
+// Renamed FlightGear/Simulator/Flight to FlightGear/Simulator/FDM since
+// Jon accepted my offer to do this and thought it was a good idea.
+//
+// Revision 1.18  1998/12/11 20:26:30  curt
+// Fixed view frustum culling accuracy bug so we can look out the sides and
+// back without tri-stripes dropping out.
+//
+// Revision 1.17  1998/12/09 18:50:29  curt
+// Converted "class fgVIEW" to "class FGView" and updated to make data
+// members private and make required accessor functions.
+//
+// Revision 1.16  1998/12/05 15:54:25  curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
 // Revision 1.15  1998/10/16 23:27:56  curt
 // C++-ifying.
 //