Update the camera properties after a resize event.
This commit is contained in:
parent
4f4434787f
commit
4e047d456f
3 changed files with 16 additions and 1 deletions
|
@ -446,6 +446,18 @@ void CameraGroup::setCameraCullMasks(Node::NodeMask nm)
|
|||
}
|
||||
}
|
||||
|
||||
void CameraGroup::resized()
|
||||
{
|
||||
for (CameraIterator i = camerasBegin(), e = camerasEnd(); i != e; ++i) {
|
||||
CameraInfo *info = i->get();
|
||||
const Viewport* viewport = info->camera->getViewport();
|
||||
info->x = viewport->x();
|
||||
info->y = viewport->y();
|
||||
info->width = viewport->width();
|
||||
info->height = viewport->height();
|
||||
}
|
||||
}
|
||||
|
||||
Camera* getGUICamera(CameraGroup* cgroup)
|
||||
{
|
||||
CameraGroup::CameraIterator end = cgroup->camerasEnd();
|
||||
|
|
|
@ -171,7 +171,9 @@ public:
|
|||
/** Set the cull mask on all non-GUI cameras
|
||||
*/
|
||||
void setCameraCullMasks(osg::Node::NodeMask nm);
|
||||
|
||||
/** Update camera properties after a resize event.
|
||||
*/
|
||||
void resized();
|
||||
protected:
|
||||
CameraList _cameras;
|
||||
osg::ref_ptr<osgViewer::Viewer> _viewer;
|
||||
|
|
|
@ -217,6 +217,7 @@ bool FGEventHandler::handle(const osgGA::GUIEventAdapter& ea,
|
|||
(*mouseMotionHandler)(x, y);
|
||||
return true;
|
||||
case osgGA::GUIEventAdapter::RESIZE:
|
||||
CameraGroup::getDefault()->resized();
|
||||
if (resizable && windowResizeHandler)
|
||||
(*windowResizeHandler)(ea.getWindowWidth(), ea.getWindowHeight());
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue