MeVisLab Toolbox Reference
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:
68
70 void updateFunctionName(SoField* field = nullptr);
71
73 void updateFunctionBody(SoField* field = nullptr);
74
76 void updateFunctionDisplay();
77
79 void updateParameters(SoField* field = nullptr);
80
82 void updateSubstep(SoField* field = nullptr);
83
85 void updateAll(SoField* field = nullptr);
86
88 struct Parameter
89 {
90 enum ParameterType
91 {
92 PT_UNIFORM,
93 PT_VARYING,
94 PT_ATTRIBUTE,
95 PT_STATE,
96 PT_INCLUDE
97 };
98
99 ParameterType parameterType;
100 std::string valueType;
101 std::string name;
102 std::string size;
103 std::string defaultValue;
104 };
105
106 typedef std::vector<Parameter> ParameterVector;
107 typedef std::vector<std::string> StringVector;
108 typedef std::vector<SoSFString*> StringFieldVector;
109
111 void parseParameterDeclarationText(ParameterVector& target, const std::string& source);
112
116 bool parseParameterDeclarationLine(Parameter& parameter, const std::string& line);
117
120 bool parseTokens(Parameter& parameter, const StringVector& tokens);
121
123 bool checkTokens(const StringVector& tokens, size_t numberOfRequiredTokens);
124
126 bool isReplacementField(SoField* field);
127
129 void doReplacement(std::string& value);
130
132 StringFieldVector _replacedStringFields;
133
135 StringFieldVector _replacementStringFields;
136};
137
138
140{
141 SO_NODE_HEADER(SoView2DShaderFunction);
142
144
145public:
146
148 static void initClass();
149
156
157protected:
159};
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.