.. | .. |
---|
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; |
---|
.. | .. |
---|
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 | } |
---|
.. | .. |
---|
6961 | 6962 | short residu = 0; |
---|
6962 | 6963 | |
---|
6963 | 6964 | // wraparound workarounds |
---|
6964 | | - short fuck = (short) (buffer[i] & 0xFF); |
---|
| 6965 | + short ww = (short) (buffer[i] & 0xFF); |
---|
6965 | 6966 | /* |
---|
6966 | | - residu += (fuck%2); |
---|
6967 | | - if(fuck/2 < 256-residu/2) |
---|
| 6967 | + residu += (ww%2); |
---|
| 6968 | + if(ww/2 < 256-residu/2) |
---|
6968 | 6969 | { |
---|
6969 | | - fuck = (short)((fuck/2) + residu/2); |
---|
| 6970 | + ww = (short)((ww/2) + residu/2); |
---|
6970 | 6971 | if(residu == 2) |
---|
6971 | 6972 | residu = 0; |
---|
6972 | 6973 | } |
---|
6973 | 6974 | else |
---|
6974 | 6975 | { |
---|
6975 | 6976 | residu = 0; |
---|
6976 | | - fuck /= 2; |
---|
| 6977 | + ww /= 2; |
---|
6977 | 6978 | } |
---|
6978 | 6979 | */ |
---|
6979 | | - if (i < imglength / 3 || rnd.nextFloat() < 0.5 || fuck >= 254) |
---|
| 6980 | + if (i < imglength / 3 || rnd.nextFloat() < 0.5 || ww >= 254) |
---|
6980 | 6981 | { |
---|
6981 | | - fuck /= 2; |
---|
| 6982 | + ww /= 2; |
---|
6982 | 6983 | } else |
---|
6983 | 6984 | { |
---|
6984 | | - fuck = (short) ((fuck / 2) + fuck % 2); |
---|
| 6985 | + ww = (short) ((ww / 2) + ww % 2); |
---|
6985 | 6986 | } |
---|
6986 | 6987 | |
---|
6987 | | - buffer[i] = (byte) fuck; |
---|
| 6988 | + buffer[i] = (byte) ww; |
---|
6988 | 6989 | } |
---|
6989 | 6990 | //System.out.print(bytes[i] + " "); |
---|
6990 | 6991 | //if(buffer[i] >= 0 && buffer[i]<=eps-1) buffer[i] = eps; |
---|
.. | .. |
---|
10760 | 10761 | } |
---|
10761 | 10762 | /**/ |
---|
10762 | 10763 | |
---|
10763 | | - if (selection) |
---|
| 10764 | + boolean control = ((modifiers & CTRL) != 0); |
---|
| 10765 | + |
---|
| 10766 | + if (selection && (!Globals.isLIVE() || control)) |
---|
10764 | 10767 | { |
---|
10765 | 10768 | selectbuffer.display(); |
---|
10766 | 10769 | return; |
---|
.. | .. |
---|
11865 | 11868 | } |
---|
11866 | 11869 | |
---|
11867 | 11870 | if (Globals.isLIVE() && DrawMode() == DEFAULT || pingthread.live) // may 2013 |
---|
| 11871 | + { |
---|
| 11872 | + renderCamera.computeTransform(); |
---|
11868 | 11873 | repaint(); |
---|
| 11874 | + } |
---|
11869 | 11875 | |
---|
11870 | 11876 | displaydone = true; |
---|
11871 | 11877 | } |
---|
.. | .. |
---|
14337 | 14343 | public void mouseClicked(MouseEvent e) |
---|
14338 | 14344 | { |
---|
14339 | 14345 | System.out.println("mouseClicked: " + e); |
---|
| 14346 | + System.exit(0); |
---|
14340 | 14347 | } |
---|
14341 | 14348 | |
---|
14342 | 14349 | public void mousePressed(MouseEvent e) |
---|
.. | .. |
---|
14421 | 14428 | //} |
---|
14422 | 14429 | |
---|
14423 | 14430 | SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
14424 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
| 14431 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, e.getModifiers(), e.getModifiersEx()); |
---|
14425 | 14432 | anchorX = ax; |
---|
14426 | 14433 | anchorY = ay; |
---|
14427 | 14434 | prevX = px; |
---|
.. | .. |
---|
14648 | 14655 | boolean jump; |
---|
14649 | 14656 | boolean live; |
---|
14650 | 14657 | |
---|
14651 | | - boolean mute; |
---|
| 14658 | + boolean mute = false; |
---|
14652 | 14659 | |
---|
14653 | 14660 | // void JumpToTarget() |
---|
14654 | 14661 | // { |
---|
.. | .. |
---|
14664 | 14671 | // only one thread!? synchronized |
---|
14665 | 14672 | void StepToTarget(boolean jump) |
---|
14666 | 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 | + |
---|
14667 | 14696 | if (mute) |
---|
14668 | 14697 | return; |
---|
14669 | 14698 | |
---|
14670 | | - if (capsLocked) |
---|
| 14699 | + if (capsLocked && manipCamera.viewCode == 0) |
---|
14671 | 14700 | { |
---|
14672 | 14701 | eye.x = manipCamera.location.x; |
---|
14673 | 14702 | eye.y = manipCamera.location.y + 0.25; |
---|
.. | .. |
---|
14958 | 14987 | targetLookAt.set(manipCamera.lookAt); |
---|
14959 | 14988 | } |
---|
14960 | 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 | + |
---|
14961 | 15002 | void GoDown(int mod) |
---|
14962 | 15003 | { |
---|
14963 | 15004 | MODIFIERS |= COMMAND; |
---|
.. | .. |
---|
14968 | 15009 | // if (isVR) |
---|
14969 | 15010 | // manipCamera.RotateInterest(0, speed); |
---|
14970 | 15011 | // else |
---|
| 15012 | + if (isVR) |
---|
| 15013 | + ViewAngle(-speed*delta); |
---|
| 15014 | + else |
---|
14971 | 15015 | manipCamera.Translate(0, -speed*delta, getWidth()); |
---|
14972 | 15016 | } |
---|
14973 | 15017 | else |
---|
.. | .. |
---|
14995 | 15039 | |
---|
14996 | 15040 | void GoUp(int mod) |
---|
14997 | 15041 | { |
---|
| 15042 | + RigidBody.justclicked = true; |
---|
| 15043 | + |
---|
14998 | 15044 | MODIFIERS |= COMMAND; |
---|
14999 | 15045 | /**/ |
---|
15000 | 15046 | boolean isVR = (mouseMode&VR)!=0; |
---|
.. | .. |
---|
15004 | 15050 | // if (isVR) |
---|
15005 | 15051 | // manipCamera.RotateInterest(0, -speed); |
---|
15006 | 15052 | // else |
---|
| 15053 | + if (isVR) |
---|
| 15054 | + ViewAngle(speed*delta); |
---|
| 15055 | + else |
---|
15007 | 15056 | manipCamera.Translate(0, speed*delta, getWidth()); |
---|
15008 | 15057 | } |
---|
15009 | 15058 | else |
---|
.. | .. |
---|
15034 | 15083 | MODIFIERS |= COMMAND; |
---|
15035 | 15084 | /**/ |
---|
15036 | 15085 | if((mod&SHIFT) == SHIFT) |
---|
15037 | | - manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
| 15086 | + manipCamera.Translate(speed, 0, getWidth()); |
---|
15038 | 15087 | else |
---|
15039 | 15088 | { |
---|
15040 | 15089 | if ((mouseMode&VR)!=0) |
---|
15041 | | - manipCamera.RotateInterest(-speed, 0); |
---|
| 15090 | + manipCamera.RotateInterest(-speed*manipCamera.shaper_fovy/90, 0); |
---|
15042 | 15091 | else |
---|
15043 | | - manipCamera.RotatePosition(speed, 0); |
---|
| 15092 | + manipCamera.RotatePosition(speed*manipCamera.shaper_fovy/90, 0); |
---|
15044 | 15093 | } |
---|
15045 | 15094 | |
---|
15046 | 15095 | /**/ |
---|
.. | .. |
---|
15066 | 15115 | MODIFIERS |= COMMAND; |
---|
15067 | 15116 | /**/ |
---|
15068 | 15117 | if((mod&SHIFT) == SHIFT) |
---|
15069 | | - manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
| 15118 | + manipCamera.Translate(-speed, 0, getWidth()); |
---|
15070 | 15119 | else |
---|
15071 | 15120 | { |
---|
15072 | 15121 | if ((mouseMode&VR)!=0) |
---|
15073 | | - manipCamera.RotateInterest(speed, 0); |
---|
| 15122 | + manipCamera.RotateInterest(speed*manipCamera.shaper_fovy/90, 0); |
---|
15074 | 15123 | else |
---|
15075 | | - manipCamera.RotatePosition(-speed, 0); |
---|
| 15124 | + manipCamera.RotatePosition(-speed*manipCamera.shaper_fovy/90, 0); |
---|
15076 | 15125 | } |
---|
15077 | 15126 | |
---|
15078 | 15127 | /**/ |
---|
.. | .. |
---|
15219 | 15268 | if ((mouseMode & ZOOM) != 0) |
---|
15220 | 15269 | { |
---|
15221 | 15270 | //if ((mouseMode & BACKFORTH) != 0) |
---|
| 15271 | + if ((modifiersex & SHIFT) == SHIFT) |
---|
| 15272 | + { |
---|
| 15273 | + ViewAngle(dy); |
---|
| 15274 | + } |
---|
| 15275 | + else |
---|
15222 | 15276 | if ((mouseMode & VR) != 0) |
---|
15223 | 15277 | manipCamera.BackForth(dx, dy, getWidth()); |
---|
15224 | 15278 | else |
---|
.. | .. |
---|
15320 | 15374 | |
---|
15321 | 15375 | public void mouseReleased(MouseEvent e) |
---|
15322 | 15376 | { |
---|
| 15377 | + if (isRenderer && !movingcamera) |
---|
| 15378 | + { |
---|
| 15379 | + RigidBody.justclicked = true; |
---|
| 15380 | + System.out.println("justclicked: " + e); |
---|
| 15381 | + } |
---|
| 15382 | + |
---|
15323 | 15383 | Globals.MOUSEDRAGGED = false; |
---|
15324 | 15384 | |
---|
15325 | 15385 | movingcamera = false; |
---|
.. | .. |
---|
15923 | 15983 | case ENTER: |
---|
15924 | 15984 | // object.editWindow.ScreenFit(); // Edit(); |
---|
15925 | 15985 | ToggleLive(); |
---|
| 15986 | + if (capsLocked) |
---|
| 15987 | + { |
---|
| 15988 | + Globals.WALK ^= true; |
---|
| 15989 | + } |
---|
15926 | 15990 | break; |
---|
15927 | 15991 | case DELETE: |
---|
15928 | 15992 | ClearSelection(); |
---|
.. | .. |
---|
16713 | 16777 | |
---|
16714 | 16778 | public boolean mouseDrag(Event evt, int x, int y) |
---|
16715 | 16779 | { |
---|
16716 | | - //System.out.println("mouseDrag: " + evt); |
---|
| 16780 | + System.out.println("mouseDrag: " + evt); |
---|
| 16781 | + System.exit(0); |
---|
16717 | 16782 | /* |
---|
16718 | 16783 | drag = true; |
---|
16719 | 16784 | //System.out.println("Mouse DRAG"); |
---|
.. | .. |
---|
16832 | 16897 | public boolean mouseUp(Event evt, int x, int y) |
---|
16833 | 16898 | { |
---|
16834 | 16899 | System.out.println("mouseUp: " + evt); |
---|
| 16900 | + System.exit(0); |
---|
16835 | 16901 | /* |
---|
16836 | 16902 | locked = false; |
---|
16837 | 16903 | if (isRenderer) |
---|
.. | .. |
---|
17102 | 17168 | return; |
---|
17103 | 17169 | } |
---|
17104 | 17170 | |
---|
17105 | | - if (WIREFRAME) |
---|
| 17171 | + //if (WIREFRAME) |
---|
17106 | 17172 | gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL); |
---|
17107 | 17173 | |
---|
17108 | 17174 | gl.glDisable(gl.GL_CULL_FACE); |
---|
.. | .. |
---|
17202 | 17268 | |
---|
17203 | 17269 | if (WIREFRAME) |
---|
17204 | 17270 | gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE); |
---|
| 17271 | + else |
---|
| 17272 | + gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL); |
---|
17205 | 17273 | } |
---|
17206 | 17274 | |
---|
17207 | 17275 | private void DrawChecker(GL gl) |
---|
.. | .. |
---|
18206 | 18274 | |
---|
18207 | 18275 | private boolean keepshadow; |
---|
18208 | 18276 | |
---|
18209 | | - public boolean capsLocked = false; // VR |
---|
| 18277 | + static public boolean capsLocked = false; // VR |
---|
18210 | 18278 | |
---|
18211 | 18279 | static public int indexcount = 0; |
---|
18212 | 18280 | /*static*/ cColor vertexOcclusion = new cColor(); |
---|