0024855: Revision of parameters of standard materials
[occt.git] / samples / tcl / materials.tcl
CommitLineData
44c7c33e 1# Script displays properties of different materials available in OCCT
2
3set THE_MATERIALS {brass bronze copper gold jade neon_phc pewter obsidian plaster plastic satin silver steel stone chrome aluminium water glass diamond charcoal}
4set THE_COLORS {default red green blue1}
5set THE_ROW_DIST 35
6
7proc drawLabels {} {
8 set x 20
9 set y 15
10 set r 25
11 set g 25
12 set b 25
13 foreach aMatIter $::THE_MATERIALS {
14 vdrawtext "$aMatIter" $x $y 0 $r $g $b 2 1 000 0 14 1 Arial
15 incr y 10
16 }
17 set x 40
18 set y 5
19 foreach aColIter $::THE_COLORS {
20 if { $aColIter == "red" } {
21 set r 255
22 set g 0
23 set b 0
24 } elseif { $aColIter == "green" } {
25 set r 0
26 set g 255
27 set b 0
28 } elseif { $aColIter == "blue1" } {
29 set r 0
30 set g 0
31 set b 255
32 }
33 vdrawtext "$aColIter" $x $y 0 $r $g $b 1 1 000 0 14 1 Arial
34 incr x $::THE_ROW_DIST
35 }
36}
37
38proc drawObjects {theRow theColor} {
39 set aSize 4
40 set aCtr -2
41 set aCounter 0
42 set x [expr 30 + $theRow * $::THE_ROW_DIST]
43 set y 15
44 foreach aMatIter $::THE_MATERIALS {
45 set aSph s${theRow}_${aCounter}
46 set aBox b${theRow}_${aCounter}
47 uplevel #0 psphere $aSph $aSize
48 uplevel #0 box $aBox $aCtr $aCtr $aCtr $aSize $aSize $aSize
49 uplevel #0 ttranslate $aSph $x $y 0
50 uplevel #0 ttranslate $aBox [expr $x + 10] $y 0
51 uplevel #0 vdisplay -noredraw $aSph $aBox
52 uplevel #0 vsetmaterial -noredraw $aSph $aBox $aMatIter
53 if {$theColor != ""} {
54 uplevel #0 vsetcolor -noredraw $aSph $aBox $theColor
55 }
56 incr aCounter
57 incr y 10
58 }
59}
60
61# setup 3D viewer content
62pload MODELING VISUALIZATION
63
64catch { vclose View1 }
65vinit View1 w=768 h=768
66vclear
67vtop
68vglinfo
69vsetgradientbg 180 200 255 180 180 180 2
70vlight change 0 pos -1 1 1
71vsetdispmode 1
72
73# adjust scene bounding box
74box bnd 0 0 0 180 210 1
75vdisplay -noredraw bnd
76vsetdispmode bnd 0
77vfit
78vremove -noredraw bnd
79
80# draw spheres and boxes with different materials
81drawLabels
82drawObjects 0 ""
83drawObjects 1 red
84drawObjects 2 green
85drawObjects 3 blue1
86#vfit
87vzfit