0031388: Data Exchange - support kinematics data in STEP format
[occt.git] / samples / tcl / raytrace.tcl
CommitLineData
a347ef35 1# Script demonstrating ray tracing in 3d view
12402146 2
ab91ab6f 3#Category: Visualization
4#Title: Ray tracing
5
ba562b2b 6# Ray-Tracing doesn't work with Compatible Profile on macOS
7pload VISUALIZATION
8if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
9
12402146 10# make bottle by calling another script
11source [file join [file dirname [info script]] bottle.tcl]
12
13# make table and a glass
14box table -50 -50 -10 100 100 10
15pcone glass_out 7 9 25
16pcone glass_in 7 9 25
17ttranslate glass_in 0 0 0.2
18bcut glass glass_out glass_in
19ttranslate glass -30 -30 0
20
21# show table and glass
a347ef35 22vinit w=1024 h=1024
12402146 23vsetmaterial bottle aluminium
24vdisplay table
25vsetmaterial table bronze
26vsetmaterial table plastic
27vsetcolor table coral2
28vdisplay glass
29vsetmaterial glass plastic
30vsetcolor glass brown
31vsettransparency glass 0.6
32
33# add light source for shadows
06d40093 34vlight spot -type SPOT -pos -100 -100 300
12402146 35
36# set white background and fit view
293211ae 37vbackground -color WHITE
12402146 38vfit
39
40# set ray tracing
fc73a202 41puts "Trying raytrace mode..."
bc8c79bb 42if { ! [catch {vrenderparams -raytrace -shadows -reflections -fsaa -rayDepth 5}] } {
fc73a202 43 vtextureenv on 1
12402146 44}