X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Fviewer.hxx;h=107401a373fa572b73e82251c09718a63caaa104;hb=e2dd3ac3e5682a47200f668343f91a617382f3fb;hp=087b59c75dd23b5d528178b4e0aadba3b5cd2e5b;hpb=f24b6a4098c79a1c47d6dfba97e959fb0e7c6d38;p=flightgear.git diff --git a/src/Main/viewer.hxx b/src/Main/viewer.hxx index 087b59c75..107401a37 100644 --- a/src/Main/viewer.hxx +++ b/src/Main/viewer.hxx @@ -35,6 +35,10 @@ #include // plib include +#define FG_FOV_MIN 0.1 +#define FG_FOV_MAX 179.9 + + // Define a structure containing view information class FGViewer { @@ -55,9 +59,16 @@ protected: fgViewType _type; + // the field of view in the x (width) direction + double fov; + + // ratio of x and y fov's; fov(y) = fov(x) * win_ratio + double win_ratio; + // the current view offset angle from forward (rotated about the // view_up vector) double view_offset; + bool reverse_view_offset; // the goal view offset angle (used for smooth view changes) double goal_view_offset; @@ -79,6 +90,9 @@ protected: // translated to scenery.center sgVec3 zero_elev; + // height ASL of the terrain for our current view position + // (future?) double ground_elev; + // pilot offset from center of gravity. The X axis is positive // out the tail, Y is out the right wing, and Z is positive up. // Distances in meters of course. @@ -102,7 +116,7 @@ protected: inline void set_clean() { dirty = false; } // Update the view volume, position, and orientation - virtual void update(); + virtual void update() = 0; public: @@ -115,6 +129,8 @@ public: ////////////////////////////////////////////////////////////////////// // setter functions ////////////////////////////////////////////////////////////////////// + inline void set_fov( double amount ) { fov = amount; } + inline void set_win_ratio( double r ) { win_ratio = r; } inline void set_view_offset( double a ) { set_dirty(); view_offset = a; @@ -126,6 +142,15 @@ public: inline void set_goal_view_offset( double a) { set_dirty(); goal_view_offset = a; + while ( goal_view_offset < 0 ) { + goal_view_offset += 360.0; + } + while ( goal_view_offset > 360.0 ) { + goal_view_offset -= 360.0; + } + } + inline void set_reverse_view_offset( bool val ) { + reverse_view_offset = val; } inline void set_geod_view_pos( double lon, double lat, double alt ) { // data should be in radians and meters asl @@ -150,7 +175,10 @@ public: inline int get_type() const { return _type ; } inline int is_a( int t ) const { return get_type() == t ; } inline bool is_dirty() const { return dirty; } + inline double get_fov() const { return fov; } + inline double get_win_ratio() const { return win_ratio; } inline double get_view_offset() const { return view_offset; } + inline bool get_reverse_view_offset() const { return reverse_view_offset; } inline double get_goal_view_offset() const { return goal_view_offset; } inline double *get_geod_view_pos() { return geod_view_pos; } inline float *get_pilot_offset() { return pilot_offset; } @@ -171,6 +199,11 @@ public: if ( dirty ) { update(); } return zero_elev; } + // (future?) + // inline double get_ground_elev() { + // if ( dirty ) { update(); } + // return ground_elev; + // } inline float *get_surface_south() { if ( dirty ) { update(); } return surface_south;