.. | .. |
---|
113 | 113 | /*static*/ com.sun.opengl.util.texture.Texture cubemap; // Either custom or rgb |
---|
114 | 114 | /*static*/ com.sun.opengl.util.texture.Texture cubemapcustom; |
---|
115 | 115 | /*static*/ com.sun.opengl.util.texture.Texture cubemaprgb; |
---|
| 116 | + boolean transformMode; |
---|
| 117 | + |
---|
116 | 118 | boolean reverseUP = false; |
---|
117 | 119 | static boolean frozen = false; |
---|
118 | 120 | boolean enablebackspace = false; // patch for back buffer refresh |
---|
.. | .. |
---|
166 | 168 | |
---|
167 | 169 | |
---|
168 | 170 | // OPTIONS |
---|
169 | | - boolean Skinshader = true; |
---|
| 171 | + boolean Skinshader = false; // true; |
---|
170 | 172 | boolean cameraLight = false; |
---|
171 | 173 | boolean UVdebug = false; |
---|
172 | 174 | boolean Udebug = false; |
---|
.. | .. |
---|
2515 | 2517 | com.sun.opengl.util.texture.TextureIO.newTextureData( |
---|
2516 | 2518 | getClass().getClassLoader().getResourceAsStream(name), |
---|
2517 | 2519 | true, |
---|
2518 | | - com.sun.opengl.util.texture.TextureIO.PNG); |
---|
| 2520 | + GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2519 | 2521 | } catch (java.io.IOException e) |
---|
2520 | 2522 | { |
---|
2521 | 2523 | throw new javax.media.opengl.GLException(e); |
---|
.. | .. |
---|
10688 | 10690 | static boolean init = false; |
---|
10689 | 10691 | |
---|
10690 | 10692 | double[][] matrix = LA.newMatrix(); |
---|
| 10693 | + |
---|
| 10694 | + // This is to refresh the UI of the material panel. |
---|
| 10695 | + ObjEditor patchMaterial; |
---|
10691 | 10696 | |
---|
10692 | 10697 | public void display(GLAutoDrawable drawable) |
---|
10693 | 10698 | { |
---|
| 10699 | + if (patchMaterial.patchMaterial) |
---|
| 10700 | + { |
---|
| 10701 | + patchMaterial.patchMaterial = false; |
---|
| 10702 | + patchMaterial.objectPanel.setSelectedIndex(0); |
---|
| 10703 | + } |
---|
| 10704 | + |
---|
10694 | 10705 | if (Grafreed.savesound && Grafreed.hassound) |
---|
10695 | 10706 | { |
---|
10696 | 10707 | Grafreed.wav.save(); |
---|
.. | .. |
---|
11082 | 11093 | // |
---|
11083 | 11094 | // newenvy = -1; |
---|
11084 | 11095 | |
---|
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")) |
---|
11086 | 11097 | { |
---|
11087 | 11098 | if (cubemaprgb == null) |
---|
11088 | 11099 | { |
---|
11089 | | - cubemaprgb = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
| 11100 | + cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false); |
---|
11090 | 11101 | } |
---|
11091 | 11102 | |
---|
11092 | 11103 | cubemap = cubemaprgb; |
---|
.. | .. |
---|
11097 | 11108 | { |
---|
11098 | 11109 | if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
11099 | 11110 | { |
---|
| 11111 | + if (cubemap != null && cubemap != cubemaprgb) |
---|
| 11112 | + cubemap.dispose(); |
---|
11100 | 11113 | cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
11101 | 11114 | loadedskyboxname = object.skyboxname; |
---|
11102 | 11115 | } |
---|
.. | .. |
---|
13415 | 13428 | program = programmin; |
---|
13416 | 13429 | } |
---|
13417 | 13430 | |
---|
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 | + |
---|
13420 | 13437 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13421 | 13438 | |
---|
13422 | 13439 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
13463 | 13480 | "\n" + |
---|
13464 | 13481 | "END\n"; |
---|
13465 | 13482 | |
---|
13466 | | - System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
| 13483 | + if (Globals.DEBUG) |
---|
| 13484 | + System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
13467 | 13485 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13468 | 13486 | |
---|
13469 | 13487 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
14662 | 14680 | void GoDown(int mod) |
---|
14663 | 14681 | { |
---|
14664 | 14682 | MODIFIERS |= COMMAND; |
---|
| 14683 | + boolean isVR = (mouseMode&VR)!=0; |
---|
14665 | 14684 | /**/ |
---|
14666 | 14685 | 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 | + } |
---|
14668 | 14692 | else |
---|
14669 | | - manipCamera.RotatePosition(0, -speed); |
---|
| 14693 | + manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth()); |
---|
14670 | 14694 | /**/ |
---|
14671 | 14695 | if ((mod & SHIFT) == SHIFT) |
---|
14672 | 14696 | { |
---|
.. | .. |
---|
14676 | 14700 | mouseMode |= BACKFORTH; |
---|
14677 | 14701 | } |
---|
14678 | 14702 | |
---|
| 14703 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14704 | + |
---|
14679 | 14705 | //prevX = X = anchorX; |
---|
14680 | 14706 | prevY = Y = anchorY - (int) (renderCamera.Distance()); |
---|
14681 | 14707 | } |
---|
.. | .. |
---|
14684 | 14710 | { |
---|
14685 | 14711 | MODIFIERS |= COMMAND; |
---|
14686 | 14712 | /**/ |
---|
| 14713 | + boolean isVR = (mouseMode&VR)!=0; |
---|
| 14714 | + |
---|
14687 | 14715 | 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 | + } |
---|
14689 | 14722 | else |
---|
14690 | | - manipCamera.RotatePosition(0, speed); |
---|
| 14723 | + manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth()); |
---|
14691 | 14724 | /**/ |
---|
14692 | 14725 | if ((mod & SHIFT) == SHIFT) |
---|
14693 | 14726 | { |
---|
.. | .. |
---|
14697 | 14730 | mouseMode |= BACKFORTH; |
---|
14698 | 14731 | } |
---|
14699 | 14732 | |
---|
| 14733 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14734 | + |
---|
14700 | 14735 | //prevX = X = anchorX; |
---|
14701 | 14736 | prevY = Y = anchorY + (int) (renderCamera.Distance()); |
---|
14702 | 14737 | } |
---|
.. | .. |
---|
14706 | 14741 | MODIFIERS |= COMMAND; |
---|
14707 | 14742 | /**/ |
---|
14708 | 14743 | if((mod&SHIFT) == SHIFT) |
---|
14709 | | - manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
| 14744 | + manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14710 | 14745 | 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 | + } |
---|
14712 | 14752 | /**/ |
---|
14713 | 14753 | if ((mod & SHIFT) == SHIFT) |
---|
14714 | 14754 | { |
---|
.. | .. |
---|
14718 | 14758 | mouseMode |= ROTATE; |
---|
14719 | 14759 | } // TRANSLATE; |
---|
14720 | 14760 | |
---|
| 14761 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14762 | + |
---|
14721 | 14763 | prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance()); |
---|
14722 | 14764 | prevY = Y = anchorY; |
---|
14723 | 14765 | } |
---|
.. | .. |
---|
14727 | 14769 | MODIFIERS |= COMMAND; |
---|
14728 | 14770 | /**/ |
---|
14729 | 14771 | if((mod&SHIFT) == SHIFT) |
---|
14730 | | - manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
| 14772 | + manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14731 | 14773 | 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 | + |
---|
14733 | 14781 | /**/ |
---|
14734 | 14782 | if ((mod & SHIFT) == SHIFT) |
---|
14735 | 14783 | { |
---|
.. | .. |
---|
14739 | 14787 | mouseMode |= ROTATE; |
---|
14740 | 14788 | } // TRANSLATE; |
---|
14741 | 14789 | |
---|
| 14790 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14791 | + |
---|
14742 | 14792 | prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance()); |
---|
14743 | 14793 | prevY = Y = anchorY; |
---|
14744 | 14794 | } |
---|
.. | .. |
---|
15241 | 15291 | case 'K': |
---|
15242 | 15292 | KOMPACTTEXTURE ^= true; |
---|
15243 | 15293 | //textures.clear(); |
---|
15244 | | - break; |
---|
15245 | | - case 'P': // Texture Projection macros |
---|
| 15294 | + // break; |
---|
| 15295 | + //case 'P': // Texture Projection macros |
---|
15246 | 15296 | // SAVETEXTURE ^= true; |
---|
15247 | 15297 | macromode = true; |
---|
15248 | 15298 | Udebug = Vdebug = NORMALdebug = false; programInitialized = false; |
---|
.. | .. |
---|
15363 | 15413 | targetLookAt.set(manipCamera.lookAt); |
---|
15364 | 15414 | repaint(); |
---|
15365 | 15415 | break; |
---|
15366 | | - case 'p': |
---|
| 15416 | + case 'P': // p': |
---|
15367 | 15417 | // c'est quoi ca au juste? spherical ^= true; |
---|
15368 | 15418 | Skinshader ^= true; programInitialized = false; |
---|
15369 | 15419 | repaint(); |
---|
.. | .. |
---|
16123 | 16173 | { |
---|
16124 | 16174 | switch (hitSomething) |
---|
16125 | 16175 | { |
---|
16126 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 16176 | + case Object3D.hitCenter: gr.setColor(Color.white); |
---|
16127 | 16177 | gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
16128 | 16178 | break; |
---|
16129 | 16179 | case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
.. | .. |
---|
16149 | 16199 | if (hasMarquee) |
---|
16150 | 16200 | { |
---|
16151 | 16201 | gr.setXORMode(Color.white); |
---|
16152 | | - gr.setColor(Color.red); |
---|
| 16202 | + gr.setColor(Color.white); |
---|
16153 | 16203 | if (!firstime) |
---|
16154 | 16204 | { |
---|
16155 | 16205 | gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH); |
---|
.. | .. |
---|
16788 | 16838 | gl.glDisable(GL.GL_TEXTURE_GEN_R); |
---|
16789 | 16839 | |
---|
16790 | 16840 | cubemap.disable(); |
---|
16791 | | - ////cubemap.unbind(); |
---|
| 16841 | + //cubemap.dispose(); |
---|
| 16842 | + |
---|
16792 | 16843 | if (CULLFACE) |
---|
16793 | 16844 | { |
---|
16794 | 16845 | gl.glEnable(gl.GL_CULL_FACE); |
---|
.. | .. |
---|
17324 | 17375 | |
---|
17325 | 17376 | public void init(GLAutoDrawable drawable) |
---|
17326 | 17377 | { |
---|
| 17378 | + if (Globals.DEBUG) |
---|
17327 | 17379 | System.out.println("shadow buffer init"); |
---|
17328 | 17380 | |
---|
17329 | 17381 | GL gl = drawable.getGL(); |
---|