Commit d13554ab authored by Jan Möbius's avatar Jan Möbius

Moved stereo flag into viewer properties

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15945 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0e3f19c9
...@@ -82,6 +82,7 @@ namespace Viewer { ...@@ -82,6 +82,7 @@ namespace Viewer {
sceneRadius_(1.0), sceneRadius_(1.0),
trackballCenter_(ACG::Vec3d( 0.0, 0.0, 0.0 )), trackballCenter_(ACG::Vec3d( 0.0, 0.0, 0.0 )),
trackballRadius_(1.0), trackballRadius_(1.0),
stereo_(false),
viewerId_(_id) viewerId_(_id)
{ {
settingsSection_ = "Viewer" + QString::number(_id) + "/"; settingsSection_ = "Viewer" + QString::number(_id) + "/";
......
...@@ -497,7 +497,25 @@ namespace Viewer { ...@@ -497,7 +497,25 @@ namespace Viewer {
double trackballRadius_; double trackballRadius_;
/** @} */ /** @} */
//===========================================================================
//===========================================================================
/** @name Stereo Settings
* @{ */
//===========================================================================
//===========================================================================
public:
void stereo(bool _stereo) { stereo_ = _stereo; emit updated(); };
bool stereo() {return stereo_; };
private:
/// Flag if stereo should be enabled for the current viewer
bool stereo_;
/** @} */
signals: signals:
......
...@@ -182,9 +182,6 @@ glViewer::glViewer( QGraphicsScene* _scene, ...@@ -182,9 +182,6 @@ glViewer::glViewer( QGraphicsScene* _scene,
trackMouse_ = false; trackMouse_ = false;
// stereo
stereo_ = false;
// Note: we start locked (initialization of updateLocked_) // Note: we start locked (initialization of updateLocked_)
// will be unlocked in initializeGL() // will be unlocked in initializeGL()
...@@ -422,7 +419,7 @@ void glViewer::updateProjectionMatrix() ...@@ -422,7 +419,7 @@ void glViewer::updateProjectionMatrix()
glstate_->reset_projection(); glstate_->reset_projection();
// In stereo mode we have to use a perspective matrix // In stereo mode we have to use a perspective matrix
if (stereo_ || projectionMode_ == PERSPECTIVE_PROJECTION) if ( properties_.stereo() || projectionMode_ == PERSPECTIVE_PROJECTION)
{ {
double aspect; double aspect;
...@@ -597,7 +594,7 @@ void glViewer::drawScene() ...@@ -597,7 +594,7 @@ void glViewer::drawScene()
// Check if we use build in default renderers // Check if we use build in default renderers
if ( renderManager().activeId( properties_.viewerId() ) == 0 ) { if ( renderManager().activeId( properties_.viewerId() ) == 0 ) {
if (stereo_) drawScene_stereo(); if ( properties_.stereo()) drawScene_stereo();
else drawScene_mono(); else drawScene_mono();
} else { } else {
renderManager().active( properties_.viewerId() )->plugin->render(glstate_,properties_); renderManager().active( properties_.viewerId() )->plugin->render(glstate_,properties_);
...@@ -954,7 +951,7 @@ void glViewer::paintGL() ...@@ -954,7 +951,7 @@ void glViewer::paintGL()
glColor4f(1.0,0.0,0.0,1.0); glColor4f(1.0,0.0,0.0,1.0);
// clear (stereo mode clears buffers on its own) // clear (stereo mode clears buffers on its own)
if (!stereo_) if (! properties_.stereo())
glstate_->clearBuffers (); glstate_->clearBuffers ();
properties_.unLockUpdate(); properties_.unLockUpdate();
...@@ -1872,7 +1869,7 @@ void glViewer::viewWheelEvent( QWheelEvent* _event) ...@@ -1872,7 +1869,7 @@ void glViewer::viewWheelEvent( QWheelEvent* _event)
if (_event->modifiers() == Qt::ShiftModifier) if (_event->modifiers() == Qt::ShiftModifier)
factor = properties_.wheelZoomFactorShift(); factor = properties_.wheelZoomFactorShift();
if (projectionMode() == PERSPECTIVE_PROJECTION || stereo_) if (projectionMode() == PERSPECTIVE_PROJECTION || properties_.stereo())
{ {
double d = -(double)_event->delta() / 120.0 * 0.2 * factor * properties_.trackballRadius() / 3.0; double d = -(double)_event->delta() / 120.0 * 0.2 * factor * properties_.trackballRadius() / 3.0;
translate( ACG::Vec3d(0.0, 0.0, d) ); translate( ACG::Vec3d(0.0, 0.0, d) );
...@@ -2161,7 +2158,7 @@ void glViewer::updateCursorPosition (QPointF _scenePos) ...@@ -2161,7 +2158,7 @@ void glViewer::updateCursorPosition (QPointF _scenePos)
cursorPositionValid_ = false; cursorPositionValid_ = false;
} }
// only do real pick in stereo mode // only do real pick in stereo mode
else if (stereo_ && OpenFlipperSettings().value("Core/Gui/glViewer/stereoMousePick",true).toBool() && else if ( properties_.stereo() && OpenFlipperSettings().value("Core/Gui/glViewer/stereoMousePick",true).toBool() &&
pick (ACG::SceneGraph::PICK_ANYTHING, _scenePos.toPoint(), nodeIdx, targetIdx, &tmp)) pick (ACG::SceneGraph::PICK_ANYTHING, _scenePos.toPoint(), nodeIdx, targetIdx, &tmp))
{ {
// the point we get back will contain the view transformation and we have to revert it // the point we get back will contain the view transformation and we have to revert it
......
...@@ -678,8 +678,6 @@ private: ...@@ -678,8 +678,6 @@ private:
private: private:
bool stereo_;
// custom anaglyph stuff // custom anaglyph stuff
int agTexWidth_; int agTexWidth_;
int agTexHeight_; int agTexHeight_;
......
...@@ -91,9 +91,9 @@ static const char* customAnaglyphProg = { ...@@ -91,9 +91,9 @@ static const char* customAnaglyphProg = {
void void
glViewer::setStereoMode(bool _b) glViewer::setStereoMode(bool _b)
{ {
stereo_ = _b; properties_.stereo(_b);
if (!stereo_) { if (! properties_.stereo()) {
makeCurrent(); makeCurrent();
ACG::GLState::drawBuffer(GL_BACK); ACG::GLState::drawBuffer(GL_BACK);
} }
......
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