awips2/cave/com.raytheon.viz.core.gl/localization/glsl/mosaicMaxVal.glsl
Max Schenkelberg 7822511754 Issue #2680 fixed samplers in structs issues with GLSL spec.
Change-Id: I2375e4c273f6cd340f253d71ae7eadc8ed9a38e9

Former-commit-id: 4f3635fc682c2a1746e188dac0f371676c9e0be9
2014-02-10 13:43:16 -06:00

33 lines
No EOL
1.1 KiB
GLSL

// this shader program sets values into a mosaic texture
// which is the same size as the screen (frame buffer)
#include <mapping>
uniform sampler2D imageDataTex;
uniform DataTextureInfo imageData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) {
float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue = mosaicValue;
// No data check/special NaN check
if (imageValue != imageData.noDataValue && imageValue == imageValue) {
// Convert image value to mosaic value
imageValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
if (imageValue > mosaicValue) {
newValue = imageValue;
}
}
gl_FragColor = vec4(dataToTextureValue(mosaicData, newValue), 0.0, 0.0,
1.0);
}