From ad2a55b2f3620864805b47470d6b436f0610dedf Mon Sep 17 00:00:00 2001 From: isk Date: Thu, 10 Dec 2015 14:18:38 +0300 Subject: [PATCH] 0026975: Visualization, TKOpenGl - handle triangle strips correctly within Ray-Tracing core --- src/OpenGl/OpenGl_View_Raytrace.cxx | 8 ++++---- tests/bugs/vis/bug26975 | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tests/bugs/vis/bug26975 diff --git a/src/OpenGl/OpenGl_View_Raytrace.cxx b/src/OpenGl/OpenGl_View_Raytrace.cxx index 45f9e79546..0839951abd 100644 --- a/src/OpenGl/OpenGl_View_Raytrace.cxx +++ b/src/OpenGl/OpenGl_View_Raytrace.cxx @@ -807,8 +807,8 @@ Standard_Boolean OpenGl_View::addRaytraceTriangleStripArray (OpenGl_TriangleSet& { for (Standard_Integer aVert = theOffset, aCW = 0; aVert < theOffset + theCount - 2; ++aVert, aCW = (aCW + 1) % 2) { - theSet.Elements.push_back (BVH_Vec4i (theIndices->Index (aVert + aCW ? 1 : 0), - theIndices->Index (aVert + aCW ? 0 : 1), + theSet.Elements.push_back (BVH_Vec4i (theIndices->Index (aVert + (aCW ? 1 : 0)), + theIndices->Index (aVert + (aCW ? 0 : 1)), theIndices->Index (aVert + 2), theMatID)); } @@ -817,8 +817,8 @@ Standard_Boolean OpenGl_View::addRaytraceTriangleStripArray (OpenGl_TriangleSet& { for (Standard_Integer aVert = theOffset, aCW = 0; aVert < theOffset + theCount - 2; ++aVert, aCW = (aCW + 1) % 2) { - theSet.Elements.push_back (BVH_Vec4i (aVert + aCW ? 1 : 0, - aVert + aCW ? 0 : 1, + theSet.Elements.push_back (BVH_Vec4i (aVert + (aCW ? 1 : 0), + aVert + (aCW ? 0 : 1), aVert + 2, theMatID)); } diff --git a/tests/bugs/vis/bug26975 b/tests/bugs/vis/bug26975 new file mode 100644 index 0000000000..11c3b0c3d1 --- /dev/null +++ b/tests/bugs/vis/bug26975 @@ -0,0 +1,27 @@ +puts "============" +puts "CR26975" +puts "============" +puts "" + +########################################################################################## +puts "Visualization, TKOpenGl - handle triangle strips correctly within Ray-Tracing core" +########################################################################################## + +pload MODELING VISUALIZATION +vclear +vinit View1 +vraytrace 0 +vdrawparray s trianglestrips v 0 0 0 n 0 0 1 v 0 2 0 n 0 0 1 v 2 0 0 n 0 0 1 v 2 2 0 n 0 0 1 +vfit + +vdump $imagedir/${casename}_rt_off.png + +vraytrace 1 + +vdump $imagedir/${casename}_rt_on.png + +set color [vreadpixel 250 250 rgb name] +puts $color +if { $color == "BLACK" } { + puts "ERROR: CR26975 is reproduced. Triangle strips incorrect within Ray-Tracing core." +}