1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0027796: Visualization - allow 3D objects with Graphic3d_TMF_2d flag

Graphic3d_TransformPers::Apply() now does not reset projection matrix
for objects with Graphic3d_TMF_2d flag.

Useless flag Graphic3d_TMF_2d_IsTopDown has been removed.
SelectMgr_SelectableObjectTrsfPersSet now does not skip Graphic3d_TMF_2d presentations.
OpenGl_Layer::BoundingBox() now takes into account Graphic3d_TMF_2d presentations for proper Z-fit.

AIS_ColorScale now uses "lazy" mode for rendering labels
(considering 2D persistence to be already defined within entire structure).

OpenGl_Layer::updateBVH() now updates myAlwaysRenderedMap to handle
dynamic transformation persistence flag change without redisplaying the object.
This commit is contained in:
kgv
2016-08-20 19:37:56 +03:00
committed by bugmaster
parent 0766573201
commit 150ed3d5ef
11 changed files with 151 additions and 95 deletions

View File

@@ -1,43 +0,0 @@
puts "============"
puts "OCC25783_1"
puts "Draw 2d objects in top-down mode."
puts "============"
puts ""
vfont add [locate_data_file DejaVuSans.ttf] SansFont
vinit View1
vclear
vaxo
# display polyline in overlay
text2brep tcc "Center" -font SansFont -height 30
vdisplay tcc -2dTopDown -osd
polyline lcc -50 -50 0 -50 50 0 50 50 0 50 0 0 0 -50 0 -50 -50 0
vdisplay lcc -2dTopDown -overlay
# display polyline in overlay in the top left corner of the view
text2brep ttl "Top-Left" -font SansFont -height 30
vdisplay ttl -2dTopDown -trsfPersPos -1 -1 5 -osd
polyline ltl 0 0 0 0 100 0 100 100 0 100 50 0 50 0 0 0 0 0
vdisplay ltl -2dTopDown -trsfPersPos -1 -1 3 -overlay
# display polyline in overlay in the bottom left corner of the view
text2brep tbl "Bottom-Left" -font SansFont -height 30 -pos -27 0 0
vdisplay tbl -2dTopDown -trsfPersPos -1 1 30 -osd
polyline lbl 0 -100 0 0 0 0 100 0 0 100 -50 0 50 -100 0 0 -100 0
vdisplay lbl -2dTopDown -trsfPersPos -1 1 3 -overlay
# display polyline in overlay in the bottom right corner of the view
text2brep tbr Bottom-Right -font SansFont -height 30 -pos -145 0 0
vdisplay tbr -2dTopDown -trsfPersPos 1 1 30 -osd
polyline lbr -100 -100 0 -100 0 0 0 0 0 0 -50 0 -50 -100 0 -100 -100 0
vdisplay lbr -2dTopDown -trsfPersPos 1 1 3 -overlay
# display polyline in overlay in the top right corner of the view
text2brep ttr "Top-Right" -font SansFont -height 30 -pos -130 0 0
vdisplay ttr -2dTopDown -trsfPersPos 1 -1 5 -osd
polyline ltr -100 0 0 -100 100 0 0 100 0 0 50 0 -50 0 0 -100 0 0
vdisplay ltr -2dTopDown -trsfPersPos 1 -1 3 -overlay
vdump ${imagedir}/${casename}.png

106
tests/bugs/vis/bug27796 Normal file
View File

@@ -0,0 +1,106 @@
puts "========"
puts "Allow 3D objects with Graphic3d_TMF_2d flag"
puts "========"
pload MODELING VISUALIZATION
# four rectangles
box b4 -175 -125 -5 350 250 1
box b3 -150 -100 -4 300 200 1
box b2 -125 -75 -3 250 150 1
box b1 -100 -50 -2 200 100 1
# text label
text2brep t "texT | Text\ntexT | Text" -height 50
set aTB [bounding t]
set aTX [expr [lindex $aTB 3] * -0.5]
set aTY [expr [lindex $aTB 4] * -0.5]
ttranslate t $aTX $aTY 1
# sphere
psphere s 50
# clock marks
set aPnts {}
for {set i 1} {$i <= 1} {incr i} { vertex p1_$i [expr 75+5*$i] 86 1; lappend aPnts p1_$i }
compound {*}$aPnts p1
set aPnts {}
for {set i 1} {$i <= 2} {incr i} { vertex p2_$i [expr 130+5*$i] 86 1; lappend aPnts p2_$i }
compound {*}$aPnts p2
set aPnts {}
for {set i 1} {$i <= 3} {incr i} { vertex p3_$i [expr 130+5*$i] 0 1; lappend aPnts p3_$i }
compound {*}$aPnts p3
set aPnts {}
for {set i 1} {$i <= 4} {incr i} { vertex p4_$i [expr 120+5*$i] -85 1; lappend aPnts p4_$i }
compound {*}$aPnts p4
set aPnts {}
for {set i 1} {$i <= 5} {incr i} { vertex p5_$i [expr 55+5*$i] -85 1; lappend aPnts p5_$i }
compound {*}$aPnts p5
set aPnts {}
for {set i 1} {$i <= 6} {incr i} { vertex p6_$i [expr -18+5*$i] -85 1; lappend aPnts p6_$i }
compound {*}$aPnts p6
set aPnts {}
for {set i 1} {$i <= 7} {incr i} { vertex p7_$i [expr -85+5*$i] -85 1; lappend aPnts p7_$i }
compound {*}$aPnts p7
set aPnts {}
for {set i 1} {$i <= 8} {incr i} { vertex p8_$i [expr -160+5*$i] -85 1; lappend aPnts p8_$i }
compound {*}$aPnts p8
set aPnts {}
for {set i 1} {$i <= 9} {incr i} { vertex p9_$i [expr -160+5*$i] 0 1; lappend aPnts p9_$i }
compound {*}$aPnts p9
set aPnts {}
for {set i 1} {$i <=10} {incr i} { vertex p10_$i [expr -165+5*$i] 86 1; lappend aPnts p10_$i }
compound {*}$aPnts p10
set aPnts {}
for {set i 1} {$i <=11} {incr i} { vertex p11_$i [expr -100+5*$i] 86 1; lappend aPnts p11_$i }
compound {*}$aPnts p11
set aPnts {}
for {set i 1} {$i <=12} {incr i} { vertex p12_$i [expr -30+5*$i] 86 1; lappend aPnts p12_$i }
compound {*}$aPnts p12
# entire list of 2d presentations
set aList {b1 b2 b3 b4 s t p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12}
vclear
vinit View1
vdisplay -dispMode 1 -highMode 1 -2d -trsfPersPos 0 0 {*}$aList
vsetmaterial b1 b2 b3 b4 t PLASTIC
vsetcolor b1 RED
vsetcolor b2 GREEN
vsetcolor b3 BLUE1
vsetcolor b4 MAGENTA1
vsetcolor t GOLD
vsetlocation s 0 0 -1
box bb 1000 1000 1000
vdisplay -dispMode 0 bb
vfit
vdump $imagedir/${casename}_center.png
vdisplay -dispMode 1 -highMode 1 -2d -trsfPersPos -1 1 {*}$aList
vdump $imagedir/${casename}_tl.png
vdisplay -dispMode 1 -highMode 1 -2d -trsfPersPos 1 1 {*}$aList
vdump $imagedir/${casename}_tr.png
vdisplay -dispMode 1 -highMode 1 -2d -trsfPersPos 1 -1 {*}$aList
vdump $imagedir/${casename}_br.png
vdisplay -dispMode 1 -highMode 1 -2d -trsfPersPos -1 -1 {*}$aList
vdump $imagedir/${casename}_bl.png
vmoveto 110 385
vselect 110 385
set aColor [vreadpixel 110 385 rgb name]
if { $aColor != "WHITE" } { puts "Error: wrong object is highlighted" }