.. | .. |
---|
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) |
---|
.. | .. |
---|
8503 | 8510 | return texture!=null?texture.texturedata:null; |
---|
8504 | 8511 | } |
---|
8505 | 8512 | |
---|
8506 | | - boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
| 8513 | + com.sun.opengl.util.texture.Texture BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8507 | 8514 | { |
---|
8508 | 8515 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8509 | 8516 | { |
---|
.. | .. |
---|
8515 | 8522 | com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
8516 | 8523 | |
---|
8517 | 8524 | if (texture == null) |
---|
8518 | | - return false; |
---|
| 8525 | + return texture; |
---|
8519 | 8526 | /**/ |
---|
8520 | 8527 | |
---|
8521 | 8528 | if (textureon || tex.equals("DEFAULT_TEXTURE") || tex.equals("DEFAULT_TEXTURE_BUMP") || tex.equals("WHITE_NOISE")) // || tex.equals("IMMORTAL")) |
---|
.. | .. |
---|
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 | { |
---|
| 15728 | + Grafreed.Assert(object != null); |
---|
| 15729 | + Grafreed.Assert(object.selection != null); |
---|
15720 | 15730 | if (object.selection.Size() > 0) |
---|
15721 | 15731 | { |
---|
15722 | 15732 | int hitSomething = object.selection.get(0).hitSomething; |
---|
.. | .. |
---|
16550 | 16560 | } |
---|
16551 | 16561 | } |
---|
16552 | 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 | + |
---|
16553 | 16571 | class SelectBuffer implements GLEventListener |
---|
16554 | 16572 | { |
---|
16555 | 16573 | |
---|
.. | .. |
---|
16629 | 16647 | |
---|
16630 | 16648 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16631 | 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 | + |
---|
16632 | 16661 | //int tmp = selection_view; |
---|
16633 | 16662 | //selection_view = -1; |
---|
16634 | 16663 | int temp = DrawMode(); |
---|
.. | .. |
---|
16640 | 16669 | // temp = DEFAULT; // patch for selection debug |
---|
16641 | 16670 | Globals.drawMode = temp; // WARNING |
---|
16642 | 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 | + |
---|
16643 | 16683 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16644 | 16684 | |
---|
16645 | 16685 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16745 | 16785 | if (!movingcamera && !PAINTMODE) |
---|
16746 | 16786 | object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16747 | 16787 | |
---|
16748 | | - 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) |
---|
16749 | 16789 | { |
---|
16750 | | - Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16751 | | - |
---|
16752 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
16753 | | - |
---|
16754 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16755 | | - |
---|
16756 | | - group.add(paintobj); // link |
---|
16757 | | - |
---|
16758 | | - object.GetWindow().SnapObject(group); |
---|
16759 | | - |
---|
16760 | | - Object3D folder = object.GetWindow().copy; |
---|
| 16790 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16761 | 16791 | |
---|
16762 | 16792 | if (object.GetWindow().copy.selection.Size() > 0) |
---|
16763 | | - folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16793 | + { |
---|
| 16794 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16764 | 16795 | |
---|
16765 | | - folder.add(group); |
---|
16766 | | - |
---|
16767 | | - object.GetWindow().ResetModel(); |
---|
16768 | | - 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 | + } |
---|
16769 | 16811 | } |
---|
16770 | 16812 | else |
---|
16771 | 16813 | paintcount = 0; |
---|