This file is indexed.

/usr/share/vtk/Rendering/Tcl/LightKitViewer.tcl is in vtk-examples 5.8.0-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# This example builds a user interface to set the parameters for
# a vtkLightKit object.  The default parameters for a LightKit
# are pretty reasonable, but moving the lights around may help
# a user light a particular object.

package require vtk
package require vtkinteraction
package require vtktesting

# demonstrate LightKit functionality.

set root [toplevel .top -visual {truecolor 24}]
wm title .top "LightKit Viewer"
wm protocol .top WM_DELETE_WINDOW exit
wm withdraw .

vtkRenderWindow renWin
set renWidget [vtkTkRenderWidget $root.ren -width 400 -height 400 -rw renWin]
::vtk::bind_tk_render_widget $renWidget

vtkRenderer ren1
renWin AddRenderer ren1

vtkLightKit lightKit
lightKit AddLightsToRenderer ren1

set TitleFont {-size 12 -family Helvetica -weight bold}


# Key Light panel
set keyfrm [frame $root.keyfrm]
set keylbl [label $keyfrm.lbl -text "Key Light" -anchor w  -font $TitleFont]
set keywarmlbl [label $keyfrm.warmlbl -text "Warmth" -anchor se]
set keywarm [scale $keyfrm.warm -from 0 -to 1 -res 0.01 -orient horizontal]

set keyelevlbl [label $keyfrm.elevlbl -text "Elevation" -anchor se]
set keyelev [scale $keyfrm.elev -from 0 -to 90 -orient horizontal]

set keyazimlbl [label $keyfrm.azimlbl -text "Azimuth" -anchor se]
set keyazim [scale $keyfrm.azim -from -90 -to 90 -orient horizontal]

set keyintlbl [label $keyfrm.intlbl -text "Intensity" -anchor se]
set keyint [scale $keyfrm.int -from 0 -to 2 -orient horizontal -res 0.05]

grid $keylbl - -sticky news
grid $keywarmlbl $keywarm -sticky news
grid $keyintlbl $keyint -sticky news

grid $keyelevlbl $keyelev -sticky news
grid $keyazimlbl $keyazim -sticky news

# Fill Light Panel
set fillfrm [frame $root.fillfrm]
set filllbl [label $fillfrm.lbl -text "Fill Light" -anchor w -font $TitleFont]

set fillwarmlbl [label $fillfrm.warmlbl -text "Warmth" -anchor se]
set fillwarm [scale $fillfrm.warm -from 0 -to 1 -res 0.01 -orient horizontal]

set fillelevlbl [label $fillfrm.elevlbl -text "Elevation" -anchor se]
set fillelev [scale $fillfrm.elev -from -90 -to 10 -orient horizontal]

set fillazimlbl [label $fillfrm.azimlbl -text "Azimuth" -anchor se]
set fillazim [scale $fillfrm.azim -from -90 -to 90 -orient horizontal]

set fillratlbl [label $fillfrm.ratlbl -text "K:F Ratio" -anchor se]
set fillrat [scale $fillfrm.rat -from 1 -to 15 -res 0.1 -orient horizontal]

grid $filllbl - -sticky news
grid $fillwarmlbl $fillwarm -sticky news
grid $fillratlbl $fillrat -sticky news

grid $fillelevlbl $fillelev -sticky news
grid $fillazimlbl $fillazim -sticky news

# Back Light panel
set backfrm [frame $root.backfrm]
set backlbl [label $backfrm.lbl -text "Back Light" -anchor w -font $TitleFont]
set backwarmlbl [label $backfrm.warmlbl -text "Warmth" -anchor se]
set backwarm [scale $backfrm.warm -from 0 -to 1 -res 0.01 -orient horizontal]

set backelevlbl [label $backfrm.elevlbl -text "Elevation" -anchor se]
set backelev [scale $backfrm.elev -from -45 -to 45 -orient horizontal]

set backazimlbl [label $backfrm.azimlbl -text "Azimuth" -anchor se]
set backazim [scale $backfrm.azim -from 60 -to 170 -orient horizontal]

set backratlbl [label $backfrm.ratlbl -text "K:B Ratio" -anchor se]
set backrat [scale $backfrm.rat -from 1 -to 15 -res 0.1 -orient horizontal]

grid $backlbl - -sticky news
grid $backwarmlbl $backwarm -sticky news
grid $backratlbl $backrat -sticky news

grid $backelevlbl $backelev -sticky news
grid $backazimlbl $backazim -sticky news

# HeadLight panel
set headfrm [frame $root.headfrm]
set headlbl [label $headfrm.lbl -text "Head Light" -anchor w  -font $TitleFont]
set headwarmlbl [label $headfrm.warmlbl -text "Warmth" -anchor se]
set headwarm [scale $headfrm.warm -from 0 -to 1 -res 0.01 -orient horizontal]

set headratlbl [label $headfrm.ratlbl -text "K:H Ratio" -anchor se]
set headrat [scale $headfrm.rat -from 1 -to 15 -res 0.1 -orient horizontal]


set f1 [canvas $headfrm.f1 -border 1 -relief raised -width 0 -height 0]
set f2 [canvas $headfrm.f2 -border 1 -relief raised -width 0 -height 0]

set maintlumlbl [label $headfrm.maintlumlbl -text "Maintain Luminance" -anchor w  -font $TitleFont]
set maintlum [checkbutton $headfrm.maintlum -variable MaintainLuminance]

set butfrm [frame $headfrm.butfrm]
set helpbut [button $butfrm.helpbut -text "Help" -command showHelp]
set quitbut [button $butfrm.quitbut -text "Quit" -command exit]
pack $helpbut -side left -expand  true -fill x
pack $quitbut -side right -expand true -fill x

grid $headlbl - -sticky nw
grid $headwarmlbl $headwarm -sticky news
grid $headratlbl $headrat -sticky news
grid $f1 - -sticky ew
grid $maintlumlbl - -sticky news
grid $maintlum - -sticky news
grid $f2 - -sticky ew
grid $butfrm - -sticky ew
grid [frame $headfrm.f0] -sticky news

grid rowconfigure $headfrm 7 -weight 1

set f0 [canvas $root.f0 -border 1 -relief raised -width 0 -height 0]
set f1 [canvas $root.f1 -border 1 -relief raised -width 0 -height 0]
set f2 [canvas $root.f2 -border 1 -relief raised -width 0 -height 0]
set f3 [canvas $root.f3 -border 1 -relief raised -width 0 -height 0]


grid $renWidget - - - - - - -sticky news
grid $keyfrm $f0 $fillfrm $f1 $backfrm $f2 $headfrm -sticky news

vtkSuperquadricSource squad
   squad SetPhiResolution 20
   squad SetThetaResolution 25
squad SetPhiRoundness 1.5
squad SetThickness 0.43
squad SetThetaRoundness 0.7
squad ToroidalOn

vtkAppendPolyData appendSquads
    appendSquads AddInput [squad GetOutput]
   
vtkPolyDataMapper mapper
    mapper SetInputConnection [squad GetOutputPort]
    mapper ScalarVisibilityOff

vtkActor actor
    actor SetMapper mapper
    eval [actor GetProperty] SetDiffuseColor 1 1 1
    eval [actor GetProperty] SetSpecularColor 1 1 1
    eval [actor GetProperty] SetSpecularPower 20
    eval [actor GetProperty] SetSpecular 0.4
    eval [actor GetProperty] SetDiffuse 0.7

ren1 AddActor actor
ren1 SetBackground 0.1 0.1 0.15
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 1.5
[ren1 GetActiveCamera] Elevation 40
[ren1 GetActiveCamera] Azimuth -20

proc SetLightWarmth {lt x} {
    lightKit Set${lt}LightWarmth $x
    renWin Render
}

proc SetHeadLightWarmth {x} {
    lightKit SetHeadLightWarmth $x
    renWin Render
}

proc SetLightElevation {lt x} {
    lightKit Set${lt}LightElevation $x
    renWin Render
}

proc SetLightAzimuth {lt x} {
    lightKit Set${lt}LightAzimuth $x
    renWin Render
}

proc SetKeyToFillRatio {x} {
    lightKit SetKeyToFillRatio $x
    renWin Render
}

proc SetKeyToBackRatio {x} {
    lightKit SetKeyToBackRatio $x
    renWin Render
}

proc SetKeyToHeadRatio {x} {
    lightKit SetKeyToHeadRatio $x
    renWin Render
}

proc SetKeyLightIntensity {x} {
    lightKit SetKeyLightIntensity $x
    renWin Render
}

proc SetMaintainLuminance {} {
    global MaintainLuminance
    lightKit SetMaintainLuminance $MaintainLuminance
    renWin Render
}

# get defaults directly from the LightKit

$keywarm set [lightKit GetKeyLightWarmth]
$keyelev set [lightKit GetKeyLightElevation]
$keyazim set [lightKit GetKeyLightAzimuth]
$keyint set [lightKit GetKeyLightIntensity]

$fillwarm set [lightKit GetFillLightWarmth]
$fillelev set [lightKit GetFillLightElevation]
$fillazim set [lightKit GetFillLightAzimuth]
$fillrat set [lightKit GetKeyToFillRatio]

$backwarm set [lightKit GetBackLightWarmth]
$backrat set [lightKit GetKeyToBackRatio]
$backelev set [lightKit GetBackLightElevation]
$backazim set [lightKit GetBackLightAzimuth]

$headwarm set [lightKit GetHeadLightWarmth]
$headrat  set [lightKit GetKeyToHeadRatio]

set MaintainLuminance [lightKit GetMaintainLuminance]

$keywarm config -command "SetLightWarmth Key"
$keyelev config -command "SetLightElevation Key"
$keyazim config -command "SetLightAzimuth Key"
$keyint  config -command "SetKeyLightIntensity"

$fillwarm config -command "SetLightWarmth Fill"
$fillelev config -command "SetLightElevation Fill"
$fillazim config -command "SetLightAzimuth Fill"
$fillrat  config -command "SetKeyToFillRatio"

$backwarm config -command "SetLightWarmth Back"
$backrat  config -command "SetKeyToBackRatio"
$backelev config -command "SetLightElevation Back"
$backazim config -command "SetLightAzimuth Back"

$headwarm config -command "SetHeadLightWarmth"
$headrat  config -command "SetKeyToHeadRatio"

$maintlum config -command SetMaintainLuminance

proc showHelp {} {

set helpfrm .helpfrm

if {[winfo exists $helpfrm]} {
    wm deiconify $helpfrm
    raise $helpfrm
    return
}

toplevel $helpfrm
wm title $helpfrm "Help for LightKitViewer"
set msg [label $helpfrm.msg -justify left \
	-wraplength 350 -font {-weight normal -family Helvetica}]
$msg config -text \
{The key light is the dominant light in the scene, located in front of\
and above the object. The fill light is usually positioned to shine\
on the parts of the object not illuminated by the key light.  The headlight\
reduces the contrast of the scene by shining from the camera position.

Fill, back, and headlights are dimmer than the key light; K:F K:B and K:H \
control the key-to-fill, key-to-back and key-to-headlight intensity\
respectively. The key light intensity, in effect, controls the entire\
scene brightness level.

Lights always shine on the point where the camera looking, but their angles\
can be adjusted.  The position of the key, back, and fill lights are \
controlled by their elevation (latitude) and azimuth (longitude) \
expressed in degrees. Both angles are specified with respect to the camera.\
(elevation=0, azimuth=0) is located at the camera (a headlight).\
(elevation=90, azimuth=0) is directly over the object\
shining down. Negative azimuth angles position a light to the left of the\
camera, positive values right.  

The back light is actually two lights, one on the left and one on the\
right.  The two lights have the same elevation, but opposite azimuth.\
When you adjust the angle of the back light, both lights are moved\
automatically for you.

The warmth parameter controls the color of the lights: 0.5 is white, 0 is\
cold blue, and 1 is deep sunset red.  Use extreme colors with restraint.

If MaintainLuminance is set, the\
brightness of the lights is scaled to compensate for their reduced\
perceptual brightness.}

pack $msg -ipadx 5 -ipady 5
}

update