Commit 15fa1db7 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 82927ee1
......@@ -82,6 +82,7 @@ namespace Viewer {
sceneRadius_(1.0),
trackballCenter_(ACG::Vec3d( 0.0, 0.0, 0.0 )),
trackballRadius_(1.0),
stereo_(false),
viewerId_(_id)
{
settingsSection_ = "Viewer" + QString::number(_id) + "/";
......
......@@ -497,7 +497,25 @@ namespace Viewer {
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:
......
......@@ -182,9 +182,6 @@ glViewer::glViewer( QGraphicsScene* _scene,
trackMouse_ = false;
// stereo
stereo_ = false;
// Note: we start locked (initialization of updateLocked_)
// will be unlocked in initializeGL()
......@@ -422,7 +419,7 @@ void glViewer::updateProjectionMatrix()
glstate_->reset_projection();
// In stereo mode we have to use a perspective matrix
if (stereo_ || projectionMode_ == PERSPECTIVE_PROJECTION)
if ( properties_.stereo() || projectionMode_ == PERSPECTIVE_PROJECTION)
{
double aspect;
......@@ -597,7 +594,7 @@ void glViewer::drawScene()
// Check if we use build in default renderers
if ( renderManager().activeId( properties_.viewerId() ) == 0 ) {
if (stereo_) drawScene_stereo();
if ( properties_.stereo()) drawScene_stereo();
else drawScene_mono();
} else {
renderManager().active( properties_.viewerId() )->plugin->render(glstate_,properties_);
......@@ -954,7 +951,7 @@ void glViewer::paintGL()
glColor4f(1.0,0.0,0.0,1.0);
// clear (stereo mode clears buffers on its own)
if (!stereo_)
if (! properties_.stereo())
glstate_->clearBuffers ();
properties_.unLockUpdate();
......@@ -1872,7 +1869,7 @@ void glViewer::viewWheelEvent( QWheelEvent* _event)
if (_event->modifiers() == Qt::ShiftModifier)
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;
translate( ACG::Vec3d(0.0, 0.0, d) );
......@@ -2161,7 +2158,7 @@ void glViewer::updateCursorPosition (QPointF _scenePos)
cursorPositionValid_ = false;
}
// 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))
{
// the point we get back will contain the view transformation and we have to revert it
......
......@@ -678,8 +678,6 @@ private:
private:
bool stereo_;
// custom anaglyph stuff
int agTexWidth_;
int agTexHeight_;
......
......@@ -91,9 +91,9 @@ static const char* customAnaglyphProg = {
void
glViewer::setStereoMode(bool _b)
{
stereo_ = _b;
properties_.stereo(_b);
if (!stereo_) {
if (! properties_.stereo()) {
makeCurrent();
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