Commit 08460271 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Fixed TrackballNavigationEventListener setting the window ratio of its...

Fixed TrackballNavigationEventListener setting the window ratio of its CameraProperty being directly overwritten due to concurrent access.
parent 4bffec12
......@@ -158,7 +158,13 @@ namespace campvis {
_trackball->setViewprtSize(_viewportSizeProp->getValue());
float ratio = static_cast<float>(_viewportSizeProp->getValue().x) / static_cast<float>(_viewportSizeProp->getValue().y);
_cameraProperty->setWindowRatio(ratio);
if (ratio == 0) {
LERROR("Window ratio must not be 0.");
}
else {
_trackball->setWindowRatio(ratio);
}
}
}
......@@ -37,14 +37,4 @@ namespace campvis {
CameraProperty::~CameraProperty() {
}
void CameraProperty::setWindowRatio(float r) {
if (r == 0) {
LERROR("Window ratio must not be 0.");
return;
}
tgt::Camera c = getValue();
c.setWindowRatio(r);
setValue(c);
}
}
......@@ -47,11 +47,6 @@ namespace campvis {
virtual ~CameraProperty();
/**
* Sets the camera's window ratio.
* \param r The new camera's window ratio (viewport.x / viewport.y)
*/
void setWindowRatio(float r);
protected:
......
......@@ -552,6 +552,11 @@ void Trackball::timerEvent(TimeEvent* e) {
}
}
void Trackball::setWindowRatio(float r) {
getCamera()->setWindowRatio(r);
hcam_->update();
}
///////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -247,6 +247,12 @@ class TGT_API Trackball : public Navigation {
if (getCamera() != 0)
reset();
}
/**
* Sets the camera's window ratio.
* \param r The new camera's window ratio (viewport.x / viewport.y)
*/
void setWindowRatio(float r);
///////////////////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment