44#include "RenderPickingPlugin.hh"
49#include <QSurfaceFormat>
54void RenderPickingPlugin::initializePlugin()
61 QMenu* menu =
new QMenu(
"Picking Renderer Target");
64 QActionGroup* pickingTargetsGroup =
new QActionGroup(
this );
65 pickingTargetsGroup->setExclusive(
true );
68 QAction * action =
new QAction(
"PICK_ANYTHING" , pickingTargetsGroup );
69 action->setCheckable(
true );
70 action->setChecked(
true);
72 action =
new QAction(
"PICK_VERTEX" , pickingTargetsGroup );
73 action->setCheckable(
true );
75 action->setChecked(
true);
77 action =
new QAction(
"PICK_EDGE" , pickingTargetsGroup );
78 action->setCheckable(
true );
80 action->setChecked(
true);
82 action =
new QAction(
"PICK_SPLINE" , pickingTargetsGroup );
83 action->setCheckable(
true );
85 action->setChecked(
true);
87 action =
new QAction(
"PICK_FACE" , pickingTargetsGroup );
88 action->setCheckable(
true );
90 action->setChecked(
true);
92 action =
new QAction(
"PICK_FRONT_VERTEX" , pickingTargetsGroup );
93 action->setCheckable(
true );
95 action->setChecked(
true);
97 action =
new QAction(
"PICK_FRONT_EDGE" , pickingTargetsGroup );
98 action->setCheckable(
true );
100 action->setChecked(
true);
102 action =
new QAction(
"PICK_CELL" , pickingTargetsGroup );
103 action->setCheckable(
true );
105 action->setChecked(
true);
107 menu->addActions(pickingTargetsGroup->actions());
109 connect(pickingTargetsGroup,SIGNAL(triggered( QAction * )),
this,SLOT(slotPickTargetChanged( QAction * )));
111 return menu->menuAction();
114void RenderPickingPlugin::slotPickTargetChanged( QAction * _action) {
117 if ( _action->text() ==
"PICK_ANYTHING") {
119 }
else if ( _action->text() ==
"PICK_VERTEX") {
121 }
else if ( _action->text() ==
"PICK_EDGE") {
123 }
else if ( _action->text() ==
"PICK_SPLINE") {
125 }
else if ( _action->text() ==
"PICK_FACE") {
127 }
else if ( _action->text() ==
"PICK_FRONT_VERTEX") {
129 }
else if ( _action->text() ==
"PICK_FRONT_EDGE") {
131 }
else if ( _action->text() ==
"PICK_CELL") {
134 std::cerr <<
"Error : optionHandling unable to find pick mode!!! " << _action->text().toStdString() << std::endl;
140QString RenderPickingPlugin::rendererName() {
141 return QString(
"Picking renderer");
152 bool blendState = _glState->
blending();
153 if(_glState->compatibilityProfile())
157 glClear(GL_DEPTH_BUFFER_BIT);
162 _glState->
enable(GL_DEPTH_TEST);
165 if(_glState->compatibilityProfile())
174QString RenderPickingPlugin::checkOpenGL() {
176 return QString(
"Insufficient OpenGL Version! OpenGL 2.0 or higher required");
void pick_init(bool _color)
initialize name/color picking stack (like glInitNames())
static void enable(GLenum _cap, bool _warnRemoved=true)
replaces glEnable, but supports locking
bool blending()
get whether transparenet or solid objects should be drawn
static void disable(GLenum _cap, bool _warnRemoved=true)
replaces glDisable, but supports locking
QAction * optionsAction()
Return options menu.
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
DrawMode DEFAULT
use the default (global) draw mode and not the node's own.
void traverse_multipass(BaseNode *_node, Action &_action, const unsigned int &_pass)
@ PICK_EDGE
picks edges (may not be implemented for all nodes)
@ PICK_ANYTHING
pick any of the prior targets (should be implemented for all nodes)
@ PICK_CELL
picks faces (may not be implemented for all nodes)
@ PICK_SPLINE
Pick spline curve or surface (picks u or u,v coords respectively)
@ PICK_FRONT_VERTEX
picks only visible front verices (may not be implemented for all nodes)
@ PICK_FACE
picks faces (should be implemented for all nodes)
@ PICK_VERTEX
picks verices (may not be implemented for all nodes)
@ PICK_FRONT_EDGE
picks only visible front edges (may not be implemented for all nodes)
bool openGLVersion(const int _major, const int _minor, bool _verbose)
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node