--------------------------------------------------------------------------
| 139 | |
| 140 | //-------------------------------------------------------------------------- |
| 141 | inline 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[" |
no test coverage detected