0032208: Tests - refactor visualization tests to cover several graphic drivers
[occt.git] / tests / opengl / data / clipping / bug27751_capping
1 puts "========"
2 puts "Capping plane preserving material"
3 puts "========"
4
5 set aHatch  [locate_data_file images/hatch_1.png]
6
7 pload MODELING VISUALIZATION
8
9 puts "Create the geometry"
10 box b0sole 10 10   0 30 30 70
11 box b0hole 20 20 -10 10 10 90
12 bcut b0 b0sole b0hole
13 box b1 40 20 0 10 30 70
14 box b2 20 40 0 20 10 70
15 box b3 0  40 0 20 10 70
16 box b4 0  10 0 10 30 70
17 box b5 0   0 0 30 10 70
18
19 set aNbParts 6
20 set aColors { RED YELLOW GREEN GRAY MAGENTA ORANGE }
21
22 compound b0 b1 b2 b3 b4 b5 cc
23
24 puts "Create the viewer"
25 vclear
26 vclose ALL
27 vinit name=View1 w=512 h=512
28
29 vpoint p0 0 0 0
30 vzbufftrihedron
31
32 puts "Display the geometry as dedicated objects"
33 for { set aPartIter 0 } { $aPartIter < $aNbParts } { incr aPartIter } {
34   vdisplay -noupdate -dispMode 1 b${aPartIter}
35   set aColor [lindex $aColors $aPartIter]
36   vsetcolor -noupdate b${aPartIter} $aColor
37 }
38
39 puts "Display the geometry as sole object"
40 vdisplay -noupdate -dispMode 1 cc
41 for { set aPartIter 0 } { $aPartIter < $aNbParts } { incr aPartIter } {
42   set aColor [lindex $aColors $aPartIter]
43   vaspects -noupdate cc -subShapes b${aPartIter} -setColor $aColor
44 }
45 # show also connected interactive object
46 vconnectto co -70 0 0 cc
47 vsetdispmode co 1
48 vsetlocation cc 70 0 0
49 vfit
50
51
52 set aPln1Z 40
53 set aPln2Y 15
54
55 vpoint p1 0 0 1
56 vpoint p2 1 0 1
57 vpoint p3 0 1 1
58 vplane pp1 p1 p2 p3
59 vsetlocation -noupdate pp1 25 0 [expr $aPln1Z - 1]
60 vremove -noupdate p1 p2 p3
61
62 vpoint p1 0 1 0
63 vpoint p2 1 1 0
64 vpoint p3 0 1 1
65 vplane pp2 p1 p2 p3
66 vsetlocation -noupdate pp2 25 $aPln2Y 35
67 vremove -noupdate p1 p2 p3
68 verase pp1 pp2
69 vfit
70 vdisplay pp1 pp2
71 vzoom 0.8
72
73 puts "Enable capping planes"
74 vclipplane pln1 -set -equation 0 0 -1 $aPln1Z        -capping 1 -color 0.5 0.5 0.5 -texname $aHatch -texscale 0.02 -0.02 -useObjMaterial 1
75 vclipplane pln2 -set -equation 0 1 0 [expr -$aPln2Y] -capping 1 -color 0.8 0.8 0.9 -texname $aHatch -texscale 0.02 -0.02
76 vdump $imagedir/${casename}.png