Browse Source

Fixed wrong translation data in resetView(), also added fullscreen detection for resetView(), and made nicer viewing point in fullscreen

hutattedonmyarm 12 years ago
parent
commit
7a1912e249
1 changed files with 18 additions and 7 deletions
  1. 18
    7
      CubeControl/Led3D.java

+ 18
- 7
CubeControl/Led3D.java View File

50
 	private Matrix4d mat = null;
50
 	private Matrix4d mat = null;
51
 	private Matrix4d fullScreenMat = null;
51
 	private Matrix4d fullScreenMat = null;
52
 	private Frame parentFrame = null;
52
 	private Frame parentFrame = null;
53
+	private boolean inFullscreen = false;
53
 
54
 
54
 	private Sphere[][][] leds = new Sphere[8][8][8];
55
 	private Sphere[][][] leds = new Sphere[8][8][8];
55
 	private static ColoringAttributes redColor = new ColoringAttributes(
56
 	private static ColoringAttributes redColor = new ColoringAttributes(
82
 		mat.setRow(3, 0.0, 0.0, 0.0, 1.0);
83
 		mat.setRow(3, 0.0, 0.0, 0.0, 1.0);
83
 
84
 
84
 		fullScreenMat = new Matrix4d();
85
 		fullScreenMat = new Matrix4d();
85
-		fullScreenMat.setRow(0, 0.7597, -0.0204, 0.64926, 0.56);
86
-		fullScreenMat.setRow(1, -0.08, -0.995, 0.061, 0.02);
87
-		fullScreenMat.setRow(2, 0.64473, -0.09786, -0.758, -14.68);
86
+		fullScreenMat.setRow(0, 0.7597, -0.0204, 0.64926, 0.68);
87
+		fullScreenMat.setRow(1, -0.08, -0.995, 0.061, 0.7);
88
+		fullScreenMat.setRow(2, 0.64473, -0.09786, -0.758, -22.88);
88
 		fullScreenMat.setRow(3, 0.0, 0.0, 0.0, 1.0);
89
 		fullScreenMat.setRow(3, 0.0, 0.0, 0.0, 1.0);
89
 
90
 
90
 
91
 
293
 	 */
294
 	 */
294
 	public void resetView() {
295
 	public void resetView() {
295
 		Matrix4d mat = new Matrix4d();
296
 		Matrix4d mat = new Matrix4d();
296
-		mat.setRow(0, 0.744, 0.0237, -0.66756, -0.34);
297
-		mat.setRow(1, 0.136, -0.9837, 0.117, 3.24);
298
-		mat.setRow(2, -0.6536, -0.1785, -0.735, -8.32);
299
-		mat.setRow(3, 0.0, 0.0, 0.0, 1.0);
297
+		
298
+		if(inFullscreen){
299
+			mat.setRow(0, 0.7597, -0.0204, 0.64926, 0.68);
300
+			mat.setRow(1, -0.08, -0.995, 0.061, 0.7);
301
+			mat.setRow(2, 0.64473, -0.09786, -0.758, -22.88);
302
+			mat.setRow(3, 0.0, 0.0, 0.0, 1.0);	
303
+		} else {
304
+			mat.setRow(0, 0.7597, -0.0204, 0.64926, 0.56);
305
+			mat.setRow(1, -0.08, -0.995, 0.061, 0.02);
306
+			mat.setRow(2, 0.64473, -0.09786, -0.758, -14.68);
307
+			mat.setRow(3, 0.0, 0.0, 0.0, 1.0);
308
+		}
300
 		trans3D.set(mat);
309
 		trans3D.set(mat);
301
 		transGroup.setTransform(trans3D);
310
 		transGroup.setTransform(trans3D);
302
 		feetGroup.setTransform(trans3D);
311
 		feetGroup.setTransform(trans3D);
359
 		background = createBackground();
368
 		background = createBackground();
360
 		group.addChild(background);
369
 		group.addChild(background);
361
 		universe.addBranchGraph(group);
370
 		universe.addBranchGraph(group);
371
+		inFullscreen = !inFullscreen;
362
 	}
372
 	}
363
 	
373
 	
364
 	/**
374
 	/**
369
 		trans3D.set(fullScreenMat);
379
 		trans3D.set(fullScreenMat);
370
 		transGroup.setTransform(trans3D);
380
 		transGroup.setTransform(trans3D);
371
 		feetGroup.setTransform(trans3D);
381
 		feetGroup.setTransform(trans3D);
382
+		resetView(); //This is important. For some reason some legs are missing when entering fullscreen mode. Calling this function solves the problem.
372
 	}
383
 	}
373
 	
384
 	
374
 	/**
385
 	/**

Loading…
Cancel
Save