Mercurial > hg > octave-nkf
changeset 17589:c3aadd228c37
Fix surf/mesh handling of NaN values in cdata (transparent) (bug #32275).
* libinterp/corefcn/gl-render.cc(draw_surface): Check lowest indexed vertex for
NaN in "flat" mode. Check all 4 vertices for NaN in "interp" mode. When
found, don't bother to draw anything which makes things transparent.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 07 Oct 2013 13:01:25 -0700 |
parents | 9ff04de067ce |
children | a53a97faf61a |
files | libinterp/corefcn/gl-render.cc |
diffstat | 1 files changed, 52 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc +++ b/libinterp/corefcn/gl-render.cc @@ -1616,8 +1616,10 @@ j1 = j; clip(i,j) = is_nan_or_inf (x(i1,j), y(i,j1), z(i,j)); + /* if (fc_mode == 1 || fc_mode == 2) clip(i,j) |= (xisnan (c(i,j)) || xisinf (c(i,j))); + */ } } @@ -1676,10 +1678,25 @@ for (int j = 1; j < zr; j++) { - if (clip(j-1, i-1) || clip (j, i-1) - || clip (j-1, i) || clip (j, i)) + + if (clip(j-1, i-1) || clip(j, i-1) + || clip(j-1, i) || clip(j, i)) continue; + if (fc_mode == 1) + { + // "flat" only needs color at lower-left vertex + if (! xfinite (c(j-1,i-1))) + continue; + } + else if (fc_mode == 2) + { + // "interp" needs valid color at all 4 vertices + if (! (xfinite (c(j-1, i-1)) && xfinite (c(j, i-1)) + && xfinite (c(j-1, i)) && xfinite (c(j, i)))) + continue; + } + if (x_mat) { j1 = j-1; @@ -1867,6 +1884,19 @@ if (clip(j-1,i) || clip(j,i)) continue; + if (ec_mode == 1) + { + // "flat" only needs color at lower-left vertex + if (! xfinite (c(j-1,i))) + continue; + } + else if (ec_mode == 2) + { + // "interp" needs valid color at both vertices + if (! (xfinite (c(j-1, i)) && xfinite (c(j, i)))) + continue; + } + if (x_mat) { j1 = j-1; @@ -1951,6 +1981,19 @@ if (clip(j,i-1) || clip(j,i)) continue; + if (ec_mode == 1) + { + // "flat" only needs color at lower-left vertex + if (! xfinite (c(j,i-1))) + continue; + } + else if (ec_mode == 2) + { + // "interp" needs valid color at both vertices + if (! (xfinite (c(j, i-1)) && xfinite (c(j, i)))) + continue; + } + if (y_mat) { i1 = i-1; @@ -2080,12 +2123,17 @@ if ((do_edge && mecolor.numel () == 0) || (do_face && mfcolor.numel () == 0)) { + if (! xfinite (c(j,i))) + continue; // Skip NaNs in color data + for (int k = 0; k < 3; k++) cc(k) = c(j,i,k); } - Matrix lc = (do_edge ? (mecolor.numel () == 0 ? cc : mecolor) : Matrix ()); - Matrix fc = (do_face ? (mfcolor.numel () == 0 ? cc : mfcolor) : Matrix ()); + Matrix lc = (do_edge ? (mecolor.numel () == 0 ? cc : mecolor) + : Matrix ()); + Matrix fc = (do_face ? (mfcolor.numel () == 0 ? cc : mfcolor) + : Matrix ()); draw_marker (x(j1,i), y(j,i1), z(j,i), lc, fc); }