X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Fviewer.hxx;h=7005e661ff6b029f44e08a70b48855a058d4b872;hb=658715f90b19e3d99fed48e01f7f4fc13842b25f;hp=2e46afba6c03a77cb4a1cb56551d2df4c1fe7311;hpb=7e5d6d1d75e56f3537acbf28230dd307da965d96;p=flightgear.git diff --git a/src/Main/viewer.hxx b/src/Main/viewer.hxx index 2e46afba6..7005e661f 100644 --- a/src/Main/viewer.hxx +++ b/src/Main/viewer.hxx @@ -25,19 +25,19 @@ #ifndef _VIEWER_HXX -#define _VIEWER_HXX +#define _VIEWER_HXX +namespace flightgear +{ +class CameraGroup; +} -#ifndef __cplusplus -# error This library requires C++ -#endif +#include #include #include #include -#include - -#include // plib include +#include #define FG_FOV_MIN 0.1 #define FG_FOV_MAX 179.9 @@ -98,23 +98,12 @@ public: // pilot view, model in model view). // FIXME: the model view position (ie target positions) // should be in the model class. - virtual double getLongitude_deg () const { return _lon_deg; } - virtual double getLatitude_deg () const { return _lat_deg; } - virtual double getAltitudeASL_ft () const { return _alt_ft; } - virtual void setLongitude_deg (double lon_deg); - virtual void setLatitude_deg (double lat_deg); - virtual void setAltitude_ft (double alt_ft); virtual void setPosition (double lon_deg, double lat_deg, double alt_ft); + const SGGeod& getPosition() const { return _position; } // Reference geodetic target position... - virtual double getTargetLongitude_deg () const { return _target_lon_deg; } - virtual double getTargetLatitude_deg () const { return _target_lat_deg; } - virtual double getTargetAltitudeASL_ft () const { return _target_alt_ft; } - virtual void setTargetLongitude_deg (double lon_deg); - virtual void setTargetLatitude_deg (double lat_deg); - virtual void setTargetAltitude_ft (double alt_ft); virtual void setTargetPosition (double lon_deg, double lat_deg, double alt_ft); - + const SGGeod& getTargetPosition() const { return _target; } @@ -130,6 +119,7 @@ public: // orientation rotations listed below. This has the effect of the // eye moving around and "looking at" the object (model) from // different angles. + virtual SGVec3d getOffset_m () const { return _offset_m; } virtual double getXOffset_m () const { return _offset_m.x(); } virtual double getYOffset_m () const { return _offset_m.y(); } virtual double getZOffset_m () const { return _offset_m.z(); } @@ -209,21 +199,10 @@ public: // Vectors and positions... - // Get zero view_pos - const SGVec3f& get_view_pos() {if ( _dirty ) { recalc(); } return _view_pos; } - // Get the absolute view position in fgfs coordinates. - virtual double * get_absolute_view_pos (); - // Get zero elev - const SGVec3f& get_zero_elev() {if ( _dirty ) { recalc(); } return _zero_elev; } - // Get world up vector - const SGVec3f& get_world_up() {if ( _dirty ) { recalc(); } return _world_up; } - // Get surface east vector - const SGVec3f& get_surface_east() { if ( _dirty ) { recalc(); } return _surface_east; } - // Get surface south vector - const SGVec3f& get_surface_south() {if ( _dirty ) { recalc(); } return _surface_south; } - + const SGVec3d& get_view_pos() { if ( _dirty ) { recalc(); } return _absolute_view_pos; } const SGVec3d& getViewPosition() { if ( _dirty ) { recalc(); } return _absolute_view_pos; } const SGQuatd& getViewOrientation() { if ( _dirty ) { recalc(); } return mViewOrientation; } + const SGQuatd& getViewOrientationOffset() { if ( _dirty ) { recalc(); } return mViewOffsetOr; } ////////////////////////////////////////////////////////////////////// // Part 4: View and frustrum data setters and getters @@ -260,10 +239,6 @@ public: inline void set_dirty() { _dirty = true; } inline void set_clean() { _dirty = false; } - // return eye location... - virtual SGLocation * getSGLocation () const { return _location; } - - private: ////////////////////////////////////////////////////////////////// @@ -274,15 +249,11 @@ private: bool _dirty; SGQuatd mViewOrientation; + SGQuatd mViewOffsetOr; SGVec3d _absolute_view_pos; - SGVec3f _relative_view_pos; - double _lon_deg; - double _lat_deg; - double _alt_ft; - double _target_lon_deg; - double _target_lat_deg; - double _target_alt_ft; + SGGeod _position; + SGGeod _target; double _roll_deg; double _pitch_deg; @@ -336,40 +307,20 @@ private: bool _at_model; int _at_model_index; // number of model (for multi model) - SGLocation * _location; - SGLocation * _target_location; - // the nominal field of view (angle, in degrees) double _fov_deg; // Ratio of window width and height; height = width * // aspect_ratio. This value is automatically calculated based on // window dimentions. - double _aspect_ratio; + double _aspect_ratio; // default = 1.0, this value is user configurable and is // multiplied into the aspect_ratio to get the actual vertical fov double _aspect_ratio_multiplier; - // view position in opengl world coordinates (this is the - // abs_view_pos translated to scenery.center) - SGVec3f _view_pos; - - // cartesion coordinates of current lon/lat if at sea level - // translated to scenery.center - SGVec3f _zero_elev; - - // surface vector heading south - SGVec3f _surface_south; - - // surface vector heading east (used to unambiguously align sky - // with sun) - SGVec3f _surface_east; - - // world up vector (normal to the plane tangent to the earth's - // surface at the spot we are directly above - SGVec3f _world_up; - + // camera group controled by this view + osg::ref_ptr _cameraGroup; ////////////////////////////////////////////////////////////////// // private functions // //////////////////////////////////////////////////////////////////