SoGLHighlightRenderAction.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package MemoryX::gui-plugins::SceneEditor
19  * @date 2015
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
24 /*
25  * SoGLHighlightRenderAction.h
26  *
27  * Created on: Jan 13, 2015
28  * Author: philipp
29  */
30 
31 #pragma once
32 
33 #include <Inventor/actions/SoGLRenderAction.h>
34 #include <Inventor/SbName.h>
35 #include <Inventor/actions/SoSearchAction.h>
36 #include <Inventor/actions/SoSubAction.h>
37 #include <Inventor/elements/SoDrawStyleElement.h>
38 #include <Inventor/elements/SoGLLazyElement.h>
39 #include <Inventor/elements/SoLinePatternElement.h>
40 #include <Inventor/elements/SoLineWidthElement.h>
41 #include <Inventor/elements/SoOverrideElement.h>
42 #include <Inventor/elements/SoPolygonOffsetElement.h>
43 #include <Inventor/elements/SoTextureOverrideElement.h>
44 #include <Inventor/elements/SoTextureQualityElement.h>
45 #include <Inventor/elements/SoMaterialBindingElement.h>
46 #include <Inventor/elements/SoNormalElement.h>
47 #include <Inventor/lists/SoEnabledElementsList.h>
48 #include <Inventor/lists/SoPathList.h>
49 #include <Inventor/misc/SoState.h>
50 #include <Inventor/nodes/SoSelection.h>
51 #include <Inventor/threads/SbStorage.h>
52 
53 #include "Scene.h"
54 
55 namespace scene3D
56 {
57  class SoGLHighlightRenderAction : public SoGLRenderAction
58  {
59  public:
60  /**
61  * Constructor
62  * Creates an Instance of the Class
63  *
64  * @param viewportregion ViewportRegion the Class is initialized with
65  */
66  SoGLHighlightRenderAction(const SbViewportRegion& viewportregion, Scene* scene);
67 
68  /**
69  * Destructor.
70  *
71  */
72  ~SoGLHighlightRenderAction() override;
73 
74  /**
75  * Applies the Highlighting to a given node.
76  *
77  * @param node Node to be highlighted
78  */
79  void apply(SoNode* node) override;
80 
81  /**
82  * Sets the Highlighting visible.
83  *
84  */
85  void setVisible();
86 
87  /**
88  * Returns if the Highlighting is visible.
89  *
90  * @return bool Visibility of Highlighting
91  */
92  bool getVisible();
93 
94  private:
95  Scene* scene;
96 
97  bool isVisible;
98 
99  void drawHighlight(SoPath* pathtothis, const SoPathList* pathlist);
100  void drawWireframe(SoPath* pathtothis, bool active);
101 
102  SbColor selectedColor;
103  SbColor activeColor;
104  uint16_t linepattern;
105  float linewidth;
106  SoTempPath* postprocpath;
107  SbStorage selectedcolor_storage;
108 
109  static void alloc_colorpacker(void* data)
110  {
111  SoColorPacker** cptr = (SoColorPacker**) data;
112  *cptr = new SoColorPacker;
113  }
114 
115  static void free_colorpacker(void* data)
116  {
117  SoColorPacker** cptr = (SoColorPacker**) data;
118  delete *cptr;
119  }
120  };
121 }
122 
scene3D::Scene
Definition: Scene.h:61
scene3D::SoGLHighlightRenderAction::~SoGLHighlightRenderAction
~SoGLHighlightRenderAction() override
Destructor.
Definition: SoGLHighlightRenderAction.cpp:50
scene3D::SoGLHighlightRenderAction::apply
void apply(SoNode *node) override
Applies the Highlighting to a given node.
Definition: SoGLHighlightRenderAction.cpp:55
scene3D::SoGLHighlightRenderAction
Definition: SoGLHighlightRenderAction.h:57
scene3D::SoGLHighlightRenderAction::SoGLHighlightRenderAction
SoGLHighlightRenderAction(const SbViewportRegion &viewportregion, Scene *scene)
Constructor Creates an Instance of the Class.
Definition: SoGLHighlightRenderAction.cpp:33
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
Scene.h
scene3D
Definition: ManipulatorMode.h:26
scene3D::SoGLHighlightRenderAction::setVisible
void setVisible()
Sets the Highlighting visible.
scene3D::SoGLHighlightRenderAction::getVisible
bool getVisible()
Returns if the Highlighting is visible.