Commit 21cc2ddc authored by Isaak Lim's avatar Isaak Lim
Browse files

When the viewer's projection mode (orthographic/perspective) is switched, the...

When the viewer's projection mode (orthographic/perspective) is switched, the coordinate system node now switches to the same mode.

Note: The projection mode of the coordinate system node can still be set individually

closes #870

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14719 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 5b3bf606
...@@ -333,6 +333,26 @@ void glViewer::trackMouse(bool _track) ...@@ -333,6 +333,26 @@ void glViewer::trackMouse(bool _track)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void glViewer::setCoordSysProjection(ProjectionMode _mode) {
// Find coordsys node
ACG::SceneGraph::BaseNode* node = 0;
node = PluginFunctions::getSceneGraphRootNode()->find("Core Coordsys Node");
// set the projection mode for the coordinate system node
if (node != 0) {
ACG::SceneGraph::CoordsysNode* cnode = dynamic_cast<ACG::SceneGraph::CoordsysNode*> (node);
if (_mode == ORTHOGRAPHIC_PROJECTION) {
cnode->setProjectionMode(ACG::SceneGraph::CoordsysNode::ORTHOGRAPHIC_PROJECTION);
} else {
cnode->setProjectionMode(ACG::SceneGraph::CoordsysNode::PERSPECTIVE_PROJECTION);
}
}
}
//-----------------------------------------------------------------------------
void glViewer::perspectiveProjection() void glViewer::perspectiveProjection()
{ {
projectionMode(PERSPECTIVE_PROJECTION); projectionMode(PERSPECTIVE_PROJECTION);
...@@ -367,6 +387,8 @@ void glViewer::projectionMode(ProjectionMode _p) ...@@ -367,6 +387,8 @@ void glViewer::projectionMode(ProjectionMode _p)
updateProjectionMatrix(); updateProjectionMatrix();
setCoordSysProjection(_p);
emit viewChanged(); emit viewChanged();
} }
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include <ACG/GL/GLState.hh> #include <ACG/GL/GLState.hh>
#include <ACG/Scenegraph/SceneGraph.hh> #include <ACG/Scenegraph/SceneGraph.hh>
#include <ACG/Scenegraph/CoordsysNode.hh>
#include <ACG/QtWidgets/QtSceneGraphWidget.hh> #include <ACG/QtWidgets/QtSceneGraphWidget.hh>
#include <ACG/ShaderUtils/GLSLShader.hh> #include <ACG/ShaderUtils/GLSLShader.hh>
...@@ -493,6 +494,8 @@ private: ...@@ -493,6 +494,8 @@ private:
void drawScene(); void drawScene();
// helper called by drawScene(). // helper called by drawScene().
void drawScene_mono(); void drawScene_mono();
/// helper function for setting the projection mode of the coordinate system node
void setCoordSysProjection(glViewer::ProjectionMode _mode);
......
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