44 #include "RenderPickingPlugin.hh" 54 void 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();
114 void 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;
140 QString 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())
174 QString RenderPickingPlugin::checkOpenGL() {
176 return QString(
"Insufficient OpenGL Version! OpenGL 2.0 or higher required");
pick any of the prior targets (should be implemented for all nodes)
Pick spline curve or surface (picks u or u,v coords respectively)
QAction * optionsAction()
Return options menu.
static void enable(GLenum _cap, bool _warnRemoved=true)
replaces glEnable, but supports locking
DrawMode DEFAULT
use the default (global) draw mode and not the node's own.
void pick_init(bool _color)
initialize name/color picking stack (like glInitNames())
bool blending()
get whether transparenet or solid objects should be drawn
picks edges (may not be implemented for all nodes)
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
picks faces (may not be implemented for all nodes)
void traverse_multipass(BaseNode *_node, Action &_action, const unsigned int &_pass)
picks only visible front verices (may not be implemented for all nodes)
picks faces (should be implemented for all nodes)
static void disable(GLenum _cap, bool _warnRemoved=true)
replaces glDisable, but supports locking
picks verices (may not be implemented for all nodes)
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
picks only visible front edges (may not be implemented for all nodes)
bool openGLVersion(const int _major, const int _minor, bool _verbose)