.. | .. |
---|
2298 | 2298 | HANDLES ^= true; |
---|
2299 | 2299 | } |
---|
2300 | 2300 | |
---|
| 2301 | + Object3D paintFolder; |
---|
| 2302 | + |
---|
2301 | 2303 | void TogglePaint() |
---|
2302 | 2304 | { |
---|
2303 | 2305 | PAINTMODE ^= true; |
---|
2304 | 2306 | paintcount = 0; |
---|
| 2307 | + |
---|
| 2308 | + if (PAINTMODE) |
---|
| 2309 | + { |
---|
| 2310 | + paintFolder = GetFolder(); |
---|
| 2311 | + } |
---|
2305 | 2312 | } |
---|
2306 | 2313 | |
---|
2307 | 2314 | void SwapCamera(int a, int b) |
---|
.. | .. |
---|
7923 | 7930 | String pigment = Object3D.GetPigment(tex); |
---|
7924 | 7931 | String bump = Object3D.GetBump(tex); |
---|
7925 | 7932 | |
---|
7926 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7933 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7927 | 7934 | { |
---|
7928 | 7935 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7929 | 7936 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7957 | 7964 | |
---|
7958 | 7965 | String pigment = Object3D.GetPigment(tex); |
---|
7959 | 7966 | |
---|
7960 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7967 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7961 | 7968 | { |
---|
7962 | 7969 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7963 | 7970 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7986 | 7993 | |
---|
7987 | 7994 | String bump = Object3D.GetBump(tex); |
---|
7988 | 7995 | |
---|
7989 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7996 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7990 | 7997 | { |
---|
7991 | 7998 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7992 | 7999 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8124 | 8131 | usedtextures.put(pigment, pigment); |
---|
8125 | 8132 | usedtextures.put(bump, bump); |
---|
8126 | 8133 | |
---|
8127 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8134 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8128 | 8135 | { |
---|
8129 | 8136 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8130 | 8137 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8166 | 8173 | |
---|
8167 | 8174 | usedtextures.put(pigment, pigment); |
---|
8168 | 8175 | |
---|
8169 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8176 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8170 | 8177 | { |
---|
8171 | 8178 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8172 | 8179 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8199 | 8206 | |
---|
8200 | 8207 | usedtextures.put(bump, bump); |
---|
8201 | 8208 | |
---|
8202 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8209 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8203 | 8210 | { |
---|
8204 | 8211 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8205 | 8212 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8510 | 8517 | return false; |
---|
8511 | 8518 | } |
---|
8512 | 8519 | |
---|
8513 | | - boolean newtex = false; |
---|
| 8520 | + //boolean newtex = false; |
---|
8514 | 8521 | |
---|
8515 | 8522 | com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
8516 | 8523 | |
---|
.. | .. |
---|
8542 | 8549 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8543 | 8550 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8544 | 8551 | |
---|
8545 | | - return newtex; |
---|
| 8552 | + return true; // Warning: not used. |
---|
8546 | 8553 | } |
---|
8547 | 8554 | |
---|
8548 | 8555 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
11028 | 11035 | |
---|
11029 | 11036 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
11030 | 11037 | |
---|
11031 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
11032 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
11033 | | -//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11038 | +gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11039 | +gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11040 | +gl.glEnable(gl.GL_MULTISAMPLE); |
---|
11034 | 11041 | } else |
---|
11035 | 11042 | { |
---|
11036 | 11043 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
11041 | 11048 | //System.out.println("BLENDING ON"); |
---|
11042 | 11049 | gl.glEnable(GL.GL_BLEND); |
---|
11043 | 11050 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
11044 | | - |
---|
| 11051 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
11045 | 11052 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
11046 | 11053 | gl.glLoadIdentity(); |
---|
11047 | 11054 | |
---|
.. | .. |
---|
14297 | 14304 | void GoDown(int mod) |
---|
14298 | 14305 | { |
---|
14299 | 14306 | MODIFIERS |= COMMAND; |
---|
14300 | | - /* |
---|
| 14307 | + /**/ |
---|
14301 | 14308 | if((mod&SHIFT) == SHIFT) |
---|
14302 | 14309 | manipCamera.RotatePosition(0, -speed); |
---|
14303 | 14310 | else |
---|
14304 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14305 | | - */ |
---|
| 14311 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14312 | + /**/ |
---|
14306 | 14313 | if ((mod & SHIFT) == SHIFT) |
---|
14307 | 14314 | { |
---|
14308 | 14315 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14318 | 14325 | void GoUp(int mod) |
---|
14319 | 14326 | { |
---|
14320 | 14327 | MODIFIERS |= COMMAND; |
---|
14321 | | - /* |
---|
| 14328 | + /**/ |
---|
14322 | 14329 | if((mod&SHIFT) == SHIFT) |
---|
14323 | 14330 | manipCamera.RotatePosition(0, speed); |
---|
14324 | 14331 | else |
---|
14325 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14326 | | - */ |
---|
| 14332 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14333 | + /**/ |
---|
14327 | 14334 | if ((mod & SHIFT) == SHIFT) |
---|
14328 | 14335 | { |
---|
14329 | 14336 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14339 | 14346 | void GoLeft(int mod) |
---|
14340 | 14347 | { |
---|
14341 | 14348 | MODIFIERS |= COMMAND; |
---|
14342 | | - /* |
---|
| 14349 | + /**/ |
---|
14343 | 14350 | if((mod&SHIFT) == SHIFT) |
---|
14344 | | - manipCamera.RotatePosition(speed, 0); |
---|
14345 | | - else |
---|
14346 | 14351 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14347 | | - */ |
---|
| 14352 | + else |
---|
| 14353 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14354 | + /**/ |
---|
14348 | 14355 | if ((mod & SHIFT) == SHIFT) |
---|
14349 | 14356 | { |
---|
14350 | 14357 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14360 | 14367 | void GoRight(int mod) |
---|
14361 | 14368 | { |
---|
14362 | 14369 | MODIFIERS |= COMMAND; |
---|
14363 | | - /* |
---|
| 14370 | + /**/ |
---|
14364 | 14371 | if((mod&SHIFT) == SHIFT) |
---|
14365 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14366 | | - else |
---|
14367 | 14372 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14368 | | - */ |
---|
| 14373 | + else |
---|
| 14374 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14375 | + /**/ |
---|
14369 | 14376 | if ((mod & SHIFT) == SHIFT) |
---|
14370 | 14377 | { |
---|
14371 | 14378 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14946 | 14953 | case 'E' : COMPACT ^= true; |
---|
14947 | 14954 | repaint(); |
---|
14948 | 14955 | break; |
---|
14949 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14956 | + case 'W' : // Wide Window (fullscreen) |
---|
| 14957 | + //DEBUGHSB ^= true; |
---|
| 14958 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14950 | 14959 | repaint(); |
---|
14951 | 14960 | break; |
---|
14952 | 14961 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14972 | 14981 | repaint(); |
---|
14973 | 14982 | break; |
---|
14974 | 14983 | case 'l': |
---|
14975 | | - lightMode ^= true; |
---|
14976 | | - Globals.lighttouched = true; |
---|
14977 | | - manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
14978 | | - targetLookAt.set(manipCamera.lookAt); |
---|
14979 | | - repaint(); |
---|
14980 | | - break; |
---|
14981 | | - case 'L': |
---|
| 14984 | + //case 'L': |
---|
14982 | 14985 | if (lightMode) |
---|
14983 | 14986 | { |
---|
14984 | 14987 | lightMode = false; |
---|
.. | .. |
---|
15125 | 15128 | // kompactbit = 6; |
---|
15126 | 15129 | // break; |
---|
15127 | 15130 | case ' ': |
---|
15128 | | - ObjEditor.theFrame.ToggleFullScreen(); |
---|
| 15131 | + lightMode ^= true; |
---|
| 15132 | + Globals.lighttouched = true; |
---|
| 15133 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 15134 | + targetLookAt.set(manipCamera.lookAt); |
---|
15129 | 15135 | repaint(); |
---|
15130 | 15136 | break; |
---|
15131 | 15137 | //case '`' : |
---|
.. | .. |
---|
15709 | 15715 | info.bounds.y += (height - desired) / 2; |
---|
15710 | 15716 | } |
---|
15711 | 15717 | } |
---|
| 15718 | + |
---|
15712 | 15719 | info.g = gr; |
---|
15713 | 15720 | info.camera = renderCamera; |
---|
15714 | 15721 | /* |
---|
.. | .. |
---|
15718 | 15725 | */ |
---|
15719 | 15726 | if (!isRenderer) |
---|
15720 | 15727 | { |
---|
| 15728 | + Grafreed.Assert(object != null); |
---|
| 15729 | + Grafreed.Assert(object.selection != null); |
---|
15721 | 15730 | if (object.selection.Size() > 0) |
---|
15722 | 15731 | { |
---|
15723 | 15732 | int hitSomething = object.selection.get(0).hitSomething; |
---|
.. | .. |
---|
16551 | 16560 | } |
---|
16552 | 16561 | } |
---|
16553 | 16562 | |
---|
| 16563 | + private Object3D GetFolder() |
---|
| 16564 | + { |
---|
| 16565 | + Object3D folder = object.GetWindow().copy; |
---|
| 16566 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16567 | + folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16568 | + return folder; |
---|
| 16569 | + } |
---|
| 16570 | + |
---|
16554 | 16571 | class SelectBuffer implements GLEventListener |
---|
16555 | 16572 | { |
---|
16556 | 16573 | |
---|
.. | .. |
---|
16630 | 16647 | |
---|
16631 | 16648 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16632 | 16649 | |
---|
| 16650 | + if (PAINTMODE) |
---|
| 16651 | + { |
---|
| 16652 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16653 | + { |
---|
| 16654 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16655 | + |
---|
| 16656 | + // Make what you paint not selectable. |
---|
| 16657 | + paintobj.ResetSelectable(); |
---|
| 16658 | + } |
---|
| 16659 | + } |
---|
| 16660 | + |
---|
16633 | 16661 | //int tmp = selection_view; |
---|
16634 | 16662 | //selection_view = -1; |
---|
16635 | 16663 | int temp = DrawMode(); |
---|
.. | .. |
---|
16641 | 16669 | // temp = DEFAULT; // patch for selection debug |
---|
16642 | 16670 | Globals.drawMode = temp; // WARNING |
---|
16643 | 16671 | |
---|
| 16672 | + if (PAINTMODE) |
---|
| 16673 | + { |
---|
| 16674 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16675 | + { |
---|
| 16676 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16677 | + |
---|
| 16678 | + // Revert. |
---|
| 16679 | + paintobj.RestoreSelectable(); |
---|
| 16680 | + } |
---|
| 16681 | + } |
---|
| 16682 | + |
---|
16644 | 16683 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16645 | 16684 | |
---|
16646 | 16685 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16746 | 16785 | if (!movingcamera && !PAINTMODE) |
---|
16747 | 16786 | object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16748 | 16787 | |
---|
16749 | | - if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16788 | + if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16750 | 16789 | { |
---|
16751 | | - Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16752 | | - |
---|
16753 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
16754 | | - |
---|
16755 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16756 | | - |
---|
16757 | | - group.add(paintobj); // link |
---|
16758 | | - |
---|
16759 | | - object.GetWindow().SnapObject(group); |
---|
16760 | | - |
---|
16761 | | - Object3D folder = object.GetWindow().copy; |
---|
| 16790 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16762 | 16791 | |
---|
16763 | 16792 | if (object.GetWindow().copy.selection.Size() > 0) |
---|
16764 | | - folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16793 | + { |
---|
| 16794 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16765 | 16795 | |
---|
16766 | | - folder.add(group); |
---|
16767 | | - |
---|
16768 | | - object.GetWindow().ResetModel(); |
---|
16769 | | - object.GetWindow().refreshContents(); |
---|
| 16796 | + Object3D inst = new Object3D("inst" + paintcount++); |
---|
| 16797 | + |
---|
| 16798 | + inst.CreateMaterial(); // use a void leaf to select instances |
---|
| 16799 | + |
---|
| 16800 | + inst.add(paintobj); // link |
---|
| 16801 | + |
---|
| 16802 | + object.GetWindow().SnapObject(inst); |
---|
| 16803 | + |
---|
| 16804 | + Object3D folder = paintFolder; // GetFolder(); |
---|
| 16805 | + |
---|
| 16806 | + folder.add(inst); |
---|
| 16807 | + |
---|
| 16808 | + object.GetWindow().ResetModel(); |
---|
| 16809 | + object.GetWindow().refreshContents(); |
---|
| 16810 | + } |
---|
16770 | 16811 | } |
---|
16771 | 16812 | else |
---|
16772 | 16813 | paintcount = 0; |
---|