0030690: Draw Harness - provide XDisplay command for displaying XDE document
[occt.git] / tests / v3d / glsl / clipping1
CommitLineData
25c35042 1puts "========"
2puts "0029729: Visualization, Graphic3d_ClipPlane - add support of clipping plane chains"
3puts "========"
4
5vclear
6vclose ALL
7vinit View1
8
9set aCapParams "-capping 1 -color 0.5 0.5 0.5 -texname [locate_data_file images/hatch_1.png] -texscale 0.02 -0.02 -useObjMaterial 1"
10
11pload MODELING VISUALIZATION
12
13# create the geometry
14box b0sole 10 10 0 30 30 70
15box b0hole 20 20 -10 10 10 90
16bcut b0 b0sole b0hole
17box b1 40 20 0 10 30 70
18box b2 20 40 0 20 10 70
19box b3 0 40 0 20 10 70
20box b4 0 10 0 10 30 70
21box b5 0 0 0 30 10 70
6f26baa0 22box bb 10 -10 0 20 10 10
25c35042 23
24set aNbParts 6
25set aColors { RED YELLOW GREEN GRAY MAGENTA1 ORANGE }
26
27compound b0 b1 b2 b3 b4 b5 cc
28
29# create the viewer
30vclear
31vclose ALL
32vinit name=View1 w=512 h=512
33vviewparams -scale 4.66737 -proj 0.465292 -0.577133 0.671134 -up -0.46873 0.482524 0.739907 -at 15.807 37.1157 21.9799
34
35vpoint p0 0 0 0
6f26baa0 36vdisplay -dispMode 1 bb
37vaspects -noupdate bb -setColor CYAN1
25c35042 38vzbufftrihedron
39
40puts "Display the geometry as dedicated objects"
41for { set aPartIter 0 } { $aPartIter < $aNbParts } { incr aPartIter } {
42 vdisplay -noupdate -dispMode 1 b${aPartIter}
43 set aColor [lindex $aColors $aPartIter]
44 vsetcolor -noupdate b${aPartIter} $aColor
45}
46
47puts "Display the geometry as sole object"
48vdisplay -noupdate -dispMode 1 cc
49for { set aPartIter 0 } { $aPartIter < $aNbParts } { incr aPartIter } {
50 set aColor [lindex $aColors $aPartIter]
51 vaspects -noupdate cc -subShapes b${aPartIter} -setColor $aColor
52}
53# show also connected interactive object
54vconnectto co -70 0 0 cc
55vsetdispmode co 1
56vsetlocation cc 70 0 0
57
58set aPln1Z 40
59set aPln2Y 15
60
25c35042 61vpoint p1 0 0 1
62vpoint p2 1 0 1
63vpoint p3 0 1 1
64vplane pp1 p1 p2 p3
65vsetlocation -noupdate pp1 25 0 [expr $aPln1Z - 1]
66vremove -noupdate p1 p2 p3
67
68vpoint p1 0 1 0
69vpoint p2 1 1 0
70vpoint p3 0 1 1
71vplane pp2 p1 p2 p3
72vsetlocation -noupdate pp2 25 $aPln2Y 35
73vremove -noupdate p1 p2 p3
74verase pp1 pp2
75vfit
76vdisplay pp1 pp2
77
78vclipplane pln -set {*}$aCapParams -equation1 0 0 -1 40 -equation2 0 1 0 -15
6f26baa0 79if { [vreadpixel 200 360 rgb name] != "DARKTURQUOISE" } { puts "Error: bb should NOT be clipped" }
25c35042 80vdump $::imagedir/${::casename}_2.png
81
82vclipplane pln -set {*}$aCapParams -equation1 0 0 -1 40 -equation2 0 1 0 -15 -equation3 -1 0 0 5
83vdump $::imagedir/${::casename}_3.png
84
85vsettransparency b0 b1 b2 b3 b4 b5 0.5
86vdump $::imagedir/${::casename}_3transp.png
87
88vviewparams -scale 8.51584 -proj 0.284186 0.750426 0.59674 -up -0.228109 -0.55161 0.802305 -at 24.2647 23.8116 32.8743
89vclipplane pln -set {*}$aCapParams -boxint 25 25 25 55 55 55
90vsettransparency b0 b1 b2 b3 b4 b5 0
91vdump $::imagedir/${::casename}_6.png
92
93vsettransparency b0 b1 b2 b3 b4 b5 0.5
94vdump $::imagedir/${::casename}_6transp.png