// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen // SPDX-License-Identifier: BSD-3-Clause #include "vtkSobelGradientMagnitudePass1FS.h" const char *vtkSobelGradientMagnitudePass1FS = "//VTK::System::Dec\n" "\n" "\n" "// Fragment shader used by the first pass of the Sobel filter render pass.\n" "\n" "in vec2 tcoordVC;\n" "uniform sampler2D source;\n" "uniform float stepSize; // 1/W\n" "\n" "// the output of this shader\n" "//VTK::Output::Dec\n" "\n" "void main(void)\n" "{\n" " vec2 offset=vec2(stepSize,0.0);\n" " vec4 t1=texture2D(source,tcoordVC-offset);\n" " vec4 t2=texture2D(source,tcoordVC);\n" " vec4 t3=texture2D(source,tcoordVC+offset);\n" "\n" " // Gx\n" "\n" " // version with unclamped float textures t3-t1 will be in [-1,1]\n" "// gl_FragData[0]=t3-t1;\n" "\n" " // version with clamped unchar textures (t3-t1+1)/2 stays in [0,1]\n" " gl_FragData[0]=(t3-t1+1.0)/2.0;\n" "\n" " // Gy\n" " gl_FragData[1]=(t1+2.0*t2+t3)/4.0;\n" "}\n" "";