MCPcopy Create free account
hub / github.com/Kitware/VTK / BaseDeclarationFragment

Function BaseDeclarationFragment

Rendering/VolumeOpenGL2/vtkVolumeShaderComposer.h:141–382  ·  view source on GitHub ↗

--------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

139
140//--------------------------------------------------------------------------
141inline std::string BaseDeclarationFragment(vtkRenderer* vtkNotUsed(ren), vtkVolumeMapper* mapper,
142 vtkOpenGLGPUVolumeRayCastMapper::VolumeInputMap& inputs, int totalNumberOfLights,
143 int numberPositionalLights, bool defaultLighting, int noOfComponents, int independentComponents)
144{
145 const int numInputs = static_cast<int>(inputs.size());
146
147 std::ostringstream toShaderStr;
148 toShaderStr << "uniform sampler3D in_volume[" << numInputs << "];\n";
149
150 toShaderStr << "uniform vec4 in_volume_scale[" << numInputs
151 << "];\n"
152 "uniform vec4 in_volume_bias["
153 << numInputs << "];\n";
154
155 if (vtkRectilinearGrid::SafeDownCast(mapper->GetInput()))
156 {
157 toShaderStr << "uniform sampler1D in_coordTexs;\n";
158 toShaderStr << "uniform vec3 in_coordTexSizes;\n";
159 toShaderStr << "uniform vec3 in_coordsScale;\n";
160 toShaderStr << "uniform vec3 in_coordsBias;\n";
161 }
162
163 if (mapper->GetInput()->GetPointGhostArray() || mapper->GetInput()->GetCellGhostArray())
164 {
165 toShaderStr << "uniform sampler3D in_blanking;\n";
166 }
167
168 toShaderStr << "uniform int in_noOfComponents;\n"
169 "\n"
170 "uniform sampler2D in_depthSampler;\n";
171
172 vtkOpenGLGPUVolumeRayCastMapper* glMapper = vtkOpenGLGPUVolumeRayCastMapper::SafeDownCast(mapper);
173 if (glMapper->GetUseJittering())
174 {
175 toShaderStr << "uniform sampler2D in_noiseSampler;\n";
176 }
177
178 // For multiple inputs (numInputs > 1), an additional transformation is
179 // needed for the bounding-box.
180 const int numTransf = (numInputs > 1) ? numInputs + 1 : 1;
181 toShaderStr << "uniform mat4 in_volumeMatrix[" << numTransf
182 << "];\n"
183 "uniform mat4 in_inverseVolumeMatrix["
184 << numTransf
185 << "];\n"
186 "uniform mat4 in_textureDatasetMatrix["
187 << numTransf
188 << "];\n"
189 "uniform mat4 in_inverseTextureDatasetMatrix["
190 << numTransf
191 << "];\n"
192 "uniform mat4 in_textureToEye["
193 << numTransf
194 << "];\n"
195 "uniform vec3 in_texMin["
196 << numTransf
197 << "];\n"
198 "uniform vec3 in_texMax["

Callers 1

ReplaceShaderBaseMethod · 0.85

Calls 12

GetPointGhostArrayMethod · 0.80
GetCellGhostArrayMethod · 0.80
GetShadeMethod · 0.80
GetBlendModeMethod · 0.80
IsAMethod · 0.80
HasGradientOpacityFunction · 0.70
to_stringFunction · 0.50
sizeMethod · 0.45
GetInputMethod · 0.45
GetPropertyMethod · 0.45
beginMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected