Normand Briere
2019-08-17 07c0c67b88160b51e61c5c1d2b9b602daafa44a9
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
....@@ -166,7 +168,7 @@
166168
167169
168170 // OPTIONS
169
- boolean Skinshader = true;
171
+ boolean Skinshader = false; // true;
170172 boolean cameraLight = false;
171173 boolean UVdebug = false;
172174 boolean Udebug = false;
....@@ -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);
....@@ -10688,9 +10690,18 @@
1068810690 static boolean init = false;
1068910691
1069010692 double[][] matrix = LA.newMatrix();
10693
+
10694
+ // This is to refresh the UI of the material panel.
10695
+ ObjEditor patchMaterial;
1069110696
1069210697 public void display(GLAutoDrawable drawable)
1069310698 {
10699
+ if (patchMaterial.patchMaterial)
10700
+ {
10701
+ patchMaterial.patchMaterial = false;
10702
+ patchMaterial.objectPanel.setSelectedIndex(0);
10703
+ }
10704
+
1069410705 if (Grafreed.savesound && Grafreed.hassound)
1069510706 {
1069610707 Grafreed.wav.save();
....@@ -11082,11 +11093,11 @@
1108211093 //
1108311094 // newenvy = -1;
1108411095
11085
- if (object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb"))
11096
+ if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb"))
1108611097 {
1108711098 if (cubemaprgb == null)
1108811099 {
11089
- cubemaprgb = LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
11100
+ cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false);
1109011101 }
1109111102
1109211103 cubemap = cubemaprgb;
....@@ -11097,6 +11108,8 @@
1109711108 {
1109811109 if (!object.skyboxname.equals(this.loadedskyboxname))
1109911110 {
11111
+ if (cubemap != null && cubemap != cubemaprgb)
11112
+ cubemap.dispose();
1110011113 cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
1110111114 loadedskyboxname = object.skyboxname;
1110211115 }
....@@ -13415,8 +13428,12 @@
1341513428 program = programmin;
1341613429 }
1341713430
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 " : ""));
13431
+ if (Globals.DEBUG)
13432
+ {
13433
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13434
+ System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13435
+ }
13436
+
1342013437 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1342113438
1342213439 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13463,7 +13480,8 @@
1346313480 "\n" +
1346413481 "END\n";
1346513482
13466
- System.out.println("Program shadow #" + 0 + "; length = " + program.length());
13483
+ if (Globals.DEBUG)
13484
+ System.out.println("Program shadow #" + 0 + "; length = " + program.length());
1346713485 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1346813486
1346913487 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -14662,11 +14680,17 @@
1466214680 void GoDown(int mod)
1466314681 {
1466414682 MODIFIERS |= COMMAND;
14683
+ boolean isVR = (mouseMode&VR)!=0;
1466514684 /**/
1466614685 if((mod&SHIFT) == SHIFT)
14667
- manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14686
+ {
14687
+ if (isVR)
14688
+ manipCamera.RotateInterest(0, -speed);
14689
+ else
14690
+ manipCamera.RotatePosition(0, -speed);
14691
+ }
1466814692 else
14669
- manipCamera.RotatePosition(0, -speed);
14693
+ manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth());
1467014694 /**/
1467114695 if ((mod & SHIFT) == SHIFT)
1467214696 {
....@@ -14676,6 +14700,8 @@
1467614700 mouseMode |= BACKFORTH;
1467714701 }
1467814702
14703
+ targetLookAt.set(manipCamera.lookAt);
14704
+
1467914705 //prevX = X = anchorX;
1468014706 prevY = Y = anchorY - (int) (renderCamera.Distance());
1468114707 }
....@@ -14684,10 +14710,17 @@
1468414710 {
1468514711 MODIFIERS |= COMMAND;
1468614712 /**/
14713
+ boolean isVR = (mouseMode&VR)!=0;
14714
+
1468714715 if((mod&SHIFT) == SHIFT)
14688
- manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14716
+ {
14717
+ if (isVR)
14718
+ manipCamera.RotateInterest(0, speed);
14719
+ else
14720
+ manipCamera.RotatePosition(0, speed);
14721
+ }
1468914722 else
14690
- manipCamera.RotatePosition(0, speed);
14723
+ manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth());
1469114724 /**/
1469214725 if ((mod & SHIFT) == SHIFT)
1469314726 {
....@@ -14697,6 +14730,8 @@
1469714730 mouseMode |= BACKFORTH;
1469814731 }
1469914732
14733
+ targetLookAt.set(manipCamera.lookAt);
14734
+
1470014735 //prevX = X = anchorX;
1470114736 prevY = Y = anchorY + (int) (renderCamera.Distance());
1470214737 }
....@@ -14706,9 +14741,14 @@
1470614741 MODIFIERS |= COMMAND;
1470714742 /**/
1470814743 if((mod&SHIFT) == SHIFT)
14709
- manipCamera.Translate(speed*delta, 0, getWidth());
14744
+ manipCamera.Translate(speed*delta, 0, getWidth());
1471014745 else
14711
- manipCamera.RotatePosition(speed, 0);
14746
+ {
14747
+ if ((mouseMode&VR)!=0)
14748
+ manipCamera.RotateInterest(-speed, 0);
14749
+ else
14750
+ manipCamera.RotatePosition(speed, 0);
14751
+ }
1471214752 /**/
1471314753 if ((mod & SHIFT) == SHIFT)
1471414754 {
....@@ -14718,6 +14758,8 @@
1471814758 mouseMode |= ROTATE;
1471914759 } // TRANSLATE;
1472014760
14761
+ targetLookAt.set(manipCamera.lookAt);
14762
+
1472114763 prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance());
1472214764 prevY = Y = anchorY;
1472314765 }
....@@ -14727,9 +14769,15 @@
1472714769 MODIFIERS |= COMMAND;
1472814770 /**/
1472914771 if((mod&SHIFT) == SHIFT)
14730
- manipCamera.Translate(-speed*delta, 0, getWidth());
14772
+ manipCamera.Translate(-speed*delta, 0, getWidth());
1473114773 else
14732
- manipCamera.RotatePosition(-speed, 0);
14774
+ {
14775
+ if ((mouseMode&VR)!=0)
14776
+ manipCamera.RotateInterest(speed, 0);
14777
+ else
14778
+ manipCamera.RotatePosition(-speed, 0);
14779
+ }
14780
+
1473314781 /**/
1473414782 if ((mod & SHIFT) == SHIFT)
1473514783 {
....@@ -14739,6 +14787,8 @@
1473914787 mouseMode |= ROTATE;
1474014788 } // TRANSLATE;
1474114789
14790
+ targetLookAt.set(manipCamera.lookAt);
14791
+
1474214792 prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance());
1474314793 prevY = Y = anchorY;
1474414794 }
....@@ -15241,8 +15291,8 @@
1524115291 case 'K':
1524215292 KOMPACTTEXTURE ^= true;
1524315293 //textures.clear();
15244
- break;
15245
- case 'P': // Texture Projection macros
15294
+ // break;
15295
+ //case 'P': // Texture Projection macros
1524615296 // SAVETEXTURE ^= true;
1524715297 macromode = true;
1524815298 Udebug = Vdebug = NORMALdebug = false; programInitialized = false;
....@@ -15363,7 +15413,7 @@
1536315413 targetLookAt.set(manipCamera.lookAt);
1536415414 repaint();
1536515415 break;
15366
- case 'p':
15416
+ case 'P': // p':
1536715417 // c'est quoi ca au juste? spherical ^= true;
1536815418 Skinshader ^= true; programInitialized = false;
1536915419 repaint();
....@@ -16123,7 +16173,7 @@
1612316173 {
1612416174 switch (hitSomething)
1612516175 {
16126
- case Object3D.hitCenter: gr.setColor(Color.pink);
16176
+ case Object3D.hitCenter: gr.setColor(Color.white);
1612716177 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1612816178 break;
1612916179 case Object3D.hitRotate: gr.setColor(Color.yellow);
....@@ -16149,7 +16199,7 @@
1614916199 if (hasMarquee)
1615016200 {
1615116201 gr.setXORMode(Color.white);
16152
- gr.setColor(Color.red);
16202
+ gr.setColor(Color.white);
1615316203 if (!firstime)
1615416204 {
1615516205 gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH);
....@@ -16788,7 +16838,8 @@
1678816838 gl.glDisable(GL.GL_TEXTURE_GEN_R);
1678916839
1679016840 cubemap.disable();
16791
- ////cubemap.unbind();
16841
+ //cubemap.dispose();
16842
+
1679216843 if (CULLFACE)
1679316844 {
1679416845 gl.glEnable(gl.GL_CULL_FACE);
....@@ -17324,6 +17375,7 @@
1732417375
1732517376 public void init(GLAutoDrawable drawable)
1732617377 {
17378
+ if (Globals.DEBUG)
1732717379 System.out.println("shadow buffer init");
1732817380
1732917381 GL gl = drawable.getGL();