.. | .. |
---|
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.*; |
---|
.. | .. |
---|
1529 | 1530 | } |
---|
1530 | 1531 | } |
---|
1531 | 1532 | float b = 0; |
---|
1532 | | - if (obj.support != null && obj.link2support) |
---|
| 1533 | + if (obj.support != null && obj.link2master) |
---|
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; |
---|
.. | .. |
---|
11865 | 11866 | } |
---|
11866 | 11867 | |
---|
11867 | 11868 | if (Globals.isLIVE() && DrawMode() == DEFAULT || pingthread.live) // may 2013 |
---|
| 11869 | + { |
---|
| 11870 | + renderCamera.computeTransform(); |
---|
11868 | 11871 | repaint(); |
---|
| 11872 | + } |
---|
11869 | 11873 | |
---|
11870 | 11874 | displaydone = true; |
---|
11871 | 11875 | } |
---|
.. | .. |
---|
14337 | 14341 | public void mouseClicked(MouseEvent e) |
---|
14338 | 14342 | { |
---|
14339 | 14343 | System.out.println("mouseClicked: " + e); |
---|
| 14344 | + System.exit(0); |
---|
14340 | 14345 | } |
---|
14341 | 14346 | |
---|
14342 | 14347 | public void mousePressed(MouseEvent e) |
---|
14343 | 14348 | { |
---|
| 14349 | + RigidBody.justclicked = true; |
---|
| 14350 | + System.out.println("justclicked: " + e); |
---|
14344 | 14351 | //System.out.println("mousePressed: " + e); |
---|
14345 | 14352 | clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
14346 | 14353 | } |
---|
.. | .. |
---|
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; |
---|
.. | .. |
---|
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 | + RigidBody.wind.set(RigidBody.pos); |
---|
| 14683 | + RigidBody.wind.x -= (float)manipCamera.location.x; |
---|
| 14684 | + RigidBody.wind.y -= (float)manipCamera.location.y; |
---|
| 14685 | + RigidBody.wind.z -= (float)manipCamera.location.z; |
---|
| 14686 | + RigidBody.wind.normalize(); |
---|
| 14687 | + } |
---|
| 14688 | + |
---|
14667 | 14689 | if (mute) |
---|
14668 | 14690 | return; |
---|
14669 | 14691 | |
---|
14670 | | - if (capsLocked) |
---|
| 14692 | + if (capsLocked && manipCamera.viewCode == 0) |
---|
14671 | 14693 | { |
---|
14672 | 14694 | eye.x = manipCamera.location.x; |
---|
14673 | 14695 | eye.y = manipCamera.location.y + 0.25; |
---|
.. | .. |
---|
14958 | 14980 | targetLookAt.set(manipCamera.lookAt); |
---|
14959 | 14981 | } |
---|
14960 | 14982 | |
---|
| 14983 | + void ViewAngle(float dy) |
---|
| 14984 | + { |
---|
| 14985 | + double factor = Math.exp(-dy/300.0); // (1 + dy/100); |
---|
| 14986 | + |
---|
| 14987 | + if (manipCamera.shaper_fovy * factor > 1 && |
---|
| 14988 | + manipCamera.shaper_fovy * factor < 150) |
---|
| 14989 | + { |
---|
| 14990 | + manipCamera.shaper_fovy *= factor; |
---|
| 14991 | + //System.out.println("fovy = " + shaper_fovy); |
---|
| 14992 | + } |
---|
| 14993 | + } |
---|
| 14994 | + |
---|
14961 | 14995 | void GoDown(int mod) |
---|
14962 | 14996 | { |
---|
14963 | 14997 | MODIFIERS |= COMMAND; |
---|
.. | .. |
---|
14968 | 15002 | // if (isVR) |
---|
14969 | 15003 | // manipCamera.RotateInterest(0, speed); |
---|
14970 | 15004 | // else |
---|
| 15005 | + if (isVR) |
---|
| 15006 | + ViewAngle(-speed*delta); |
---|
| 15007 | + else |
---|
14971 | 15008 | manipCamera.Translate(0, -speed*delta, getWidth()); |
---|
14972 | 15009 | } |
---|
14973 | 15010 | else |
---|
.. | .. |
---|
14995 | 15032 | |
---|
14996 | 15033 | void GoUp(int mod) |
---|
14997 | 15034 | { |
---|
| 15035 | + RigidBody.justclicked = true; |
---|
| 15036 | + |
---|
14998 | 15037 | MODIFIERS |= COMMAND; |
---|
14999 | 15038 | /**/ |
---|
15000 | 15039 | boolean isVR = (mouseMode&VR)!=0; |
---|
.. | .. |
---|
15004 | 15043 | // if (isVR) |
---|
15005 | 15044 | // manipCamera.RotateInterest(0, -speed); |
---|
15006 | 15045 | // else |
---|
| 15046 | + if (isVR) |
---|
| 15047 | + ViewAngle(speed*delta); |
---|
| 15048 | + else |
---|
15007 | 15049 | manipCamera.Translate(0, speed*delta, getWidth()); |
---|
15008 | 15050 | } |
---|
15009 | 15051 | else |
---|
.. | .. |
---|
15034 | 15076 | MODIFIERS |= COMMAND; |
---|
15035 | 15077 | /**/ |
---|
15036 | 15078 | if((mod&SHIFT) == SHIFT) |
---|
15037 | | - manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
| 15079 | + manipCamera.Translate(speed, 0, getWidth()); |
---|
15038 | 15080 | else |
---|
15039 | 15081 | { |
---|
15040 | 15082 | if ((mouseMode&VR)!=0) |
---|
15041 | | - manipCamera.RotateInterest(-speed, 0); |
---|
| 15083 | + manipCamera.RotateInterest(-speed*manipCamera.shaper_fovy/90, 0); |
---|
15042 | 15084 | else |
---|
15043 | | - manipCamera.RotatePosition(speed, 0); |
---|
| 15085 | + manipCamera.RotatePosition(speed*manipCamera.shaper_fovy/90, 0); |
---|
15044 | 15086 | } |
---|
15045 | 15087 | |
---|
15046 | 15088 | /**/ |
---|
.. | .. |
---|
15066 | 15108 | MODIFIERS |= COMMAND; |
---|
15067 | 15109 | /**/ |
---|
15068 | 15110 | if((mod&SHIFT) == SHIFT) |
---|
15069 | | - manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
| 15111 | + manipCamera.Translate(-speed, 0, getWidth()); |
---|
15070 | 15112 | else |
---|
15071 | 15113 | { |
---|
15072 | 15114 | if ((mouseMode&VR)!=0) |
---|
15073 | | - manipCamera.RotateInterest(speed, 0); |
---|
| 15115 | + manipCamera.RotateInterest(speed*manipCamera.shaper_fovy/90, 0); |
---|
15074 | 15116 | else |
---|
15075 | | - manipCamera.RotatePosition(-speed, 0); |
---|
| 15117 | + manipCamera.RotatePosition(-speed*manipCamera.shaper_fovy/90, 0); |
---|
15076 | 15118 | } |
---|
15077 | 15119 | |
---|
15078 | 15120 | /**/ |
---|
.. | .. |
---|
15219 | 15261 | if ((mouseMode & ZOOM) != 0) |
---|
15220 | 15262 | { |
---|
15221 | 15263 | //if ((mouseMode & BACKFORTH) != 0) |
---|
| 15264 | + if ((modifiersex & SHIFT) == SHIFT) |
---|
| 15265 | + { |
---|
| 15266 | + ViewAngle(dy); |
---|
| 15267 | + } |
---|
| 15268 | + else |
---|
15222 | 15269 | if ((mouseMode & VR) != 0) |
---|
15223 | 15270 | manipCamera.BackForth(dx, dy, getWidth()); |
---|
15224 | 15271 | else |
---|
.. | .. |
---|
16717 | 16764 | |
---|
16718 | 16765 | public boolean mouseDrag(Event evt, int x, int y) |
---|
16719 | 16766 | { |
---|
16720 | | - //System.out.println("mouseDrag: " + evt); |
---|
| 16767 | + System.out.println("mouseDrag: " + evt); |
---|
| 16768 | + System.exit(0); |
---|
16721 | 16769 | /* |
---|
16722 | 16770 | drag = true; |
---|
16723 | 16771 | //System.out.println("Mouse DRAG"); |
---|
.. | .. |
---|
16836 | 16884 | public boolean mouseUp(Event evt, int x, int y) |
---|
16837 | 16885 | { |
---|
16838 | 16886 | System.out.println("mouseUp: " + evt); |
---|
| 16887 | + System.exit(0); |
---|
16839 | 16888 | /* |
---|
16840 | 16889 | locked = false; |
---|
16841 | 16890 | if (isRenderer) |
---|
.. | .. |
---|
18210 | 18259 | |
---|
18211 | 18260 | private boolean keepshadow; |
---|
18212 | 18261 | |
---|
18213 | | - public boolean capsLocked = false; // VR |
---|
| 18262 | + static public boolean capsLocked = false; // VR |
---|
18214 | 18263 | |
---|
18215 | 18264 | static public int indexcount = 0; |
---|
18216 | 18265 | /*static*/ cColor vertexOcclusion = new cColor(); |
---|