puts "============="
puts "0030484: Visualization - 2d persistent: order of detection doesn't coincide with order of objects creation"
puts "============="

pload MODELING VISUALIZATION
vclear
vinit
vselprops dynHighlight -dispMode 1 -color WHITE
# Compare behaviour in a scene with two quads
# 1 from a box and another from primitive array
# quad primitive array only highlights in the corners
box box_1 75 -250 0 200 200 200
vdisplay box_1 -2d topLeft -top -dispmode 1
vsetmaterial box_1  PLASTIC
vsetcolor    box_1 DEEPPINK2

vdrawparray quad1 quads v 175 -300 0 c 0 0 1 v 375 -300 0 c 0 0 1 v 375 -100 0 c 0 0 1 v 175 -100 0 c 0 0 1
vdisplay quad1 -2d topLeft -top -dispmode 1
vsetmaterial quad1 PLASTIC
vsetcolor    quad1 PALEGREEN2

# dump image
vdump $imagedir/${casename}_box_quad_undefined.png
vmoveto 100 100
vdump $imagedir/${casename}_box_quad_boxhighlight.png
vmoveto 376 100
vdump $imagedir/${casename}_box_quad_quadhighlight.png

#test selection priority
vmoveto 0 0
vpriority -update box_1 6
vpriority -update quad1 5
vselectpriority box_1 5
vselectpriority quad1 6
vmoveto 175 99
if { [vreadpixel 300 200 rgb name] != "WHITE" } { puts "Error: quad primitive should be highlighted" }
vdump $imagedir/${casename}_box_quad_selectionpriority_focused.png
