Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
CameraPane.java
....@@ -113,6 +113,8 @@
113113 /*static*/ com.sun.opengl.util.texture.Texture cubemap; // Either custom or rgb
114114 /*static*/ com.sun.opengl.util.texture.Texture cubemapcustom;
115115 /*static*/ com.sun.opengl.util.texture.Texture cubemaprgb;
116
+ boolean transformMode;
117
+
116118 boolean reverseUP = false;
117119 static boolean frozen = false;
118120 boolean enablebackspace = false; // patch for back buffer refresh
....@@ -2515,7 +2517,7 @@
25152517 com.sun.opengl.util.texture.TextureIO.newTextureData(
25162518 getClass().getClassLoader().getResourceAsStream(name),
25172519 true,
2518
- com.sun.opengl.util.texture.TextureIO.PNG);
2520
+ GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG);
25192521 } catch (java.io.IOException e)
25202522 {
25212523 throw new javax.media.opengl.GLException(e);
....@@ -11082,11 +11084,11 @@
1108211084 //
1108311085 // newenvy = -1;
1108411086
11085
- if (object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb"))
11087
+ if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb"))
1108611088 {
1108711089 if (cubemaprgb == null)
1108811090 {
11089
- cubemaprgb = LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
11091
+ cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false);
1109011092 }
1109111093
1109211094 cubemap = cubemaprgb;
....@@ -11097,6 +11099,8 @@
1109711099 {
1109811100 if (!object.skyboxname.equals(this.loadedskyboxname))
1109911101 {
11102
+ if (cubemap != null && cubemap != cubemaprgb)
11103
+ cubemap.dispose();
1110011104 cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
1110111105 loadedskyboxname = object.skyboxname;
1110211106 }
....@@ -13415,8 +13419,12 @@
1341513419 program = programmin;
1341613420 }
1341713421
13418
- System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13419
- System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13422
+ if (Globals.DEBUG)
13423
+ {
13424
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13425
+ System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13426
+ }
13427
+
1342013428 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1342113429
1342213430 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13463,7 +13471,8 @@
1346313471 "\n" +
1346413472 "END\n";
1346513473
13466
- System.out.println("Program shadow #" + 0 + "; length = " + program.length());
13474
+ if (Globals.DEBUG)
13475
+ System.out.println("Program shadow #" + 0 + "; length = " + program.length());
1346713476 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1346813477
1346913478 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -14662,11 +14671,17 @@
1466214671 void GoDown(int mod)
1466314672 {
1466414673 MODIFIERS |= COMMAND;
14674
+ boolean isVR = (mouseMode&VR)!=0;
1466514675 /**/
1466614676 if((mod&SHIFT) == SHIFT)
14667
- manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14677
+ {
14678
+ if (isVR)
14679
+ manipCamera.RotateInterest(0, -speed);
14680
+ else
14681
+ manipCamera.RotatePosition(0, -speed);
14682
+ }
1466814683 else
14669
- manipCamera.RotatePosition(0, -speed);
14684
+ manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth());
1467014685 /**/
1467114686 if ((mod & SHIFT) == SHIFT)
1467214687 {
....@@ -14676,6 +14691,8 @@
1467614691 mouseMode |= BACKFORTH;
1467714692 }
1467814693
14694
+ targetLookAt.set(manipCamera.lookAt);
14695
+
1467914696 //prevX = X = anchorX;
1468014697 prevY = Y = anchorY - (int) (renderCamera.Distance());
1468114698 }
....@@ -14684,10 +14701,17 @@
1468414701 {
1468514702 MODIFIERS |= COMMAND;
1468614703 /**/
14704
+ boolean isVR = (mouseMode&VR)!=0;
14705
+
1468714706 if((mod&SHIFT) == SHIFT)
14688
- manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14707
+ {
14708
+ if (isVR)
14709
+ manipCamera.RotateInterest(0, speed);
14710
+ else
14711
+ manipCamera.RotatePosition(0, speed);
14712
+ }
1468914713 else
14690
- manipCamera.RotatePosition(0, speed);
14714
+ manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth());
1469114715 /**/
1469214716 if ((mod & SHIFT) == SHIFT)
1469314717 {
....@@ -14697,6 +14721,8 @@
1469714721 mouseMode |= BACKFORTH;
1469814722 }
1469914723
14724
+ targetLookAt.set(manipCamera.lookAt);
14725
+
1470014726 //prevX = X = anchorX;
1470114727 prevY = Y = anchorY + (int) (renderCamera.Distance());
1470214728 }
....@@ -14706,9 +14732,14 @@
1470614732 MODIFIERS |= COMMAND;
1470714733 /**/
1470814734 if((mod&SHIFT) == SHIFT)
14709
- manipCamera.Translate(speed*delta, 0, getWidth());
14735
+ manipCamera.Translate(speed*delta, 0, getWidth());
1471014736 else
14711
- manipCamera.RotatePosition(speed, 0);
14737
+ {
14738
+ if ((mouseMode&VR)!=0)
14739
+ manipCamera.RotateInterest(-speed, 0);
14740
+ else
14741
+ manipCamera.RotatePosition(speed, 0);
14742
+ }
1471214743 /**/
1471314744 if ((mod & SHIFT) == SHIFT)
1471414745 {
....@@ -14718,6 +14749,8 @@
1471814749 mouseMode |= ROTATE;
1471914750 } // TRANSLATE;
1472014751
14752
+ targetLookAt.set(manipCamera.lookAt);
14753
+
1472114754 prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance());
1472214755 prevY = Y = anchorY;
1472314756 }
....@@ -14727,9 +14760,15 @@
1472714760 MODIFIERS |= COMMAND;
1472814761 /**/
1472914762 if((mod&SHIFT) == SHIFT)
14730
- manipCamera.Translate(-speed*delta, 0, getWidth());
14763
+ manipCamera.Translate(-speed*delta, 0, getWidth());
1473114764 else
14732
- manipCamera.RotatePosition(-speed, 0);
14765
+ {
14766
+ if ((mouseMode&VR)!=0)
14767
+ manipCamera.RotateInterest(speed, 0);
14768
+ else
14769
+ manipCamera.RotatePosition(-speed, 0);
14770
+ }
14771
+
1473314772 /**/
1473414773 if ((mod & SHIFT) == SHIFT)
1473514774 {
....@@ -14739,6 +14778,8 @@
1473914778 mouseMode |= ROTATE;
1474014779 } // TRANSLATE;
1474114780
14781
+ targetLookAt.set(manipCamera.lookAt);
14782
+
1474214783 prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance());
1474314784 prevY = Y = anchorY;
1474414785 }
....@@ -16123,7 +16164,7 @@
1612316164 {
1612416165 switch (hitSomething)
1612516166 {
16126
- case Object3D.hitCenter: gr.setColor(Color.pink);
16167
+ case Object3D.hitCenter: gr.setColor(Color.white);
1612716168 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1612816169 break;
1612916170 case Object3D.hitRotate: gr.setColor(Color.yellow);
....@@ -16149,7 +16190,7 @@
1614916190 if (hasMarquee)
1615016191 {
1615116192 gr.setXORMode(Color.white);
16152
- gr.setColor(Color.red);
16193
+ gr.setColor(Color.white);
1615316194 if (!firstime)
1615416195 {
1615516196 gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH);
....@@ -16788,7 +16829,8 @@
1678816829 gl.glDisable(GL.GL_TEXTURE_GEN_R);
1678916830
1679016831 cubemap.disable();
16791
- ////cubemap.unbind();
16832
+ //cubemap.dispose();
16833
+
1679216834 if (CULLFACE)
1679316835 {
1679416836 gl.glEnable(gl.GL_CULL_FACE);
....@@ -17324,6 +17366,7 @@
1732417366
1732517367 public void init(GLAutoDrawable drawable)
1732617368 {
17369
+ if (Globals.DEBUG)
1732717370 System.out.println("shadow buffer init");
1732817371
1732917372 GL gl = drawable.getGL();