.. | .. |
---|
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 |
---|
.. | .. |
---|
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); |
---|
.. | .. |
---|
11082 | 11084 | // |
---|
11083 | 11085 | // newenvy = -1; |
---|
11084 | 11086 | |
---|
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")) |
---|
11086 | 11088 | { |
---|
11087 | 11089 | if (cubemaprgb == null) |
---|
11088 | 11090 | { |
---|
11089 | | - cubemaprgb = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
| 11091 | + cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false); |
---|
11090 | 11092 | } |
---|
11091 | 11093 | |
---|
11092 | 11094 | cubemap = cubemaprgb; |
---|
.. | .. |
---|
11097 | 11099 | { |
---|
11098 | 11100 | if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
11099 | 11101 | { |
---|
| 11102 | + if (cubemap != null && cubemap != cubemaprgb) |
---|
| 11103 | + cubemap.dispose(); |
---|
11100 | 11104 | cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
11101 | 11105 | loadedskyboxname = object.skyboxname; |
---|
11102 | 11106 | } |
---|
.. | .. |
---|
13415 | 13419 | program = programmin; |
---|
13416 | 13420 | } |
---|
13417 | 13421 | |
---|
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 | + |
---|
13420 | 13428 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13421 | 13429 | |
---|
13422 | 13430 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
13463 | 13471 | "\n" + |
---|
13464 | 13472 | "END\n"; |
---|
13465 | 13473 | |
---|
13466 | | - System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
| 13474 | + if (Globals.DEBUG) |
---|
| 13475 | + System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
13467 | 13476 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13468 | 13477 | |
---|
13469 | 13478 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
14662 | 14671 | void GoDown(int mod) |
---|
14663 | 14672 | { |
---|
14664 | 14673 | MODIFIERS |= COMMAND; |
---|
| 14674 | + boolean isVR = (mouseMode&VR)!=0; |
---|
14665 | 14675 | /**/ |
---|
14666 | 14676 | 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 | + } |
---|
14668 | 14683 | else |
---|
14669 | | - manipCamera.RotatePosition(0, -speed); |
---|
| 14684 | + manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth()); |
---|
14670 | 14685 | /**/ |
---|
14671 | 14686 | if ((mod & SHIFT) == SHIFT) |
---|
14672 | 14687 | { |
---|
.. | .. |
---|
14676 | 14691 | mouseMode |= BACKFORTH; |
---|
14677 | 14692 | } |
---|
14678 | 14693 | |
---|
| 14694 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14695 | + |
---|
14679 | 14696 | //prevX = X = anchorX; |
---|
14680 | 14697 | prevY = Y = anchorY - (int) (renderCamera.Distance()); |
---|
14681 | 14698 | } |
---|
.. | .. |
---|
14684 | 14701 | { |
---|
14685 | 14702 | MODIFIERS |= COMMAND; |
---|
14686 | 14703 | /**/ |
---|
| 14704 | + boolean isVR = (mouseMode&VR)!=0; |
---|
| 14705 | + |
---|
14687 | 14706 | 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 | + } |
---|
14689 | 14713 | else |
---|
14690 | | - manipCamera.RotatePosition(0, speed); |
---|
| 14714 | + manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth()); |
---|
14691 | 14715 | /**/ |
---|
14692 | 14716 | if ((mod & SHIFT) == SHIFT) |
---|
14693 | 14717 | { |
---|
.. | .. |
---|
14697 | 14721 | mouseMode |= BACKFORTH; |
---|
14698 | 14722 | } |
---|
14699 | 14723 | |
---|
| 14724 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14725 | + |
---|
14700 | 14726 | //prevX = X = anchorX; |
---|
14701 | 14727 | prevY = Y = anchorY + (int) (renderCamera.Distance()); |
---|
14702 | 14728 | } |
---|
.. | .. |
---|
14706 | 14732 | MODIFIERS |= COMMAND; |
---|
14707 | 14733 | /**/ |
---|
14708 | 14734 | if((mod&SHIFT) == SHIFT) |
---|
14709 | | - manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
| 14735 | + manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14710 | 14736 | 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 | + } |
---|
14712 | 14743 | /**/ |
---|
14713 | 14744 | if ((mod & SHIFT) == SHIFT) |
---|
14714 | 14745 | { |
---|
.. | .. |
---|
14718 | 14749 | mouseMode |= ROTATE; |
---|
14719 | 14750 | } // TRANSLATE; |
---|
14720 | 14751 | |
---|
| 14752 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14753 | + |
---|
14721 | 14754 | prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance()); |
---|
14722 | 14755 | prevY = Y = anchorY; |
---|
14723 | 14756 | } |
---|
.. | .. |
---|
14727 | 14760 | MODIFIERS |= COMMAND; |
---|
14728 | 14761 | /**/ |
---|
14729 | 14762 | if((mod&SHIFT) == SHIFT) |
---|
14730 | | - manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
| 14763 | + manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14731 | 14764 | 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 | + |
---|
14733 | 14772 | /**/ |
---|
14734 | 14773 | if ((mod & SHIFT) == SHIFT) |
---|
14735 | 14774 | { |
---|
.. | .. |
---|
14739 | 14778 | mouseMode |= ROTATE; |
---|
14740 | 14779 | } // TRANSLATE; |
---|
14741 | 14780 | |
---|
| 14781 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14782 | + |
---|
14742 | 14783 | prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance()); |
---|
14743 | 14784 | prevY = Y = anchorY; |
---|
14744 | 14785 | } |
---|
.. | .. |
---|
16123 | 16164 | { |
---|
16124 | 16165 | switch (hitSomething) |
---|
16125 | 16166 | { |
---|
16126 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 16167 | + case Object3D.hitCenter: gr.setColor(Color.white); |
---|
16127 | 16168 | gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
16128 | 16169 | break; |
---|
16129 | 16170 | case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
.. | .. |
---|
16149 | 16190 | if (hasMarquee) |
---|
16150 | 16191 | { |
---|
16151 | 16192 | gr.setXORMode(Color.white); |
---|
16152 | | - gr.setColor(Color.red); |
---|
| 16193 | + gr.setColor(Color.white); |
---|
16153 | 16194 | if (!firstime) |
---|
16154 | 16195 | { |
---|
16155 | 16196 | gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH); |
---|
.. | .. |
---|
16788 | 16829 | gl.glDisable(GL.GL_TEXTURE_GEN_R); |
---|
16789 | 16830 | |
---|
16790 | 16831 | cubemap.disable(); |
---|
16791 | | - ////cubemap.unbind(); |
---|
| 16832 | + //cubemap.dispose(); |
---|
| 16833 | + |
---|
16792 | 16834 | if (CULLFACE) |
---|
16793 | 16835 | { |
---|
16794 | 16836 | gl.glEnable(gl.GL_CULL_FACE); |
---|
.. | .. |
---|
17324 | 17366 | |
---|
17325 | 17367 | public void init(GLAutoDrawable drawable) |
---|
17326 | 17368 | { |
---|
| 17369 | + if (Globals.DEBUG) |
---|
17327 | 17370 | System.out.println("shadow buffer init"); |
---|
17328 | 17371 | |
---|
17329 | 17372 | GL gl = drawable.getGL(); |
---|