1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0032208: Tests - refactor visualization tests to cover several graphic drivers

Removed testgrids 'bugs/vis' and '3rdparty'; tests have been redistributed across other grids.
Moved testgrid 'v3d/ivtk' into dedicated 'vtk/ivtk'.

Added testgrid 'vselect' dedicated to 3D viewer picking/selection functionality
and filled with tests from 'v3d/vertex', 'v3d/face' and similar groups.

Added testgrid 'opengl' dedicated to OpenGL driver low-level functionality (GLSL programs and similar)
and filled with tests from 'v3d/glsl', 'v3d/raytrace', '3rdparty/fonts', 'bugs/vis' (portion) and similar.

Added testgrid 'opengles3' dedicated to OpenGL ES 3.0 driver low-level functionality
and reusing tests from 'opengl' testgrid.
Subgroup 'opengles3/raytrace' is disabled on Windows, as Ray-Tracing currently requires OpenGL ES 3.2.
while ANGLE library implements only OpenGL ES 3.0.

Added testgrid 'opengles2' dedicated to OpenGL ES 2.0 driver low-level functionality
and reusing a limited subset of passing tests from 'opengl' testgrid.
Currently testgrid is activated only on Windows platform when using ANGLE library
(properietary OpenGL ES drivers do not allow creation of restricted 2.0 context).

Test cases have been cleaned out to put bug description into log,
to properly load necessary plugins and to explicitly dump viewer.
This commit is contained in:
kgv
2021-03-22 12:29:04 +03:00
committed by bugmaster
parent a076535090
commit 0d828ac838
1891 changed files with 4279 additions and 6199 deletions

View File

@@ -0,0 +1,17 @@
puts "============"
puts "0029823: Visualization, TKOpenGl - highlighting by Bounding Box mistreats Local Transformation"
puts "============"
puts ""
pload MODELING VISUALIZATION
vclear
vinit View1
vaxo
psphere s0 1
psphere s1 1
vdisplay -dispMode 1 s0 s1
vlocation s1 -reset -rotate 0 0 0 1 0 0 20 -translate 2 1 0
vfit
vbounding
vdump $imagedir/${casename}.png

View File

@@ -0,0 +1,33 @@
puts "========"
puts "OCC25679: Visualization, TKOpenGl - View frustum culling clips wrong objects"
puts "========"
puts ""
pload MODELING VISUALIZATION
set LINES_IN_ROW 50
set aNoCulling $imagedir/${casename}_without.png
set aWithCulling $imagedir/${casename}_with.png
set aDiff $imagedir/${casename}_diff.png
vinit View1
for {set i 0} {$i < $LINES_IN_ROW} {incr i} {
for {set j 0} {$j < $LINES_IN_ROW} {incr j} {
set aLineName "line"
append aLineName [expr $i * $LINES_IN_ROW + $j]
vline $aLineName 0 0 0 1 0 0
vsetlocation $aLineName [expr $i * 3] [expr $j * 3] 0
}
}
vfit
vrenderparams -frustumculling on
vdump $aWithCulling
vrenderparams -frustumculling off
vdump $aNoCulling
set aDiffRes [diffimage $aWithCulling $aNoCulling 0.1 0 0 $aDiff]
if {$aDiffRes != 0} { puts "ERROR : Test failed: there is a difference between images rendered with and without frustum culling" }

View File

@@ -0,0 +1,34 @@
puts "========"
puts "0029295: Visualization, TKOpenGl - provide distance culling option"
puts "Check distance culling"
puts "========"
set THE_NB_BOXES 5
set THE_COLORS { RED GREEN BLUE YELLOW PURPLE1 }
set THE_PICK_PNTS1 { { 20 80 } { 60 110 } { 120 140 } { 200 180 } { 300 240 } }
set THE_PICK_PNTS2 { { 110 140 } { 130 150 } { 160 170 } { 200 190 } { 240 210 } }
pload MODELING VISUALIZATION
vclear
vinit View1
vaxo
vcamera -persp
for { set x 0 } { $x < $THE_NB_BOXES } { incr x } { box b$x $x 0 0 0.5 0.2 0.4; vpoint p$x $x 0 0; vdisplay -mutable p$x; vdisplay -dispMode 1 b$x }
for { set x 0 } { $x < $THE_NB_BOXES } { incr x } { vsetcolor b$x [lindex $THE_COLORS $x] }
vline l 0 0 0 5 0 0
vdisplay -mutable l
vfit
vzlayer default -culldist 7
for { set x 0 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1 $x] rgb name] == "BLACK" } { puts "Error: object is culled" } }
vdump $::imagedir/${::casename}_7.png
vzlayer default -culldist 5
for { set x 2 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1 $x] rgb name] == "BLACK" } { puts "Error: object is culled" } }
for { set x 0 } { $x < 2 } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1 $x] rgb name] != "BLACK" } { puts "Error: object is NOT culled" } }
vdump $::imagedir/${::casename}_5.png
vzoom 0.5
vzlayer default -culldist 10
for { set x 1 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS2 $x] rgb name] == "BLACK" } { puts "Error: object is culled" } }
for { set x 0 } { $x < 1 } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS2 $x] rgb name] != "BLACK" } { puts "Error: object is NOT culled" } }
vdump $::imagedir/${::casename}_10.png

View File

@@ -0,0 +1,57 @@
puts "========"
puts "0029295: Visualization, TKOpenGl - provide distance culling option"
puts "Check size culling"
puts "========"
set THE_NB_BOXES 5
set THE_COLORS { RED GREEN BLUE YELLOW PURPLE1 }
set THE_PICK_PNTS1O { { 10 165 } { 100 200 } { 170 250 } { 250 250 } { 350 300 } }
set THE_PICK_PNTS1P { { 40 170 } { 100 200 } { 170 250 } { 250 250 } { 380 350 } }
set THE_PICK_PNTS2O { { 148 192 } { 175 200 } { 190 200 } { 200 220 } { 250 230 } }
set THE_PICK_PNTS2P { { 152 192 } { 175 200 } { 190 200 } { 220 220 } { 250 230 } }
set THE_PICK_PNTS3P { { 90 155 } { 105 160 } { 125 170 } { 140 175 } { 160 180 } }
pload MODELING VISUALIZATION
vclear
vinit View1
vaxo
for { set x 1 } { $x <= $THE_NB_BOXES } { incr x } { box b$x [expr $x * 1.0] 0 0 [expr $x * 0.2] [expr $x *0.1] [expr $x *0.3]; vdisplay -dispMode 1 b$x }
for { set x 1 } { $x <= $THE_NB_BOXES } { incr x } { vsetcolor b$x [lindex $THE_COLORS [expr $x - 1]] }
vline l 1 0 0 6 0 0
vdisplay -mutable l
vcamera -ortho
vfit
vzlayer default -cullsize 25
vcamera -ortho
for { set x 0 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1O $x] rgb name] == "BLACK" } { puts "Error: object $x is culled" } }
vdump $::imagedir/${::casename}_25o.png
vcamera -persp
for { set x 0 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1P $x] rgb name] == "BLACK" } { puts "Error: object $x is culled" } }
vdump $::imagedir/${::casename}_25p.png
vzlayer default -cullsize 50
vcamera -ortho
for { set x 1 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1O $x] rgb name] == "BLACK" } { puts "Error: object $x is culled" } }
for { set x 0 } { $x < 1 } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1O $x] rgb name] != "BLACK" } { puts "Error: object $x is NOT culled" } }
vdump $::imagedir/${::casename}_50o.png
vcamera -persp
for { set x 1 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1P $x] rgb name] == "BLACK" } { puts "Error: object $x is culled" } }
for { set x 0 } { $x < 1 } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS1P $x] rgb name] != "BLACK" } { puts "Error: object $x is NOT culled" } }
vdump $::imagedir/${::casename}_50p.png
vzoom 0.25
vzlayer default -cullsize 30
vcamera -ortho
for { set x 2 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS2O $x] rgb name] == "BLACK" } { puts "Error: object $x is culled" } }
for { set x 0 } { $x < 2 } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS2O $x] rgb name] != "BLACK" } { puts "Error: object $x is NOT culled" } }
vdump $::imagedir/${::casename}_30o.png
vcamera -persp
for { set x 2 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS2P $x] rgb name] == "BLACK" } { puts "Error: object $x is culled" } }
for { set x 0 } { $x < 2 } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS2P $x] rgb name] != "BLACK" } { puts "Error: object $x is NOT culled" } }
vdump $::imagedir/${::casename}_30p.png
vviewparams -eye 16.8333 -9.08333 10.0833 -at 7.5 0.25 0.75
for { set x 3 } { $x < $THE_NB_BOXES } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS3P $x] rgb name] == "BLACK" } { puts "Error: object $x is culled" } }
for { set x 0 } { $x < 3 } { incr x } { if { [vreadpixel {*}[lindex $THE_PICK_PNTS3P $x] rgb name] != "BLACK" } { puts "Error: object $x is NOT culled" } }
vdump $::imagedir/${::casename}_30p2.png

View File

@@ -0,0 +1,28 @@
puts "========"
puts "0029300: Visualization, TKOpenGl - provide depth pre-pass option"
puts "========"
pload MODELING VISUALIZATION
vclear
vclose ALL
vinit View1
# display objects
psphere s 1
box b 1 2 3
vaxo
vdisplay -dispMode 1 s b
vaspects b -setColor RED -setTransparency 0.5
vfit
vzbufftrihedron
vmoveto 150 250
vcaps -ffp 0
vrenderparams -shadingModel phong
vrenderparams -depthPrePass off
vdump $::imagedir/${::casename}_1.png
vrenderparams -depthPrePass on
vdump $::imagedir/${::casename}_2.png
if { [diffimage $::imagedir/${::casename}_1.png $::imagedir/${::casename}_2.png 0 0 0 $::imagedir/${::casename}_diff.png] != 0 } { puts "Error: images differ" }

View File

@@ -0,0 +1,54 @@
puts "========"
puts "0024393: Visualization - objects position with enhanced precision"
puts "========"
pload MODELING VISUALIZATION
vclear
vinit View1
vaxo
vzbufftrihedron
circle c 0 0 0 0.001
mkedge e c
wire w e
plane s
mkface f0 s w
mkface f1000 s w
ttranslate f1000 1000 0 0
# Display object with pre-applied transformation.
# Result presentation is already corrupted
# AND it jumps while rotating the camera.
vpoint v1000 1000 0 0.001
vdisplay -dispMode 1 f1000
vfit
# Display object with external transformation.
# Result presentation jumps while rotating the camera.
vdisplay -dispMode 1 f0
vsetlocation f0 1000 0 0
# Display object with external transformation
# in Z-layer with translated Origin.
# Result presentation does not jump while rotating the camera.
vzlayer top -origin 1000 0 0
vdisplay -dispMode 1 -top f0
# check transformation persistence
vtrihedron tt
vdisplay -top -trihedron topLeft 100 100 tt
box zp 40 50 30
vdisplay -top -dispMode 1 -trsfPers zoom -trsfPersPos 1000 0 0 zp
# check clippling planes
vclipplane pln -equation -1 0 0 1000 -set
# check positional lights
vlight add positional pos 1000 0 0.001 color RED1 headlight 0
vremove f1000
vmoveto 220 220
vdrawtext text Text -pos 0 0 0
vdisplay -top text -trsfPers zoomRotate -trsfPersPos 1000 0 0.001
vdump $::imagedir/${::casename}.png

View File

@@ -0,0 +1,22 @@
puts "========"
puts "Test to verify the lights are turned off after 'vlight clear' (and scene is black)"
puts "========"
pload MODELING VISUALIZATION
# create box
box b 1 2 3
# draw box
vclear
vclose ALL
vinit View1
vsetdispmode 1
vdisplay b
vfit
vlight clear
set color [vreadpixel 100 100 rgb]
set black "0 0 0"
if {[string equal $color $black] != 1} {error "Lights do not seems to be cleared!"}

View File

@@ -0,0 +1,34 @@
puts "========"
puts "Multisampling FBOs"
puts "========"
pload MODELING VISUALIZATION
box b 2 3 1
vclear
vclose ALL
vinit View1 w=512 h=512
vbackground -gradient B4C8FF B4B4B4 -gradientMode VERTICAL
vsetdispmode 0
vdisplay b
vfit
vrotate 0.5 0 0
vzbufftrihedron
vrenderparams -msaa 0
vdump $::imagedir/${::casename}_512x512_msaa0.png
vrenderparams -msaa 2
vdump $::imagedir/${::casename}_512x512_msaa2.png
vrenderparams -msaa 4
vdump $::imagedir/${::casename}_512x512_msaa4.png
vrenderparams -msaa 8
vdump $::imagedir/${::casename}_512x512_msaa8.png
# check dump with resolutions not equal to window size
vdump $::imagedir/${::casename}_1920x1080_msaa8.png -width 1920 -height 1080
vdump $::imagedir/${::casename}_2560x1440_msaa8.png -width 2560 -height 1440
# check dump with stereo
vstereo anaglyph
vdump $::imagedir/${::casename}_512x512_msaa8stereo.png -stereo blend
vdump $::imagedir/${::casename}_1920x1080_msaa8stereo.png -width 1920 -height 1080 -stereo blend
vdump $::imagedir/${::casename}_2560x1440_msaa8stereo.png -width 2560 -height 1440 -stereo blend

View File

@@ -0,0 +1,41 @@
puts "========"
puts "Rendering resolution scale factor"
puts "========"
set aFontFile ""
catch { set aFontFile [locate_data_file DejaVuSans.ttf] }
pload MODELING VISUALIZATION
set aLabelFont "Arial"
if { "$aFontFile" != "" } {
vfont add "$aFontFile" SansFont
set aLabelFont "SansFont"
}
box b 1 2 3
vclear
vclose ALL
vinit View1
vdisplay b
vfit
vpoint p 0 0 0
vzbufftrihedron
vdrawtext t Text2d -font $aLabelFont
vtrihedron tt
vdisplay -trsfPers zoom -trsfPersPos 1 0 0 tt
text2brep ttl "Top-Left" -font $aLabelFont -height 30 -pos 0 -30 0
vdisplay ttl -2d topLeft -dispMode 1
vcolorscale cs -demo
vrenderparams -rendScale 1
vdump $::imagedir/${::casename}_100.png
vrenderparams -rendScale 0.5
vdump $::imagedir/${::casename}_050.png
vrenderparams -rendScale 0.75
vdump $::imagedir/${::casename}_075.png
vrenderparams -rendScale 2
vdump $::imagedir/${::casename}_200.png

View File

@@ -0,0 +1,36 @@
puts "========"
puts "Stereo output modes"
puts "========"
pload MODELING VISUALIZATION
restore [locate_data_file occ/fuse.brep] f
vclear
vclose ALL
vinit View1
vsetdispmode 1
vaxo
vdisplay f
vfit
vrotate -0.5 0.0 0.0
vstereo -mode anaglyph
vfit
vdump $::imagedir/${::casename}_anaglyph.png -stereo blend
vstereo -mode columnInterlaced
vdump $::imagedir/${::casename}_col.png -stereo blend
vstereo -mode chessBoard
vdump $::imagedir/${::casename}_chess.png -stereo blend
vstereo -mode rowInterlaced
vdump $::imagedir/${::casename}_row.png -stereo blend
vstereo -mode sideBySide
vdump $::imagedir/${::casename}_sbs_anamorph.png -stereo blend
vstereo -mode overUnder
vdump $::imagedir/${::casename}_overunder_anamorph.png -stereo blend
vdump $::imagedir/${::casename}_sbs.png -stereo sbs

View File

@@ -0,0 +1,85 @@
puts "========"
puts "Tiled image dump"
puts "========"
set aFontFile ""
catch { set aFontFile [locate_data_file DejaVuSans.ttf] }
pload MODELING VISUALIZATION
box b 2 3 1
box b2 50 20 30
set aLabelFont "Arial"
if { "$aFontFile" != "" } {
vfont add "$aFontFile" SansFont
set aLabelFont "SansFont"
}
vclear
vclose ALL
vinit View1
vraytrace 0
vbackground -gradient B4C8FF B4B4B4 -gradientMode VERTICAL
vsetdispmode 0
vdisplay -dispMode 1 b
vfit
vrotate 0.5 0 0
vzbufftrihedron
catch { vzlayer del 1 }
set aLayerId [vzlayer add]
vzlayer $aLayerId -enable depthClear -disable rayTracing
vtrihedron trh
vdisplay -noupdate trh -layer $aLayerId -trihedron topRight 100 100
text2brep tcc "Center" -font $aLabelFont -height 30 -pos -40 0 0
vdisplay -noupdate tcc -2d center -layer $aLayerId -dispMode 1
polyline lcc -50 -50 0 -50 50 0 50 50 0 50 0 0 0 -50 0 -50 -50 0
vdisplay -noupdate lcc -2d center -layer $aLayerId
vsetwidth -noupdate lcc 2
text2brep tbl "Bottom-Left" -font $aLabelFont -height 30 -pos 0 3 5
vdisplay -noupdate tbl -2d bottomLeft -layer $aLayerId -dispMode 1
polyline lbl 0 0 0 0 100 0 100 100 0 100 50 0 50 0 0 0 0 0
vdisplay -noupdate lbl -2d bottomLeft -layer $aLayerId
vsetwidth -noupdate lbl 2
text2brep ttl "Top-Left" -font $aLabelFont -height 30 -pos 0 -30 0
vdisplay -noupdate ttl -2d topLeft -layer $aLayerId -dispMode 1
polyline ltl 0 -100 0 0 0 0 100 0 0 100 -50 0 50 -100 0 0 -100 0
vdisplay -noupdate ltl -2d topLeft -layer $aLayerId
vsetwidth -noupdate ltl 2
text2brep ttr "Top-Right" -font $aLabelFont -height 30 -pos -130 -30 0
vdisplay -noupdate ttr -2d topRight -layer $aLayerId -dispMode 1
polyline ltr -100 -100 0 -100 0 0 0 0 0 0 -50 0 -50 -100 0 -100 -100 0
vdisplay -noupdate ltr -2d topRight -layer $aLayerId
vsetwidth -noupdate ltr 2
text2brep tbr "Bottom-Right" -font $aLabelFont -height 30 -pos -180 3 0
vdisplay -noupdate tbr -2d bottomRight -layer $aLayerId -dispMode 1
polyline lbr -100 0 0 -100 100 0 0 100 0 0 50 0 -50 0 0 -100 0 0
vdisplay -noupdate lbr -2d bottomRight -layer $aLayerId
vsetwidth -noupdate lbr 2
vdrawtext t2 "Label" -pos 1 0 1 -font $aLabelFont
vdisplay b2 -trsfPers zoom -trsfPersPos 1 0 1
vdump $::imagedir/${::casename}_409x409_tile0.png
vdump $::imagedir/${::casename}_409x409_tile128.png -tileSize 128
vdump $::imagedir/${::casename}_409x409_tile1024.png -tileSize 1024
vdump $::imagedir/${::casename}_1920x1080_tile0.png -width 1920 -height 1920
vdump $::imagedir/${::casename}_1920x1080_tile128.png -width 1920 -height 1920 -tileSize 128
vdump $::imagedir/${::casename}_1920x1080_tile1024.png -width 1920 -height 1920 -tileSize 1024
diffimage $::imagedir/${::casename}_409x409_tile0.png $::imagedir/${::casename}_409x409_tile128.png 0 0 0 $::imagedir/${::casename}_409x409_tile128diff.png
# check dump with stereo
vstereo anaglyph
vdump $::imagedir/${::casename}_409x409_stereotile0.png -stereo blend
vdump $::imagedir/${::casename}_409x409_stereotile128.png -stereo blend -tileSize 128
vdump $::imagedir/${::casename}_409x409_stereotile1024.png -stereo blend -tileSize 1024
vdump $::imagedir/${::casename}_1920x1080_stereotile0.png -width 1920 -height 1920 -stereo blend
vdump $::imagedir/${::casename}_1920x1080_stereotile128.png -width 1920 -height 1920 -stereo blend -tileSize 128
vdump $::imagedir/${::casename}_1920x1080_stereotile1024.png -width 1920 -height 1920 -stereo blend -tileSize 1024
diffimage $::imagedir/${::casename}_409x409_stereotile0.png $::imagedir/${::casename}_409x409_stereotile128.png 0 0 0 $::imagedir/${::casename}_409x409_stereotile128diff.png