//=========================================================================//// Program: Visualization Toolkit// Module: vtkLineIntegralConvolution2D_LIC0.glsl//// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen// All rights reserved.// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.//// This software is distributed WITHOUT ANY WARRANTY; without even// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR// PURPOSE. See the above copyright notice for more information.////=========================================================================/**This shader initializes the convolution for the LIC computation.*/// The following line handles system declarations such as// default precisions, or defining precisions to null//VTK::System::Decuniformsampler2DtexMaskVectors;uniformsampler2DtexNoise;uniformsampler2DtexLIC;uniformintuStepNo;// in step 0 initialize lic and seeds, else just seedsuniformintuPassNo;// in pass 1 hpf of pass 0 is convolved.uniformfloatuMaskThreshold;// if |V| < uMaskThreshold render transparentuniformvec2uNoiseBoundsPt1;// tc of upper right pt of noise texturevaryingvec2tcoordVC;// convert from vector coordinate space to noise coordinate space.// the noise texture is tiled across the *whole* domainvec2VectorTCToNoiseTC(vec2vectc){returnvectc/uNoiseBoundsPt1;}// get the texture coordidnate to lookup noise value. this// depends on the pass number.vec2getNoiseTC(vec2vectc){// in pass 1 : convert from vector tc to noise tc// in pass 2 : use vector tcif(uPassNo==0){returnVectorTCToNoiseTC(vectc);}else{returnvectc;}}// look up noise value at the given location. The location// is supplied in vector texture coordinates, hence the// need to convert to noise texture coordinates.floatgetNoise(vec2vectc){returntexture2D(texNoise,getNoiseTC(vectc)).r;}voidmain(void){vec2vectc=tcoordVC.st;// lic => (convolution, mask, 0, step count)if(uStepNo==0){floatmaskCriteria=length(texture2D(texMaskVectors,vectc).xyz);floatmaskFlag;if(maskCriteria<=uMaskThreshold){maskFlag=1.0;}else{maskFlag=0.0;}floatnoise=getNoise(vectc);gl_FragData[0]=vec4(noise,maskFlag,0.0,1.0);}else{gl_FragData[0]=texture2D(texLIC,vectc);}// initial seedgl_FragData[1]=vec4(vectc,0.0,1.0);}