.. | .. |
---|
1 | 1 | |
---|
| 2 | +import com.bulletphysics.dynamics.RigidBody; |
---|
2 | 3 | import java.awt.*; |
---|
3 | 4 | import java.awt.event.*; |
---|
4 | 5 | import java.awt.image.*; |
---|
.. | .. |
---|
123 | 124 | static boolean LOCALTRANSFORM = false; |
---|
124 | 125 | static boolean FULLSCREEN = false; |
---|
125 | 126 | static boolean SUPPORT = true; |
---|
126 | | -static boolean INERTIA = true; |
---|
| 127 | +static boolean INERTIA = false; // true; |
---|
127 | 128 | static boolean FAST = false; |
---|
128 | 129 | static boolean SLOWPOSE = false; |
---|
129 | 130 | static boolean FOOTCONTACT = true; |
---|
.. | .. |
---|
134 | 135 | static boolean ZOOMBOXMODE = false; |
---|
135 | 136 | static boolean BOXMODE = false; |
---|
136 | 137 | static boolean IMAGEFLIP = false; |
---|
137 | | -static boolean SMOOTHFOCUS = false; |
---|
| 138 | +static boolean SMOOTHFOCUS = true; // false; |
---|
138 | 139 | static boolean SPEAKERMOCAP = true; // jan 2014 false; |
---|
139 | 140 | static boolean SPEAKERCAMERA = false; |
---|
140 | 141 | static boolean SPEAKERFOCUS = false; |
---|
.. | .. |
---|
174 | 175 | boolean Udebug = false; |
---|
175 | 176 | boolean Vdebug = false; |
---|
176 | 177 | boolean NORMALdebug = false; |
---|
177 | | - static boolean doublesided = false; // true; // reversed normals are awful for conformance |
---|
| 178 | + static boolean doublesided = true; // false; // reversed normals are awful for conformance |
---|
178 | 179 | boolean anisotropy = true; |
---|
179 | 180 | boolean softshadow = true; // slower but better false; |
---|
180 | 181 | boolean opacityhalo = false; // reverse the halo effect (e.g. glass) |
---|
.. | .. |
---|
221 | 222 | cameras = new Camera[2]; |
---|
222 | 223 | targetLookAts = new cVector[2]; |
---|
223 | 224 | |
---|
224 | | - SetCamera(cam); |
---|
| 225 | + SetCamera(cam, true); |
---|
225 | 226 | |
---|
226 | 227 | // Warning: not used. |
---|
227 | | - SetLight(new Camera(new cVector(15, 10, -20))); |
---|
| 228 | + //SetLight(new Camera(new cVector(15, 10, -20))); |
---|
228 | 229 | |
---|
229 | 230 | object = o; |
---|
230 | 231 | |
---|
.. | .. |
---|
249 | 250 | |
---|
250 | 251 | public javax.media.opengl.GL GetGL0() |
---|
251 | 252 | { |
---|
252 | | - return null; |
---|
| 253 | + return currentGL; |
---|
253 | 254 | } |
---|
254 | 255 | |
---|
255 | 256 | public int GenList() |
---|
.. | .. |
---|
1529 | 1530 | } |
---|
1530 | 1531 | } |
---|
1531 | 1532 | float b = 0; |
---|
1532 | | - if (obj.support != null && obj.link2master) |
---|
| 1533 | + if (obj.support != null && obj.Link2Support()) |
---|
1533 | 1534 | { |
---|
1534 | 1535 | b = 1; |
---|
1535 | 1536 | } |
---|
.. | .. |
---|
2064 | 2065 | |
---|
2065 | 2066 | static int camerachangeframe; |
---|
2066 | 2067 | |
---|
2067 | | - public boolean SetCamera(Camera cam) |
---|
| 2068 | + public boolean SetCamera(Camera cam, boolean set) |
---|
2068 | 2069 | { |
---|
2069 | 2070 | // may 2014 if (cam == cameras[0] || cam == cameras[1]) |
---|
2070 | 2071 | // return false; |
---|
.. | .. |
---|
2082 | 2083 | |
---|
2083 | 2084 | camerachangeframe = Globals.framecount; |
---|
2084 | 2085 | |
---|
2085 | | - cam.hAspect = -1; // Read only |
---|
| 2086 | + if (cam != null) |
---|
| 2087 | + cam.hAspect = -1; // Read only |
---|
2086 | 2088 | |
---|
2087 | 2089 | cameras[0] = cam; |
---|
2088 | 2090 | targetLookAts[0] = new cVector(cam.lookAt); |
---|
.. | .. |
---|
2092 | 2094 | { |
---|
2093 | 2095 | cameras[i] = new Camera(cam.viewCode); |
---|
2094 | 2096 | } |
---|
2095 | | - |
---|
2096 | | - cameras[i].setAim(cam.location, cam.lookAt); |
---|
2097 | | - cameras[i].shaper_fovy = cam.shaper_fovy; |
---|
2098 | | - cameras[i].UP.set(cam.UP); |
---|
2099 | | - targetLookAts[i] = new cVector(cameras[i].lookAt); |
---|
| 2097 | + |
---|
| 2098 | + if (set) |
---|
| 2099 | + { |
---|
| 2100 | + cameras[i].setAim(cam.location, cam.lookAt); |
---|
| 2101 | + cameras[i].shaper_fovy = cam.shaper_fovy; |
---|
| 2102 | + cameras[i].UP.set(cam.UP); |
---|
| 2103 | + targetLookAts[i] = new cVector(cameras[i].lookAt); |
---|
| 2104 | + } |
---|
2100 | 2105 | } |
---|
2101 | 2106 | cameracount = 0; |
---|
2102 | 2107 | targetLookAt = targetLookAts[cameracount]; |
---|
.. | .. |
---|
2105 | 2110 | // Start with free camera |
---|
2106 | 2111 | SwitchCameras(true); |
---|
2107 | 2112 | |
---|
2108 | | - pingthread.jump = true; // optional? |
---|
| 2113 | +// pingthread.jump = true; // optional? |
---|
2109 | 2114 | |
---|
2110 | 2115 | if (TRACKONCE) |
---|
2111 | 2116 | { |
---|
.. | .. |
---|
2292 | 2297 | public void ToggleTrack() |
---|
2293 | 2298 | { |
---|
2294 | 2299 | TRACK ^= true; |
---|
2295 | | - if (TRACK) |
---|
2296 | | - { |
---|
2297 | | - if (object.selection != null && |
---|
2298 | | - object.selection.size() > 0 && |
---|
2299 | | - object.selection.elementAt(0) != null && |
---|
2300 | | - !(object.selection.elementAt(0) instanceof Camera) && |
---|
2301 | | - !(object.selection.elementAt(0) instanceof ScriptNode)) |
---|
2302 | | - { |
---|
2303 | | - trackedobject = object.selection.elementAt(0); |
---|
2304 | | - repaint(); |
---|
2305 | | - } |
---|
2306 | | - } |
---|
2307 | 2300 | |
---|
2308 | 2301 | repaint(); |
---|
2309 | 2302 | } |
---|
.. | .. |
---|
2395 | 2388 | { |
---|
2396 | 2389 | //System.out.println("PROTECTION = " + cam.hAspect); |
---|
2397 | 2390 | //assert (cam.hAspect == 0); |
---|
2398 | | - cam.hAspect = 0; |
---|
| 2391 | + if (cam != null) |
---|
| 2392 | + cam.hAspect = 0; |
---|
2399 | 2393 | lightCamera = cam; |
---|
2400 | 2394 | } |
---|
2401 | 2395 | |
---|
.. | .. |
---|
3596 | 3590 | }; |
---|
3597 | 3591 | /**/ |
---|
3598 | 3592 | |
---|
| 3593 | + static Object3D lastObject; |
---|
| 3594 | + |
---|
3599 | 3595 | //com.sun.opengl.util.texture.Texture |
---|
3600 | 3596 | TextureData |
---|
3601 | 3597 | GetFileTexture(String name, boolean bump, int resolution) |
---|
.. | .. |
---|
3632 | 3628 | // return null; |
---|
3633 | 3629 | //if (i == 2) |
---|
3634 | 3630 | // return null; |
---|
| 3631 | + // TIFF issue sept 2019 |
---|
| 3632 | + System.err.println("lastObject = " + lastObject); |
---|
3635 | 3633 | e.printStackTrace(); |
---|
3636 | 3634 | name = name.split("\\.tif")[0] + ".jpg"; |
---|
3637 | 3635 | } |
---|
.. | .. |
---|
6964 | 6962 | short residu = 0; |
---|
6965 | 6963 | |
---|
6966 | 6964 | // wraparound workarounds |
---|
6967 | | - short fuck = (short) (buffer[i] & 0xFF); |
---|
| 6965 | + short ww = (short) (buffer[i] & 0xFF); |
---|
6968 | 6966 | /* |
---|
6969 | | - residu += (fuck%2); |
---|
6970 | | - if(fuck/2 < 256-residu/2) |
---|
| 6967 | + residu += (ww%2); |
---|
| 6968 | + if(ww/2 < 256-residu/2) |
---|
6971 | 6969 | { |
---|
6972 | | - fuck = (short)((fuck/2) + residu/2); |
---|
| 6970 | + ww = (short)((ww/2) + residu/2); |
---|
6973 | 6971 | if(residu == 2) |
---|
6974 | 6972 | residu = 0; |
---|
6975 | 6973 | } |
---|
6976 | 6974 | else |
---|
6977 | 6975 | { |
---|
6978 | 6976 | residu = 0; |
---|
6979 | | - fuck /= 2; |
---|
| 6977 | + ww /= 2; |
---|
6980 | 6978 | } |
---|
6981 | 6979 | */ |
---|
6982 | | - if (i < imglength / 3 || rnd.nextFloat() < 0.5 || fuck >= 254) |
---|
| 6980 | + if (i < imglength / 3 || rnd.nextFloat() < 0.5 || ww >= 254) |
---|
6983 | 6981 | { |
---|
6984 | | - fuck /= 2; |
---|
| 6982 | + ww /= 2; |
---|
6985 | 6983 | } else |
---|
6986 | 6984 | { |
---|
6987 | | - fuck = (short) ((fuck / 2) + fuck % 2); |
---|
| 6985 | + ww = (short) ((ww / 2) + ww % 2); |
---|
6988 | 6986 | } |
---|
6989 | 6987 | |
---|
6990 | | - buffer[i] = (byte) fuck; |
---|
| 6988 | + buffer[i] = (byte) ww; |
---|
6991 | 6989 | } |
---|
6992 | 6990 | //System.out.print(bytes[i] + " "); |
---|
6993 | 6991 | //if(buffer[i] >= 0 && buffer[i]<=eps-1) buffer[i] = eps; |
---|
.. | .. |
---|
8454 | 8452 | { |
---|
8455 | 8453 | // texturecache = textures.get(texname); // suspicious |
---|
8456 | 8454 | if (texturecache == null) |
---|
8457 | | - texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution); |
---|
| 8455 | + texturecache = new CacheTexture(GetResourceTexture("whitenoise.jpg", bump),resolution); |
---|
8458 | 8456 | else |
---|
8459 | 8457 | new Exception().printStackTrace(); |
---|
8460 | 8458 | } else |
---|
8461 | 8459 | { |
---|
8462 | | - if (texname.startsWith("@")) |
---|
| 8460 | + if (texname.startsWith("@") && textureon) |
---|
8463 | 8461 | { |
---|
8464 | 8462 | // texturecache = textures.get(texname); // suspicious |
---|
8465 | 8463 | if (texturecache == null) |
---|
.. | .. |
---|
8642 | 8640 | { |
---|
8643 | 8641 | tex.bw = texturecache.texturedata.getWidth(); |
---|
8644 | 8642 | tex.bh = texturecache.texturedata.getHeight(); |
---|
8645 | | - tex.bumpdata = CompressJPEG(CreateBim(((ByteBuffer)texturecache.texturedata.getBuffer()).array(), tex.bw, tex.bh), 0.5f); |
---|
| 8643 | + tex.bumpdata = //CompressJPEG(CreateBim( |
---|
| 8644 | + ((ByteBuffer)texturecache.texturedata.getBuffer()).array(); |
---|
| 8645 | + //, tex.bw, tex.bh), 0.5f); |
---|
8646 | 8646 | } |
---|
8647 | 8647 | } |
---|
8648 | 8648 | } |
---|
.. | .. |
---|
9840 | 9840 | DrawSkyBox(gl, (float)rati); |
---|
9841 | 9841 | gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB); |
---|
9842 | 9842 | gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB); |
---|
9843 | | - accPerspective(gl, renderCamera.shaper_fovy / ratio, |
---|
| 9843 | + |
---|
| 9844 | + boolean vr = capsLocked && !lightMode; |
---|
| 9845 | + |
---|
| 9846 | + accPerspective(gl, renderCamera.shaper_fovy / ratio * (vr ? 1.2 : 1), |
---|
9844 | 9847 | ratio, |
---|
9845 | 9848 | //near_plane, far_plane, |
---|
9846 | 9849 | renderCamera.shaper_zNear * renderCamera.Distance(), renderCamera.shaper_zFar * renderCamera.Distance(), |
---|
.. | .. |
---|
10712 | 10715 | if (patchMaterial.patchMaterial) |
---|
10713 | 10716 | { |
---|
10714 | 10717 | patchMaterial.patchMaterial = false; |
---|
10715 | | - patchMaterial.objectPanel.setSelectedIndex(1); |
---|
| 10718 | + patchMaterial.objectTabbedPane.setSelectedIndex(1); |
---|
10716 | 10719 | } |
---|
10717 | 10720 | |
---|
10718 | 10721 | if (Grafreed.savesound && Grafreed.hassound) |
---|
.. | .. |
---|
10758 | 10761 | } |
---|
10759 | 10762 | /**/ |
---|
10760 | 10763 | |
---|
10761 | | - if (selection) |
---|
| 10764 | + boolean control = ((modifiers & CTRL) != 0); |
---|
| 10765 | + |
---|
| 10766 | + if (selection && (!Globals.isLIVE() || control)) |
---|
10762 | 10767 | { |
---|
10763 | 10768 | selectbuffer.display(); |
---|
10764 | 10769 | return; |
---|
.. | .. |
---|
10810 | 10815 | |
---|
10811 | 10816 | if (DrawMode() == DEFAULT) |
---|
10812 | 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 | + speed = ++speedkey[DOWN_ARROW]; |
---|
| 10869 | + if (speed > 20) |
---|
| 10870 | + speed = 20; |
---|
| 10871 | + GoDown(modifiers); |
---|
| 10872 | + keyon = true; |
---|
| 10873 | + } |
---|
| 10874 | + else |
---|
| 10875 | + speedkey[DOWN_ARROW] = 0; |
---|
| 10876 | + |
---|
| 10877 | + if (keys[UP_ARROW]) |
---|
| 10878 | + { |
---|
| 10879 | + speed = ++speedkey[UP_ARROW]; |
---|
| 10880 | + if (speed > 20) |
---|
| 10881 | + speed = 20; |
---|
| 10882 | + GoUp(modifiers); |
---|
| 10883 | + keyon = true; |
---|
| 10884 | + } |
---|
| 10885 | + else |
---|
| 10886 | + speedkey[UP_ARROW] = 0; |
---|
| 10887 | + |
---|
| 10888 | + if (keys[LEFT_ARROW]) |
---|
| 10889 | + { |
---|
| 10890 | + speed = ++speedkey[LEFT_ARROW]; |
---|
| 10891 | + if (speed > 20) |
---|
| 10892 | + speed = 20; |
---|
| 10893 | + GoLeft(modifiers); |
---|
| 10894 | + keyon = true; |
---|
| 10895 | + } |
---|
| 10896 | + else |
---|
| 10897 | + speedkey[LEFT_ARROW] = 0; |
---|
| 10898 | + |
---|
| 10899 | + if (keys[RIGHT_ARROW]) |
---|
| 10900 | + { |
---|
| 10901 | + speed = ++speedkey[RIGHT_ARROW]; |
---|
| 10902 | + if (speed > 20) |
---|
| 10903 | + speed = 20; |
---|
| 10904 | + GoRight(modifiers); |
---|
| 10905 | + keyon = true; |
---|
| 10906 | + } |
---|
| 10907 | + else |
---|
| 10908 | + speedkey[RIGHT_ARROW] = 0; |
---|
| 10909 | + |
---|
| 10910 | + if (Globals.WALK && capsLocked) |
---|
| 10911 | + { |
---|
| 10912 | + Walk(); |
---|
| 10913 | + keyon = true; |
---|
| 10914 | + } |
---|
| 10915 | + |
---|
| 10916 | + if (keyon) |
---|
| 10917 | + { |
---|
| 10918 | + repaint(); |
---|
| 10919 | + } |
---|
| 10920 | + |
---|
| 10921 | + //pingthread.mute = false; |
---|
| 10922 | + } |
---|
| 10923 | + |
---|
10813 | 10924 | currentlydrawing = true; |
---|
10814 | 10925 | } |
---|
10815 | 10926 | |
---|
.. | .. |
---|
11334 | 11445 | |
---|
11335 | 11446 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
11336 | 11447 | |
---|
11337 | | -gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
11338 | | -gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
11339 | | -gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11448 | +//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11449 | +//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11450 | +//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
11340 | 11451 | } else |
---|
11341 | 11452 | { |
---|
11342 | 11453 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
11397 | 11508 | //gl.glOrtho(-BOOST, BOOST, -BOOST, BOOST, 0.001, 1000); |
---|
11398 | 11509 | } else |
---|
11399 | 11510 | { |
---|
11400 | | - glu.gluPerspective(cam.shaper_fovy / ratio, ratio, cam.shaper_zNear * cam.Distance(), cam.shaper_zFar * cam.Distance()); |
---|
| 11511 | + boolean vr = capsLocked && !lightMode; |
---|
| 11512 | + |
---|
| 11513 | + glu.gluPerspective(cam.shaper_fovy / ratio * (vr ? 1.2 : 1), |
---|
| 11514 | + ratio, cam.shaper_zNear * cam.Distance(), cam.shaper_zFar * cam.Distance()); |
---|
11401 | 11515 | } |
---|
11402 | 11516 | } |
---|
11403 | 11517 | |
---|
.. | .. |
---|
11753 | 11867 | repaint(); |
---|
11754 | 11868 | } |
---|
11755 | 11869 | |
---|
11756 | | - if (Globals.isLIVE() && DrawMode() == DEFAULT) // may 2013 |
---|
| 11870 | + if (Globals.isLIVE() && DrawMode() == DEFAULT || pingthread.live) // may 2013 |
---|
| 11871 | + { |
---|
| 11872 | + renderCamera.computeTransform(); |
---|
11757 | 11873 | repaint(); |
---|
| 11874 | + } |
---|
11758 | 11875 | |
---|
11759 | 11876 | displaydone = true; |
---|
11760 | 11877 | } |
---|
.. | .. |
---|
11829 | 11946 | //GL gl = getGL(); |
---|
11830 | 11947 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11831 | 11948 | { |
---|
| 11949 | + if (TRACK) |
---|
| 11950 | + { |
---|
| 11951 | + if (object.selection != null && |
---|
| 11952 | + object.selection.size() > 0 && |
---|
| 11953 | + object.selection.elementAt(0) != null && |
---|
| 11954 | + !(object.selection.elementAt(0) instanceof Camera) && |
---|
| 11955 | + !(object.selection.elementAt(0) instanceof ScriptNode)) |
---|
| 11956 | + { |
---|
| 11957 | + trackedobject = object.selection.elementAt(0); |
---|
| 11958 | + //repaint(); |
---|
| 11959 | + } |
---|
| 11960 | + else |
---|
| 11961 | + trackedobject = null; |
---|
| 11962 | + } |
---|
11832 | 11963 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11833 | 11964 | object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11834 | | - pingthread.StepToTarget(true); // true); |
---|
| 11965 | + pingthread.StepToTarget(); // true); |
---|
11835 | 11966 | // zoomonce = false; |
---|
11836 | 11967 | } |
---|
11837 | 11968 | |
---|
.. | .. |
---|
14212 | 14343 | public void mouseClicked(MouseEvent e) |
---|
14213 | 14344 | { |
---|
14214 | 14345 | System.out.println("mouseClicked: " + e); |
---|
| 14346 | + System.exit(0); |
---|
14215 | 14347 | } |
---|
14216 | 14348 | |
---|
14217 | 14349 | public void mousePressed(MouseEvent e) |
---|
.. | .. |
---|
14250 | 14382 | return; |
---|
14251 | 14383 | } |
---|
14252 | 14384 | |
---|
14253 | | - boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
| 14385 | + //boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
| 14386 | + |
---|
| 14387 | + boolean vr = capsLocked && !lightMode; |
---|
14254 | 14388 | |
---|
14255 | 14389 | // TIMER |
---|
14256 | | - if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
| 14390 | + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !vr) // VR |
---|
14257 | 14391 | { |
---|
14258 | 14392 | keepboxmode = BOXMODE; |
---|
14259 | 14393 | keepsupport = SUPPORT; |
---|
.. | .. |
---|
14294 | 14428 | //} |
---|
14295 | 14429 | |
---|
14296 | 14430 | SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
14297 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
| 14431 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, e.getModifiers(), e.getModifiersEx()); |
---|
14298 | 14432 | anchorX = ax; |
---|
14299 | 14433 | anchorY = ay; |
---|
14300 | 14434 | prevX = px; |
---|
.. | .. |
---|
14389 | 14523 | // fev 2014??? |
---|
14390 | 14524 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
14391 | 14525 | object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
14392 | | - pingthread.StepToTarget(true); // true); |
---|
| 14526 | + pingthread.StepToTarget(); // true); |
---|
14393 | 14527 | } |
---|
| 14528 | + |
---|
14394 | 14529 | // if (!LIVE) |
---|
14395 | 14530 | super.repaint(); |
---|
14396 | 14531 | } |
---|
.. | .. |
---|
14485 | 14620 | |
---|
14486 | 14621 | //if (drawing) |
---|
14487 | 14622 | //return; |
---|
14488 | | - if ((e.getModifiersEx() & CTRL) != 0 |
---|
14489 | | - || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
| 14623 | + if ((e.getModifiersEx() & CTRL) != 0 || |
---|
| 14624 | + (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
14490 | 14625 | { |
---|
14491 | 14626 | //System.out.println("mouseDragged: " + e); |
---|
14492 | 14627 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
.. | .. |
---|
14510 | 14645 | return targetLookAt; |
---|
14511 | 14646 | } |
---|
14512 | 14647 | |
---|
| 14648 | + javax.vecmath.Point3d eye = new javax.vecmath.Point3d(); |
---|
| 14649 | + javax.vecmath.Point3d eye2 = new javax.vecmath.Point3d(); |
---|
| 14650 | + javax.vecmath.Vector3d dir = new javax.vecmath.Vector3d(); |
---|
| 14651 | + |
---|
| 14652 | + |
---|
14513 | 14653 | class PingThread extends Thread |
---|
14514 | 14654 | { |
---|
14515 | 14655 | boolean jump; |
---|
| 14656 | + boolean live; |
---|
| 14657 | + |
---|
| 14658 | + boolean mute = false; |
---|
14516 | 14659 | |
---|
14517 | 14660 | // void JumpToTarget() |
---|
14518 | 14661 | // { |
---|
.. | .. |
---|
14528 | 14671 | // only one thread!? synchronized |
---|
14529 | 14672 | void StepToTarget(boolean jump) |
---|
14530 | 14673 | { |
---|
| 14674 | + RigidBody.pos.x = 0; |
---|
| 14675 | + RigidBody.pos.y = 0; |
---|
| 14676 | + RigidBody.pos.z = 0; |
---|
| 14677 | + if (RigidBody.justclicked) |
---|
| 14678 | + { |
---|
| 14679 | +// RigidBody.pos.x = (float)manipCamera.lookAt.x; |
---|
| 14680 | +// RigidBody.pos.y = (float)manipCamera.lookAt.y; |
---|
| 14681 | +// RigidBody.pos.z = (float)manipCamera.lookAt.z; |
---|
| 14682 | + // System.err.println("selected point = " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][1]) + " " + Trunk(selectedpoint.toParent[3][2])); |
---|
| 14683 | + CreateSelectedPoint(); |
---|
| 14684 | + |
---|
| 14685 | + RigidBody.pos.x = (float)selectedpoint.toParent[3][0]; |
---|
| 14686 | + RigidBody.pos.y = (float)selectedpoint.toParent[3][1]; |
---|
| 14687 | + RigidBody.pos.z = (float)selectedpoint.toParent[3][2]; |
---|
| 14688 | + |
---|
| 14689 | + RigidBody.wind.set(RigidBody.pos); |
---|
| 14690 | + RigidBody.wind.x -= (float)manipCamera.location.x; |
---|
| 14691 | + RigidBody.wind.y -= (float)manipCamera.location.y; |
---|
| 14692 | + RigidBody.wind.z -= (float)manipCamera.location.z; |
---|
| 14693 | + RigidBody.wind.normalize(); |
---|
| 14694 | + } |
---|
| 14695 | + |
---|
| 14696 | + if (mute) |
---|
| 14697 | + return; |
---|
| 14698 | + |
---|
| 14699 | + if (capsLocked && manipCamera.viewCode == 0) |
---|
| 14700 | + { |
---|
| 14701 | + eye.x = manipCamera.location.x; |
---|
| 14702 | + eye.y = manipCamera.location.y + 0.25; |
---|
| 14703 | + eye.z = manipCamera.location.z; |
---|
| 14704 | + |
---|
| 14705 | + dir.y = -1; |
---|
| 14706 | + |
---|
| 14707 | + Ray ray = new Ray(eye, dir); |
---|
| 14708 | + |
---|
| 14709 | + IntersectResult res = new IntersectResult(); |
---|
| 14710 | + res.t = Double.POSITIVE_INFINITY; |
---|
| 14711 | + |
---|
| 14712 | + tmp.set(targetLookAt); |
---|
| 14713 | + tmp.sub(manipCamera.location); |
---|
| 14714 | + |
---|
| 14715 | + double dist = tmp.length(); |
---|
| 14716 | + |
---|
| 14717 | + tmp.normalize(); |
---|
| 14718 | + |
---|
| 14719 | + eye2.x = manipCamera.location.x + tmp.x * 0.25; |
---|
| 14720 | + eye2.y = manipCamera.location.y + 0.25; |
---|
| 14721 | + eye2.z = manipCamera.location.z + tmp.z * 0.25; |
---|
| 14722 | + |
---|
| 14723 | + Ray ray2 = new Ray(eye2, dir); |
---|
| 14724 | + |
---|
| 14725 | + IntersectResult res2 = new IntersectResult(); |
---|
| 14726 | + res2.t = Double.POSITIVE_INFINITY; |
---|
| 14727 | + |
---|
| 14728 | + if (object.intersect(ray, res) && object.intersect(ray2, res2) && Math.abs(res.t - res2.t) < 0.25) |
---|
| 14729 | + { |
---|
| 14730 | + //tmp.set(manipCamera.location); |
---|
| 14731 | + |
---|
| 14732 | + manipCamera.location.x = ray.eyePoint.x + ray.viewDirection.x * res.t; |
---|
| 14733 | + manipCamera.location.y = ray.eyePoint.y + ray.viewDirection.y * res.t + 0.5; |
---|
| 14734 | + manipCamera.location.z = ray.eyePoint.z + ray.viewDirection.z * res.t; |
---|
| 14735 | + |
---|
| 14736 | + //tmp.sub(manipCamera.location); |
---|
| 14737 | + |
---|
| 14738 | + targetLookAt.x = ray2.eyePoint.x + ray2.viewDirection.x * res2.t; |
---|
| 14739 | + targetLookAt.y = ray2.eyePoint.y + ray2.viewDirection.y * res2.t + 0.5; |
---|
| 14740 | + targetLookAt.z = ray2.eyePoint.z + ray2.viewDirection.z * res2.t; |
---|
| 14741 | + |
---|
| 14742 | + targetLookAt.sub(manipCamera.location); |
---|
| 14743 | + targetLookAt.normalize(); |
---|
| 14744 | + targetLookAt.mul(dist); |
---|
| 14745 | + targetLookAt.add(manipCamera.location); |
---|
| 14746 | + |
---|
| 14747 | + //if (tmp.dot(tmp) > 0.000001) |
---|
| 14748 | + // System.out.println("INTERSECTION " + manipCamera.location); |
---|
| 14749 | + |
---|
| 14750 | + manipCamera.lookAt.set(targetLookAt); |
---|
| 14751 | + |
---|
| 14752 | + tmp.x = res.n.x; |
---|
| 14753 | + tmp.y = res.n.y; |
---|
| 14754 | + tmp.z = res.n.z; |
---|
| 14755 | + tmp.x += res2.n.x; |
---|
| 14756 | + tmp.y += res2.n.y; |
---|
| 14757 | + tmp.z += res2.n.z; |
---|
| 14758 | + tmp.normalize(); |
---|
| 14759 | + manipCamera.UP.set(tmp); |
---|
| 14760 | + } |
---|
| 14761 | + } |
---|
| 14762 | + |
---|
14531 | 14763 | tmp.set(targetLookAt); |
---|
14532 | 14764 | tmp.sub(manipCamera.lookAt); // june 2014 |
---|
14533 | 14765 | |
---|
.. | .. |
---|
14565 | 14797 | |
---|
14566 | 14798 | if (tmp.dot(tmp) > 1) // may 2014. far away: jump to target |
---|
14567 | 14799 | { |
---|
14568 | | - jump = true; // step = 1; |
---|
| 14800 | + // sep 2019 jump = true; // step = 1; |
---|
14569 | 14801 | } |
---|
14570 | 14802 | |
---|
14571 | 14803 | if (OEILONCE && OEIL) |
---|
.. | .. |
---|
14600 | 14832 | if (tmp.dot(tmp) < 0.00001) |
---|
14601 | 14833 | { |
---|
14602 | 14834 | zoomonce = false; |
---|
| 14835 | + live = false; |
---|
14603 | 14836 | } |
---|
| 14837 | + else |
---|
| 14838 | + live = true; |
---|
14604 | 14839 | |
---|
14605 | 14840 | tmp.mul(step > step2 ? step : step2); |
---|
14606 | 14841 | } |
---|
.. | .. |
---|
14627 | 14862 | { |
---|
14628 | 14863 | if (LOOKAT) |
---|
14629 | 14864 | manipCamera.lookAt.add(tmp); |
---|
14630 | | - if (OEIL) |
---|
| 14865 | + if (OEIL && !capsLocked) |
---|
14631 | 14866 | manipCamera.location.add(tmp); |
---|
14632 | 14867 | |
---|
14633 | 14868 | { |
---|
.. | .. |
---|
14642 | 14877 | lightCamera.computeTransform(); |
---|
14643 | 14878 | } |
---|
14644 | 14879 | } |
---|
14645 | | - manipCamera.computeTransform(); |
---|
| 14880 | + if (tmp.x != 0 || tmp.y != 0 || tmp.z != 0) |
---|
| 14881 | + { |
---|
| 14882 | + manipCamera.computeTransform(); |
---|
| 14883 | + } |
---|
14646 | 14884 | } |
---|
14647 | 14885 | // ?????? mouseDown = true; |
---|
14648 | 14886 | //System.out.println("---------------- ---------- Paint " + tmp.length2()); |
---|
.. | .. |
---|
14735 | 14973 | } |
---|
14736 | 14974 | } |
---|
14737 | 14975 | } |
---|
| 14976 | + |
---|
14738 | 14977 | PingThread pingthread = new PingThread(); |
---|
14739 | | - int delta = 2; |
---|
14740 | | - int speed = 10; |
---|
| 14978 | + int delta = 1; |
---|
| 14979 | + int speed = 1; |
---|
| 14980 | + int walk = 8; |
---|
14741 | 14981 | boolean autorepeat = false; |
---|
14742 | 14982 | |
---|
| 14983 | + void Walk() |
---|
| 14984 | + { |
---|
| 14985 | + manipCamera.BackForth(0, walk, 1000); |
---|
| 14986 | + |
---|
| 14987 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14988 | + } |
---|
| 14989 | + |
---|
| 14990 | + void ViewAngle(float dy) |
---|
| 14991 | + { |
---|
| 14992 | + double factor = Math.exp(-dy/300.0); // (1 + dy/100); |
---|
| 14993 | + |
---|
| 14994 | + if (manipCamera.shaper_fovy * factor > 1 && |
---|
| 14995 | + manipCamera.shaper_fovy * factor < 150) |
---|
| 14996 | + { |
---|
| 14997 | + manipCamera.shaper_fovy *= factor; |
---|
| 14998 | + //System.out.println("fovy = " + shaper_fovy); |
---|
| 14999 | + } |
---|
| 15000 | + } |
---|
| 15001 | + |
---|
14743 | 15002 | void GoDown(int mod) |
---|
14744 | 15003 | { |
---|
14745 | 15004 | MODIFIERS |= COMMAND; |
---|
.. | .. |
---|
14747 | 15006 | /**/ |
---|
14748 | 15007 | if((mod&SHIFT) == SHIFT) |
---|
14749 | 15008 | { |
---|
| 15009 | +// if (isVR) |
---|
| 15010 | +// manipCamera.RotateInterest(0, speed); |
---|
| 15011 | +// else |
---|
14750 | 15012 | if (isVR) |
---|
14751 | | - manipCamera.RotateInterest(0, -speed); |
---|
| 15013 | + ViewAngle(-speed*delta); |
---|
| 15014 | + else |
---|
| 15015 | + manipCamera.Translate(0, -speed*delta, getWidth()); |
---|
| 15016 | + } |
---|
| 15017 | + else |
---|
| 15018 | + { |
---|
| 15019 | + if (isVR) |
---|
| 15020 | + manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth()); |
---|
14752 | 15021 | else |
---|
14753 | 15022 | manipCamera.RotatePosition(0, -speed); |
---|
14754 | 15023 | } |
---|
14755 | | - else |
---|
14756 | | - manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth()); |
---|
| 15024 | + |
---|
14757 | 15025 | /**/ |
---|
14758 | | - if ((mod & SHIFT) == SHIFT) |
---|
14759 | | - { |
---|
14760 | | - mouseMode = mouseMode; // VR?? |
---|
14761 | | - } else |
---|
14762 | | - { |
---|
14763 | | - mouseMode |= BACKFORTH; |
---|
14764 | | - } |
---|
| 15026 | +// if ((mod & SHIFT) == SHIFT) |
---|
| 15027 | +// { |
---|
| 15028 | +// mouseMode = mouseMode; // VR?? |
---|
| 15029 | +// } else |
---|
| 15030 | +// { |
---|
| 15031 | +// mouseMode |= BACKFORTH; |
---|
| 15032 | +// } |
---|
14765 | 15033 | |
---|
14766 | 15034 | targetLookAt.set(manipCamera.lookAt); |
---|
14767 | 15035 | |
---|
.. | .. |
---|
14771 | 15039 | |
---|
14772 | 15040 | void GoUp(int mod) |
---|
14773 | 15041 | { |
---|
| 15042 | + RigidBody.justclicked = true; |
---|
| 15043 | + |
---|
14774 | 15044 | MODIFIERS |= COMMAND; |
---|
14775 | 15045 | /**/ |
---|
14776 | 15046 | boolean isVR = (mouseMode&VR)!=0; |
---|
14777 | 15047 | |
---|
14778 | 15048 | if((mod&SHIFT) == SHIFT) |
---|
14779 | 15049 | { |
---|
| 15050 | +// if (isVR) |
---|
| 15051 | +// manipCamera.RotateInterest(0, -speed); |
---|
| 15052 | +// else |
---|
14780 | 15053 | if (isVR) |
---|
14781 | | - manipCamera.RotateInterest(0, speed); |
---|
| 15054 | + ViewAngle(speed*delta); |
---|
| 15055 | + else |
---|
| 15056 | + manipCamera.Translate(0, speed*delta, getWidth()); |
---|
| 15057 | + } |
---|
| 15058 | + else |
---|
| 15059 | + { |
---|
| 15060 | + if (isVR) |
---|
| 15061 | + manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth()); |
---|
14782 | 15062 | else |
---|
14783 | 15063 | manipCamera.RotatePosition(0, speed); |
---|
14784 | 15064 | } |
---|
14785 | | - else |
---|
14786 | | - manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth()); |
---|
| 15065 | + |
---|
14787 | 15066 | /**/ |
---|
14788 | | - if ((mod & SHIFT) == SHIFT) |
---|
14789 | | - { |
---|
14790 | | - mouseMode = mouseMode; |
---|
14791 | | - } else |
---|
14792 | | - { |
---|
14793 | | - mouseMode |= BACKFORTH; |
---|
14794 | | - } |
---|
| 15067 | +// if ((mod & SHIFT) == SHIFT) |
---|
| 15068 | +// { |
---|
| 15069 | +// mouseMode = mouseMode; |
---|
| 15070 | +// } else |
---|
| 15071 | +// { |
---|
| 15072 | +// mouseMode |= BACKFORTH; |
---|
| 15073 | +// } |
---|
14795 | 15074 | |
---|
14796 | 15075 | targetLookAt.set(manipCamera.lookAt); |
---|
14797 | 15076 | |
---|
.. | .. |
---|
14804 | 15083 | MODIFIERS |= COMMAND; |
---|
14805 | 15084 | /**/ |
---|
14806 | 15085 | if((mod&SHIFT) == SHIFT) |
---|
14807 | | - manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
| 15086 | + manipCamera.Translate(speed, 0, getWidth()); |
---|
14808 | 15087 | else |
---|
14809 | 15088 | { |
---|
14810 | 15089 | if ((mouseMode&VR)!=0) |
---|
14811 | | - manipCamera.RotateInterest(-speed, 0); |
---|
| 15090 | + manipCamera.RotateInterest(-speed*manipCamera.shaper_fovy/90, 0); |
---|
14812 | 15091 | else |
---|
14813 | | - manipCamera.RotatePosition(speed, 0); |
---|
| 15092 | + manipCamera.RotatePosition(speed*manipCamera.shaper_fovy/90, 0); |
---|
14814 | 15093 | } |
---|
| 15094 | + |
---|
14815 | 15095 | /**/ |
---|
14816 | | - if ((mod & SHIFT) == SHIFT) |
---|
14817 | | - { |
---|
14818 | | - mouseMode = mouseMode; |
---|
14819 | | - } else |
---|
14820 | | - { |
---|
14821 | | - mouseMode |= ROTATE; |
---|
14822 | | - } // TRANSLATE; |
---|
| 15096 | +// if ((mod & SHIFT) == SHIFT) |
---|
| 15097 | +// { |
---|
| 15098 | +// mouseMode = mouseMode; |
---|
| 15099 | +// } else |
---|
| 15100 | +// { |
---|
| 15101 | +// mouseMode |= ROTATE; |
---|
| 15102 | +// } // TRANSLATE; |
---|
14823 | 15103 | |
---|
| 15104 | + //System.err.println("lookAt = " + manipCamera.lookAt); |
---|
| 15105 | + //System.err.println("location = " + manipCamera.location); |
---|
| 15106 | + |
---|
14824 | 15107 | targetLookAt.set(manipCamera.lookAt); |
---|
14825 | 15108 | |
---|
14826 | 15109 | prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance()); |
---|
.. | .. |
---|
14832 | 15115 | MODIFIERS |= COMMAND; |
---|
14833 | 15116 | /**/ |
---|
14834 | 15117 | if((mod&SHIFT) == SHIFT) |
---|
14835 | | - manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
| 15118 | + manipCamera.Translate(-speed, 0, getWidth()); |
---|
14836 | 15119 | else |
---|
14837 | 15120 | { |
---|
14838 | 15121 | if ((mouseMode&VR)!=0) |
---|
14839 | | - manipCamera.RotateInterest(speed, 0); |
---|
| 15122 | + manipCamera.RotateInterest(speed*manipCamera.shaper_fovy/90, 0); |
---|
14840 | 15123 | else |
---|
14841 | | - manipCamera.RotatePosition(-speed, 0); |
---|
| 15124 | + manipCamera.RotatePosition(-speed*manipCamera.shaper_fovy/90, 0); |
---|
14842 | 15125 | } |
---|
14843 | 15126 | |
---|
14844 | 15127 | /**/ |
---|
14845 | | - if ((mod & SHIFT) == SHIFT) |
---|
14846 | | - { |
---|
14847 | | - mouseMode = mouseMode; |
---|
14848 | | - } else |
---|
14849 | | - { |
---|
14850 | | - mouseMode |= ROTATE; |
---|
14851 | | - } // TRANSLATE; |
---|
| 15128 | +// if ((mod & SHIFT) == SHIFT) |
---|
| 15129 | +// { |
---|
| 15130 | +// mouseMode = mouseMode; |
---|
| 15131 | +// } else |
---|
| 15132 | +// { |
---|
| 15133 | +// mouseMode |= ROTATE; |
---|
| 15134 | +// } // TRANSLATE; |
---|
14852 | 15135 | |
---|
14853 | 15136 | targetLookAt.set(manipCamera.lookAt); |
---|
14854 | 15137 | |
---|
.. | .. |
---|
14985 | 15268 | if ((mouseMode & ZOOM) != 0) |
---|
14986 | 15269 | { |
---|
14987 | 15270 | //if ((mouseMode & BACKFORTH) != 0) |
---|
| 15271 | + if ((modifiersex & SHIFT) == SHIFT) |
---|
| 15272 | + { |
---|
| 15273 | + ViewAngle(dy); |
---|
| 15274 | + } |
---|
| 15275 | + else |
---|
14988 | 15276 | if ((mouseMode & VR) != 0) |
---|
14989 | 15277 | manipCamera.BackForth(dx, dy, getWidth()); |
---|
14990 | 15278 | else |
---|
.. | .. |
---|
15055 | 15343 | |
---|
15056 | 15344 | public void mouseMoved(MouseEvent e) |
---|
15057 | 15345 | { |
---|
| 15346 | +//object.editWindow.frame. |
---|
| 15347 | + setCursor(Cursor.getDefaultCursor()); |
---|
| 15348 | + |
---|
15058 | 15349 | //System.out.println("mouseMoved: " + e); |
---|
15059 | 15350 | if (isRenderer) |
---|
15060 | 15351 | return; |
---|
.. | .. |
---|
15083 | 15374 | |
---|
15084 | 15375 | public void mouseReleased(MouseEvent e) |
---|
15085 | 15376 | { |
---|
| 15377 | + if (isRenderer && !movingcamera) |
---|
| 15378 | + { |
---|
| 15379 | + RigidBody.justclicked = true; |
---|
| 15380 | + System.out.println("justclicked: " + e); |
---|
| 15381 | + } |
---|
| 15382 | + |
---|
15086 | 15383 | Globals.MOUSEDRAGGED = false; |
---|
15087 | 15384 | |
---|
15088 | 15385 | movingcamera = false; |
---|
.. | .. |
---|
15239 | 15536 | mouseMode |= ZOOM; |
---|
15240 | 15537 | } |
---|
15241 | 15538 | |
---|
15242 | | - boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
15243 | | - if (capsLocked) // || (modifiers & META) == META) |
---|
| 15539 | + //boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
| 15540 | + boolean vr = capsLocked && !lightMode; |
---|
| 15541 | + |
---|
| 15542 | + if (vr) // || (modifiers & META) == META) |
---|
15244 | 15543 | { |
---|
15245 | 15544 | mouseMode |= VR; // BACKFORTH; |
---|
15246 | 15545 | } |
---|
.. | .. |
---|
15252 | 15551 | { |
---|
15253 | 15552 | mouseMode |= SELECT; |
---|
15254 | 15553 | } |
---|
15255 | | - if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
| 15554 | + if (//(modifiersex & SHIFT) == SHIFT || |
---|
| 15555 | + forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
15256 | 15556 | { |
---|
15257 | 15557 | mouseMode &= ~VR; |
---|
15258 | 15558 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
15296 | 15596 | float SATPOW = 1; // 2; // 0.5f; |
---|
15297 | 15597 | float BRIPOW = 1; // 0.5f; // 0.5f; |
---|
15298 | 15598 | |
---|
| 15599 | +static BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); |
---|
| 15600 | + |
---|
| 15601 | +// Create a new blank cursor. |
---|
| 15602 | +static Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor( |
---|
| 15603 | + cursorImg, new Point(0, 0), "blank cursor"); |
---|
| 15604 | + |
---|
15299 | 15605 | public void keyPressed(int key) |
---|
15300 | 15606 | { |
---|
| 15607 | +// Set the blank cursor to the JFrame. |
---|
| 15608 | +//object.editWindow.frame. |
---|
| 15609 | + setCursor(blankCursor); |
---|
| 15610 | + |
---|
15301 | 15611 | if (key >= '0' && key <= '5') |
---|
15302 | 15612 | clampbit = (key-'0'); |
---|
15303 | 15613 | |
---|
.. | .. |
---|
15456 | 15766 | RevertCamera(); |
---|
15457 | 15767 | repaint(); |
---|
15458 | 15768 | break; |
---|
15459 | | - case 'l': |
---|
15460 | | - //case 'L': |
---|
| 15769 | + //case 'l': |
---|
| 15770 | + case 'L': |
---|
15461 | 15771 | if (lightMode) |
---|
15462 | 15772 | { |
---|
15463 | 15773 | lightMode = false; |
---|
.. | .. |
---|
15487 | 15797 | break; |
---|
15488 | 15798 | case 'm': |
---|
15489 | 15799 | { |
---|
15490 | | - PrintMemory(); |
---|
| 15800 | + //PrintMemory(); |
---|
| 15801 | + ToggleImageFlip(); |
---|
15491 | 15802 | break; |
---|
15492 | 15803 | } |
---|
15493 | 15804 | case 'M': |
---|
.. | .. |
---|
15515 | 15826 | break; |
---|
15516 | 15827 | case 'O': |
---|
15517 | 15828 | // Too dangerous. Use menu. Globals.drawMode = OCCLUSION; // WARNING |
---|
15518 | | - repaint(); |
---|
15519 | | - break; |
---|
| 15829 | + //repaint(); |
---|
| 15830 | + //break; |
---|
15520 | 15831 | case 'o': |
---|
15521 | 15832 | OCCLUSION_CULLING ^= true; |
---|
15522 | 15833 | System.out.println("OCCLUSION CULLING = " + OCCLUSION_CULLING); |
---|
.. | .. |
---|
15608 | 15919 | // kompactbit = 6; |
---|
15609 | 15920 | // break; |
---|
15610 | 15921 | case ' ': |
---|
| 15922 | + capsLocked ^= true; |
---|
| 15923 | + repaint(); |
---|
| 15924 | + break; |
---|
| 15925 | + case 'l': |
---|
15611 | 15926 | lightMode ^= true; |
---|
| 15927 | + if (lightMode) |
---|
| 15928 | + { |
---|
| 15929 | + keepshadow = Globals.RENDERSHADOW; |
---|
| 15930 | + Globals.RENDERSHADOW = false; |
---|
| 15931 | + } |
---|
| 15932 | + else |
---|
| 15933 | + { |
---|
| 15934 | + Globals.RENDERSHADOW = keepshadow; |
---|
| 15935 | + } |
---|
| 15936 | + |
---|
15612 | 15937 | Globals.lighttouched = true; |
---|
15613 | 15938 | manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
15614 | 15939 | targetLookAt.set(manipCamera.lookAt); |
---|
.. | .. |
---|
15616 | 15941 | break; |
---|
15617 | 15942 | //case '`' : |
---|
15618 | 15943 | case ESC: |
---|
| 15944 | + if (FULLSCREEN) |
---|
| 15945 | + object.editWindow.ToggleFullScreen(); |
---|
| 15946 | + break; |
---|
| 15947 | + case 'p': |
---|
15619 | 15948 | RENDERPROGRAM += 1; |
---|
15620 | 15949 | RENDERPROGRAM %= 3; |
---|
15621 | 15950 | |
---|
.. | .. |
---|
15654 | 15983 | case ENTER: |
---|
15655 | 15984 | // object.editWindow.ScreenFit(); // Edit(); |
---|
15656 | 15985 | ToggleLive(); |
---|
| 15986 | + if (capsLocked) |
---|
| 15987 | + { |
---|
| 15988 | + Globals.WALK ^= true; |
---|
| 15989 | + } |
---|
15657 | 15990 | break; |
---|
15658 | 15991 | case DELETE: |
---|
15659 | 15992 | ClearSelection(); |
---|
.. | .. |
---|
15690 | 16023 | object.GetWindow().refreshContents(true); |
---|
15691 | 16024 | break; |
---|
15692 | 16025 | case '{': |
---|
15693 | | - manipCamera.shaper_fovy /= 1.1; |
---|
| 16026 | + double factor = 1.1; |
---|
| 16027 | + if (manipCamera.shaper_fovy / factor > 0.1) |
---|
| 16028 | + manipCamera.shaper_fovy /= factor; |
---|
15694 | 16029 | System.out.println("FOV = " + manipCamera.shaper_fovy); |
---|
15695 | 16030 | repaint(); |
---|
15696 | 16031 | break; |
---|
15697 | 16032 | case '}': |
---|
15698 | | - manipCamera.shaper_fovy *= 1.1; |
---|
| 16033 | + factor = 1.1; |
---|
| 16034 | + if (manipCamera.shaper_fovy * factor < 150) |
---|
| 16035 | + manipCamera.shaper_fovy *= factor; |
---|
15699 | 16036 | System.out.println("FOV = " + manipCamera.shaper_fovy); |
---|
15700 | 16037 | repaint(); |
---|
15701 | 16038 | break; |
---|
15702 | 16039 | case '[': |
---|
15703 | | - manipCamera.shaper_fovy /= 1.01; |
---|
| 16040 | + factor = 1.01; |
---|
| 16041 | + if (manipCamera.shaper_fovy / factor > 0.1) |
---|
| 16042 | + manipCamera.shaper_fovy /= factor; |
---|
15704 | 16043 | if (false) //manipCamera.hAspect == 0) |
---|
15705 | 16044 | { |
---|
15706 | 16045 | double x = Math.tan(manipCamera.shaper_fovy * Math.PI / 180 / 2); |
---|
.. | .. |
---|
15716 | 16055 | break; |
---|
15717 | 16056 | case ']': |
---|
15718 | 16057 | //manipCamera.shaper_fovy += (180 - manipCamera.shaper_fovy)*0.1; |
---|
15719 | | - manipCamera.shaper_fovy *= 1.01; |
---|
| 16058 | + factor = 1.01; |
---|
| 16059 | + if (manipCamera.shaper_fovy * factor < 150) |
---|
| 16060 | + manipCamera.shaper_fovy *= factor; |
---|
15720 | 16061 | if (false) //manipCamera.hAspect == 0) |
---|
15721 | 16062 | { |
---|
15722 | 16063 | double x = Math.tan(manipCamera.shaper_fovy * Math.PI / 180 / 2); |
---|
.. | .. |
---|
15754 | 16095 | } |
---|
15755 | 16096 | } |
---|
15756 | 16097 | |
---|
| 16098 | + boolean keys[] = new boolean[256]; |
---|
| 16099 | + int speedkey[] = new int[256]; |
---|
| 16100 | + int modifiers = 0; |
---|
| 16101 | + |
---|
15757 | 16102 | public void processKeyEvent(KeyEvent e) |
---|
15758 | 16103 | { |
---|
15759 | 16104 | switch (e.getID()) |
---|
15760 | 16105 | { |
---|
15761 | 16106 | case KeyEvent.KEY_PRESSED: |
---|
15762 | | - if (!autorepeat) |
---|
15763 | | - { |
---|
15764 | | - //System.out.println("processKeyEvent: " + KeyEvent.getKeyText(e.getKeyCode())); |
---|
15765 | | - keyPressed(e.getKeyChar(), e.getModifiersEx()); |
---|
15766 | | - } |
---|
15767 | | - if (manipCamera == lightCamera) |
---|
15768 | | - { |
---|
15769 | | - switch (e.getKeyCode()) |
---|
15770 | | - { |
---|
15771 | | - case DOWN_ARROW: |
---|
15772 | | - lightCamera.DECAL /= 2; |
---|
15773 | | - repaint(); |
---|
15774 | | - break; |
---|
15775 | | - case UP_ARROW: |
---|
15776 | | - lightCamera.DECAL *= 2; |
---|
15777 | | - repaint(); |
---|
15778 | | - break; |
---|
15779 | | - case LEFT_ARROW: |
---|
15780 | | - lightCamera.SCALE /= 2; |
---|
15781 | | - repaint(); |
---|
15782 | | - break; |
---|
15783 | | - case RIGHT_ARROW: |
---|
15784 | | - lightCamera.SCALE *= 2; |
---|
15785 | | - repaint(); |
---|
15786 | | - break; |
---|
15787 | | - default: |
---|
15788 | | - break; |
---|
15789 | | - } |
---|
15790 | | - |
---|
15791 | | - System.out.println("DECAL = " + lightCamera.DECAL + "; SCALE = " + lightCamera.SCALE); |
---|
15792 | | - } else |
---|
15793 | | - { |
---|
15794 | | - if (true) // !autorepeat) |
---|
15795 | | - { |
---|
15796 | | - boolean reset = true; |
---|
15797 | | - |
---|
15798 | | - switch (e.getKeyCode()) |
---|
15799 | | - { |
---|
15800 | | - case DOWN_ARROW: |
---|
15801 | | - GoDown(e.getModifiersEx()); |
---|
15802 | | - repaint(); |
---|
15803 | | - break; |
---|
15804 | | - case UP_ARROW: |
---|
15805 | | - GoUp(e.getModifiersEx()); |
---|
15806 | | - repaint(); |
---|
15807 | | - break; |
---|
15808 | | - case LEFT_ARROW: |
---|
15809 | | - GoLeft(e.getModifiersEx()); |
---|
15810 | | - repaint(); |
---|
15811 | | - break; |
---|
15812 | | - case RIGHT_ARROW: |
---|
15813 | | - GoRight(e.getModifiersEx()); |
---|
15814 | | - repaint(); |
---|
15815 | | - break; |
---|
15816 | | - default: |
---|
15817 | | - reset = false; |
---|
15818 | | - break; |
---|
15819 | | - } |
---|
15820 | | - |
---|
15821 | | - if (reset) |
---|
15822 | | - { |
---|
15823 | | - autorepeat = true; |
---|
15824 | | - |
---|
15825 | | - targetLookAt.set(manipCamera.lookAt); |
---|
15826 | | - } |
---|
15827 | | - } |
---|
15828 | | - } |
---|
| 16107 | + keys[e.getKeyCode()] = true; |
---|
| 16108 | + modifiers = e.getModifiersEx(); |
---|
| 16109 | + keyPressed(e.getKeyChar(), modifiers); |
---|
| 16110 | + //Globals.theRenderer.keyPressed(e.getKeyChar()); |
---|
| 16111 | + repaint(); |
---|
15829 | 16112 | break; |
---|
15830 | | - case KeyEvent.KEY_TYPED: |
---|
15831 | | - break; |
---|
| 16113 | +// if (!autorepeat) |
---|
| 16114 | +// { |
---|
| 16115 | +// //System.out.println("processKeyEvent: " + KeyEvent.getKeyText(e.getKeyCode())); |
---|
| 16116 | +// keyPressed(e.getKeyChar(), e.getModifiersEx()); |
---|
| 16117 | +// } |
---|
| 16118 | +// if (manipCamera == lightCamera) |
---|
| 16119 | +// { |
---|
| 16120 | +// switch (e.getKeyCode()) |
---|
| 16121 | +// { |
---|
| 16122 | +// case DOWN_ARROW: |
---|
| 16123 | +// lightCamera.DECAL /= 2; |
---|
| 16124 | +// repaint(); |
---|
| 16125 | +// break; |
---|
| 16126 | +// case UP_ARROW: |
---|
| 16127 | +// lightCamera.DECAL *= 2; |
---|
| 16128 | +// repaint(); |
---|
| 16129 | +// break; |
---|
| 16130 | +// case LEFT_ARROW: |
---|
| 16131 | +// lightCamera.SCALE /= 2; |
---|
| 16132 | +// repaint(); |
---|
| 16133 | +// break; |
---|
| 16134 | +// case RIGHT_ARROW: |
---|
| 16135 | +// lightCamera.SCALE *= 2; |
---|
| 16136 | +// repaint(); |
---|
| 16137 | +// break; |
---|
| 16138 | +// default: |
---|
| 16139 | +// break; |
---|
| 16140 | +// } |
---|
| 16141 | +// |
---|
| 16142 | +// System.out.println("DECAL = " + lightCamera.DECAL + "; SCALE = " + lightCamera.SCALE); |
---|
| 16143 | +// } else |
---|
| 16144 | +// { |
---|
| 16145 | +// if (true) // !autorepeat) |
---|
| 16146 | +// { |
---|
| 16147 | +// boolean reset = true; |
---|
| 16148 | +// |
---|
| 16149 | +// switch (e.getKeyCode()) |
---|
| 16150 | +// { |
---|
| 16151 | +// case DOWN_ARROW: |
---|
| 16152 | +// GoDown(e.getModifiersEx()); |
---|
| 16153 | +// repaint(); |
---|
| 16154 | +// break; |
---|
| 16155 | +// case UP_ARROW: |
---|
| 16156 | +// GoUp(e.getModifiersEx()); |
---|
| 16157 | +// repaint(); |
---|
| 16158 | +// break; |
---|
| 16159 | +// case LEFT_ARROW: |
---|
| 16160 | +// GoLeft(e.getModifiersEx()); |
---|
| 16161 | +// repaint(); |
---|
| 16162 | +// break; |
---|
| 16163 | +// case RIGHT_ARROW: |
---|
| 16164 | +// GoRight(e.getModifiersEx()); |
---|
| 16165 | +// repaint(); |
---|
| 16166 | +// break; |
---|
| 16167 | +// default: |
---|
| 16168 | +// reset = false; |
---|
| 16169 | +// break; |
---|
| 16170 | +// } |
---|
| 16171 | +// |
---|
| 16172 | +// if (reset) |
---|
| 16173 | +// { |
---|
| 16174 | +// autorepeat = true; |
---|
| 16175 | +// |
---|
| 16176 | +// targetLookAt.set(manipCamera.lookAt); |
---|
| 16177 | +// } |
---|
| 16178 | +// } |
---|
| 16179 | +// } |
---|
| 16180 | +// break; |
---|
| 16181 | +// case KeyEvent.KEY_TYPED: |
---|
| 16182 | +// break; |
---|
15832 | 16183 | case KeyEvent.KEY_RELEASED: |
---|
15833 | | - { |
---|
15834 | | - switch (e.getKeyCode()) |
---|
15835 | | - { |
---|
15836 | | - case DOWN_ARROW: |
---|
15837 | | - case UP_ARROW: |
---|
15838 | | - case LEFT_ARROW: |
---|
15839 | | - case RIGHT_ARROW: |
---|
15840 | | - MODIFIERS &= ~COMMAND; |
---|
15841 | | - autorepeat = false; |
---|
15842 | | - break; |
---|
15843 | | - default: |
---|
15844 | | - break; |
---|
15845 | | - } |
---|
| 16184 | + keys[e.getKeyCode()] = false; |
---|
| 16185 | + modifiers = e.getModifiersEx(); |
---|
15846 | 16186 | keyReleased(e.getKeyChar(), e.getModifiersEx()); |
---|
| 16187 | + repaint(); |
---|
15847 | 16188 | break; |
---|
15848 | | - } |
---|
| 16189 | +// { |
---|
| 16190 | +// switch (e.getKeyCode()) |
---|
| 16191 | +// { |
---|
| 16192 | +// case DOWN_ARROW: |
---|
| 16193 | +// case UP_ARROW: |
---|
| 16194 | +// case LEFT_ARROW: |
---|
| 16195 | +// case RIGHT_ARROW: |
---|
| 16196 | +// MODIFIERS &= ~COMMAND; |
---|
| 16197 | +// autorepeat = false; |
---|
| 16198 | +// break; |
---|
| 16199 | +// default: |
---|
| 16200 | +// break; |
---|
| 16201 | +// } |
---|
| 16202 | +// keyReleased(e.getKeyChar(), e.getModifiersEx()); |
---|
| 16203 | +// break; |
---|
| 16204 | +// } |
---|
15849 | 16205 | default: |
---|
15850 | 16206 | break; |
---|
15851 | 16207 | } |
---|
.. | .. |
---|
16421 | 16777 | |
---|
16422 | 16778 | public boolean mouseDrag(Event evt, int x, int y) |
---|
16423 | 16779 | { |
---|
16424 | | - //System.out.println("mouseDrag: " + evt); |
---|
| 16780 | + System.out.println("mouseDrag: " + evt); |
---|
| 16781 | + System.exit(0); |
---|
16425 | 16782 | /* |
---|
16426 | 16783 | drag = true; |
---|
16427 | 16784 | //System.out.println("Mouse DRAG"); |
---|
.. | .. |
---|
16540 | 16897 | public boolean mouseUp(Event evt, int x, int y) |
---|
16541 | 16898 | { |
---|
16542 | 16899 | System.out.println("mouseUp: " + evt); |
---|
| 16900 | + System.exit(0); |
---|
16543 | 16901 | /* |
---|
16544 | 16902 | locked = false; |
---|
16545 | 16903 | if (isRenderer) |
---|
.. | .. |
---|
16810 | 17168 | return; |
---|
16811 | 17169 | } |
---|
16812 | 17170 | |
---|
16813 | | - if (WIREFRAME) |
---|
| 17171 | + //if (WIREFRAME) |
---|
16814 | 17172 | gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL); |
---|
16815 | 17173 | |
---|
16816 | 17174 | gl.glDisable(gl.GL_CULL_FACE); |
---|
.. | .. |
---|
16910 | 17268 | |
---|
16911 | 17269 | if (WIREFRAME) |
---|
16912 | 17270 | gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE); |
---|
| 17271 | + else |
---|
| 17272 | + gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL); |
---|
16913 | 17273 | } |
---|
16914 | 17274 | |
---|
16915 | 17275 | private void DrawChecker(GL gl) |
---|
.. | .. |
---|
17247 | 17607 | |
---|
17248 | 17608 | float depth = depths[y * TEX_SIZE + x]; |
---|
17249 | 17609 | |
---|
17250 | | - if (pointselection && mouseMode == SELECT && depth != 0 && depth != 1) |
---|
| 17610 | + if (pointselection && (mouseMode & SELECT) == SELECT && depth != 0 && depth != 1) |
---|
17251 | 17611 | { |
---|
17252 | 17612 | pointselection = false; |
---|
17253 | 17613 | |
---|
.. | .. |
---|
17911 | 18271 | static boolean DEBUG_SELECTION = false; |
---|
17912 | 18272 | boolean OCCLUSION_CULLING = false; //true; |
---|
17913 | 18273 | public boolean lightMode = false; |
---|
| 18274 | + |
---|
| 18275 | + private boolean keepshadow; |
---|
| 18276 | + |
---|
| 18277 | + static public boolean capsLocked = false; // VR |
---|
| 18278 | + |
---|
17914 | 18279 | static public int indexcount = 0; |
---|
17915 | 18280 | /*static*/ cColor vertexOcclusion = new cColor(); |
---|
17916 | 18281 | //private int selection_view = -1; |
---|