Normand Briere
2019-10-04 57c5b6cd8d12ffdaa3e0b099451e3c031012750a
CameraPane.java
....@@ -1,4 +1,5 @@
11
2
+import com.bulletphysics.dynamics.RigidBody;
23 import java.awt.*;
34 import java.awt.event.*;
45 import java.awt.image.*;
....@@ -123,7 +124,7 @@
123124 static boolean LOCALTRANSFORM = false;
124125 static boolean FULLSCREEN = false;
125126 static boolean SUPPORT = true;
126
-static boolean INERTIA = true;
127
+static boolean INERTIA = false; // true;
127128 static boolean FAST = false;
128129 static boolean SLOWPOSE = false;
129130 static boolean FOOTCONTACT = true;
....@@ -134,7 +135,7 @@
134135 static boolean ZOOMBOXMODE = false;
135136 static boolean BOXMODE = false;
136137 static boolean IMAGEFLIP = false;
137
-static boolean SMOOTHFOCUS = false;
138
+static boolean SMOOTHFOCUS = true; // false;
138139 static boolean SPEAKERMOCAP = true; // jan 2014 false;
139140 static boolean SPEAKERCAMERA = false;
140141 static boolean SPEAKERFOCUS = false;
....@@ -174,7 +175,7 @@
174175 boolean Udebug = false;
175176 boolean Vdebug = false;
176177 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
178179 boolean anisotropy = true;
179180 boolean softshadow = true; // slower but better false;
180181 boolean opacityhalo = false; // reverse the halo effect (e.g. glass)
....@@ -221,10 +222,10 @@
221222 cameras = new Camera[2];
222223 targetLookAts = new cVector[2];
223224
224
- SetCamera(cam);
225
+ SetCamera(cam, true);
225226
226227 // Warning: not used.
227
- SetLight(new Camera(new cVector(15, 10, -20)));
228
+ //SetLight(new Camera(new cVector(15, 10, -20)));
228229
229230 object = o;
230231
....@@ -249,7 +250,7 @@
249250
250251 public javax.media.opengl.GL GetGL0()
251252 {
252
- return null;
253
+ return currentGL;
253254 }
254255
255256 public int GenList()
....@@ -1529,7 +1530,7 @@
15291530 }
15301531 }
15311532 float b = 0;
1532
- if (obj.support != null && obj.link2master)
1533
+ if (obj.support != null && obj.Link2Support())
15331534 {
15341535 b = 1;
15351536 }
....@@ -2064,7 +2065,7 @@
20642065
20652066 static int camerachangeframe;
20662067
2067
- public boolean SetCamera(Camera cam)
2068
+ public boolean SetCamera(Camera cam, boolean set)
20682069 {
20692070 // may 2014 if (cam == cameras[0] || cam == cameras[1])
20702071 // return false;
....@@ -2093,11 +2094,14 @@
20932094 {
20942095 cameras[i] = new Camera(cam.viewCode);
20952096 }
2096
-
2097
- cameras[i].setAim(cam.location, cam.lookAt);
2098
- cameras[i].shaper_fovy = cam.shaper_fovy;
2099
- cameras[i].UP.set(cam.UP);
2100
- 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
+ }
21012105 }
21022106 cameracount = 0;
21032107 targetLookAt = targetLookAts[cameracount];
....@@ -2106,7 +2110,7 @@
21062110 // Start with free camera
21072111 SwitchCameras(true);
21082112
2109
- pingthread.jump = true; // optional?
2113
+// pingthread.jump = true; // optional?
21102114
21112115 if (TRACKONCE)
21122116 {
....@@ -2293,18 +2297,6 @@
22932297 public void ToggleTrack()
22942298 {
22952299 TRACK ^= true;
2296
- if (TRACK)
2297
- {
2298
- if (object.selection != null &&
2299
- object.selection.size() > 0 &&
2300
- object.selection.elementAt(0) != null &&
2301
- !(object.selection.elementAt(0) instanceof Camera) &&
2302
- !(object.selection.elementAt(0) instanceof ScriptNode))
2303
- {
2304
- trackedobject = object.selection.elementAt(0);
2305
- repaint();
2306
- }
2307
- }
23082300
23092301 repaint();
23102302 }
....@@ -3598,6 +3590,8 @@
35983590 };
35993591 /**/
36003592
3593
+ static Object3D lastObject;
3594
+
36013595 //com.sun.opengl.util.texture.Texture
36023596 TextureData
36033597 GetFileTexture(String name, boolean bump, int resolution)
....@@ -3634,6 +3628,8 @@
36343628 // return null;
36353629 //if (i == 2)
36363630 // return null;
3631
+ // TIFF issue sept 2019
3632
+ System.err.println("lastObject = " + lastObject);
36373633 e.printStackTrace();
36383634 name = name.split("\\.tif")[0] + ".jpg";
36393635 }
....@@ -6966,30 +6962,30 @@
69666962 short residu = 0;
69676963
69686964 // wraparound workarounds
6969
- short fuck = (short) (buffer[i] & 0xFF);
6965
+ short ww = (short) (buffer[i] & 0xFF);
69706966 /*
6971
- residu += (fuck%2);
6972
- if(fuck/2 < 256-residu/2)
6967
+ residu += (ww%2);
6968
+ if(ww/2 < 256-residu/2)
69736969 {
6974
- fuck = (short)((fuck/2) + residu/2);
6970
+ ww = (short)((ww/2) + residu/2);
69756971 if(residu == 2)
69766972 residu = 0;
69776973 }
69786974 else
69796975 {
69806976 residu = 0;
6981
- fuck /= 2;
6977
+ ww /= 2;
69826978 }
69836979 */
6984
- if (i < imglength / 3 || rnd.nextFloat() < 0.5 || fuck >= 254)
6980
+ if (i < imglength / 3 || rnd.nextFloat() < 0.5 || ww >= 254)
69856981 {
6986
- fuck /= 2;
6982
+ ww /= 2;
69876983 } else
69886984 {
6989
- fuck = (short) ((fuck / 2) + fuck % 2);
6985
+ ww = (short) ((ww / 2) + ww % 2);
69906986 }
69916987
6992
- buffer[i] = (byte) fuck;
6988
+ buffer[i] = (byte) ww;
69936989 }
69946990 //System.out.print(bytes[i] + " ");
69956991 //if(buffer[i] >= 0 && buffer[i]<=eps-1) buffer[i] = eps;
....@@ -8456,12 +8452,12 @@
84568452 {
84578453 // texturecache = textures.get(texname); // suspicious
84588454 if (texturecache == null)
8459
- texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
8455
+ texturecache = new CacheTexture(GetResourceTexture("whitenoise.jpg", bump),resolution);
84608456 else
84618457 new Exception().printStackTrace();
84628458 } else
84638459 {
8464
- if (texname.startsWith("@"))
8460
+ if (texname.startsWith("@") && textureon)
84658461 {
84668462 // texturecache = textures.get(texname); // suspicious
84678463 if (texturecache == null)
....@@ -9847,7 +9843,7 @@
98479843
98489844 boolean vr = capsLocked && !lightMode;
98499845
9850
- accPerspective(gl, renderCamera.shaper_fovy / ratio * (vr ? 2 : 1),
9846
+ accPerspective(gl, renderCamera.shaper_fovy / ratio * (vr ? 1.2 : 1),
98519847 ratio,
98529848 //near_plane, far_plane,
98539849 renderCamera.shaper_zNear * renderCamera.Distance(), renderCamera.shaper_zFar * renderCamera.Distance(),
....@@ -10765,7 +10761,9 @@
1076510761 }
1076610762 /**/
1076710763
10768
- if (selection)
10764
+ boolean control = ((modifiers & CTRL) != 0);
10765
+
10766
+ if (selection && (!Globals.isLIVE() || control))
1076910767 {
1077010768 selectbuffer.display();
1077110769 return;
....@@ -10867,30 +10865,59 @@
1086710865
1086810866 if (keys[DOWN_ARROW])
1086910867 {
10868
+ speed = ++speedkey[DOWN_ARROW];
10869
+ if (speed > 20)
10870
+ speed = 20;
1087010871 GoDown(modifiers);
1087110872 keyon = true;
1087210873 }
10874
+ else
10875
+ speedkey[DOWN_ARROW] = 0;
1087310876
1087410877 if (keys[UP_ARROW])
1087510878 {
10879
+ speed = ++speedkey[UP_ARROW];
10880
+ if (speed > 20)
10881
+ speed = 20;
1087610882 GoUp(modifiers);
1087710883 keyon = true;
1087810884 }
10885
+ else
10886
+ speedkey[UP_ARROW] = 0;
1087910887
1088010888 if (keys[LEFT_ARROW])
1088110889 {
10890
+ speed = ++speedkey[LEFT_ARROW];
10891
+ if (speed > 20)
10892
+ speed = 20;
1088210893 GoLeft(modifiers);
1088310894 keyon = true;
1088410895 }
10896
+ else
10897
+ speedkey[LEFT_ARROW] = 0;
1088510898
1088610899 if (keys[RIGHT_ARROW])
1088710900 {
10901
+ speed = ++speedkey[RIGHT_ARROW];
10902
+ if (speed > 20)
10903
+ speed = 20;
1088810904 GoRight(modifiers);
10905
+ keyon = true;
10906
+ }
10907
+ else
10908
+ speedkey[RIGHT_ARROW] = 0;
10909
+
10910
+ if (Globals.WALK && capsLocked)
10911
+ {
10912
+ Walk();
1088910913 keyon = true;
1089010914 }
1089110915
1089210916 if (keyon)
10917
+ {
1089310918 repaint();
10919
+ }
10920
+
1089410921 //pingthread.mute = false;
1089510922 }
1089610923
....@@ -11483,7 +11510,8 @@
1148311510 {
1148411511 boolean vr = capsLocked && !lightMode;
1148511512
11486
- glu.gluPerspective(cam.shaper_fovy / ratio * (vr ? 2 : 1), ratio, cam.shaper_zNear * cam.Distance(), cam.shaper_zFar * cam.Distance());
11513
+ glu.gluPerspective(cam.shaper_fovy / ratio * (vr ? 1.2 : 1),
11514
+ ratio, cam.shaper_zNear * cam.Distance(), cam.shaper_zFar * cam.Distance());
1148711515 }
1148811516 }
1148911517
....@@ -11839,8 +11867,11 @@
1183911867 repaint();
1184011868 }
1184111869
11842
- if (Globals.isLIVE() && DrawMode() == DEFAULT) // may 2013
11870
+ if (Globals.isLIVE() && DrawMode() == DEFAULT || pingthread.live) // may 2013
11871
+ {
11872
+ renderCamera.computeTransform();
1184311873 repaint();
11874
+ }
1184411875
1184511876 displaydone = true;
1184611877 }
....@@ -11915,9 +11946,23 @@
1191511946 //GL gl = getGL();
1191611947 if ((TRACK || SHADOWTRACK) || zoomonce)
1191711948 {
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
+ }
1191811963 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
1191911964 object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11920
- pingthread.StepToTarget(true); // true);
11965
+ pingthread.StepToTarget(); // true);
1192111966 // zoomonce = false;
1192211967 }
1192311968
....@@ -14298,6 +14343,7 @@
1429814343 public void mouseClicked(MouseEvent e)
1429914344 {
1430014345 System.out.println("mouseClicked: " + e);
14346
+ System.exit(0);
1430114347 }
1430214348
1430314349 public void mousePressed(MouseEvent e)
....@@ -14382,7 +14428,7 @@
1438214428 //}
1438314429
1438414430 SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
14385
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
14431
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, e.getModifiers(), e.getModifiersEx());
1438614432 anchorX = ax;
1438714433 anchorY = ay;
1438814434 prevX = px;
....@@ -14477,8 +14523,9 @@
1447714523 // fev 2014???
1447814524 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
1447914525 object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
14480
- pingthread.StepToTarget(true); // true);
14526
+ pingthread.StepToTarget(); // true);
1448114527 }
14528
+
1448214529 // if (!LIVE)
1448314530 super.repaint();
1448414531 }
....@@ -14573,8 +14620,8 @@
1457314620
1457414621 //if (drawing)
1457514622 //return;
14576
- if ((e.getModifiersEx() & CTRL) != 0
14577
- || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
14623
+ if ((e.getModifiersEx() & CTRL) != 0 ||
14624
+ (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
1457814625 {
1457914626 //System.out.println("mouseDragged: " + e);
1458014627 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
....@@ -14598,11 +14645,17 @@
1459814645 return targetLookAt;
1459914646 }
1460014647
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
+
1460114653 class PingThread extends Thread
1460214654 {
1460314655 boolean jump;
14656
+ boolean live;
1460414657
14605
- boolean mute;
14658
+ boolean mute = false;
1460614659
1460714660 // void JumpToTarget()
1460814661 // {
....@@ -14618,8 +14671,94 @@
1461814671 // only one thread!? synchronized
1461914672 void StepToTarget(boolean jump)
1462014673 {
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
+
1462114696 if (mute)
1462214697 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
+ }
1462314762
1462414763 tmp.set(targetLookAt);
1462514764 tmp.sub(manipCamera.lookAt); // june 2014
....@@ -14658,7 +14797,7 @@
1465814797
1465914798 if (tmp.dot(tmp) > 1) // may 2014. far away: jump to target
1466014799 {
14661
- jump = true; // step = 1;
14800
+ // sep 2019 jump = true; // step = 1;
1466214801 }
1466314802
1466414803 if (OEILONCE && OEIL)
....@@ -14693,7 +14832,10 @@
1469314832 if (tmp.dot(tmp) < 0.00001)
1469414833 {
1469514834 zoomonce = false;
14835
+ live = false;
1469614836 }
14837
+ else
14838
+ live = true;
1469714839
1469814840 tmp.mul(step > step2 ? step : step2);
1469914841 }
....@@ -14720,7 +14862,7 @@
1472014862 {
1472114863 if (LOOKAT)
1472214864 manipCamera.lookAt.add(tmp);
14723
- if (OEIL)
14865
+ if (OEIL && !capsLocked)
1472414866 manipCamera.location.add(tmp);
1472514867
1472614868 {
....@@ -14735,7 +14877,10 @@
1473514877 lightCamera.computeTransform();
1473614878 }
1473714879 }
14738
- manipCamera.computeTransform();
14880
+ if (tmp.x != 0 || tmp.y != 0 || tmp.z != 0)
14881
+ {
14882
+ manipCamera.computeTransform();
14883
+ }
1473914884 }
1474014885 // ?????? mouseDown = true;
1474114886 //System.out.println("---------------- ---------- Paint " + tmp.length2());
....@@ -14828,11 +14973,32 @@
1482814973 }
1482914974 }
1483014975 }
14976
+
1483114977 PingThread pingthread = new PingThread();
14832
- int delta = 2;
14833
- int speed = 5;
14978
+ int delta = 1;
14979
+ int speed = 1;
14980
+ int walk = 8;
1483414981 boolean autorepeat = false;
1483514982
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
+
1483615002 void GoDown(int mod)
1483715003 {
1483815004 MODIFIERS |= COMMAND;
....@@ -14840,21 +15006,30 @@
1484015006 /**/
1484115007 if((mod&SHIFT) == SHIFT)
1484215008 {
15009
+// if (isVR)
15010
+// manipCamera.RotateInterest(0, speed);
15011
+// else
1484315012 if (isVR)
14844
- 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());
1484515021 else
1484615022 manipCamera.RotatePosition(0, -speed);
1484715023 }
14848
- else
14849
- manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth());
15024
+
1485015025 /**/
14851
- if ((mod & SHIFT) == SHIFT)
14852
- {
14853
- mouseMode = mouseMode; // VR??
14854
- } else
14855
- {
14856
- mouseMode |= BACKFORTH;
14857
- }
15026
+// if ((mod & SHIFT) == SHIFT)
15027
+// {
15028
+// mouseMode = mouseMode; // VR??
15029
+// } else
15030
+// {
15031
+// mouseMode |= BACKFORTH;
15032
+// }
1485815033
1485915034 targetLookAt.set(manipCamera.lookAt);
1486015035
....@@ -14864,27 +15039,38 @@
1486415039
1486515040 void GoUp(int mod)
1486615041 {
15042
+ RigidBody.justclicked = true;
15043
+
1486715044 MODIFIERS |= COMMAND;
1486815045 /**/
1486915046 boolean isVR = (mouseMode&VR)!=0;
1487015047
1487115048 if((mod&SHIFT) == SHIFT)
1487215049 {
15050
+// if (isVR)
15051
+// manipCamera.RotateInterest(0, -speed);
15052
+// else
1487315053 if (isVR)
14874
- 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());
1487515062 else
1487615063 manipCamera.RotatePosition(0, speed);
1487715064 }
14878
- else
14879
- manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth());
15065
+
1488015066 /**/
14881
- if ((mod & SHIFT) == SHIFT)
14882
- {
14883
- mouseMode = mouseMode;
14884
- } else
14885
- {
14886
- mouseMode |= BACKFORTH;
14887
- }
15067
+// if ((mod & SHIFT) == SHIFT)
15068
+// {
15069
+// mouseMode = mouseMode;
15070
+// } else
15071
+// {
15072
+// mouseMode |= BACKFORTH;
15073
+// }
1488815074
1488915075 targetLookAt.set(manipCamera.lookAt);
1489015076
....@@ -14897,22 +15083,23 @@
1489715083 MODIFIERS |= COMMAND;
1489815084 /**/
1489915085 if((mod&SHIFT) == SHIFT)
14900
- manipCamera.Translate(speed*delta, 0, getWidth());
15086
+ manipCamera.Translate(speed, 0, getWidth());
1490115087 else
1490215088 {
1490315089 if ((mouseMode&VR)!=0)
14904
- manipCamera.RotateInterest(-speed, 0);
15090
+ manipCamera.RotateInterest(-speed*manipCamera.shaper_fovy/90, 0);
1490515091 else
14906
- manipCamera.RotatePosition(speed, 0);
15092
+ manipCamera.RotatePosition(speed*manipCamera.shaper_fovy/90, 0);
1490715093 }
15094
+
1490815095 /**/
14909
- if ((mod & SHIFT) == SHIFT)
14910
- {
14911
- mouseMode = mouseMode;
14912
- } else
14913
- {
14914
- mouseMode |= ROTATE;
14915
- } // TRANSLATE;
15096
+// if ((mod & SHIFT) == SHIFT)
15097
+// {
15098
+// mouseMode = mouseMode;
15099
+// } else
15100
+// {
15101
+// mouseMode |= ROTATE;
15102
+// } // TRANSLATE;
1491615103
1491715104 //System.err.println("lookAt = " + manipCamera.lookAt);
1491815105 //System.err.println("location = " + manipCamera.location);
....@@ -14928,23 +15115,23 @@
1492815115 MODIFIERS |= COMMAND;
1492915116 /**/
1493015117 if((mod&SHIFT) == SHIFT)
14931
- manipCamera.Translate(-speed*delta, 0, getWidth());
15118
+ manipCamera.Translate(-speed, 0, getWidth());
1493215119 else
1493315120 {
1493415121 if ((mouseMode&VR)!=0)
14935
- manipCamera.RotateInterest(speed, 0);
15122
+ manipCamera.RotateInterest(speed*manipCamera.shaper_fovy/90, 0);
1493615123 else
14937
- manipCamera.RotatePosition(-speed, 0);
15124
+ manipCamera.RotatePosition(-speed*manipCamera.shaper_fovy/90, 0);
1493815125 }
1493915126
1494015127 /**/
14941
- if ((mod & SHIFT) == SHIFT)
14942
- {
14943
- mouseMode = mouseMode;
14944
- } else
14945
- {
14946
- mouseMode |= ROTATE;
14947
- } // TRANSLATE;
15128
+// if ((mod & SHIFT) == SHIFT)
15129
+// {
15130
+// mouseMode = mouseMode;
15131
+// } else
15132
+// {
15133
+// mouseMode |= ROTATE;
15134
+// } // TRANSLATE;
1494815135
1494915136 targetLookAt.set(manipCamera.lookAt);
1495015137
....@@ -15081,6 +15268,11 @@
1508115268 if ((mouseMode & ZOOM) != 0)
1508215269 {
1508315270 //if ((mouseMode & BACKFORTH) != 0)
15271
+ if ((modifiersex & SHIFT) == SHIFT)
15272
+ {
15273
+ ViewAngle(dy);
15274
+ }
15275
+ else
1508415276 if ((mouseMode & VR) != 0)
1508515277 manipCamera.BackForth(dx, dy, getWidth());
1508615278 else
....@@ -15151,6 +15343,9 @@
1515115343
1515215344 public void mouseMoved(MouseEvent e)
1515315345 {
15346
+//object.editWindow.frame.
15347
+ setCursor(Cursor.getDefaultCursor());
15348
+
1515415349 //System.out.println("mouseMoved: " + e);
1515515350 if (isRenderer)
1515615351 return;
....@@ -15179,6 +15374,12 @@
1517915374
1518015375 public void mouseReleased(MouseEvent e)
1518115376 {
15377
+ if (isRenderer && !movingcamera)
15378
+ {
15379
+ RigidBody.justclicked = true;
15380
+ System.out.println("justclicked: " + e);
15381
+ }
15382
+
1518215383 Globals.MOUSEDRAGGED = false;
1518315384
1518415385 movingcamera = false;
....@@ -15350,7 +15551,8 @@
1535015551 {
1535115552 mouseMode |= SELECT;
1535215553 }
15353
- if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
15554
+ if (//(modifiersex & SHIFT) == SHIFT ||
15555
+ forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1535415556 {
1535515557 mouseMode &= ~VR;
1535615558 mouseMode |= TRANSLATE;
....@@ -15394,8 +15596,18 @@
1539415596 float SATPOW = 1; // 2; // 0.5f;
1539515597 float BRIPOW = 1; // 0.5f; // 0.5f;
1539615598
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
+
1539715605 public void keyPressed(int key)
1539815606 {
15607
+// Set the blank cursor to the JFrame.
15608
+//object.editWindow.frame.
15609
+ setCursor(blankCursor);
15610
+
1539915611 if (key >= '0' && key <= '5')
1540015612 clampbit = (key-'0');
1540115613
....@@ -15712,6 +15924,16 @@
1571215924 break;
1571315925 case 'l':
1571415926 lightMode ^= true;
15927
+ if (lightMode)
15928
+ {
15929
+ keepshadow = Globals.RENDERSHADOW;
15930
+ Globals.RENDERSHADOW = false;
15931
+ }
15932
+ else
15933
+ {
15934
+ Globals.RENDERSHADOW = keepshadow;
15935
+ }
15936
+
1571515937 Globals.lighttouched = true;
1571615938 manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
1571715939 targetLookAt.set(manipCamera.lookAt);
....@@ -15761,6 +15983,10 @@
1576115983 case ENTER:
1576215984 // object.editWindow.ScreenFit(); // Edit();
1576315985 ToggleLive();
15986
+ if (capsLocked)
15987
+ {
15988
+ Globals.WALK ^= true;
15989
+ }
1576415990 break;
1576515991 case DELETE:
1576615992 ClearSelection();
....@@ -15797,17 +16023,23 @@
1579716023 object.GetWindow().refreshContents(true);
1579816024 break;
1579916025 case '{':
15800
- manipCamera.shaper_fovy /= 1.1;
16026
+ double factor = 1.1;
16027
+ if (manipCamera.shaper_fovy / factor > 0.1)
16028
+ manipCamera.shaper_fovy /= factor;
1580116029 System.out.println("FOV = " + manipCamera.shaper_fovy);
1580216030 repaint();
1580316031 break;
1580416032 case '}':
15805
- manipCamera.shaper_fovy *= 1.1;
16033
+ factor = 1.1;
16034
+ if (manipCamera.shaper_fovy * factor < 150)
16035
+ manipCamera.shaper_fovy *= factor;
1580616036 System.out.println("FOV = " + manipCamera.shaper_fovy);
1580716037 repaint();
1580816038 break;
1580916039 case '[':
15810
- manipCamera.shaper_fovy /= 1.01;
16040
+ factor = 1.01;
16041
+ if (manipCamera.shaper_fovy / factor > 0.1)
16042
+ manipCamera.shaper_fovy /= factor;
1581116043 if (false) //manipCamera.hAspect == 0)
1581216044 {
1581316045 double x = Math.tan(manipCamera.shaper_fovy * Math.PI / 180 / 2);
....@@ -15823,7 +16055,9 @@
1582316055 break;
1582416056 case ']':
1582516057 //manipCamera.shaper_fovy += (180 - manipCamera.shaper_fovy)*0.1;
15826
- manipCamera.shaper_fovy *= 1.01;
16058
+ factor = 1.01;
16059
+ if (manipCamera.shaper_fovy * factor < 150)
16060
+ manipCamera.shaper_fovy *= factor;
1582716061 if (false) //manipCamera.hAspect == 0)
1582816062 {
1582916063 double x = Math.tan(manipCamera.shaper_fovy * Math.PI / 180 / 2);
....@@ -15862,6 +16096,7 @@
1586216096 }
1586316097
1586416098 boolean keys[] = new boolean[256];
16099
+ int speedkey[] = new int[256];
1586516100 int modifiers = 0;
1586616101
1586716102 public void processKeyEvent(KeyEvent e)
....@@ -16542,7 +16777,8 @@
1654216777
1654316778 public boolean mouseDrag(Event evt, int x, int y)
1654416779 {
16545
- //System.out.println("mouseDrag: " + evt);
16780
+ System.out.println("mouseDrag: " + evt);
16781
+ System.exit(0);
1654616782 /*
1654716783 drag = true;
1654816784 //System.out.println("Mouse DRAG");
....@@ -16661,6 +16897,7 @@
1666116897 public boolean mouseUp(Event evt, int x, int y)
1666216898 {
1666316899 System.out.println("mouseUp: " + evt);
16900
+ System.exit(0);
1666416901 /*
1666516902 locked = false;
1666616903 if (isRenderer)
....@@ -16931,7 +17168,7 @@
1693117168 return;
1693217169 }
1693317170
16934
- if (WIREFRAME)
17171
+ //if (WIREFRAME)
1693517172 gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL);
1693617173
1693717174 gl.glDisable(gl.GL_CULL_FACE);
....@@ -17031,6 +17268,8 @@
1703117268
1703217269 if (WIREFRAME)
1703317270 gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE);
17271
+ else
17272
+ gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL);
1703417273 }
1703517274
1703617275 private void DrawChecker(GL gl)
....@@ -17368,7 +17607,7 @@
1736817607
1736917608 float depth = depths[y * TEX_SIZE + x];
1737017609
17371
- if (pointselection && mouseMode == SELECT && depth != 0 && depth != 1)
17610
+ if (pointselection && (mouseMode & SELECT) == SELECT && depth != 0 && depth != 1)
1737217611 {
1737317612 pointselection = false;
1737417613
....@@ -18033,7 +18272,9 @@
1803318272 boolean OCCLUSION_CULLING = false; //true;
1803418273 public boolean lightMode = false;
1803518274
18036
- public boolean capsLocked = false; // VR
18275
+ private boolean keepshadow;
18276
+
18277
+ static public boolean capsLocked = false; // VR
1803718278
1803818279 static public int indexcount = 0;
1803918280 /*static*/ cColor vertexOcclusion = new cColor();