Commit 69ab63e3 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Do not modulate vector opacity by vector magnitude. Do not display vectors

with length 0 or NaN values.
parent ca4eb9bf
......@@ -88,9 +88,9 @@ PARAM zColour = {{ param_zColour }};
PARAM colourXform = {{ param_colourXform }};
# Bail if the textureq coordinate
# Bail if the texture coordinate
# is out of the image space.
# We use voxValue out of convenience
# We use voxValue as a temporary
{{
arb_call('textest.prog',
texCoord='{{ varying_vecTexCoord }}',
......@@ -105,6 +105,26 @@ TEX voxValue, {{ varying_vecTexCoord }}, {{ texture_vectorTexture }}, 3D;
TEX modValue, {{ varying_modTexCoord }}, {{ texture_modulateTexture }}, 3D;
TEX clipValue, {{ varying_clipTexCoord }}, {{ texture_clipTexture }}, 3D;
# Kill the fragment if this vector
# has length 0 or contains NaNs
# We use clipResult as a temporary
# kill if length is 0
DP3 clipResult.x, voxValue, voxValue;
MUL clipResult.x, clipResult.x, -1;
SGE clipResult.x, clipResult.x, 0;
MUL clipResult.x, clipResult.x, -1;
KIL clipResult.x;
# kill if vector contains NaNs.
# There is no nan test, or equality
# test, so we test whether
# (value >= value) || (value < value)
DP3 clipResult.x, voxValue, voxValue;
SGE clipResult.y, clipResult.x, clipResult.x;
SLT clipResult.z, clipResult.x, clipResult.x;
ADD clipResult.x, clipResult.y, clipResult.z;
SUB clipResult.x, clipResult.x, 0.5;
KIL clipResult.x;
# Clobber the clipping/modulation
# values we just looked up if their
# texture coords were out of bounds.
......@@ -165,10 +185,11 @@ ABS voxValue, voxValue;
# Cumulatively combine the rgb
# channels of those three colours
MOV fragColour, 0;
MAD fragColour, voxValue.x, xColour, fragColour;
MAD fragColour, voxValue.y, yColour, fragColour;
MAD fragColour, voxValue.z, zColour, fragColour;
MOV fragColour, 0;
MAD fragColour, voxValue.x, xColour, fragColour;
MAD fragColour, voxValue.y, yColour, fragColour;
MAD fragColour, voxValue.z, zColour, fragColour;
MOV fragColour.w, xColour.w;
# Apply the bri/con scale and offset
MAD fragColour.rgb, fragColour, colourXform.x, colourXform.y;
......
......@@ -142,6 +142,12 @@ void main(void) {
voxValue = texture3D(vectorTexture, fragVecTexCoord).xyz;
}
/* Do not draw vectors with length 0 or with NaNs */
float len = length(voxValue.xyz);
if (len == 0 || len != len) {
discard;
}
/* Look up the modulation and clipping values */
float modValue;
float clipValue;
......@@ -199,10 +205,15 @@ void main(void) {
voxValue += voxValXform[3].x;
voxValue = abs(voxValue);
/* Combine the xyz component colours. */
/*
* Combine the xyz component colours.
* Opacity should be ident0ical across
* the three colours.
*/
vec4 voxColour = voxValue.x * xColour +
voxValue.y * yColour +
voxValue.z * zColour;
voxColour.a = xColour.a;
/*
* Apply the colour scale/offset -
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment