-
Notifications
You must be signed in to change notification settings - Fork 1
/
DisplayWindow.pde
277 lines (242 loc) · 8.15 KB
/
DisplayWindow.pde
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
/**
* ---------------------------------------------
* DisplayWindow.pde
* Description: CAVE2 Master Situation Display (MSD)
*
* Class:
* System: Processing 2.2, SUSE 12.1, Windows 7 x64
* Author: Arthur Nishimoto
* Copyright (C) 2012-2014
* Electronic Visualization Laboratory, University of Illinois at Chicago
*
* Version Notes:
* ---------------------------------------------
*/
PVector controllerImagePos = new PVector( 480 , 0 );
void displayTrackableWindow( Trackable t, float xPos, float yPos )
{
pushMatrix();
translate( xPos, yPos );
fill(0);
noStroke();
rect(0,-16 * 2, 800, 400);
fill( t.currentMocapColor );
textAlign(RIGHT);
text( String.format("%.2f", t.position.x) + " meters \n" + String.format("%.2f", t.position.y) + " meters \n" + String.format("%.2f", t.position.z) + " meters ", 16 * 1 + 180, 16 * 2 );
text( String.format("%.2f", t.rotation.x) + " degrees \n" + String.format("%.2f", t.rotation.y) + " degrees \n" + String.format("%.2f", t.rotation.z) + " degrees ", 16 + 450, 16 * 2 );
textAlign(LEFT);
text( "x: \ny: \nz: ", 16 * 1, 16 * 2 );
text( "roll: \npitch: \nyaw: ", 16 + 200, 16 * 2 );
if( t.timeSinceLastMocapUpdate >= 5 )
{
fill( 250, 50, 50 );
text( t.name+" Trackable Status", 16, 16 * -1 );
text( "NOT TRACKED - TIME SINCE LAST UPDATE: " + String.format("%.2f", t.timeSinceLastMocapUpdate), 16, 16 * 0 );
}
else
{
}
text( t.name+" Trackable Status", 16, 16 * -1 );
text( "Mocap ID: "+ t.ID, 16 * 1, 16 * 1 );
fill( t.colorMinor );
text( "Minor Tracking Drops: " + t.minorDrops, 16 * 1, 16 * 6 );
fill( t.colorModerate );
text( "Moderate Tracking Drops: " + t.moderateDrops, 16 * 1, 16 * 7 );
fill( t.colorMajor );
text( "Major Tracking Drops: " + t.majorDrops, 16 * 1, 16 * 8 );
popMatrix();
}// displayTrackable
void displayControllerWindow( Trackable t, float xPos, float yPos )
{
pushMatrix();
translate( xPos, yPos );
fill(0);
noStroke();
rect(0,-16 * 2, 800, 400);
fill( t.currentMocapColor );
textAlign(RIGHT);
text( String.format("%.2f", t.position.x) + " meters \n" + String.format("%.2f", t.position.y) + " meters \n" + String.format("%.2f", t.position.z) + " meters ", 16 * 1 + 180, 16 + 16 * 1 );
text( String.format("%.2f", t.rotation.x) + " degrees \n" + String.format("%.2f", t.rotation.y) + " degrees \n" + String.format("%.2f", t.rotation.z) + " degrees ", 16 + 450, 16 + 16 * 1 );
textAlign(LEFT);
text( "x: \ny: \nz: ", 16 * 1, 16 + 16 * 1 );
text( "roll: \npitch: \nyaw: ", 16 + 200, 16 + 16 * 1 );
if( t.timeSinceLastUpdate < 2 )
{
fill(10, 250, 50, 128);
}
else if( t.timeSinceLastUpdate < 5 )
{
fill(250, 250, 50, 128);
}
else
{
fill(250, 50, 50, 128);
}
text( "Button 1", 16, 16 * 6 );
text( "Button 2", 16, 16 * 7 );
text( "Button 3", 16, 16 * 8 );
text( "Button 4", 16, 16 * 9 );
text( "Button 5", 16, 16 * 10 );
text( "Button 6", 16, 16 * 11 );
text( "Button 7", 16, 16 * 12 );
text( "Button 8", 16, 16 * 13 );
text( "Button 9", 16, 16 * 14 );
text( "Special Button 1", 16, 16 * 15 );
text( "Special Button 2", 16, 16 * 16 );
text( "Special Button 3", 16, 16 * 17 );
text( "Button Up", 216, 16 * 6 );
text( "Button Right", 216, 16 * 7 );
text( "Button Down", 216, 16 * 8 );
text( "Button Left", 216, 16 * 9 );
color currentColor;
if( t.timeSinceLastUpdate < 1 )
{
currentColor = color(10, 250, 50);
}
else if( t.timeSinceLastUpdate < 2 )
{
currentColor = color(10, 250, 50, 128);
}
else if( t.timeSinceLastUpdate < 5 )
{
currentColor = color(250, 250, 50, 128);
}
else
{
currentColor = color(250, 50, 50, 128);
}
// Center and diameter of analog region
//ellipse( targetWidth - 282 + 67, 51, 68, 68 );
PVector analogStick = t.analogStick1;
PVector analogCenter = new PVector( controllerImagePos.x + 67, controllerImagePos.y + 51 );
if( t.timeSinceLastUpdate < 1 )
{
fill(currentColor);
}
textAlign(RIGHT);
text( String.format("%.3f",t.analogStick1.x), 416, 16 * 12 );
text( String.format("%.3f",t.analogStick1.y), 416, 16 * 13 );
text( String.format("%.3f",t.analogStick2.x), 416, 16 * 14 );
text( String.format("%.3f",t.analogStick2.y), 416, 16 * 15 );
text( String.format("%.3f",t.analogStick3.x), 416, 16 * 16 );
text( String.format("%.3f",t.analogStick3.y), 416, 16 * 17 );
textAlign(LEFT);
text( "Analog 0: ", 216, 16 * 12 );
text( "Analog 1: ", 216, 16 * 13 );
text( "Analog 2: ", 216, 16 * 14 );
text( "Analog 3: ", 216, 16 * 15 );
text( "Analog 4: ", 216, 16 * 16 );
text( "Analog 5: ", 216, 16 * 17 );
if( t.timeSinceLastMocapUpdate >= 5 && t.timeSinceLastUpdate < 5 )
{
fill( 250, 150, 50 );
text( t.name+" Controller Status", 16, 16 * -1 );
text( "CONTROLLER NOT TRACKED - TIME SINCE LAST UPDATE: " + String.format("%.2f", t.timeSinceLastMocapUpdate), 16, 16 * 0 );
}
else if( t.timeSinceLastMocapUpdate < 5 && t.timeSinceLastUpdate >= 5 )
{
fill( 250, 150, 50 );
text( t.name+" Controller Status - NO CONTROLLER DATA", 16, 16 * -1 );
text( "IS CONTROLLER ON? - TIME SINCE LAST UPDATE: " + String.format("%.2f", t.timeSinceLastUpdate), 16, 16 * 0 );
}
else if( t.timeSinceLastMocapUpdate >= 5 && t.timeSinceLastUpdate >= 5 )
{
fill( 250, 50, 50 );
text( t.name+" Controller Status - CONNECTION LOST", 16, 16 * -1 );
text( "IS CONTROLLER ON? TRACKED? - TIME SINCE LAST UPDATE: " + String.format("%.2f", t.timeSinceLastUpdate), 16, 16 * 0 );
}
else
{
text( t.name+" Controller Status", 16, 16 * -1 );
}
text( "Mocap/Wand ID: "+ t.ID + " Controller ID: " + t.secondID, 16 * 1, 16 + 16 * 0 );
noFill();
stroke(currentColor);
strokeWeight(1);
line( analogCenter.x, analogCenter.y, analogCenter.x + analogStick.x * 25, analogCenter.y + analogStick.y * 25 );
ellipse( analogCenter.x + analogStick.x * 25, analogCenter.y + analogStick.y * 25, 15, 15 );
if( t.analogStick3.x > 0 )
{
tint( red(currentColor) * t.analogStick3.x, green(currentColor) * t.analogStick3.x, blue(currentColor) * t.analogStick3.x, alpha(currentColor) );
image( psNavigation_L2, controllerImagePos.x, controllerImagePos.y );
}
noStroke();
tint(currentColor);
fill(currentColor);
if( t.button1 )
{
text( "Button 1", 16, 16 * 6 );
}
if( t.button3 )
{
text( "Button 3", 16, 16 * 8 );
image( psNavigation_cross, controllerImagePos.x, controllerImagePos.y );
}
if( t.button2 )
{
text( "Button 2", 16, 16 * 7 );
image( psNavigation_circle, controllerImagePos.x, controllerImagePos.y );
}
if( t.button4 )
{
text( "Button 4", 16, 16 * 9 );
}
if( t.button5 )
{
text( "Button 5", 16, 16 * 10 );
image( psNavigation_L1, controllerImagePos.x, controllerImagePos.y );
}
if( t.button6 )
{
text( "Button 6", 16, 16 * 11 ); // L3
ellipse( analogCenter.x + analogStick.x * 25, analogCenter.y + analogStick.y * 25, 15, 15 );
image( psNavigation_L3, controllerImagePos.x, controllerImagePos.y );
}
if( t.button7 )
{
text( "Button 7", 16, 16 * 12 ); // L2
image( psNavigation_L2, controllerImagePos.x, controllerImagePos.y );
}
if( t.button8 )
{
text( "Button 8", 16, 16 * 13 ); // R1
}
if( t.button9 )
{
text( "Button 9", 16, 16 * 14 ); // R3
}
if( t.specialButton1 )
{
text( "Special Button 1", 16, 16 * 15 );
}
if( t.specialButton2 )
{
text( "Special Button 2", 16, 16 * 16 );
}
if( t.specialButton3 )
{
text( "Special Button 3", 16, 16 * 17 );
}
if( t.buttonUp )
{
text( "Button Up", 216, 16 * 6 );
image( psNavigation_up, controllerImagePos.x, controllerImagePos.y );
}
if( t.buttonDown )
{
text( "Button Down", 216, 16 * 8 );
image( psNavigation_down, controllerImagePos.x, controllerImagePos.y );
}
if( t.buttonLeft )
{
text( "Button Left", 216, 16 * 9 );
image( psNavigation_left, controllerImagePos.x, controllerImagePos.y );
}
if( t.buttonRight )
{
text( "Button Right", 216, 16 * 7 );
image( psNavigation_right, controllerImagePos.x, controllerImagePos.y );
}
image( psNavigationOutline, controllerImagePos.x, controllerImagePos.y );
popMatrix();
}// displayController