View-Mgr absolute position is gone.
This commit is contained in:
parent
65d5038962
commit
daf8c79705
3 changed files with 24 additions and 8 deletions
src/Viewer
|
@ -277,6 +277,10 @@ View::bind ()
|
||||||
_tiedProperties.Tie("raw-orientation", 2, this, &View::getRawOrientation_y);
|
_tiedProperties.Tie("raw-orientation", 2, this, &View::getRawOrientation_y);
|
||||||
_tiedProperties.Tie("raw-orientation", 3, this, &View::getRawOrientation_z);
|
_tiedProperties.Tie("raw-orientation", 3, this, &View::getRawOrientation_z);
|
||||||
|
|
||||||
|
_tiedProperties.Tie("viewer-x-m", this, &View::getAbsolutePosition_x);
|
||||||
|
_tiedProperties.Tie("viewer-y-m", this, &View::getAbsolutePosition_y);
|
||||||
|
_tiedProperties.Tie("viewer-z-m", this, &View::getAbsolutePosition_z);
|
||||||
|
|
||||||
// following config properties are exposed on current-view but don't change,
|
// following config properties are exposed on current-view but don't change,
|
||||||
// so we can simply copy them here.
|
// so we can simply copy them here.
|
||||||
_tiedProperties.getRoot()->setStringValue("name", _name);
|
_tiedProperties.getRoot()->setStringValue("name", _name);
|
||||||
|
@ -899,6 +903,21 @@ View::update (double dt)
|
||||||
recalc();
|
recalc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double View::getAbsolutePosition_x() const
|
||||||
|
{
|
||||||
|
return _absolute_view_pos.x();
|
||||||
|
}
|
||||||
|
|
||||||
|
double View::getAbsolutePosition_y() const
|
||||||
|
{
|
||||||
|
return _absolute_view_pos.y();
|
||||||
|
}
|
||||||
|
|
||||||
|
double View::getAbsolutePosition_z() const
|
||||||
|
{
|
||||||
|
return _absolute_view_pos.z();
|
||||||
|
}
|
||||||
|
|
||||||
double View::getRawOrientation_w() const
|
double View::getRawOrientation_w() const
|
||||||
{
|
{
|
||||||
return mViewOrientation.w();
|
return mViewOrientation.w();
|
||||||
|
|
|
@ -253,6 +253,10 @@ private:
|
||||||
void setPosition (const SGGeod& geod);
|
void setPosition (const SGGeod& geod);
|
||||||
void setTargetPosition (const SGGeod& geod);
|
void setTargetPosition (const SGGeod& geod);
|
||||||
|
|
||||||
|
double getAbsolutePosition_x() const;
|
||||||
|
double getAbsolutePosition_y() const;
|
||||||
|
double getAbsolutePosition_z() const;
|
||||||
|
|
||||||
double getRawOrientation_w() const;
|
double getRawOrientation_w() const;
|
||||||
double getRawOrientation_x() const;
|
double getRawOrientation_x() const;
|
||||||
double getRawOrientation_y() const;
|
double getRawOrientation_y() const;
|
||||||
|
|
|
@ -44,7 +44,6 @@ FGViewMgr::FGViewMgr( void ) :
|
||||||
inited(false),
|
inited(false),
|
||||||
view_number(fgGetNode("/sim/current-view/view-number", true)),
|
view_number(fgGetNode("/sim/current-view/view-number", true)),
|
||||||
config_list(fgGetNode("/sim", true)->getChildren("view")),
|
config_list(fgGetNode("/sim", true)->getChildren("view")),
|
||||||
abs_viewer_position(SGVec3d::zeros()),
|
|
||||||
current(0)
|
current(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -160,11 +159,6 @@ FGViewMgr::do_bind()
|
||||||
&FGViewMgr::getNear_m, &FGViewMgr::setNear_m);
|
&FGViewMgr::getNear_m, &FGViewMgr::setNear_m);
|
||||||
fgSetArchivable("/sim/current-view/ground-level-nearplane-m");
|
fgSetArchivable("/sim/current-view/ground-level-nearplane-m");
|
||||||
|
|
||||||
SGPropertyNode *n = fgGetNode("/sim/current-view", true);
|
|
||||||
_tiedProperties.Tie(n->getNode("viewer-x-m", true),SGRawValuePointer<double>(&abs_viewer_position[0]));
|
|
||||||
_tiedProperties.Tie(n->getNode("viewer-y-m", true),SGRawValuePointer<double>(&abs_viewer_position[1]));
|
|
||||||
_tiedProperties.Tie(n->getNode("viewer-z-m", true),SGRawValuePointer<double>(&abs_viewer_position[2]));
|
|
||||||
|
|
||||||
_tiedProperties.Tie("viewer-lon-deg", this, &FGViewMgr::getViewLon_deg);
|
_tiedProperties.Tie("viewer-lon-deg", this, &FGViewMgr::getViewLon_deg);
|
||||||
_tiedProperties.Tie("viewer-lat-deg", this, &FGViewMgr::getViewLat_deg);
|
_tiedProperties.Tie("viewer-lat-deg", this, &FGViewMgr::getViewLat_deg);
|
||||||
_tiedProperties.Tie("viewer-elev-ft", this, &FGViewMgr::getViewElev_ft);
|
_tiedProperties.Tie("viewer-elev-ft", this, &FGViewMgr::getViewElev_ft);
|
||||||
|
@ -212,12 +206,11 @@ FGViewMgr::update (double dt)
|
||||||
// Update the current view
|
// Update the current view
|
||||||
do_axes();
|
do_axes();
|
||||||
currentView->update(dt);
|
currentView->update(dt);
|
||||||
abs_viewer_position = currentView->getViewPosition();
|
|
||||||
|
|
||||||
|
|
||||||
// update the camera now
|
// update the camera now
|
||||||
osg::ref_ptr<flightgear::CameraGroup> cameraGroup = flightgear::CameraGroup::getDefault();
|
osg::ref_ptr<flightgear::CameraGroup> cameraGroup = flightgear::CameraGroup::getDefault();
|
||||||
cameraGroup->update(toOsg(abs_viewer_position),
|
cameraGroup->update(toOsg(currentView->getViewPosition()),
|
||||||
toOsg(currentView->getViewOrientation()));
|
toOsg(currentView->getViewOrientation()));
|
||||||
cameraGroup->setCameraParameters(currentView->get_v_fov(),
|
cameraGroup->setCameraParameters(currentView->get_v_fov(),
|
||||||
cameraGroup->getMasterAspectRatio());
|
cameraGroup->getMasterAspectRatio());
|
||||||
|
|
Loading…
Add table
Reference in a new issue