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 "Scene.h"
34 #include <Inventor/SbName.h>
35 #include <Inventor/actions/SoGLRenderAction.h>
36 #include <Inventor/actions/SoSearchAction.h>
37 #include <Inventor/actions/SoSubAction.h>
38 #include <Inventor/elements/SoDrawStyleElement.h>
39 #include <Inventor/elements/SoGLLazyElement.h>
40 #include <Inventor/elements/SoLinePatternElement.h>
41 #include <Inventor/elements/SoLineWidthElement.h>
42 #include <Inventor/elements/SoMaterialBindingElement.h>
43 #include <Inventor/elements/SoNormalElement.h>
44 #include <Inventor/elements/SoOverrideElement.h>
45 #include <Inventor/elements/SoPolygonOffsetElement.h>
46 #include <Inventor/elements/SoTextureOverrideElement.h>
47 #include <Inventor/elements/SoTextureQualityElement.h>
48 #include <Inventor/lists/SoEnabledElementsList.h>
49 #include <Inventor/lists/SoPathList.h>
50 #include <Inventor/misc/SoState.h>
51 #include <Inventor/nodes/SoSelection.h>
52 #include <Inventor/threads/SbStorage.h>
53 
54 namespace scene3D
55 {
56  class SoGLHighlightRenderAction : public SoGLRenderAction
57  {
58  public:
59  /**
60  * Constructor
61  * Creates an Instance of the Class
62  *
63  * @param viewportregion ViewportRegion the Class is initialized with
64  */
65  SoGLHighlightRenderAction(const SbViewportRegion& viewportregion, Scene* scene);
66 
67  /**
68  * Destructor.
69  *
70  */
71  ~SoGLHighlightRenderAction() override;
72 
73  /**
74  * Applies the Highlighting to a given node.
75  *
76  * @param node Node to be highlighted
77  */
78  void apply(SoNode* node) override;
79 
80  /**
81  * Sets the Highlighting visible.
82  *
83  */
84  void setVisible();
85 
86  /**
87  * Returns if the Highlighting is visible.
88  *
89  * @return bool Visibility of Highlighting
90  */
91  bool getVisible();
92 
93  private:
94  Scene* scene;
95 
96  bool isVisible;
97 
98  void drawHighlight(SoPath* pathtothis, const SoPathList* pathlist);
99  void drawWireframe(SoPath* pathtothis, bool active);
100 
101  SbColor selectedColor;
102  SbColor activeColor;
103  uint16_t linepattern;
104  float linewidth;
105  SoTempPath* postprocpath;
106  SbStorage selectedcolor_storage;
107 
108  static void
109  alloc_colorpacker(void* data)
110  {
111  SoColorPacker** cptr = (SoColorPacker**)data;
112  *cptr = new SoColorPacker;
113  }
114 
115  static void
116  free_colorpacker(void* data)
117  {
118  SoColorPacker** cptr = (SoColorPacker**)data;
119  delete *cptr;
120  }
121  };
122 } // namespace scene3D
scene3D::Scene
Definition: Scene.h:60
scene3D::SoGLHighlightRenderAction::~SoGLHighlightRenderAction
~SoGLHighlightRenderAction() override
Destructor.
Definition: SoGLHighlightRenderAction.cpp:52
scene3D::SoGLHighlightRenderAction::apply
void apply(SoNode *node) override
Applies the Highlighting to a given node.
Definition: SoGLHighlightRenderAction.cpp:58
scene3D::SoGLHighlightRenderAction
Definition: SoGLHighlightRenderAction.h:56
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.