Re-Name FGViewer to flightgear::View
- avoids confusion with osgViewer and fgviewer application. (source files to be renamed in a follow-up commit)
This commit is contained in:
parent
e60d9a191e
commit
02ff854603
10 changed files with 127 additions and 115 deletions
|
@ -213,7 +213,7 @@ void HUD::draw(osg::State&)
|
|||
void HUD::draw3D()
|
||||
{
|
||||
using namespace osg;
|
||||
FGViewer* view = globals->get_current_view();
|
||||
flightgear::View* view = globals->get_current_view();
|
||||
|
||||
// Standard fgfs projection, with essentially meaningless clip
|
||||
// planes (we'll map the whole HUD plane to z=-1)
|
||||
|
|
|
@ -87,7 +87,7 @@ void HUD::Runway::draw()
|
|||
// double po = curr_view->getPitchOffset_deg();
|
||||
// double ho = curr_view->getHeadingOffset_deg();
|
||||
|
||||
FGViewer* cockpitView = globals->get_viewmgr()->get_view(0);
|
||||
flightgear::View* cockpitView = globals->get_viewmgr()->get_view(0);
|
||||
|
||||
double yaw = -(cockpitView->getHeadingOffset_deg() - _default_heading) * SG_DEGREES_TO_RADIANS;
|
||||
double pitch = (cockpitView->getPitchOffset_deg() - _default_pitch) * SG_DEGREES_TO_RADIANS;
|
||||
|
|
|
@ -701,7 +701,7 @@ FGViewMgr *FGGlobals::get_viewmgr() const
|
|||
return get_subsystem<FGViewMgr>();
|
||||
}
|
||||
|
||||
FGViewer* FGGlobals::get_current_view () const
|
||||
flightgear::View* FGGlobals::get_current_view () const
|
||||
{
|
||||
FGViewMgr* vm = get_viewmgr();
|
||||
return vm ? vm->get_current_view() : 0;
|
||||
|
|
|
@ -61,13 +61,17 @@ class FGRouteMgr;
|
|||
class FGScenery;
|
||||
class FGTileMgr;
|
||||
class FGViewMgr;
|
||||
class FGViewer;
|
||||
class FGRenderer;
|
||||
|
||||
namespace simgear { namespace pkg {
|
||||
class Root;
|
||||
}}
|
||||
|
||||
namespace flightgear
|
||||
{
|
||||
class View;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bucket for subsystem pointers representing the sim's state.
|
||||
*/
|
||||
|
@ -317,7 +321,7 @@ public:
|
|||
}
|
||||
|
||||
FGViewMgr *get_viewmgr() const;
|
||||
FGViewer *get_current_view() const;
|
||||
flightgear::View *get_current_view() const;
|
||||
|
||||
FGControls *get_controls() const;
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ void CameraGroup::update(const osg::Vec3d& position,
|
|||
|
||||
Camera* camera = info->getCamera(MAIN_CAMERA);
|
||||
if ( camera ) {
|
||||
const View::Slave& slave = _viewer->getSlave(info->getMainSlaveIndex());
|
||||
const osg::View::Slave& slave = _viewer->getSlave(info->getMainSlaveIndex());
|
||||
|
||||
Matrix viewMatrix;
|
||||
if (info->flags & GUI) {
|
||||
|
@ -515,7 +515,7 @@ void CameraGroup::update(const osg::Vec3d& position,
|
|||
|
||||
Camera* camera = ii->second.camera.get();
|
||||
int slaveIndex = ii->second.slaveIndex;
|
||||
const View::Slave& slave = _viewer->getSlave(slaveIndex);
|
||||
const osg::View::Slave& slave = _viewer->getSlave(slaveIndex);
|
||||
|
||||
if ( !viewDone ) {
|
||||
if ((info->flags & VIEW_ABSOLUTE) != 0)
|
||||
|
|
|
@ -1618,7 +1618,7 @@ FGRenderer::update( ) {
|
|||
// initializations and are running the main loop, so this will
|
||||
// now work without seg faulting the system.
|
||||
|
||||
FGViewer *current__view = globals->get_current_view();
|
||||
flightgear::View *current__view = globals->get_current_view();
|
||||
// Force update of center dependent values ...
|
||||
current__view->set_dirty();
|
||||
|
||||
|
@ -2072,7 +2072,7 @@ bool printVisibleSceneInfo(FGRenderer* renderer)
|
|||
VisibleSceneInfoVistor vsv;
|
||||
Viewport* vp = 0;
|
||||
if (!viewer->getCamera()->getViewport() && viewer->getNumSlaves() > 0) {
|
||||
const View::Slave& slave = viewer->getSlave(0);
|
||||
const osg::View::Slave& slave = viewer->getSlave(0);
|
||||
vp = slave._camera->getViewport();
|
||||
}
|
||||
vsv.doTraversal(viewer->getCamera(), viewer->getSceneData(), vp);
|
||||
|
|
|
@ -48,7 +48,7 @@ using namespace flightgear;
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Constructor...
|
||||
FGViewer::FGViewer( ViewType Type, bool from_model, int from_model_index,
|
||||
View::View( ViewType Type, bool from_model, int from_model_index,
|
||||
bool at_model, int at_model_index,
|
||||
double damp_roll, double damp_pitch, double damp_heading,
|
||||
double x_offset_m, double y_offset_m, double z_offset_m,
|
||||
|
@ -111,26 +111,26 @@ FGViewer::FGViewer( ViewType Type, bool from_model, int from_model_index,
|
|||
|
||||
|
||||
// Destructor
|
||||
FGViewer::~FGViewer( void ) {
|
||||
View::~View( void ) {
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::init ()
|
||||
View::init ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::bind ()
|
||||
View::bind ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::unbind ()
|
||||
View::unbind ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setType ( int type )
|
||||
View::setType ( int type )
|
||||
{
|
||||
if (type == 0)
|
||||
_type = FG_LOOKFROM;
|
||||
|
@ -139,48 +139,48 @@ FGViewer::setType ( int type )
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::setInternal ( bool internal )
|
||||
View::setInternal ( bool internal )
|
||||
{
|
||||
_internal = internal;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setPosition (double lon_deg, double lat_deg, double alt_ft)
|
||||
View::setPosition (double lon_deg, double lat_deg, double alt_ft)
|
||||
{
|
||||
_dirty = true;
|
||||
_position = SGGeod::fromDegFt(lon_deg, lat_deg, alt_ft);
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setTargetPosition (double lon_deg, double lat_deg, double alt_ft)
|
||||
View::setTargetPosition (double lon_deg, double lat_deg, double alt_ft)
|
||||
{
|
||||
_dirty = true;
|
||||
_target = SGGeod::fromDegFt(lon_deg, lat_deg, alt_ft);
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setRoll_deg (double roll_deg)
|
||||
View::setRoll_deg (double roll_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_roll_deg = roll_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setPitch_deg (double pitch_deg)
|
||||
View::setPitch_deg (double pitch_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_pitch_deg = pitch_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setHeading_deg (double heading_deg)
|
||||
View::setHeading_deg (double heading_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_heading_deg = heading_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setOrientation (double roll_deg, double pitch_deg, double heading_deg)
|
||||
View::setOrientation (double roll_deg, double pitch_deg, double heading_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_roll_deg = roll_deg;
|
||||
|
@ -189,28 +189,28 @@ FGViewer::setOrientation (double roll_deg, double pitch_deg, double heading_deg)
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::setTargetRoll_deg (double target_roll_deg)
|
||||
View::setTargetRoll_deg (double target_roll_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_target_roll_deg = target_roll_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setTargetPitch_deg (double target_pitch_deg)
|
||||
View::setTargetPitch_deg (double target_pitch_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_target_pitch_deg = target_pitch_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setTargetHeading_deg (double target_heading_deg)
|
||||
View::setTargetHeading_deg (double target_heading_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_target_heading_deg = target_heading_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setTargetOrientation (double target_roll_deg, double target_pitch_deg, double target_heading_deg)
|
||||
View::setTargetOrientation (double target_roll_deg, double target_pitch_deg, double target_heading_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_target_roll_deg = target_roll_deg;
|
||||
|
@ -219,49 +219,49 @@ FGViewer::setTargetOrientation (double target_roll_deg, double target_pitch_deg,
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::setXOffset_m (double x_offset_m)
|
||||
View::setXOffset_m (double x_offset_m)
|
||||
{
|
||||
_dirty = true;
|
||||
_offset_m.x() = x_offset_m;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setYOffset_m (double y_offset_m)
|
||||
View::setYOffset_m (double y_offset_m)
|
||||
{
|
||||
_dirty = true;
|
||||
_offset_m.y() = y_offset_m;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setZOffset_m (double z_offset_m)
|
||||
View::setZOffset_m (double z_offset_m)
|
||||
{
|
||||
_dirty = true;
|
||||
_offset_m.z() = z_offset_m;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setTargetXOffset_m (double target_x_offset_m)
|
||||
View::setTargetXOffset_m (double target_x_offset_m)
|
||||
{
|
||||
_dirty = true;
|
||||
_target_offset_m.x() = target_x_offset_m;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setTargetYOffset_m (double target_y_offset_m)
|
||||
View::setTargetYOffset_m (double target_y_offset_m)
|
||||
{
|
||||
_dirty = true;
|
||||
_target_offset_m.y() = target_y_offset_m;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setTargetZOffset_m (double target_z_offset_m)
|
||||
View::setTargetZOffset_m (double target_z_offset_m)
|
||||
{
|
||||
_dirty = true;
|
||||
_target_offset_m.z() = target_z_offset_m;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setPositionOffsets (double x_offset_m, double y_offset_m, double z_offset_m)
|
||||
View::setPositionOffsets (double x_offset_m, double y_offset_m, double z_offset_m)
|
||||
{
|
||||
_dirty = true;
|
||||
_offset_m.x() = x_offset_m;
|
||||
|
@ -270,21 +270,21 @@ FGViewer::setPositionOffsets (double x_offset_m, double y_offset_m, double z_off
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::setRollOffset_deg (double roll_offset_deg)
|
||||
View::setRollOffset_deg (double roll_offset_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_roll_offset_deg = roll_offset_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setPitchOffset_deg (double pitch_offset_deg)
|
||||
View::setPitchOffset_deg (double pitch_offset_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_pitch_offset_deg = pitch_offset_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setHeadingOffset_deg (double heading_offset_deg)
|
||||
View::setHeadingOffset_deg (double heading_offset_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
if (_at_model && (_offset_m.x() == 0.0)&&(_offset_m.z() == 0.0))
|
||||
|
@ -298,14 +298,14 @@ FGViewer::setHeadingOffset_deg (double heading_offset_deg)
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::setGoalRollOffset_deg (double goal_roll_offset_deg)
|
||||
View::setGoalRollOffset_deg (double goal_roll_offset_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_goal_roll_offset_deg = goal_roll_offset_deg;
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::setGoalPitchOffset_deg (double goal_pitch_offset_deg)
|
||||
View::setGoalPitchOffset_deg (double goal_pitch_offset_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_goal_pitch_offset_deg = goal_pitch_offset_deg;
|
||||
|
@ -323,7 +323,7 @@ FGViewer::setGoalPitchOffset_deg (double goal_pitch_offset_deg)
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::setGoalHeadingOffset_deg (double goal_heading_offset_deg)
|
||||
View::setGoalHeadingOffset_deg (double goal_heading_offset_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
if (_at_model && (_offset_m.x() == 0.0)&&(_offset_m.z() == 0.0))
|
||||
|
@ -344,7 +344,7 @@ FGViewer::setGoalHeadingOffset_deg (double goal_heading_offset_deg)
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::setOrientationOffsets (double roll_offset_deg, double pitch_offset_deg, double heading_offset_deg)
|
||||
View::setOrientationOffsets (double roll_offset_deg, double pitch_offset_deg, double heading_offset_deg)
|
||||
{
|
||||
_dirty = true;
|
||||
_roll_offset_deg = roll_offset_deg;
|
||||
|
@ -356,7 +356,7 @@ FGViewer::setOrientationOffsets (double roll_offset_deg, double pitch_offset_deg
|
|||
// cached data "dirty") on the next "get". It calculates all the outputs
|
||||
// for viewer.
|
||||
void
|
||||
FGViewer::recalc ()
|
||||
View::recalc ()
|
||||
{
|
||||
if (_type == FG_LOOKFROM) {
|
||||
recalcLookFrom();
|
||||
|
@ -369,7 +369,7 @@ FGViewer::recalc ()
|
|||
|
||||
// recalculate for LookFrom view type...
|
||||
void
|
||||
FGViewer::recalcLookFrom ()
|
||||
View::recalcLookFrom ()
|
||||
{
|
||||
// Update location data ...
|
||||
if ( _from_model ) {
|
||||
|
@ -414,7 +414,7 @@ FGViewer::recalcLookFrom ()
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::recalcLookAt ()
|
||||
View::recalcLookAt ()
|
||||
{
|
||||
// The geodetic position of our target to look at
|
||||
if ( _at_model ) {
|
||||
|
@ -481,13 +481,13 @@ FGViewer::recalcLookAt ()
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::setDampTarget(double roll, double pitch, double heading)
|
||||
View::setDampTarget(double roll, double pitch, double heading)
|
||||
{
|
||||
_dampTarget = SGVec3d(roll, pitch, heading);
|
||||
}
|
||||
|
||||
void
|
||||
FGViewer::getDampOutput(double& roll, double& pitch, double& heading)
|
||||
View::getDampOutput(double& roll, double& pitch, double& heading)
|
||||
{
|
||||
roll = _dampOutput[0];
|
||||
pitch = _dampOutput[1];
|
||||
|
@ -496,9 +496,9 @@ FGViewer::getDampOutput(double& roll, double& pitch, double& heading)
|
|||
|
||||
|
||||
void
|
||||
FGViewer::updateDampOutput(double dt)
|
||||
View::updateDampOutput(double dt)
|
||||
{
|
||||
static FGViewer *last_view = 0;
|
||||
static View *last_view = 0;
|
||||
if ((last_view != this) || (dt > 1.0)) {
|
||||
_dampOutput = _dampTarget;
|
||||
last_view = this;
|
||||
|
@ -531,7 +531,7 @@ FGViewer::updateDampOutput(double dt)
|
|||
}
|
||||
|
||||
double
|
||||
FGViewer::get_h_fov()
|
||||
View::get_h_fov()
|
||||
{
|
||||
double aspectRatio = get_aspect_ratio();
|
||||
switch (_scaling_type) {
|
||||
|
@ -557,7 +557,7 @@ FGViewer::get_h_fov()
|
|||
|
||||
|
||||
double
|
||||
FGViewer::get_v_fov()
|
||||
View::get_v_fov()
|
||||
{
|
||||
double aspectRatio = get_aspect_ratio();
|
||||
switch (_scaling_type) {
|
||||
|
@ -584,7 +584,7 @@ FGViewer::get_v_fov()
|
|||
}
|
||||
|
||||
void
|
||||
FGViewer::update (double dt)
|
||||
View::update (double dt)
|
||||
{
|
||||
updateDampOutput(dt);
|
||||
|
||||
|
@ -664,7 +664,7 @@ FGViewer::update (double dt)
|
|||
recalc();
|
||||
}
|
||||
|
||||
double FGViewer::get_aspect_ratio() const
|
||||
double View::get_aspect_ratio() const
|
||||
{
|
||||
return flightgear::CameraGroup::getDefault()->getMasterAspectRatio();
|
||||
}
|
||||
|
|
|
@ -36,8 +36,11 @@
|
|||
#define FG_FOV_MIN 0.1
|
||||
#define FG_FOV_MAX 179.9
|
||||
|
||||
namespace flightgear
|
||||
{
|
||||
|
||||
// Define a structure containing view information
|
||||
class FGViewer : public SGSubsystem {
|
||||
class View : public SGSubsystem {
|
||||
|
||||
public:
|
||||
|
||||
|
@ -55,7 +58,7 @@ public:
|
|||
|
||||
|
||||
// Constructor
|
||||
FGViewer( ViewType Type, bool from_model, int from_model_index,
|
||||
View( ViewType Type, bool from_model, int from_model_index,
|
||||
bool at_model, int at_model_index,
|
||||
double damp_roll, double damp_pitch, double damp_heading,
|
||||
double x_offset_m, double y_offset_m, double z_offset_m,
|
||||
|
@ -66,7 +69,7 @@ public:
|
|||
double target_z_offset_m, double near_m, bool internal );
|
||||
|
||||
// Destructor
|
||||
virtual ~FGViewer( void );
|
||||
virtual ~View();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Part 1: standard SGSubsystem implementation.
|
||||
|
@ -334,7 +337,9 @@ private:
|
|||
_roll_offset_deg += amt;
|
||||
}
|
||||
|
||||
};
|
||||
}; // of class View
|
||||
|
||||
} // of namespace flightgear
|
||||
|
||||
|
||||
#endif // _VIEWER_HXX
|
||||
|
|
|
@ -121,7 +121,7 @@ FGViewMgr::init ()
|
|||
double target_y_offset_m = config->getDoubleValue("target-y-offset-m");
|
||||
double target_z_offset_m = config->getDoubleValue("target-z-offset-m");
|
||||
|
||||
add_view(new FGViewer ( FGViewer::FG_LOOKAT, from_model, from_model_index,
|
||||
add_view(new flightgear::View ( flightgear::View::FG_LOOKAT, from_model, from_model_index,
|
||||
at_model, at_model_index,
|
||||
damp_roll, damp_pitch, damp_heading,
|
||||
x_offset_m, y_offset_m,z_offset_m,
|
||||
|
@ -130,7 +130,7 @@ FGViewMgr::init ()
|
|||
target_x_offset_m, target_y_offset_m,
|
||||
target_z_offset_m, near_m, internal ));
|
||||
} else {
|
||||
add_view(new FGViewer ( FGViewer::FG_LOOKFROM, from_model, from_model_index,
|
||||
add_view(new flightgear::View ( flightgear::View::FG_LOOKFROM, from_model, from_model_index,
|
||||
false, 0, 0.0, 0.0, 0.0,
|
||||
x_offset_m, y_offset_m, z_offset_m,
|
||||
heading_offset_deg, pitch_offset_deg,
|
||||
|
@ -317,7 +317,7 @@ FGViewMgr::unbind ()
|
|||
void
|
||||
FGViewMgr::update (double dt)
|
||||
{
|
||||
FGViewer* currentView = (FGViewer *)get_current_view();
|
||||
flightgear::View* currentView = get_current_view();
|
||||
if (!currentView) return;
|
||||
|
||||
SGPropertyNode *n = config_list[current];
|
||||
|
@ -342,7 +342,7 @@ FGViewMgr::update (double dt)
|
|||
}
|
||||
|
||||
// if lookat (type 1) then get target data...
|
||||
if (currentView->getType() == FGViewer::FG_LOOKAT) {
|
||||
if (currentView->getType() == flightgear::View::FG_LOOKAT) {
|
||||
if (!config->getBoolValue("from-model")) {
|
||||
lon_deg = fgGetDouble(config->getStringValue("target-lon-deg-path"));
|
||||
lat_deg = fgGetDouble(config->getStringValue("target-lat-deg-path"));
|
||||
|
@ -444,7 +444,7 @@ void FGViewMgr::clear()
|
|||
views.clear();
|
||||
}
|
||||
|
||||
FGViewer*
|
||||
flightgear::View*
|
||||
FGViewMgr::get_current_view()
|
||||
{
|
||||
if ( current < (int)views.size() ) {
|
||||
|
@ -454,7 +454,7 @@ FGViewMgr::get_current_view()
|
|||
}
|
||||
}
|
||||
|
||||
const FGViewer*
|
||||
const flightgear::View*
|
||||
FGViewMgr::get_current_view() const
|
||||
{
|
||||
if ( current < (int)views.size() ) {
|
||||
|
@ -465,7 +465,7 @@ FGViewMgr::get_current_view() const
|
|||
}
|
||||
|
||||
|
||||
FGViewer*
|
||||
flightgear::View*
|
||||
FGViewMgr::get_view( int i )
|
||||
{
|
||||
if ( i < 0 ) { i = 0; }
|
||||
|
@ -473,7 +473,7 @@ FGViewMgr::get_view( int i )
|
|||
return views[i];
|
||||
}
|
||||
|
||||
const FGViewer*
|
||||
const flightgear::View*
|
||||
FGViewMgr::get_view( int i ) const
|
||||
{
|
||||
if ( i < 0 ) { i = 0; }
|
||||
|
@ -481,7 +481,7 @@ FGViewMgr::get_view( int i ) const
|
|||
return views[i];
|
||||
}
|
||||
|
||||
FGViewer*
|
||||
flightgear::View*
|
||||
FGViewMgr::next_view()
|
||||
{
|
||||
setView((current+1 < (int)views.size()) ? (current + 1) : 0);
|
||||
|
@ -489,7 +489,7 @@ FGViewMgr::next_view()
|
|||
return views[current];
|
||||
}
|
||||
|
||||
FGViewer*
|
||||
flightgear::View*
|
||||
FGViewMgr::prev_view()
|
||||
{
|
||||
setView((0 < current) ? (current - 1) : (views.size() - 1));
|
||||
|
@ -498,7 +498,7 @@ FGViewMgr::prev_view()
|
|||
}
|
||||
|
||||
void
|
||||
FGViewMgr::add_view( FGViewer * v )
|
||||
FGViewMgr::add_view( flightgear::View * v )
|
||||
{
|
||||
views.push_back(v);
|
||||
v->init();
|
||||
|
@ -507,14 +507,14 @@ FGViewMgr::add_view( FGViewer * v )
|
|||
double
|
||||
FGViewMgr::getViewHeadingOffset_deg () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0 : view->getHeadingOffset_deg());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setViewHeadingOffset_deg (double offset)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setGoalHeadingOffset_deg(offset);
|
||||
view->setHeadingOffset_deg(offset);
|
||||
|
@ -524,14 +524,14 @@ FGViewMgr::setViewHeadingOffset_deg (double offset)
|
|||
double
|
||||
FGViewMgr::getViewGoalHeadingOffset_deg () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0 : view->getGoalHeadingOffset_deg());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setViewGoalHeadingOffset_deg (double offset)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0)
|
||||
view->setGoalHeadingOffset_deg(offset);
|
||||
}
|
||||
|
@ -539,14 +539,14 @@ FGViewMgr::setViewGoalHeadingOffset_deg (double offset)
|
|||
double
|
||||
FGViewMgr::getViewPitchOffset_deg () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0 : view->getPitchOffset_deg());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setViewPitchOffset_deg (double tilt)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setGoalPitchOffset_deg(tilt);
|
||||
view->setPitchOffset_deg(tilt);
|
||||
|
@ -556,14 +556,14 @@ FGViewMgr::setViewPitchOffset_deg (double tilt)
|
|||
double
|
||||
FGViewMgr::getGoalViewPitchOffset_deg () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0 : view->getGoalPitchOffset_deg());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setGoalViewPitchOffset_deg (double tilt)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0)
|
||||
view->setGoalPitchOffset_deg(tilt);
|
||||
}
|
||||
|
@ -571,14 +571,14 @@ FGViewMgr::setGoalViewPitchOffset_deg (double tilt)
|
|||
double
|
||||
FGViewMgr::getViewRollOffset_deg () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0 : view->getRollOffset_deg());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setViewRollOffset_deg (double tilt)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setGoalRollOffset_deg(tilt);
|
||||
view->setRollOffset_deg(tilt);
|
||||
|
@ -588,14 +588,14 @@ FGViewMgr::setViewRollOffset_deg (double tilt)
|
|||
double
|
||||
FGViewMgr::getGoalViewRollOffset_deg () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0 : view->getGoalRollOffset_deg());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setGoalViewRollOffset_deg (double tilt)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0)
|
||||
view->setGoalRollOffset_deg(tilt);
|
||||
}
|
||||
|
@ -603,9 +603,9 @@ FGViewMgr::setGoalViewRollOffset_deg (double tilt)
|
|||
double
|
||||
FGViewMgr::getViewXOffset_m () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
return ((FGViewer *)view)->getXOffset_m();
|
||||
return ((flightgear::View *)view)->getXOffset_m();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ FGViewMgr::getViewXOffset_m () const
|
|||
void
|
||||
FGViewMgr::setViewXOffset_m (double x)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setXOffset_m(x);
|
||||
}
|
||||
|
@ -623,9 +623,9 @@ FGViewMgr::setViewXOffset_m (double x)
|
|||
double
|
||||
FGViewMgr::getViewYOffset_m () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
return ((FGViewer *)view)->getYOffset_m();
|
||||
return ((flightgear::View *)view)->getYOffset_m();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ FGViewMgr::getViewYOffset_m () const
|
|||
void
|
||||
FGViewMgr::setViewYOffset_m (double y)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setYOffset_m(y);
|
||||
}
|
||||
|
@ -643,9 +643,9 @@ FGViewMgr::setViewYOffset_m (double y)
|
|||
double
|
||||
FGViewMgr::getViewZOffset_m () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
return ((FGViewer *)view)->getZOffset_m();
|
||||
return ((flightgear::View *)view)->getZOffset_m();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ FGViewMgr::getViewZOffset_m () const
|
|||
void
|
||||
FGViewMgr::setViewZOffset_m (double z)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setZOffset_m(z);
|
||||
}
|
||||
|
@ -663,9 +663,9 @@ FGViewMgr::setViewZOffset_m (double z)
|
|||
double
|
||||
FGViewMgr::getViewTargetXOffset_m () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
return ((FGViewer *)view)->getTargetXOffset_m();
|
||||
return ((flightgear::View *)view)->getTargetXOffset_m();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ FGViewMgr::getViewTargetXOffset_m () const
|
|||
void
|
||||
FGViewMgr::setViewTargetXOffset_m (double x)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setTargetXOffset_m(x);
|
||||
}
|
||||
|
@ -683,9 +683,9 @@ FGViewMgr::setViewTargetXOffset_m (double x)
|
|||
double
|
||||
FGViewMgr::getViewTargetYOffset_m () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
return ((FGViewer *)view)->getTargetYOffset_m();
|
||||
return ((flightgear::View *)view)->getTargetYOffset_m();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ FGViewMgr::getViewTargetYOffset_m () const
|
|||
void
|
||||
FGViewMgr::setViewTargetYOffset_m (double y)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setTargetYOffset_m(y);
|
||||
}
|
||||
|
@ -703,9 +703,9 @@ FGViewMgr::setViewTargetYOffset_m (double y)
|
|||
double
|
||||
FGViewMgr::getViewTargetZOffset_m () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
return ((FGViewer *)view)->getTargetZOffset_m();
|
||||
return ((flightgear::View *)view)->getTargetZOffset_m();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ FGViewMgr::getViewTargetZOffset_m () const
|
|||
void
|
||||
FGViewMgr::setViewTargetZOffset_m (double z)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0) {
|
||||
view->setTargetZOffset_m(z);
|
||||
}
|
||||
|
@ -763,14 +763,14 @@ FGViewMgr::setView (int newview)
|
|||
double
|
||||
FGViewMgr::getFOV_deg () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0 : view->get_fov());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setFOV_deg (double fov)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0)
|
||||
view->set_fov(fov);
|
||||
}
|
||||
|
@ -778,14 +778,14 @@ FGViewMgr::setFOV_deg (double fov)
|
|||
double
|
||||
FGViewMgr::getARM_deg () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0 : view->get_aspect_ratio_multiplier());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setARM_deg (double aspect_ratio_multiplier)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0)
|
||||
view->set_aspect_ratio_multiplier(aspect_ratio_multiplier);
|
||||
}
|
||||
|
@ -793,14 +793,14 @@ FGViewMgr::setARM_deg (double aspect_ratio_multiplier)
|
|||
double
|
||||
FGViewMgr::getNear_m () const
|
||||
{
|
||||
const FGViewer * view = get_current_view();
|
||||
const flightgear::View * view = get_current_view();
|
||||
return (view == 0 ? 0.5f : view->getNear_m());
|
||||
}
|
||||
|
||||
void
|
||||
FGViewMgr::setNear_m (double near_m)
|
||||
{
|
||||
FGViewer * view = get_current_view();
|
||||
flightgear::View * view = get_current_view();
|
||||
if (view != 0)
|
||||
view->setNear_m(near_m);
|
||||
}
|
||||
|
@ -820,21 +820,21 @@ FGViewMgr::setViewAxisLat (double axis)
|
|||
double
|
||||
FGViewMgr::getViewLon_deg() const
|
||||
{
|
||||
const FGViewer* view = get_current_view();
|
||||
const flightgear::View* view = get_current_view();
|
||||
return (view != NULL) ? view->getPosition().getLongitudeDeg() : 0.0;
|
||||
}
|
||||
|
||||
double
|
||||
FGViewMgr::getViewLat_deg() const
|
||||
{
|
||||
const FGViewer* view = get_current_view();
|
||||
const flightgear::View* view = get_current_view();
|
||||
return (view != NULL) ? view->getPosition().getLatitudeDeg() : 0.0;
|
||||
}
|
||||
|
||||
double
|
||||
FGViewMgr::getViewElev_ft() const
|
||||
{
|
||||
const FGViewer* view = get_current_view();
|
||||
const flightgear::View* view = get_current_view();
|
||||
return (view != NULL) ? view->getPosition().getElevationFt() : 0.0;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,11 @@
|
|||
#include <simgear/math/SGMath.hxx>
|
||||
|
||||
// forward decls
|
||||
class FGViewer;
|
||||
typedef SGSharedPtr<FGViewer> FGViewerPtr;
|
||||
namespace flightgear
|
||||
{
|
||||
class View;
|
||||
typedef SGSharedPtr<flightgear::View> ViewPtr;
|
||||
}
|
||||
|
||||
// Define a structure containing view information
|
||||
class FGViewMgr : public SGSubsystem
|
||||
|
@ -60,19 +63,19 @@ public:
|
|||
inline int size() const { return views.size(); }
|
||||
inline int get_current() const { return current; }
|
||||
|
||||
FGViewer *get_current_view();
|
||||
const FGViewer *get_current_view() const;
|
||||
flightgear::View* get_current_view();
|
||||
const flightgear::View* get_current_view() const;
|
||||
|
||||
FGViewer *get_view( int i );
|
||||
const FGViewer *get_view( int i ) const;
|
||||
flightgear::View* get_view( int i );
|
||||
const flightgear::View* get_view( int i ) const;
|
||||
|
||||
FGViewer *next_view();
|
||||
FGViewer *prev_view();
|
||||
flightgear::View* next_view();
|
||||
flightgear::View* prev_view();
|
||||
|
||||
// setters
|
||||
void clear();
|
||||
|
||||
void add_view( FGViewer * v );
|
||||
void add_view( flightgear::View * v );
|
||||
|
||||
static const char* subsystemName() { return "view-manager"; }
|
||||
private:
|
||||
|
@ -145,7 +148,7 @@ private:
|
|||
bool inited;
|
||||
SGPropertyNode_ptr view_number;
|
||||
std::vector<SGPropertyNode_ptr> config_list;
|
||||
typedef std::vector<FGViewerPtr> viewer_list;
|
||||
typedef std::vector<flightgear::ViewPtr> viewer_list;
|
||||
viewer_list views;
|
||||
SGVec3d abs_viewer_position;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue