Smooth keys + box editor.
.. | .. |
---|
72 | 72 | |
---|
73 | 73 | int count = 50; |
---|
74 | 74 | |
---|
75 | | - uDivsField = (cNumberSlider)AddSlider(uvPanel, "U #", biparam.minUDivs, (int)(count*this.biparam.uStretch()) + biparam.minUDivs, biparam.uDivs).getComponent(1); |
---|
| 75 | + uDivsField = (cNumberSlider)AddSlider(uvPanel, "U #", biparam.minUDivs, (int)(count*this.biparam.uStretch() / 2) + biparam.minUDivs, biparam.uDivs).getComponent(1); |
---|
76 | 76 | vDivsField = (cNumberSlider)AddSlider(uvPanel, "V #", biparam.minVDivs, (int)(count) + biparam.minVDivs, biparam.vDivs).getComponent(1); |
---|
77 | 77 | |
---|
78 | 78 | oe.ctrlPanel.add(uvPanel); |
---|
.. | .. |
---|
104 | 104 | if (biparam instanceof Cone) // ends) |
---|
105 | 105 | { |
---|
106 | 106 | oe.ctrlPanel.add(optionCB = new JCheckBox("Close Surface", biparam.endcaps)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2); |
---|
107 | | - optionCB.addItemListener(this); |
---|
108 | | -oe.ctrlPanel.Return(); |
---|
| 107 | + optionCB.addItemListener(this); |
---|
| 108 | + oe.ctrlPanel.Return(); |
---|
109 | 109 | //endcaps.setState(!biparam.endcaps); |
---|
110 | 110 | } |
---|
111 | 111 | } |
---|
.. | .. |
---|
142 | 142 | if (//e.getSource() == nameField || |
---|
143 | 143 | e.getSource() == optionCB) |
---|
144 | 144 | { |
---|
| 145 | + new Exception().printStackTrace(); |
---|
145 | 146 | //System.out.println(e); |
---|
146 | 147 | applySelf(); |
---|
147 | 148 | //super.applySelf(); |
---|
.. | .. |
---|
2 | 2 | { |
---|
3 | 3 | static final long serialVersionUID = 0; |
---|
4 | 4 | |
---|
| 5 | + boolean open; |
---|
| 6 | + |
---|
5 | 7 | Box() |
---|
6 | 8 | { |
---|
7 | 9 | inPnt = new cVector(); |
---|
.. | .. |
---|
9 | 11 | minima = LA.newVector(-0.5, 0, -0.5); |
---|
10 | 12 | maxima = LA.newVector(0.5, 1, 0.5); |
---|
11 | 13 | bRep = new BoundaryRep(); |
---|
12 | | - bRep.redimension(8, 12); |
---|
13 | | - for (int i=0; i < 12; i++) |
---|
14 | | - bRep.setFace(i, faces[i]); |
---|
15 | 14 | |
---|
16 | 15 | recalculate(); |
---|
17 | 16 | CreateMaterial(); |
---|
.. | .. |
---|
27 | 26 | protected void deepCopySelf(Object3D other) |
---|
28 | 27 | { |
---|
29 | 28 | super.deepCopySelf(other); |
---|
30 | | - Box rec = (Box)other; |
---|
31 | | - rec.minima = new cVector(); |
---|
32 | | - LA.vecCopy(minima, rec.minima); |
---|
33 | | - rec.maxima = new cVector(); |
---|
34 | | - LA.vecCopy(maxima, rec.maxima); |
---|
| 29 | +// Box rec = (Box)other; |
---|
| 30 | +// rec.minima = new cVector(); |
---|
| 31 | +// LA.vecCopy(minima, rec.minima); |
---|
| 32 | +// rec.maxima = new cVector(); |
---|
| 33 | +// LA.vecCopy(maxima, rec.maxima); |
---|
35 | 34 | } |
---|
36 | 35 | |
---|
37 | 36 | void createEditWindow(GroupEditor callee, boolean newWindow) |
---|
.. | .. |
---|
39 | 38 | //editWindow = new BoxEditor(this, deepCopy(), callee); |
---|
40 | 39 | /**/ |
---|
41 | 40 | if (newWindow) |
---|
42 | | - objectUI = new ObjEditor(this, deepCopy(), callee); |
---|
| 41 | + objectUI = new BoxEditor(this, deepCopy(), callee); |
---|
43 | 42 | else |
---|
44 | | - objectUI = new ObjEditor(this, callee); |
---|
| 43 | + objectUI = new BoxEditor(this, callee); |
---|
45 | 44 | editWindow = objectUI.GetEditor(); |
---|
46 | | - if (!newWindow) |
---|
47 | | - ((ObjEditor)objectUI).SetupUI2(callee); |
---|
| 45 | +// if (!newWindow) |
---|
| 46 | +// ((ObjEditor)objectUI).SetupUI2(callee); |
---|
48 | 47 | /**/ |
---|
49 | 48 | } |
---|
50 | 49 | |
---|
.. | .. |
---|
64 | 63 | |
---|
65 | 64 | void recalculate() |
---|
66 | 65 | { |
---|
| 66 | + if (open) |
---|
| 67 | + { |
---|
| 68 | + bRep.redimension(8, 8); |
---|
| 69 | + for (int i=0; i < 8; i++) |
---|
| 70 | + bRep.setFace(i, facesopen[i]); |
---|
| 71 | + } |
---|
| 72 | + else |
---|
| 73 | + { |
---|
| 74 | + bRep.redimension(8, 12); |
---|
| 75 | + for (int i=0; i < 12; i++) |
---|
| 76 | + bRep.setFace(i, faces[i]); |
---|
| 77 | + } |
---|
| 78 | + |
---|
67 | 79 | for (int i=0; i < 8; i++) |
---|
68 | 80 | { |
---|
69 | 81 | double x = i >= 4 ? maxima.x : minima.x; |
---|
.. | .. |
---|
71 | 83 | double z = i % 2 != 0 ? maxima.z : minima.z; |
---|
72 | 84 | bRep.setVertex(i, x, y, z, umap[i], vmap[i]); |
---|
73 | 85 | } |
---|
74 | | - |
---|
| 86 | + |
---|
75 | 87 | // bRep.Trim(false, false); |
---|
76 | 88 | |
---|
77 | 89 | super.recalculate(); |
---|
.. | .. |
---|
139 | 151 | } |
---|
140 | 152 | }; |
---|
141 | 153 | |
---|
| 154 | + static int facesopen[][] = { |
---|
| 155 | + { |
---|
| 156 | + 0, 1, 3 |
---|
| 157 | + }, { |
---|
| 158 | + 0, 3, 2 |
---|
| 159 | + }, { |
---|
| 160 | +// 2, 3, 7 |
---|
| 161 | +// }, { |
---|
| 162 | +// 2, 7, 6 |
---|
| 163 | +// }, { |
---|
| 164 | + 1, 5, 7 |
---|
| 165 | + }, { |
---|
| 166 | + 1, 7, 3 |
---|
| 167 | + }, { |
---|
| 168 | + 4, 6, 7 |
---|
| 169 | + }, { |
---|
| 170 | + 4, 7, 5 |
---|
| 171 | + }, { |
---|
| 172 | +// 0, 4, 5 |
---|
| 173 | +// }, { |
---|
| 174 | +// 0, 5, 1 |
---|
| 175 | +// }, { |
---|
| 176 | + 0, 2, 6 |
---|
| 177 | + }, { |
---|
| 178 | + 0, 6, 4 |
---|
| 179 | + } |
---|
| 180 | + }; |
---|
| 181 | + |
---|
142 | 182 | protected cVector inPnt; |
---|
143 | 183 | } |
---|
.. | .. |
---|
9 | 9 | |
---|
10 | 10 | class BoxEditor extends ObjEditor |
---|
11 | 11 | { |
---|
| 12 | + BoxEditor(Box inBox, GroupEditor callee) |
---|
| 13 | + { |
---|
| 14 | + super(inBox, callee); |
---|
| 15 | + |
---|
| 16 | + //objEditor = new BiparamEditor(inCone, this, callee); |
---|
| 17 | + objEditor = callee.GetEditor(); |
---|
| 18 | + |
---|
| 19 | + this.box = inBox; |
---|
| 20 | + |
---|
| 21 | + SetupUI2(GetEditor()); |
---|
| 22 | + } |
---|
| 23 | + |
---|
12 | 24 | |
---|
13 | 25 | BoxEditor(Box inBox, Object3D copy, GroupEditor callee) |
---|
14 | 26 | { |
---|
15 | 27 | super(inBox, copy, callee); |
---|
| 28 | + |
---|
| 29 | + new Exception().printStackTrace(); |
---|
| 30 | + |
---|
16 | 31 | box = (Box) copy; |
---|
17 | | - ctrlPanel.add(minLabel = new JLabel("Minima"), aConstraints); |
---|
18 | | - aConstraints.gridx += 1; |
---|
19 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
20 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
21 | | - ctrlPanel.add(minimaField = new NumberField(), aConstraints); |
---|
22 | | - aConstraints.gridwidth = 1; |
---|
23 | | - minimaField.setVector(box.minima); |
---|
24 | | - aConstraints.gridx = 0; |
---|
25 | | - aConstraints.gridy += 1; |
---|
26 | | - aConstraints.fill = GridBagConstraints.NONE; |
---|
27 | | - ctrlPanel.add(maxLabel = new JLabel("Maxima"), aConstraints); |
---|
28 | | - aConstraints.gridx += 1; |
---|
29 | | - aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
30 | | - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
31 | | - ctrlPanel.add(maximaField = new NumberField(), aConstraints); |
---|
32 | | - aConstraints.gridwidth = 1; |
---|
33 | | - maximaField.setVector(box.maxima); |
---|
34 | | - aConstraints.fill = GridBagConstraints.NONE; |
---|
35 | | - aConstraints.gridx = 0; |
---|
36 | | - aConstraints.gridy += 1; |
---|
| 32 | +// ctrlPanel.add(minLabel = new JLabel("Minima"), aConstraints); |
---|
| 33 | +// aConstraints.gridx += 1; |
---|
| 34 | +// aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
| 35 | +// aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
| 36 | +// ctrlPanel.add(minimaField = new NumberField(), aConstraints); |
---|
| 37 | +// aConstraints.gridwidth = 1; |
---|
| 38 | +// minimaField.setVector(box.minima); |
---|
| 39 | +// aConstraints.gridx = 0; |
---|
| 40 | +// aConstraints.gridy += 1; |
---|
| 41 | +// aConstraints.fill = GridBagConstraints.NONE; |
---|
| 42 | +// ctrlPanel.add(maxLabel = new JLabel("Maxima"), aConstraints); |
---|
| 43 | +// aConstraints.gridx += 1; |
---|
| 44 | +// aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
| 45 | +// aConstraints.gridwidth = ObjEditor.GRIDWIDTH; |
---|
| 46 | +// ctrlPanel.add(maximaField = new NumberField(), aConstraints); |
---|
| 47 | +// aConstraints.gridwidth = 1; |
---|
| 48 | +// maximaField.setVector(box.maxima); |
---|
| 49 | +// aConstraints.fill = GridBagConstraints.NONE; |
---|
| 50 | +// aConstraints.gridx = 0; |
---|
| 51 | +// aConstraints.gridy += 1; |
---|
37 | 52 | } |
---|
38 | 53 | |
---|
39 | 54 | void Clear() |
---|
.. | .. |
---|
53 | 68 | } |
---|
54 | 69 | */ |
---|
55 | 70 | |
---|
| 71 | + void SetupUI2(ObjEditor oe) |
---|
| 72 | + { |
---|
| 73 | + super.SetupUI2(oe); |
---|
| 74 | + |
---|
| 75 | + oe.ctrlPanel.add(optionCB = new JCheckBox("Close Surface", box.open)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2); |
---|
| 76 | + optionCB.addItemListener(this); |
---|
| 77 | + oe.ctrlPanel.Return(); |
---|
| 78 | + } |
---|
| 79 | + |
---|
| 80 | + public void itemStateChanged(ItemEvent e) |
---|
| 81 | + { |
---|
| 82 | + if (//e.getSource() == nameField || |
---|
| 83 | + e.getSource() == optionCB) |
---|
| 84 | + { |
---|
| 85 | + box.open = (e.getStateChange() == ItemEvent.SELECTED); |
---|
| 86 | + |
---|
| 87 | + applySelf(); |
---|
| 88 | + |
---|
| 89 | + objEditor.refreshContents(); |
---|
| 90 | + } |
---|
| 91 | + else |
---|
| 92 | + { |
---|
| 93 | + super.itemStateChanged(e); |
---|
| 94 | + } |
---|
| 95 | + } |
---|
| 96 | + |
---|
| 97 | + |
---|
| 98 | + public void closeUI() |
---|
| 99 | + { |
---|
| 100 | + ObjEditor oe = GetEditor(); |
---|
| 101 | + |
---|
| 102 | + oe.ctrlPanel.remove(optionCB); |
---|
| 103 | + |
---|
| 104 | + super.closeUI(); |
---|
| 105 | + } |
---|
| 106 | + |
---|
56 | 107 | public void applySelf() |
---|
57 | 108 | { |
---|
58 | 109 | // june 2013 super.applySelf(); |
---|
59 | | - minimaField.getVector(box.minima); |
---|
60 | | - maximaField.getVector(box.maxima); |
---|
| 110 | +// minimaField.getVector(box.minima); |
---|
| 111 | +// maximaField.getVector(box.maxima); |
---|
61 | 112 | box.recalculate(); |
---|
62 | 113 | } |
---|
63 | 114 | |
---|
64 | 115 | Box box; |
---|
65 | | - JLabel minLabel; |
---|
66 | | - JLabel maxLabel; |
---|
67 | | - NumberField minimaField; |
---|
68 | | - NumberField maximaField; |
---|
| 116 | + |
---|
| 117 | +// JLabel minLabel; |
---|
| 118 | +// JLabel maxLabel; |
---|
| 119 | +// NumberField minimaField; |
---|
| 120 | +// NumberField maximaField; |
---|
| 121 | + |
---|
| 122 | + JCheckBox optionCB; |
---|
69 | 123 | } |
---|
.. | .. |
---|
328 | 328 | location.set(lookAt); |
---|
329 | 329 | lookAt.set(cStatic.point1); |
---|
330 | 330 | |
---|
331 | | - //computeTransform(); |
---|
| 331 | + computeTransform(); |
---|
332 | 332 | } |
---|
333 | 333 | |
---|
334 | 334 | //synchronized // june 2014 |
---|
.. | .. |
---|
8642 | 8642 | { |
---|
8643 | 8643 | tex.bw = texturecache.texturedata.getWidth(); |
---|
8644 | 8644 | tex.bh = texturecache.texturedata.getHeight(); |
---|
8645 | | - tex.bumpdata = CompressJPEG(CreateBim(((ByteBuffer)texturecache.texturedata.getBuffer()).array(), tex.bw, tex.bh), 0.5f); |
---|
| 8645 | + tex.bumpdata = //CompressJPEG(CreateBim( |
---|
| 8646 | + ((ByteBuffer)texturecache.texturedata.getBuffer()).array(); |
---|
| 8647 | + //, tex.bw, tex.bh), 0.5f); |
---|
8646 | 8648 | } |
---|
8647 | 8649 | } |
---|
8648 | 8650 | } |
---|
.. | .. |
---|
10813 | 10815 | |
---|
10814 | 10816 | if (DrawMode() == DEFAULT) |
---|
10815 | 10817 | { |
---|
| 10818 | + if (manipCamera == lightCamera) |
---|
| 10819 | + { |
---|
| 10820 | +// switch (e.getKeyCode()) |
---|
| 10821 | +// { |
---|
| 10822 | +// case DOWN_ARROW: |
---|
| 10823 | +// lightCamera.DECAL /= 2; |
---|
| 10824 | +// repaint(); |
---|
| 10825 | +// break; |
---|
| 10826 | +// case UP_ARROW: |
---|
| 10827 | +// lightCamera.DECAL *= 2; |
---|
| 10828 | +// repaint(); |
---|
| 10829 | +// break; |
---|
| 10830 | +// case LEFT_ARROW: |
---|
| 10831 | +// lightCamera.SCALE /= 2; |
---|
| 10832 | +// repaint(); |
---|
| 10833 | +// break; |
---|
| 10834 | +// case RIGHT_ARROW: |
---|
| 10835 | +// lightCamera.SCALE *= 2; |
---|
| 10836 | +// repaint(); |
---|
| 10837 | +// break; |
---|
| 10838 | +// default: |
---|
| 10839 | +// break; |
---|
| 10840 | + if (keys[DOWN_ARROW]) |
---|
| 10841 | + { |
---|
| 10842 | + lightCamera.DECAL /= 2; |
---|
| 10843 | + } |
---|
| 10844 | + |
---|
| 10845 | + if (keys[UP_ARROW]) |
---|
| 10846 | + { |
---|
| 10847 | + lightCamera.DECAL *= 2; |
---|
| 10848 | + } |
---|
| 10849 | + |
---|
| 10850 | + if (keys[LEFT_ARROW]) |
---|
| 10851 | + { |
---|
| 10852 | + lightCamera.SCALE /= 2; |
---|
| 10853 | + } |
---|
| 10854 | + |
---|
| 10855 | + if (keys[RIGHT_ARROW]) |
---|
| 10856 | + { |
---|
| 10857 | + lightCamera.SCALE *= 2; |
---|
| 10858 | + } |
---|
| 10859 | + } |
---|
| 10860 | + else |
---|
| 10861 | + { |
---|
| 10862 | + //pingthread.mute = true; |
---|
| 10863 | + |
---|
| 10864 | + boolean keyon = false; |
---|
| 10865 | + |
---|
| 10866 | + if (keys[DOWN_ARROW]) |
---|
| 10867 | + { |
---|
| 10868 | + GoDown(modifiers); |
---|
| 10869 | + keyon = true; |
---|
| 10870 | + } |
---|
| 10871 | + |
---|
| 10872 | + if (keys[UP_ARROW]) |
---|
| 10873 | + { |
---|
| 10874 | + GoUp(modifiers); |
---|
| 10875 | + keyon = true; |
---|
| 10876 | + } |
---|
| 10877 | + |
---|
| 10878 | + if (keys[LEFT_ARROW]) |
---|
| 10879 | + { |
---|
| 10880 | + GoLeft(modifiers); |
---|
| 10881 | + keyon = true; |
---|
| 10882 | + } |
---|
| 10883 | + |
---|
| 10884 | + if (keys[RIGHT_ARROW]) |
---|
| 10885 | + { |
---|
| 10886 | + GoRight(modifiers); |
---|
| 10887 | + keyon = true; |
---|
| 10888 | + } |
---|
| 10889 | + |
---|
| 10890 | + if (keyon) |
---|
| 10891 | + repaint(); |
---|
| 10892 | + //pingthread.mute = false; |
---|
| 10893 | + } |
---|
| 10894 | + |
---|
10816 | 10895 | currentlydrawing = true; |
---|
10817 | 10896 | } |
---|
10818 | 10897 | |
---|
.. | .. |
---|
11337 | 11416 | |
---|
11338 | 11417 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
11339 | 11418 | |
---|
11340 | | -gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
11341 | | -gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
11342 | | -gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11419 | +//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11420 | +//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11421 | +//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
11343 | 11422 | } else |
---|
11344 | 11423 | { |
---|
11345 | 11424 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
14521 | 14600 | { |
---|
14522 | 14601 | boolean jump; |
---|
14523 | 14602 | |
---|
| 14603 | + boolean mute; |
---|
| 14604 | + |
---|
14524 | 14605 | // void JumpToTarget() |
---|
14525 | 14606 | // { |
---|
14526 | 14607 | // StepToTarget(true); |
---|
.. | .. |
---|
14535 | 14616 | // only one thread!? synchronized |
---|
14536 | 14617 | void StepToTarget(boolean jump) |
---|
14537 | 14618 | { |
---|
| 14619 | + if (mute) |
---|
| 14620 | + return; |
---|
| 14621 | + |
---|
14538 | 14622 | tmp.set(targetLookAt); |
---|
14539 | 14623 | tmp.sub(manipCamera.lookAt); // june 2014 |
---|
14540 | 14624 | |
---|
.. | .. |
---|
14828 | 14912 | mouseMode |= ROTATE; |
---|
14829 | 14913 | } // TRANSLATE; |
---|
14830 | 14914 | |
---|
| 14915 | + //System.err.println("lookAt = " + manipCamera.lookAt); |
---|
| 14916 | + //System.err.println("location = " + manipCamera.location); |
---|
| 14917 | + |
---|
14831 | 14918 | targetLookAt.set(manipCamera.lookAt); |
---|
14832 | 14919 | |
---|
14833 | 14920 | prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance()); |
---|
.. | .. |
---|
15767 | 15854 | } |
---|
15768 | 15855 | } |
---|
15769 | 15856 | |
---|
| 15857 | + boolean keys[] = new boolean[256]; |
---|
| 15858 | + int modifiers = 0; |
---|
| 15859 | + |
---|
15770 | 15860 | public void processKeyEvent(KeyEvent e) |
---|
15771 | 15861 | { |
---|
15772 | 15862 | switch (e.getID()) |
---|
15773 | 15863 | { |
---|
15774 | 15864 | case KeyEvent.KEY_PRESSED: |
---|
15775 | | - if (!autorepeat) |
---|
15776 | | - { |
---|
15777 | | - //System.out.println("processKeyEvent: " + KeyEvent.getKeyText(e.getKeyCode())); |
---|
15778 | | - keyPressed(e.getKeyChar(), e.getModifiersEx()); |
---|
15779 | | - } |
---|
15780 | | - if (manipCamera == lightCamera) |
---|
15781 | | - { |
---|
15782 | | - switch (e.getKeyCode()) |
---|
15783 | | - { |
---|
15784 | | - case DOWN_ARROW: |
---|
15785 | | - lightCamera.DECAL /= 2; |
---|
15786 | | - repaint(); |
---|
15787 | | - break; |
---|
15788 | | - case UP_ARROW: |
---|
15789 | | - lightCamera.DECAL *= 2; |
---|
15790 | | - repaint(); |
---|
15791 | | - break; |
---|
15792 | | - case LEFT_ARROW: |
---|
15793 | | - lightCamera.SCALE /= 2; |
---|
15794 | | - repaint(); |
---|
15795 | | - break; |
---|
15796 | | - case RIGHT_ARROW: |
---|
15797 | | - lightCamera.SCALE *= 2; |
---|
15798 | | - repaint(); |
---|
15799 | | - break; |
---|
15800 | | - default: |
---|
15801 | | - break; |
---|
15802 | | - } |
---|
15803 | | - |
---|
15804 | | - System.out.println("DECAL = " + lightCamera.DECAL + "; SCALE = " + lightCamera.SCALE); |
---|
15805 | | - } else |
---|
15806 | | - { |
---|
15807 | | - if (true) // !autorepeat) |
---|
15808 | | - { |
---|
15809 | | - boolean reset = true; |
---|
15810 | | - |
---|
15811 | | - switch (e.getKeyCode()) |
---|
15812 | | - { |
---|
15813 | | - case DOWN_ARROW: |
---|
15814 | | - GoDown(e.getModifiersEx()); |
---|
15815 | | - repaint(); |
---|
15816 | | - break; |
---|
15817 | | - case UP_ARROW: |
---|
15818 | | - GoUp(e.getModifiersEx()); |
---|
15819 | | - repaint(); |
---|
15820 | | - break; |
---|
15821 | | - case LEFT_ARROW: |
---|
15822 | | - GoLeft(e.getModifiersEx()); |
---|
15823 | | - repaint(); |
---|
15824 | | - break; |
---|
15825 | | - case RIGHT_ARROW: |
---|
15826 | | - GoRight(e.getModifiersEx()); |
---|
15827 | | - repaint(); |
---|
15828 | | - break; |
---|
15829 | | - default: |
---|
15830 | | - reset = false; |
---|
15831 | | - break; |
---|
15832 | | - } |
---|
15833 | | - |
---|
15834 | | - if (reset) |
---|
15835 | | - { |
---|
15836 | | - autorepeat = true; |
---|
15837 | | - |
---|
15838 | | - targetLookAt.set(manipCamera.lookAt); |
---|
15839 | | - } |
---|
15840 | | - } |
---|
15841 | | - } |
---|
| 15865 | + keys[e.getKeyCode()] = true; |
---|
| 15866 | + modifiers = e.getModifiersEx(); |
---|
| 15867 | + keyPressed(e.getKeyChar(), modifiers); |
---|
| 15868 | + //Globals.theRenderer.keyPressed(e.getKeyChar()); |
---|
| 15869 | + repaint(); |
---|
15842 | 15870 | break; |
---|
15843 | | - case KeyEvent.KEY_TYPED: |
---|
15844 | | - break; |
---|
| 15871 | +// if (!autorepeat) |
---|
| 15872 | +// { |
---|
| 15873 | +// //System.out.println("processKeyEvent: " + KeyEvent.getKeyText(e.getKeyCode())); |
---|
| 15874 | +// keyPressed(e.getKeyChar(), e.getModifiersEx()); |
---|
| 15875 | +// } |
---|
| 15876 | +// if (manipCamera == lightCamera) |
---|
| 15877 | +// { |
---|
| 15878 | +// switch (e.getKeyCode()) |
---|
| 15879 | +// { |
---|
| 15880 | +// case DOWN_ARROW: |
---|
| 15881 | +// lightCamera.DECAL /= 2; |
---|
| 15882 | +// repaint(); |
---|
| 15883 | +// break; |
---|
| 15884 | +// case UP_ARROW: |
---|
| 15885 | +// lightCamera.DECAL *= 2; |
---|
| 15886 | +// repaint(); |
---|
| 15887 | +// break; |
---|
| 15888 | +// case LEFT_ARROW: |
---|
| 15889 | +// lightCamera.SCALE /= 2; |
---|
| 15890 | +// repaint(); |
---|
| 15891 | +// break; |
---|
| 15892 | +// case RIGHT_ARROW: |
---|
| 15893 | +// lightCamera.SCALE *= 2; |
---|
| 15894 | +// repaint(); |
---|
| 15895 | +// break; |
---|
| 15896 | +// default: |
---|
| 15897 | +// break; |
---|
| 15898 | +// } |
---|
| 15899 | +// |
---|
| 15900 | +// System.out.println("DECAL = " + lightCamera.DECAL + "; SCALE = " + lightCamera.SCALE); |
---|
| 15901 | +// } else |
---|
| 15902 | +// { |
---|
| 15903 | +// if (true) // !autorepeat) |
---|
| 15904 | +// { |
---|
| 15905 | +// boolean reset = true; |
---|
| 15906 | +// |
---|
| 15907 | +// switch (e.getKeyCode()) |
---|
| 15908 | +// { |
---|
| 15909 | +// case DOWN_ARROW: |
---|
| 15910 | +// GoDown(e.getModifiersEx()); |
---|
| 15911 | +// repaint(); |
---|
| 15912 | +// break; |
---|
| 15913 | +// case UP_ARROW: |
---|
| 15914 | +// GoUp(e.getModifiersEx()); |
---|
| 15915 | +// repaint(); |
---|
| 15916 | +// break; |
---|
| 15917 | +// case LEFT_ARROW: |
---|
| 15918 | +// GoLeft(e.getModifiersEx()); |
---|
| 15919 | +// repaint(); |
---|
| 15920 | +// break; |
---|
| 15921 | +// case RIGHT_ARROW: |
---|
| 15922 | +// GoRight(e.getModifiersEx()); |
---|
| 15923 | +// repaint(); |
---|
| 15924 | +// break; |
---|
| 15925 | +// default: |
---|
| 15926 | +// reset = false; |
---|
| 15927 | +// break; |
---|
| 15928 | +// } |
---|
| 15929 | +// |
---|
| 15930 | +// if (reset) |
---|
| 15931 | +// { |
---|
| 15932 | +// autorepeat = true; |
---|
| 15933 | +// |
---|
| 15934 | +// targetLookAt.set(manipCamera.lookAt); |
---|
| 15935 | +// } |
---|
| 15936 | +// } |
---|
| 15937 | +// } |
---|
| 15938 | +// break; |
---|
| 15939 | +// case KeyEvent.KEY_TYPED: |
---|
| 15940 | +// break; |
---|
15845 | 15941 | case KeyEvent.KEY_RELEASED: |
---|
15846 | | - { |
---|
15847 | | - switch (e.getKeyCode()) |
---|
15848 | | - { |
---|
15849 | | - case DOWN_ARROW: |
---|
15850 | | - case UP_ARROW: |
---|
15851 | | - case LEFT_ARROW: |
---|
15852 | | - case RIGHT_ARROW: |
---|
15853 | | - MODIFIERS &= ~COMMAND; |
---|
15854 | | - autorepeat = false; |
---|
15855 | | - break; |
---|
15856 | | - default: |
---|
15857 | | - break; |
---|
15858 | | - } |
---|
| 15942 | + keys[e.getKeyCode()] = false; |
---|
| 15943 | + modifiers = e.getModifiersEx(); |
---|
15859 | 15944 | keyReleased(e.getKeyChar(), e.getModifiersEx()); |
---|
| 15945 | + repaint(); |
---|
15860 | 15946 | break; |
---|
15861 | | - } |
---|
| 15947 | +// { |
---|
| 15948 | +// switch (e.getKeyCode()) |
---|
| 15949 | +// { |
---|
| 15950 | +// case DOWN_ARROW: |
---|
| 15951 | +// case UP_ARROW: |
---|
| 15952 | +// case LEFT_ARROW: |
---|
| 15953 | +// case RIGHT_ARROW: |
---|
| 15954 | +// MODIFIERS &= ~COMMAND; |
---|
| 15955 | +// autorepeat = false; |
---|
| 15956 | +// break; |
---|
| 15957 | +// default: |
---|
| 15958 | +// break; |
---|
| 15959 | +// } |
---|
| 15960 | +// keyReleased(e.getKeyChar(), e.getModifiersEx()); |
---|
| 15961 | +// break; |
---|
| 15962 | +// } |
---|
15862 | 15963 | default: |
---|
15863 | 15964 | break; |
---|
15864 | 15965 | } |
---|
.. | .. |
---|
877 | 877 | } |
---|
878 | 878 | catch (Exception e) |
---|
879 | 879 | { |
---|
880 | | - System.err.println("FAILED: " + this); |
---|
| 880 | + // System.err.println("FAILED: " + this); |
---|
881 | 881 | failedPigment = true; |
---|
882 | 882 | } |
---|
883 | 883 | |
---|
.. | .. |
---|
136 | 136 | { |
---|
137 | 137 | BufferedImage image; |
---|
138 | 138 | |
---|
139 | | - if (name.endsWith("jpg")) |
---|
140 | | - // Much faster! |
---|
141 | | - image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage(); |
---|
142 | | - else |
---|
| 139 | +// if (name.endsWith("jpg")) |
---|
| 140 | +// { |
---|
| 141 | +// try |
---|
| 142 | +// { |
---|
| 143 | +// // Much faster! |
---|
| 144 | +// image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage(); |
---|
| 145 | +// } |
---|
| 146 | +// catch (Exception e) |
---|
| 147 | +// { |
---|
| 148 | +// image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 149 | +// } |
---|
| 150 | +// } |
---|
| 151 | +// else |
---|
143 | 152 | image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
144 | 153 | |
---|
145 | 154 | // if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
.. | .. |
---|
6351 | 6351 | } |
---|
6352 | 6352 | catch (Exception e) |
---|
6353 | 6353 | { |
---|
6354 | | - System.err.println("FAILED: " + this); |
---|
| 6354 | + // System.err.println("FAILED: " + this); |
---|
6355 | 6355 | failedPigment = true; |
---|
6356 | 6356 | } |
---|
6357 | 6357 | |
---|