_tiedProperties.Tie("raw-orientation", 2, this, &View::getRawOrientation_y);
_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,
// so we can simply copy them here.
_tiedProperties.getRoot()->setStringValue("name", _name);
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
{
return mViewOrientation.w();
void setPosition (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_x() const;
double getRawOrientation_y() const;
inited(false),
view_number(fgGetNode("/sim/current-view/view-number", true)),
config_list(fgGetNode("/sim", true)->getChildren("view")),
- abs_viewer_position(SGVec3d::zeros()),
current(0)
{
}
&FGViewMgr::getNear_m, &FGViewMgr::setNear_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-lat-deg", this, &FGViewMgr::getViewLat_deg);
_tiedProperties.Tie("viewer-elev-ft", this, &FGViewMgr::getViewElev_ft);
// Update the current view
do_axes();
currentView->update(dt);
- abs_viewer_position = currentView->getViewPosition();
// update the camera now
osg::ref_ptr<flightgear::CameraGroup> cameraGroup = flightgear::CameraGroup::getDefault();
- cameraGroup->update(toOsg(abs_viewer_position),
+ cameraGroup->update(toOsg(currentView->getViewPosition()),
toOsg(currentView->getViewOrientation()));
cameraGroup->setCameraParameters(currentView->get_v_fov(),
cameraGroup->getMasterAspectRatio());