31ad19a6918a8ce4661c0d4d07f5e167d2be28f3
[occt.git] / samples / tcl / raytrace.tcl
1 # Script demonstrating ray tracing in 3d view
2
3 # make bottle by calling another script
4 source [file join [file dirname [info script]] bottle.tcl]
5
6 # make table and a glass
7 box table -50 -50 -10 100 100 10
8 pcone glass_out 7 9 25
9 pcone glass_in 7 9 25
10 ttranslate glass_in 0 0 0.2
11 bcut glass glass_out glass_in
12 ttranslate glass -30 -30 0
13
14 # show table and glass
15 vinit w=1024 h=1024
16 vsetmaterial bottle aluminium
17 vdisplay table
18 vsetmaterial table bronze
19 vsetmaterial table plastic
20 vsetcolor table coral2
21 vdisplay glass
22 vsetmaterial glass plastic
23 vsetcolor glass brown
24 vsettransparency glass 0.6
25
26 # add light source for shadows
27 vlight new spot pos -100 -100 300
28
29 # set white background and fit view
30 vsetcolorbg 255 255 255
31 vfit
32
33 # set ray tracing
34 puts "Trying raytrace mode..."
35 if { ! [catch {vrenderparams -raytrace -shadows -reflections -fsaa -rayDepth 5}] } {
36   vtextureenv on 1
37 }