|
@@ -27,6 +27,7 @@ import javax.media.j3d.*;
|
27
|
27
|
import javax.vecmath.*;
|
28
|
28
|
import com.sun.j3d.utils.behaviors.mouse.*;
|
29
|
29
|
import com.sun.j3d.utils.image.TextureLoader;
|
|
30
|
+import java.awt.Toolkit;
|
30
|
31
|
|
31
|
32
|
/**
|
32
|
33
|
* This class is responsible for displaying the 3D View of our Cube.
|
|
@@ -55,6 +56,8 @@ public class Led3D {
|
55
|
56
|
private static Material redMat = new Material(
|
56
|
57
|
new Color3f(1.0f, 0.0f, 0.0f), new Color3f(1.0f, 0.0f, 0.0f),
|
57
|
58
|
new Color3f(1.0f, 0.0f, 0.0f), new Color3f(1.0f, 0.0f, 0.0f), 64.0f);
|
|
59
|
+ private Background background;
|
|
60
|
+ private Background fullscreenBackground;
|
58
|
61
|
|
59
|
62
|
/**
|
60
|
63
|
* @param canv The Canvas3D we render our cube in
|
|
@@ -96,7 +99,11 @@ public class Led3D {
|
96
|
99
|
beh3.setSchedulingBounds(boundBox);
|
97
|
100
|
transGroup.addChild(beh3);
|
98
|
101
|
|
99
|
|
- group.addChild(createBackground());
|
|
102
|
+ background = createBackground();
|
|
103
|
+ fullscreenBackground = createFullscreenBackground();
|
|
104
|
+ group.addChild(background);
|
|
105
|
+
|
|
106
|
+
|
100
|
107
|
|
101
|
108
|
// Add all our led sphares to the universe
|
102
|
109
|
for (int x = 0; x < 8; x++) {
|
|
@@ -241,4 +248,26 @@ public class Led3D {
|
241
|
248
|
100.0));
|
242
|
249
|
return bg;
|
243
|
250
|
}
|
|
251
|
+
|
|
252
|
+ //create fullscreen background
|
|
253
|
+ private Background createFullscreenBackground() {
|
|
254
|
+ Background bg = new Background();
|
|
255
|
+ int radius = Toolkit.getDefaultToolkit().getScreenSize().width;
|
|
256
|
+ bg.setApplicationBounds(new BoundingSphere(new Point3d(0.0, 0.0, 0.0), radius));
|
|
257
|
+ return bg;
|
|
258
|
+
|
|
259
|
+ }
|
|
260
|
+
|
|
261
|
+ public void enterFullscreen() {
|
|
262
|
+
|
|
263
|
+ group.removeChild(background);
|
|
264
|
+ group.addChild(fullscreenBackground);
|
|
265
|
+
|
|
266
|
+ }
|
|
267
|
+
|
|
268
|
+ public void leaveFullscreen() {
|
|
269
|
+ group.removeChild(fullscreenBackground);
|
|
270
|
+ group.addChild(background);
|
|
271
|
+
|
|
272
|
+ }
|
244
|
273
|
}
|