MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
SoView2DShaderFunction.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2009, 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 "ShaderPipeline/ShaderPipelineCustomFunction.h"
19
20#include <Inventor/nodes/SoSubNode.h>
21#include <Inventor/fields/SoSFEnum.h>
22#include <Inventor/fields/SoSFBool.h>
23#include <Inventor/fields/SoSFString.h>
24
25class SoView2DShaderFunctionBase : public SoNode
26{
27 SO_NODE_HEADER(SoView2DShaderFunctionBase);
28
29public:
32
34 static void initClass();
35
38
46
49
59
60protected:
62 ShaderPipelineCustomFunction _function;
63
66
67private:
69 void updateFunctionName(SoField* field = nullptr);
70
72 void updateFunctionBody(SoField* field = nullptr);
73
75 void updateFunctionDisplay();
76
78 void updateParameters(SoField* field = nullptr);
79
81 void updateSubstep(SoField* field = nullptr);
82
84 void updateAll(SoField* field = nullptr);
85
87 struct Parameter
88 {
89 enum ParameterType {
90 PT_UNIFORM,
91 PT_VARYING,
92 PT_ATTRIBUTE,
93 PT_STATE,
94 PT_INCLUDE
95 };
96
97 ParameterType parameterType;
98 std::string valueType;
99 std::string name;
100 std::string size;
101 std::string defaultValue;
102 };
103
104 typedef std::vector<Parameter> ParameterVector;
105 typedef std::vector<std::string> StringVector;
106 typedef std::vector<SoSFString*> StringFieldVector;
107
109 void parseParameterDeclarationText(ParameterVector& target, const std::string& source);
110
114 bool parseParameterDeclarationLine(Parameter& parameter, const std::string& line);
115
118 bool parseTokens(Parameter& parameter, const StringVector& tokens);
119
121 bool checkTokens(const StringVector& tokens, size_t numberOfRequiredTokens);
122
124 bool isReplacementField(SoField* field);
125
127 void doReplacement(std::string& value);
128
130 StringFieldVector _replacedStringFields;
131
133 StringFieldVector _replacementStringFields;
134};
135
136
std::vector< std::string > StringVector
SoView2DShaderOperation _operation
The operation configured by this node.
static void initClass()
Initialization for inventor runtime system.
SoSFString replaced1
String replacement fields.
SoSFString functionName
Function declaration fields.
~SoView2DShaderFunctionBase() override
SoSFBool enabled
Enable/disabled this node.
ShaderPipelineCustomFunction _function
The function configured by this node.
SoSFString functionDisplay
Resulting function display.
SoSFEnum modificationType
Insertion settings.
static void initClass()
Initialization for inventor runtime system.
void GLRender(SoGLRenderAction *action) override
Container class to specify a change operation for the shader pipeline shader.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.