MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
SoView2DShaderOverlay.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 "SoView2DExtension.h"
16#include "SoView2DShaderState.h"
20
23
26
28{
29
30 SO_NODE_HEADER(SoView2DShaderOverlay);
31
32public:
33 static void initClass();
34
36
39
42
43 enum WrapMode {
44 ClampToEdge = GL_CLAMP_TO_EDGE,
45 ClampToBorder = GL_CLAMP_TO_BORDER
46 };
47
50
53
55 void draw(View2DSliceList* dsl, View2DSlice* dslice, int slice) override;
56
58
60 void addOverlay(SoGLShaderProgram* program, SoView2DShaderOverlayInfo* overlay, float& dx1, float& dy1, float& dx2,
61 float& dy2, bool firstOverlay);
62
64
65protected:
67 {
68 std::vector<SoView2DShaderCustomInclude*> _includes;
69 std::vector<SoView2DShaderOperation*> _operations;
70 std::vector<SoView2DShaderOverlayInfo*> _overlays;
72 std::vector<size_t> _nodeIds;
74 };
75
77
89
91
93
94 void createShaders(std::string& vertexShader, std::string& fragmentShader, SoState* state,
96
98 std::string& output);
99
100 void applyFragmentOperations(const std::vector<SoView2DShaderOperation*>& operations);
101 void addFragmentIncludes(const std::vector<SoView2DShaderCustomInclude*>& includes);
102
106
108
110
113
114 SoView2DShaderBuiltInFunctions::SetupState _setupState;
115 SoView2DShaderBuiltInFunctions::WriteFragment _writeFragment;
116};
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
Class managing an OpenGL shader program.
SoView2DExtension Base class for all View2DExtensions used for drawing and event handling on the View...
Container class to specify a change operation for the shader pipeline shader.
Stores information for each overlay to render.
void combineShaderString(const SoView2DShaderState &currentState, const ShaderPipelineCodeTarget &source, std::string &output)
void applyFragmentOperations(const std::vector< SoView2DShaderOperation * > &operations)
void overwriteDrawingSettings(SoView2DDrawingSettings &settings) override
SoView2DShaderBuiltInFunctions::SetupState _setupState
SoSFBool clipToOverlays
Clip shader area to overlay(s)
void addOverlay(SoGLShaderProgram *program, SoView2DShaderOverlayInfo *overlay, float &dx1, float &dy1, float &dx2, float &dy2, bool firstOverlay)
Adds the overlay uniforms to the shader program.
SoView2DShaderBuiltInIncludes::IncludeContainer _builtInIncludes
void appendFunction(ShaderPipeline &pipeline, int step, SoView2DShaderBuiltInFunctions::SoView2DShaderFunction *function, const SoView2DShaderState &currentState)
SoSFEnum overlayWrapMode
Selects the wrap mode for overlay textures.
static void initClass()
void addFragmentIncludes(const std::vector< SoView2DShaderCustomInclude * > &includes)
ShaderPipeline _fragmentPipeline
The fragment shader pipeline.
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
Draws a border on the given slice.
void fillDiagnosis(CachedShader &current, SoView2DShaderDiagnosis *diagnosisModule, SoState *state)
SoSFEnum blendMode
select the blend mode of the shader
SoView2DShaderBuiltInFunctions::WriteFragment _writeFragment
void GLRender(SoGLRenderAction *action) override
SoSFBool disableBaseImageDrawing
If enabled, the SoView2D does not draw its base image.
void createShaders(std::string &vertexShader, std::string &fragmentShader, SoState *state, const SoView2DShaderState &currentState)
Stores the state that defines the shader of the shader pipeline, used to detect if a regeneration of ...
a list that holds all View2DSlice objects (lazily created) of a SoView2D
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
Definition View2DSlice.h:48
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
Drawing settings that can be overwritten by extensions.
std::vector< SoView2DShaderOperation * > _operations
std::vector< SoView2DShaderCustomInclude * > _includes
std::vector< SoView2DShaderOverlayInfo * > _overlays
SoRef< SoFragmentShader > _fragmentShader