.. | .. |
---|
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; |
---|
.. | .. |
---|
14604 | 14611 | Globals.MOUSEDRAGGED = false; |
---|
14605 | 14612 | |
---|
14606 | 14613 | movingcamera = false; |
---|
14607 | | - X = Y = 0; |
---|
| 14614 | + X = 0; // getBounds().width/2; |
---|
| 14615 | + Y = 0; // getBounds().height/2; |
---|
14608 | 14616 | //System.out.println("mouseReleased: " + e); |
---|
14609 | 14617 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14610 | 14618 | } |
---|
.. | .. |
---|
14945 | 14953 | case 'E' : COMPACT ^= true; |
---|
14946 | 14954 | repaint(); |
---|
14947 | 14955 | break; |
---|
14948 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14956 | + case 'W' : // Wide Window (fullscreen) |
---|
| 14957 | + //DEBUGHSB ^= true; |
---|
| 14958 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14949 | 14959 | repaint(); |
---|
14950 | 14960 | break; |
---|
14951 | 14961 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14971 | 14981 | repaint(); |
---|
14972 | 14982 | break; |
---|
14973 | 14983 | case 'l': |
---|
14974 | | - lightMode ^= true; |
---|
14975 | | - Globals.lighttouched = true; |
---|
14976 | | - manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
14977 | | - targetLookAt.set(manipCamera.lookAt); |
---|
14978 | | - repaint(); |
---|
14979 | | - break; |
---|
14980 | | - case 'L': |
---|
| 14984 | + //case 'L': |
---|
14981 | 14985 | if (lightMode) |
---|
14982 | 14986 | { |
---|
14983 | 14987 | lightMode = false; |
---|
.. | .. |
---|
15124 | 15128 | // kompactbit = 6; |
---|
15125 | 15129 | // break; |
---|
15126 | 15130 | case ' ': |
---|
15127 | | - ObjEditor.theFrame.ToggleFullScreen(); |
---|
| 15131 | + lightMode ^= true; |
---|
| 15132 | + Globals.lighttouched = true; |
---|
| 15133 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 15134 | + targetLookAt.set(manipCamera.lookAt); |
---|
15128 | 15135 | repaint(); |
---|
15129 | 15136 | break; |
---|
15130 | 15137 | //case '`' : |
---|
.. | .. |
---|
15708 | 15715 | info.bounds.y += (height - desired) / 2; |
---|
15709 | 15716 | } |
---|
15710 | 15717 | } |
---|
| 15718 | + |
---|
15711 | 15719 | info.g = gr; |
---|
15712 | 15720 | info.camera = renderCamera; |
---|
15713 | 15721 | /* |
---|
.. | .. |
---|
15717 | 15725 | */ |
---|
15718 | 15726 | if (!isRenderer) |
---|
15719 | 15727 | { |
---|
15720 | | - object.drawEditHandles(info, 0); |
---|
15721 | | - |
---|
15722 | | - if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0) |
---|
| 15728 | + Grafreed.Assert(object != null); |
---|
| 15729 | + Grafreed.Assert(object.selection != null); |
---|
| 15730 | + if (object.selection.Size() > 0) |
---|
15723 | 15731 | { |
---|
15724 | | - switch (object.selection.get(0).hitSomething) |
---|
| 15732 | + int hitSomething = object.selection.get(0).hitSomething; |
---|
| 15733 | + |
---|
| 15734 | + info.DX = 0; |
---|
| 15735 | + info.DY = 0; |
---|
| 15736 | + info.W = 1; |
---|
| 15737 | + if (hitSomething == Object3D.hitCenter) |
---|
15725 | 15738 | { |
---|
15726 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
15727 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15728 | | - break; |
---|
15729 | | - case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
15730 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15731 | | - break; |
---|
15732 | | - case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
15733 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15734 | | - break; |
---|
| 15739 | + info.DX = X; |
---|
| 15740 | + if (X != 0) |
---|
| 15741 | + info.DX -= info.bounds.width/2; |
---|
| 15742 | + |
---|
| 15743 | + info.DY = Y; |
---|
| 15744 | + if (Y != 0) |
---|
| 15745 | + info.DY -= info.bounds.height/2; |
---|
15735 | 15746 | } |
---|
15736 | | - |
---|
| 15747 | + |
---|
| 15748 | + object.drawEditHandles(info, 0); |
---|
| 15749 | + |
---|
| 15750 | + if (drag && (X != 0 || Y != 0)) |
---|
| 15751 | + { |
---|
| 15752 | + switch (hitSomething) |
---|
| 15753 | + { |
---|
| 15754 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15755 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15756 | + break; |
---|
| 15757 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15758 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15759 | + break; |
---|
| 15760 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15761 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15762 | + break; |
---|
| 15763 | + } |
---|
| 15764 | + |
---|
| 15765 | + } |
---|
15737 | 15766 | } |
---|
15738 | 15767 | } |
---|
15739 | 15768 | } |
---|
.. | .. |
---|
16531 | 16560 | } |
---|
16532 | 16561 | } |
---|
16533 | 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 | + |
---|
16534 | 16571 | class SelectBuffer implements GLEventListener |
---|
16535 | 16572 | { |
---|
16536 | 16573 | |
---|
.. | .. |
---|
16610 | 16647 | |
---|
16611 | 16648 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16612 | 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 | + |
---|
16613 | 16661 | //int tmp = selection_view; |
---|
16614 | 16662 | //selection_view = -1; |
---|
16615 | 16663 | int temp = DrawMode(); |
---|
.. | .. |
---|
16621 | 16669 | // temp = DEFAULT; // patch for selection debug |
---|
16622 | 16670 | Globals.drawMode = temp; // WARNING |
---|
16623 | 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 | + |
---|
16624 | 16683 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16625 | 16684 | |
---|
16626 | 16685 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16726 | 16785 | if (!movingcamera && !PAINTMODE) |
---|
16727 | 16786 | object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16728 | 16787 | |
---|
16729 | | - 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) |
---|
16730 | 16789 | { |
---|
16731 | | - Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16732 | | - |
---|
16733 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
16734 | | - |
---|
16735 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16736 | | - |
---|
16737 | | - group.add(paintobj); // link |
---|
16738 | | - |
---|
16739 | | - object.GetWindow().SnapObject(group); |
---|
16740 | | - |
---|
16741 | | - Object3D folder = object.GetWindow().copy; |
---|
| 16790 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16742 | 16791 | |
---|
16743 | 16792 | if (object.GetWindow().copy.selection.Size() > 0) |
---|
16744 | | - folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16793 | + { |
---|
| 16794 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16745 | 16795 | |
---|
16746 | | - folder.add(group); |
---|
16747 | | - |
---|
16748 | | - object.GetWindow().ResetModel(); |
---|
16749 | | - 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 | + } |
---|
16750 | 16811 | } |
---|
16751 | 16812 | else |
---|
16752 | 16813 | paintcount = 0; |
---|