stressui
6.66 KB
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
#!/usr/IRIXpro/bin/wishx -f
#
# User interface for stress application
#
#
wm title . "Stress Control"
#
# This procedure is invoked whenever a mode word changes.
# The t variable indicates whether trap has been selected or not.
# The modes are sent to the application running on the R4300
# via driverd.
#
proc varChanged {t args} {
global enDither enAA
global enTexBilerp enTexPersp enBFcull
global scene
global mountains pool orb clock altimeter
set mode $enAA
set mode [expr $mode | [expr $enBFcull << 1]]
set mode [expr $mode | [expr $enDither << 2]]
set mode [expr $mode | [expr $enTexBilerp << 3]]
set mode [expr $mode | [expr $enTexPersp << 4]]
set display $mountains
set display [expr $display | [expr $pool << 1]]
set display [expr $display | [expr $orb << 2]]
set display [expr $display | [expr $clock << 3]]
set display [expr $display | [expr $altimeter << 4]]
StressTclMode $t $mode $scene $display
}
proc scenechanged {t args} {
set_fly
varChanged "0"
}
proc do_trap { } {
set traps 1
catch {destroy .dialog}
toplevel .dialog -class Dialog
wm title .dialog "Trap"
wm iconname .dialog Dialog
frame .dialog.top -relief raised -bd 1
pack .dialog.top -side top -fill both
frame .dialog.bot -relief raised -bd 1
pack .dialog.bot -side bottom -fill both
label .dialog.msg -text "Enter number of frames to trap: "
entry .dialog.entry -width 5 -relief sunken -bd 2
.dialog.entry insert 0 "1"
bind .dialog.entry <Return> { set traps [.dialog.entry get] }
button .dialog.done -text "Apply" -command "set traps [.dialog.entry get]"
pack .dialog.msg .dialog.entry -side left -in .dialog.top
pack .dialog.done -fill x -in .dialog.bot
set oldFocus [focus]
grab .dialog
tkwait variable traps
varChanged $traps
focus $oldFocus
destroy .dialog
}
#-------------------------------------------------------
# Set up the main window and menu.
#
#
#-------------------------------------------------------
frame .menu -relief raised -borderwidth 1
message .msg -font -Adobe-times-medium-r-normal--*-100* -relief raised -width 300 \
-borderwidth 1 \
-text "This window controls top-level attributes for the stress\
application. The Modes menu\
contains switches for turning attributes on and off. To run a frame\
through the RSP simulator and dump files to run through the RDP\
simulator, select 'trap' under the File menu.
To exit this application, select 'quit' under the File menu."
pack .menu -side top -fill x
pack .msg -side bottom -expand yes -fill both
#-------------------------------------------------------
# The code below creates all the menus
#-------------------------------------------------------
menubutton .menu.file -text "File" -menu .menu.file.m -underline 0
menu .menu.file.m
.menu.file.m add command -label "Trap" -command {do_trap}
.menu.file.m add command -label "Quit" -command "destroy ."
set enAA 1
set enDither 1
set enBFcull 1
set enTexBilerp 1
set enTexPersp 1
menubutton .menu.modes -text "Modes" -menu .menu.modes.m -underline 0
menu .menu.modes.m
.menu.modes.m add check -label "Anti-Alias En" -variable enAA
.menu.modes.m add check -label "Cull Backfaces" -variable enBFcull
.menu.modes.m add check -label "Dither En" -variable enDither
.menu.modes.m add check -label "Texture Bilerp En" -variable enTexBilerp
.menu.modes.m add check -label "Texture Persp En" -variable enTexPersp
set scene 0
menubutton .menu.pos -text "Position" -menu .menu.pos.m -underline 0
menu .menu.pos.m
.menu.pos.m add radiobutton -label "Scene 0" -variable scene -value 0
.menu.pos.m add radiobutton -label "Scene 1" -variable scene -value 1
.menu.pos.m add radiobutton -label "Scene 2" -variable scene -value 2
.menu.pos.m add radiobutton -label "Scene 3" -variable scene -value 3
.menu.pos.m add radiobutton -label "Scene 4" -variable scene -value 4
set mountains 1
set pool 1
set orb 1
set clock 1
set altimeter 1
menubutton .menu.disp -text "Display" -menu .menu.disp.m -underline 0
menu .menu.disp.m
.menu.disp.m add check -label "Mountains" -variable mountains -command {varChanged "0"}
.menu.disp.m add check -label "Pool" -variable pool -command {varChanged "0"}
.menu.disp.m add check -label "Orb" -variable orb -command {varChanged "0"}
.menu.disp.m add check -label "Clock" -variable clock -command {varChanged "0"}
.menu.disp.m add check -label "Altimeter" -variable altimeter -command {varChanged "0"}
set enTexture 1
set enTexPersp 1
set enBFcull 1
set enShade 1
set enZbuf 1
trace variable enTexture "w" {varChanged "0"}
trace variable enTexPersp "w" {varChanged "0"}
trace variable enBFcull "w" {varChanged "0"}
trace variable enShade "w" {varChanged "0"}
trace variable enZbuf "w" {varChanged "0"}
trace variable scene "w" {scenechanged "0"}
trace variable enAA "w" {varChanged "0"}
trace variable enDither "w" {varChanged "0"}
trace variable enBFcull "w" {varChanged "0"}
trace variable enTexBilerp "w" {varChanged "0"}
trace variable enTexPersp "w" {varChanged "0"}
pack .menu.file .menu.modes .menu.pos .menu.disp -side left
tk_menuBar .menu .menu.file .menu.modes .menu.pos .menu.disp
#-------------------------------------------------------
# Create flying controls
#-------------------------------------------------------
scale .velocity -label "Velocity" -from -100 -to 100 \
-orient horiz -command update_vel -showvalue true
scale .roll -label "Roll" -from -180 -to 180 \
-orient horiz -command update_roll -showvalue true
scale .pitch -label "Pitch" -from -180 -to 180 \
-orient horiz -command update_pitch -showvalue true
scale .yaw -label "Yaw" -from -180 -to 180 \
-orient horiz -command update_yaw -showvalue true
button .flyreset -text "Reset controls" -command set_fly -foreground red
pack .flyreset .yaw .pitch .roll .velocity -side bottom -fill x
proc set_fly { } {
global velocity roll pitch yaw
set velocity 0
set roll 0
set pitch 0
set yaw 0
.velocity set $velocity
.roll set $roll
.pitch set $pitch
.yaw set $yaw
}
proc update_vel { vel } {
global velocity roll pitch yaw
set velocity $vel
StressTclFly $velocity $roll $pitch $yaw
}
proc update_roll { r } {
global velocity roll pitch yaw
set roll $r
StressTclFly $velocity $roll $pitch $yaw
}
proc update_pitch { p } {
global velocity roll pitch yaw
set pitch $p
StressTclFly $velocity $roll $pitch $yaw
}
proc update_yaw { y } {
global velocity roll pitch yaw
set yaw $y
StressTclFly $velocity $roll $pitch $yaw
}
#-------------------------------------------------------
# Open library for talking to hardware
#-------------------------------------------------------
set stressdso [lindex $argv 0]
dlopen $stressdso init StressTclInit
StressTclConnect [lindex $argv 1] [lindex $argv 2]
set_fly