MeVisLab Toolbox Reference
SoView2DShaderElement.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2015, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #pragma once
14 
15 #include "SoView2DSystem.h"
16 
17 #include <Inventor/elements/SoReplacedElement.h>
18 #include <Inventor/SbColor.h>
19 #include "View2DSlice.h"
20 #include "View2DTexture.h"
21 #include <vector>
22 
24 
28 
31 {
32 public:
34 
35  std::string _name;
36  SbColor _color;
37  float _alpha;
40 
41  SbVec2f _devicePos[3];
42 
45  SoView2DShaderBuiltInFunctions::SetupOverlay _setup;
46  SoView2DShaderBuiltInFunctions::CheckInsideOverlay _inside;
47  SoView2DShaderBuiltInFunctions::FetchOverlay _fetch;
48  SoView2DShaderBuiltInFunctions::ClassifyOverlay _classify;
49  SoView2DShaderBuiltInFunctions::CompositeOverlay _composite;
50 };
51 
52 class SOVIEW2D_API SoView2DShaderElement : public SoReplacedElement {
53 
54  SO_ELEMENT_HEADER(SoView2DShaderElement);
55 
56  public:
57  void init(SoState *state) override;
58 
59  void pop(SoState *state, const SoElement *prevTopElement) override;
60  void push(SoState* aState) override;
61 
62  void clearData();
63 
65  static void setDiagnosis(SoState *state, SoNode* node, SoView2DShaderDiagnosis *diagnosis);
66 
68  static SoView2DShaderDiagnosis* getDiagnosis(SoState *state);
69 
71  static void clear(SoState *state, SoNode* node);
72 
74  static void addOverlay(SoState *state, SoNode *node, SoView2DShaderOverlayInfo* overlay);
75 
77  static void addOperation(SoState *state, SoNode *node, SoView2DShaderOperation *operation);
79  static void addInclude(SoState *state, SoNode *node, SoView2DShaderCustomInclude *include);
80 
82  static const std::vector<SoView2DShaderOverlayInfo*>& getOverlays(SoState *state);
83 
85  static const std::vector<SoView2DShaderOperation*>& getOperations(SoState *state);
86 
88  static const std::vector<SoView2DShaderCustomInclude*>& getIncludes(SoState *state);
89 
91  static const std::vector<size_t>& getNodeIds(SoState *state);
92 
94  static const SoView2DShaderElement * getInstance(SoState *state);
95 
96  SbBool matches(const SoElement *elt) const override;
97 
98  SoElement *copyMatchInfo() const override;
99 
100  static void initClass();
101 
102  protected:
104  std::vector<SoView2DShaderOperation*> _operations;
105  std::vector<SoView2DShaderCustomInclude*> _includes;
106  std::vector<SoView2DShaderOverlayInfo*> _overlays;
107  std::vector<size_t> _nodeIds;
108 };
View2DBlendMode
Blend mode.
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
The helper class for the include which is added to the GVR.
static void addInclude(SoState *state, SoNode *node, SoView2DShaderCustomInclude *include)
Add a pipeline include.
std::vector< SoView2DShaderOverlayInfo * > _overlays
std::vector< SoView2DShaderOperation * > _operations
static const std::vector< SoView2DShaderOperation * > & getOperations(SoState *state)
Get list of SoView2DShaderOperations from current state.
SbBool matches(const SoElement *elt) const override
static const std::vector< size_t > & getNodeIds(SoState *state)
Get list of node ids that added operations/includes (to be used for caching)
static SoView2DShaderDiagnosis * getDiagnosis(SoState *state)
Get diagnosis module.
static void setDiagnosis(SoState *state, SoNode *node, SoView2DShaderDiagnosis *diagnosis)
Set diagnosis module.
std::vector< size_t > _nodeIds
static void addOperation(SoState *state, SoNode *node, SoView2DShaderOperation *operation)
Add a pipeline operation.
static const std::vector< SoView2DShaderCustomInclude * > & getIncludes(SoState *state)
Get list of SoView2DShaderCustomInclude from current state.
SoView2DShaderDiagnosis * _diagnosis
static void clear(SoState *state, SoNode *node)
Clear all stored state.
void init(SoState *state) override
static const SoView2DShaderElement * getInstance(SoState *state)
Returns the top (current) instance of the element in the state.
static const std::vector< SoView2DShaderOverlayInfo * > & getOverlays(SoState *state)
Get list of overlays from current state.
static void initClass()
static void addOverlay(SoState *state, SoNode *node, SoView2DShaderOverlayInfo *overlay)
Add an overlay.
SoElement * copyMatchInfo() const override
void pop(SoState *state, const SoElement *prevTopElement) override
void push(SoState *aState) override
std::vector< SoView2DShaderCustomInclude * > _includes
Container class to specify a change operation for the shader pipeline shader.
Stores information for each overlay to render.
SoView2DShaderBuiltInFunctions::ClassifyOverlay _classify
SoView2DShaderBuiltInFunctions::FetchOverlay _fetch
SoView2DShaderBuiltInFunctions::CompositeOverlay _composite
SoView2DShaderBuiltInFunctions::SetupOverlay _setup
SoView2DShaderBuiltInFunctions::CheckInsideOverlay _inside
A class to render images as OpenGL Textures.
Definition: View2DTexture.h:47