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.*;
....@@ -113,6 +114,8 @@
113114 /*static*/ com.sun.opengl.util.texture.Texture cubemap; // Either custom or rgb
114115 /*static*/ com.sun.opengl.util.texture.Texture cubemapcustom;
115116 /*static*/ com.sun.opengl.util.texture.Texture cubemaprgb;
117
+ boolean transformMode;
118
+
116119 boolean reverseUP = false;
117120 static boolean frozen = false;
118121 boolean enablebackspace = false; // patch for back buffer refresh
....@@ -121,7 +124,7 @@
121124 static boolean LOCALTRANSFORM = false;
122125 static boolean FULLSCREEN = false;
123126 static boolean SUPPORT = true;
124
-static boolean INERTIA = true;
127
+static boolean INERTIA = false; // true;
125128 static boolean FAST = false;
126129 static boolean SLOWPOSE = false;
127130 static boolean FOOTCONTACT = true;
....@@ -132,7 +135,7 @@
132135 static boolean ZOOMBOXMODE = false;
133136 static boolean BOXMODE = false;
134137 static boolean IMAGEFLIP = false;
135
-static boolean SMOOTHFOCUS = false;
138
+static boolean SMOOTHFOCUS = true; // false;
136139 static boolean SPEAKERMOCAP = true; // jan 2014 false;
137140 static boolean SPEAKERCAMERA = false;
138141 static boolean SPEAKERFOCUS = false;
....@@ -166,13 +169,13 @@
166169
167170
168171 // OPTIONS
169
- boolean Skinshader = true;
172
+ boolean Skinshader = false; // true;
170173 boolean cameraLight = false;
171174 boolean UVdebug = false;
172175 boolean Udebug = false;
173176 boolean Vdebug = false;
174177 boolean NORMALdebug = false;
175
- static boolean doublesided = false; // true; // reversed normals are awful for conformance
178
+ static boolean doublesided = true; // false; // reversed normals are awful for conformance
176179 boolean anisotropy = true;
177180 boolean softshadow = true; // slower but better false;
178181 boolean opacityhalo = false; // reverse the halo effect (e.g. glass)
....@@ -219,10 +222,10 @@
219222 cameras = new Camera[2];
220223 targetLookAts = new cVector[2];
221224
222
- SetCamera(cam);
225
+ SetCamera(cam, true);
223226
224227 // Warning: not used.
225
- SetLight(new Camera(new cVector(15, 10, -20)));
228
+ //SetLight(new Camera(new cVector(15, 10, -20)));
226229
227230 object = o;
228231
....@@ -247,7 +250,7 @@
247250
248251 public javax.media.opengl.GL GetGL0()
249252 {
250
- return null;
253
+ return currentGL;
251254 }
252255
253256 public int GenList()
....@@ -540,7 +543,8 @@
540543 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
541544 LA.vecCross(obj.v0, obj.v1, obj.v2);
542545 LA.vecNormalize(obj.v2);
543
- gl.glNormal3f((float) obj.v2.x, (float) obj.v2.y, (float) obj.v2.z);
546
+
547
+ SetGLNormal(gl, (float) obj.v2.x, (float) obj.v2.y, (float) obj.v2.z);
544548 }
545549
546550 // P
....@@ -562,7 +566,7 @@
562566 y += ny * obj.NORMALPUSH;
563567 z += nz * obj.NORMALPUSH;
564568
565
- gl.glNormal3f(nx, ny, nz);
569
+ SetGLNormal(gl, nx, ny, nz);
566570 }
567571 gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
568572 SetColor(obj, pv);
....@@ -594,7 +598,7 @@
594598 y += ny * obj.NORMALPUSH;
595599 z += nz * obj.NORMALPUSH;
596600
597
- gl.glNormal3f(nx, ny, nz);
601
+ SetGLNormal(gl, nx, ny, nz);
598602 }
599603 //System.out.println("vertexq = " + qv.s + ", " + qv.t);
600604 // boolean locked = false;
....@@ -642,7 +646,7 @@
642646 y += ny * obj.NORMALPUSH;
643647 z += nz * obj.NORMALPUSH;
644648
645
- gl.glNormal3f(nx, ny, nz);
649
+ SetGLNormal(gl, nx, ny, nz);
646650 }
647651
648652 // if ((dot&4) == 0)
....@@ -878,7 +882,7 @@
878882 //// tris.postdraw(this);
879883 }
880884
881
- static Camera localcamera = new Camera();
885
+ static Camera localAOcamera = new Camera();
882886 static cVector from = new cVector();
883887 static cVector to = new cVector();
884888
....@@ -887,7 +891,7 @@
887891 CameraPane cp = this;
888892
889893 Camera keep = cp.RenderCamera();
890
- cp.renderCamera = localcamera;
894
+ cp.renderCamera = localAOcamera;
891895
892896 if (br.trimmed)
893897 {
....@@ -905,7 +909,7 @@
905909 br.positions[i3 + 2] + br.normals[i3 + 2]);
906910 LA.xformPos(from, transform, from);
907911 LA.xformPos(to, transform, to); // RIGID ONLY
908
- localcamera.setAim(from, to);
912
+ localAOcamera.setAim(from, to);
909913
910914 CameraPane.occlusionbuffer.display();
911915
....@@ -939,7 +943,7 @@
939943 to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z);
940944 LA.xformPos(from, transform, from);
941945 LA.xformPos(to, transform, to); // RIGID ONLY
942
- localcamera.setAim(from, to);
946
+ localAOcamera.setAim(from, to);
943947
944948 CameraPane.occlusionbuffer.display();
945949
....@@ -1248,10 +1252,10 @@
12481252 {
12491253 if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
12501254 {
1251
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1255
+ SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]);
12521256 } else
12531257 {
1254
- gl.glNormal3f(0, 0, 1);
1258
+ SetGLNormal(gl, 0, 0, 1);
12551259 }
12561260
12571261 if (c != null)
....@@ -1275,10 +1279,10 @@
12751279 {
12761280 if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
12771281 {
1278
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1282
+ SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]);
12791283 } else
12801284 {
1281
- gl.glNormal3f(0, 0, 1);
1285
+ SetGLNormal(gl, 0, 0, 1);
12821286 }
12831287 if (c != null)
12841288 {
....@@ -1303,10 +1307,10 @@
13031307 {
13041308 if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
13051309 {
1306
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1310
+ SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]);
13071311 } else
13081312 {
1309
- gl.glNormal3f(0, 0, 1);
1313
+ SetGLNormal(gl, 0, 0, 1);
13101314 }
13111315 if (c != null)
13121316 {
....@@ -1488,7 +1492,7 @@
14881492 {
14891493 if (!selectmode)
14901494 {
1491
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
1495
+ SetGLNormal(gl, (float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
14921496 gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
14931497
14941498 if (flipV)
....@@ -1526,7 +1530,7 @@
15261530 }
15271531 }
15281532 float b = 0;
1529
- if (obj.support != null && obj.link2master)
1533
+ if (obj.support != null && obj.Link2Support())
15301534 {
15311535 b = 1;
15321536 }
....@@ -1817,7 +1821,7 @@
18171821
18181822 display.modelParams7[0] = 0;
18191823 display.modelParams7[1] = 1000;
1820
- display.modelParams7[2] = 0;
1824
+ display.modelParams7[2] = material.parallax;
18211825 display.modelParams7[3] = 0;
18221826
18231827 //display.modelParams6[0] = 100; // criss de bug de bump
....@@ -2050,9 +2054,9 @@
20502054 switch(viewcode)
20512055 {
20522056 case 0: return "main";
2053
- case 1: return "one";
2054
- case 2: return "two";
2055
- case 3: return "three";
2057
+ case 1: return "Red";
2058
+ case 2: return "Green";
2059
+ case 3: return "Blue";
20562060 case 4: return "light";
20572061 }
20582062
....@@ -2061,7 +2065,7 @@
20612065
20622066 static int camerachangeframe;
20632067
2064
- public boolean SetCamera(Camera cam)
2068
+ public boolean SetCamera(Camera cam, boolean set)
20652069 {
20662070 // may 2014 if (cam == cameras[0] || cam == cameras[1])
20672071 // return false;
....@@ -2079,7 +2083,8 @@
20792083
20802084 camerachangeframe = Globals.framecount;
20812085
2082
- cam.hAspect = -1; // Read only
2086
+ if (cam != null)
2087
+ cam.hAspect = -1; // Read only
20832088
20842089 cameras[0] = cam;
20852090 targetLookAts[0] = new cVector(cam.lookAt);
....@@ -2089,11 +2094,14 @@
20892094 {
20902095 cameras[i] = new Camera(cam.viewCode);
20912096 }
2092
-
2093
- cameras[i].setAim(cam.location, cam.lookAt);
2094
- cameras[i].shaper_fovy = cam.shaper_fovy;
2095
- cameras[i].UP.set(cam.UP);
2096
- 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
+ }
20972105 }
20982106 cameracount = 0;
20992107 targetLookAt = targetLookAts[cameracount];
....@@ -2102,7 +2110,7 @@
21022110 // Start with free camera
21032111 SwitchCameras(true);
21042112
2105
- pingthread.jump = true; // optional?
2113
+// pingthread.jump = true; // optional?
21062114
21072115 if (TRACKONCE)
21082116 {
....@@ -2289,18 +2297,6 @@
22892297 public void ToggleTrack()
22902298 {
22912299 TRACK ^= true;
2292
- if (TRACK)
2293
- {
2294
- if (object.selection != null &&
2295
- object.selection.size() > 0 &&
2296
- object.selection.elementAt(0) != null &&
2297
- !(object.selection.elementAt(0) instanceof Camera) &&
2298
- !(object.selection.elementAt(0) instanceof ScriptNode))
2299
- {
2300
- trackedobject = object.selection.elementAt(0);
2301
- repaint();
2302
- }
2303
- }
23042300
23052301 repaint();
23062302 }
....@@ -2392,7 +2388,8 @@
23922388 {
23932389 //System.out.println("PROTECTION = " + cam.hAspect);
23942390 //assert (cam.hAspect == 0);
2395
- cam.hAspect = 0;
2391
+ if (cam != null)
2392
+ cam.hAspect = 0;
23962393 lightCamera = cam;
23972394 }
23982395
....@@ -2473,6 +2470,18 @@
24732470 return CreateBim(bytes, width, height);
24742471 }
24752472
2473
+ private void SetGLNormal(javax.media.opengl.GL gl, float nx, float ny, float nz)
2474
+ {
2475
+ gl.glNormal3f(nx, ny, nz);
2476
+
2477
+ if (ny > 0.9 || ny < -0.9)
2478
+ // Ground or ceiling
2479
+ gl.glVertexAttrib3f(4, 1, 0, 0);
2480
+ else
2481
+ // Walls
2482
+ gl.glVertexAttrib3f(4, 0, 1, 0);
2483
+ }
2484
+
24762485 /**/
24772486 class CacheTexture
24782487 {
....@@ -2515,7 +2524,7 @@
25152524 com.sun.opengl.util.texture.TextureIO.newTextureData(
25162525 getClass().getClassLoader().getResourceAsStream(name),
25172526 true,
2518
- com.sun.opengl.util.texture.TextureIO.PNG);
2527
+ GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG);
25192528 } catch (java.io.IOException e)
25202529 {
25212530 throw new javax.media.opengl.GLException(e);
....@@ -3581,6 +3590,8 @@
35813590 };
35823591 /**/
35833592
3593
+ static Object3D lastObject;
3594
+
35843595 //com.sun.opengl.util.texture.Texture
35853596 TextureData
35863597 GetFileTexture(String name, boolean bump, int resolution)
....@@ -3617,6 +3628,8 @@
36173628 // return null;
36183629 //if (i == 2)
36193630 // return null;
3631
+ // TIFF issue sept 2019
3632
+ System.err.println("lastObject = " + lastObject);
36203633 e.printStackTrace();
36213634 name = name.split("\\.tif")[0] + ".jpg";
36223635 }
....@@ -6949,30 +6962,30 @@
69496962 short residu = 0;
69506963
69516964 // wraparound workarounds
6952
- short fuck = (short) (buffer[i] & 0xFF);
6965
+ short ww = (short) (buffer[i] & 0xFF);
69536966 /*
6954
- residu += (fuck%2);
6955
- if(fuck/2 < 256-residu/2)
6967
+ residu += (ww%2);
6968
+ if(ww/2 < 256-residu/2)
69566969 {
6957
- fuck = (short)((fuck/2) + residu/2);
6970
+ ww = (short)((ww/2) + residu/2);
69586971 if(residu == 2)
69596972 residu = 0;
69606973 }
69616974 else
69626975 {
69636976 residu = 0;
6964
- fuck /= 2;
6977
+ ww /= 2;
69656978 }
69666979 */
6967
- if (i < imglength / 3 || rnd.nextFloat() < 0.5 || fuck >= 254)
6980
+ if (i < imglength / 3 || rnd.nextFloat() < 0.5 || ww >= 254)
69686981 {
6969
- fuck /= 2;
6982
+ ww /= 2;
69706983 } else
69716984 {
6972
- fuck = (short) ((fuck / 2) + fuck % 2);
6985
+ ww = (short) ((ww / 2) + ww % 2);
69736986 }
69746987
6975
- buffer[i] = (byte) fuck;
6988
+ buffer[i] = (byte) ww;
69766989 }
69776990 //System.out.print(bytes[i] + " ");
69786991 //if(buffer[i] >= 0 && buffer[i]<=eps-1) buffer[i] = eps;
....@@ -8439,12 +8452,12 @@
84398452 {
84408453 // texturecache = textures.get(texname); // suspicious
84418454 if (texturecache == null)
8442
- texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
8455
+ texturecache = new CacheTexture(GetResourceTexture("whitenoise.jpg", bump),resolution);
84438456 else
84448457 new Exception().printStackTrace();
84458458 } else
84468459 {
8447
- if (texname.startsWith("@"))
8460
+ if (texname.startsWith("@") && textureon)
84488461 {
84498462 // texturecache = textures.get(texname); // suspicious
84508463 if (texturecache == null)
....@@ -8627,7 +8640,9 @@
86278640 {
86288641 tex.bw = texturecache.texturedata.getWidth();
86298642 tex.bh = texturecache.texturedata.getHeight();
8630
- 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);
86318646 }
86328647 }
86338648 }
....@@ -9825,7 +9840,10 @@
98259840 DrawSkyBox(gl, (float)rati);
98269841 gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
98279842 gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB);
9828
- accPerspective(gl, renderCamera.shaper_fovy / ratio,
9843
+
9844
+ boolean vr = capsLocked && !lightMode;
9845
+
9846
+ accPerspective(gl, renderCamera.shaper_fovy / ratio * (vr ? 1.2 : 1),
98299847 ratio,
98309848 //near_plane, far_plane,
98319849 renderCamera.shaper_zNear * renderCamera.Distance(), renderCamera.shaper_zFar * renderCamera.Distance(),
....@@ -10688,9 +10706,18 @@
1068810706 static boolean init = false;
1068910707
1069010708 double[][] matrix = LA.newMatrix();
10709
+
10710
+ // This is to refresh the UI of the material panel.
10711
+ ObjEditor patchMaterial;
1069110712
1069210713 public void display(GLAutoDrawable drawable)
1069310714 {
10715
+ if (patchMaterial.patchMaterial)
10716
+ {
10717
+ patchMaterial.patchMaterial = false;
10718
+ patchMaterial.objectTabbedPane.setSelectedIndex(1);
10719
+ }
10720
+
1069410721 if (Grafreed.savesound && Grafreed.hassound)
1069510722 {
1069610723 Grafreed.wav.save();
....@@ -10734,7 +10761,9 @@
1073410761 }
1073510762 /**/
1073610763
10737
- if (selection)
10764
+ boolean control = ((modifiers & CTRL) != 0);
10765
+
10766
+ if (selection && (!Globals.isLIVE() || control))
1073810767 {
1073910768 selectbuffer.display();
1074010769 return;
....@@ -10786,6 +10815,112 @@
1078610815
1078710816 if (DrawMode() == DEFAULT)
1078810817 {
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
+
1078910924 currentlydrawing = true;
1079010925 }
1079110926
....@@ -11082,11 +11217,11 @@
1108211217 //
1108311218 // newenvy = -1;
1108411219
11085
- if (object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb"))
11220
+ if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb"))
1108611221 {
1108711222 if (cubemaprgb == null)
1108811223 {
11089
- cubemaprgb = LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
11224
+ cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false);
1109011225 }
1109111226
1109211227 cubemap = cubemaprgb;
....@@ -11097,6 +11232,8 @@
1109711232 {
1109811233 if (!object.skyboxname.equals(this.loadedskyboxname))
1109911234 {
11235
+ if (cubemap != null && cubemap != cubemaprgb)
11236
+ cubemap.dispose();
1110011237 cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
1110111238 loadedskyboxname = object.skyboxname;
1110211239 }
....@@ -11308,9 +11445,9 @@
1130811445
1130911446 gl.glMatrixMode(GL.GL_MODELVIEW);
1131011447
11311
-gl.glEnable(gl.GL_POLYGON_SMOOTH);
11312
-gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11313
-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);
1131411451 } else
1131511452 {
1131611453 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11371,7 +11508,10 @@
1137111508 //gl.glOrtho(-BOOST, BOOST, -BOOST, BOOST, 0.001, 1000);
1137211509 } else
1137311510 {
11374
- 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());
1137511515 }
1137611516 }
1137711517
....@@ -11727,8 +11867,11 @@
1172711867 repaint();
1172811868 }
1172911869
11730
- if (Globals.isLIVE() && DrawMode() == DEFAULT) // may 2013
11870
+ if (Globals.isLIVE() && DrawMode() == DEFAULT || pingthread.live) // may 2013
11871
+ {
11872
+ renderCamera.computeTransform();
1173111873 repaint();
11874
+ }
1173211875
1173311876 displaydone = true;
1173411877 }
....@@ -11803,9 +11946,23 @@
1180311946 //GL gl = getGL();
1180411947 if ((TRACK || SHADOWTRACK) || zoomonce)
1180511948 {
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
+ }
1180611963 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
1180711964 object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11808
- pingthread.StepToTarget(true); // true);
11965
+ pingthread.StepToTarget(); // true);
1180911966 // zoomonce = false;
1181011967 }
1181111968
....@@ -12488,8 +12645,9 @@
1248812645 String programmin =
1248912646 // Min shader
1249012647 "!!ARBfp1.0\n" +
12491
- "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" +
12492
- "PARAM pow2 = { 0.5, 0.25, 0.125, 0.0 };" +
12648
+ "PARAM zero12t = { 0.0, 1.0, 2, 1.25 };" +
12649
+ "PARAM pow_2 = { 0.5, 0.25, 0.125, 0.0 };" +
12650
+ "PARAM pow2 = { 2, 4, 8, 0.0 };" +
1249312651 "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
1249412652 "PARAM eps = { 0.001, 0.001, 0.001, 1.0 };" +
1249512653 "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" +
....@@ -12504,10 +12662,11 @@
1250412662 "TEMP eye;" +
1250512663 "TEMP pos;" +
1250612664
12507
- "MAD normal, fragment.color, zero123.z, -zero123.y;" +
12665
+ "MAD normal, fragment.color, zero12t.z, -zero12t.y;" +
1250812666 Normalize("normal") +
1250912667 "MOV light, state.light[0].position;" +
1251012668 "DP3 ndotl.x, light, normal;" +
12669
+ "MAX ndotl.x, ndotl.x, zero12t.x;" +
1251112670
1251212671 // shadow
1251312672 "MOV pos, fragment.texcoord[1];" +
....@@ -12523,7 +12682,7 @@
1252312682 "MUL ndotl.x, ndotl.x, ndotl.z;" + // Shadow
1252412683
1252512684 // Backlit
12526
- "MOV pos.w, zero123.y;" +
12685
+ "MOV pos.w, zero12t.y;" + // one
1252712686 "DP4 eye.x, pos, light2cam0;" +
1252812687 "DP4 eye.y, pos, light2cam1;" +
1252912688 "DP4 eye.z, pos, light2cam2;" +
....@@ -12531,24 +12690,28 @@
1253112690
1253212691 "DP3 ndotl.y, -eye, normal;" +
1253312692 //"MUL ndotl.y, ndotl.y, pow2.x;" +
12534
- "POW ndotl.y, ndotl.y, pow2.z;" + // backlit
12535
- "SUB ndotl.y, zero123.y, ndotl.y;" +
12693
+ "POW ndotl.y, ndotl.y, pow2.x;" + // backlit
12694
+ "SUB ndotl.y, zero12t.y, ndotl.y;" + // 1 - y
12695
+ //"POW ndotl.y, ndotl.y, pow2.z;" + // backlit
1253612696 //"SUB ndotl.y, zero123.y, ndotl.y;" +
1253712697 //"MUL ndotl.y, ndotl.y, pow2.z;" +
12698
+ "ADD ndotl.y, ndotl.y, one.x;" +
12699
+ "MUL ndotl.y, ndotl.y, pow_2.x;" +
1253812700
1253912701 //"MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient
1254012702 //"MAX ndotl.x, ndotl.x, pow2.y;" + // Ambient
1254112703
1254212704 // Pigment
1254312705 "TEX temp, fragment.texcoord[0], texture[0], 2D;" +
12544
- "LRP temp, zero123.w, temp, one;" + // texture proportion
12545
- "MUL temp, temp, ndotl.x;" +
12546
-
12547
- "MUL temp, temp, zero123.z;" +
12706
+ "LRP temp, zero12t.w, temp, one;" + // texture proportion
12707
+ "MUL temp, temp, zero12t.w;" + // Times x
1254812708
1254912709 //"MUL temp, temp, ndotl.y;" +
12710
+ "MAD ndotl.x, pow_2.xxxx, ndotl.yyyy, ndotl.x;" +
1255012711
12551
- "MOV temp.w, zero123.y;" + // reset alpha
12712
+ "MUL temp, temp, ndotl.x;" + // lambert
12713
+
12714
+ "MOV temp.w, zero12t.y;" + // reset alpha
1255212715 "MOV result.color, temp;" +
1255312716 "END";
1255412717
....@@ -12580,7 +12743,7 @@
1258012743 "PARAM params4 = program.env[4];" + // anisoV, cameralight, selfshadow, shadow
1258112744 "PARAM params5 = program.env[5];" + // texture, opacity, fakedepth, shadowbias
1258212745 "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough
12583
- "PARAM params7 = program.env[7];" + // noise power, opacity power
12746
+ "PARAM params7 = program.env[7];" + // noise power, opacity power, parallax
1258412747 "PARAM options0 = program.env[63];" + // fog density, intensity, elevation
1258512748 "PARAM options1 = program.env[62];" + // fog rgb color
1258612749 "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen
....@@ -12825,7 +12988,7 @@
1282512988 "POW texSamp.a, texSamp.a, params6.w;" + // fog punch through shortcut
1282612989 // mar 2013 ??? "KIL alpha.a;" +
1282712990 "MOV alpha, texSamp.aaaa;" + // y;" +
12828
- "KIL alpha.a;" +
12991
+ "KIL alpha.a;" + // not sure with parallax mapping
1282912992 /*
1283012993 "MUL temp.xy, temp, two;" +
1283112994 "TXB bump, temp, texture[0], 2D;" +
....@@ -12911,11 +13074,6 @@
1291113074 "SUB bump0, bump0, half;" +
1291213075 "ADD bump, bump, bump0;" +
1291313076
12914
- "MOV temp.x, texSamp.a;" +
12915
- "LRP texSamp, params5.x, texSamp, one;" + // texture proportion
12916
- //"LRP texSamp0, params5.x, texSamp0, one;" +
12917
- "MOV texSamp.a, temp.x;" +
12918
-
1291913077 // double-sided
1292013078 /**/
1292113079 (doublesided?"DP3 temp.z, normal, eye;" +
....@@ -12925,26 +13083,73 @@
1292513083 "ADD temp.x, temp.x, one.x;" +
1292613084 "MUL normal, normal, temp.xxxx;":""
1292713085 ) +
12928
- /**/
12929
-//// Normalize("normal") +
12930
-//// "MAX normal.z, eps.x, normal.z;" +
12931
-// Normalize("normal") +
12932
- "MOV normald, normal;" +
12933
- "MOV normals, normal;" +
13086
+ /**/
13087
+
13088
+ "MOV temp, fragment.texcoord[4];" +
1293413089
1293513090 // UV base
1293613091 //"DP3 UP.x,state.matrix.modelview.row[0],Y;" +
1293713092 //"DP3 UP.y,state.matrix.modelview.row[1],Y;" +
1293813093 //"DP3 UP.z,state.matrix.modelview.row[2],Y;" +
12939
- "DP3 UP.x,state.matrix.texture[7].row[0],Y;" +
12940
- "DP3 UP.y,state.matrix.texture[7].row[1],Y;" +
12941
- "DP3 UP.z,state.matrix.texture[7].row[2],Y;" +
13094
+ "DP3 UP.x,state.matrix.texture[7].row[0],temp;" +
13095
+ "DP3 UP.y,state.matrix.texture[7].row[1],temp;" +
13096
+ "DP3 UP.z,state.matrix.texture[7].row[2],temp;" +
13097
+ Normalize("UP") +
13098
+
1294213099 "XPD V, normal, UP;" +
1294313100 Normalize("V") +
1294413101 "XPD U, V, normal;" +
1294513102 Normalize("U") +
1294613103
13104
+ "MOV temp, fragment.texcoord[0];" +
13105
+
13106
+// "MAD normal, -temp.x, U, normal;" +
13107
+// "MAD normal, -temp.y, V, normal;" +
13108
+// Normalize("normal") +
13109
+
13110
+//// "MAX normal.z, eps.x, normal.z;" +
13111
+// Normalize("normal") +
13112
+ "MOV normald, normal;" +
13113
+ "MOV normals, normal;" +
13114
+
1294713115 // parallax mapping
13116
+
13117
+ "DP3 temp2.x, V, eye;" +
13118
+ "DP3 temp2.y, U, eye;" +
13119
+ "DP3 temp2.z, normal, eye;" +
13120
+ "RCP temp2.z, temp2.z;" +
13121
+
13122
+ "DP3 temp2.w, texSamp, texSamp;" + // Height
13123
+ "RSQ temp2.w, temp2.w;" +
13124
+ "RCP temp2.w, temp2.w;" +
13125
+
13126
+ "SUB temp2.w, temp2.w, half;" +
13127
+ // "SGE temp.x, temp2.w, eps.x;" +
13128
+ // "MUL temp2.w, temp2.w, temp.x;" +
13129
+
13130
+ // "MOV texSamp, U;" +
13131
+
13132
+ "MUL temp2.z, temp2.z, temp2.w;" +
13133
+ "MUL temp2.z, temp2.z, params7.z;" + // parallax
13134
+
13135
+ "MUL temp2, temp2, temp2.z;" +
13136
+
13137
+ "SUB temp, temp, temp2;" +
13138
+
13139
+ "TEX temp, temp, texture[0], 2D;" +
13140
+ "POW temp.a, temp.a, params6.w;" + // punch through
13141
+
13142
+ "ADD texSamp, temp, texSamp;" +
13143
+ "MUL texSamp.xyz, half, texSamp;" +
13144
+
13145
+ "MOV alpha, texSamp.aaaa;" +
13146
+
13147
+// parallax mapping
13148
+
13149
+ "MOV temp.x, texSamp.a;" +
13150
+ "LRP texSamp, params5.x, texSamp, one;" + // texture proportion
13151
+ //"LRP texSamp0, params5.x, texSamp0, one;" +
13152
+ "MOV texSamp.a, temp.x;" +
1294813153
1294913154 //"MOV temp, fragment.texcoord[0];" +
1295013155 //
....@@ -13415,8 +13620,12 @@
1341513620 program = programmin;
1341613621 }
1341713622
13418
- System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13419
- System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13623
+ if (Globals.DEBUG)
13624
+ {
13625
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13626
+ System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13627
+ }
13628
+
1342013629 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1342113630
1342213631 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13463,7 +13672,8 @@
1346313672 "\n" +
1346413673 "END\n";
1346513674
13466
- System.out.println("Program shadow #" + 0 + "; length = " + program.length());
13675
+ if (Globals.DEBUG)
13676
+ System.out.println("Program shadow #" + 0 + "; length = " + program.length());
1346713677 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1346813678
1346913679 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13721,7 +13931,7 @@
1372113931 /*static*/ float[] modelParams4 = new float[]{0, 0, 0, 0}; // anisoV, cameralight, selfshadow, shadow
1372213932 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1372313933 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
13724
- /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13934
+ /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power, parallax
1372513935
1372613936 //Object3D.cVector2[] vector2buffer;
1372713937
....@@ -13888,7 +14098,7 @@
1388814098 "PARAM p[4] = { state.matrix.projection }; # modelview projection matrix\n" +
1388914099 "PARAM zero = { 0.0, 0.0, 0.0, 1.0 };" +
1389014100 "PARAM half = { 0.5, 0.5, 0.5, 1.0 };" +
13891
- "PARAM one = { 1.0, 1.0, 1.0, 0.0 };" +
14101
+ "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
1389214102 "PARAM two = { 2.0, 2.0, 2.0, 1.0 };" +
1389314103 "PARAM third = { 0.33333333333, 0.33333333333, 0.33333333333, 1.0 };" +
1389414104 //"PARAM v256 = { 256.0, 256.0, 256.0, 1.0 };" +
....@@ -13949,7 +14159,7 @@
1394914159 "DP4 temp.x,state.matrix.texture[0].inverse.row[0],vertex.texcoord;" +
1395014160 "DP4 temp.y,state.matrix.texture[0].inverse.row[1],vertex.texcoord;" +
1395114161 "DP4 temp.z,state.matrix.texture[0].inverse.row[2],vertex.texcoord;" +
13952
- //"MOV result.texcoord, vertex.texcoord;" +
14162
+ //"MOV result.texcoord, vertex.fogcoord;" +
1395314163 "MOV result.texcoord, temp;" +
1395414164 // border fade
1395514165 "MOV result.texcoord[3], vertex.texcoord;" +
....@@ -13996,7 +14206,9 @@
1399614206
1399714207 //"ADD temp.z, temp.z, one;" +
1399814208
13999
- "MOV result.color, temp;"
14209
+ "MOV result.texcoord[4], vertex.attrib[4];" + // U dir
14210
+
14211
+ "MOV result.color, temp;" // Normal
1400014212 : "MOV result.color, vertex.color;") +
1400114213 ((mode & VP_PROJECTION) != 0 ? "MOV result.color, zero;"
1400214214 : "") +
....@@ -14131,6 +14343,7 @@
1413114343 public void mouseClicked(MouseEvent e)
1413214344 {
1413314345 System.out.println("mouseClicked: " + e);
14346
+ System.exit(0);
1413414347 }
1413514348
1413614349 public void mousePressed(MouseEvent e)
....@@ -14169,10 +14382,12 @@
1416914382 return;
1417014383 }
1417114384
14172
- 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;
1417314388
1417414389 // TIMER
14175
- if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
14390
+ if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !vr) // VR
1417614391 {
1417714392 keepboxmode = BOXMODE;
1417814393 keepsupport = SUPPORT;
....@@ -14213,7 +14428,7 @@
1421314428 //}
1421414429
1421514430 SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
14216
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
14431
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, e.getModifiers(), e.getModifiersEx());
1421714432 anchorX = ax;
1421814433 anchorY = ay;
1421914434 prevX = px;
....@@ -14308,8 +14523,9 @@
1430814523 // fev 2014???
1430914524 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
1431014525 object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
14311
- pingthread.StepToTarget(true); // true);
14526
+ pingthread.StepToTarget(); // true);
1431214527 }
14528
+
1431314529 // if (!LIVE)
1431414530 super.repaint();
1431514531 }
....@@ -14404,8 +14620,8 @@
1440414620
1440514621 //if (drawing)
1440614622 //return;
14407
- if ((e.getModifiersEx() & CTRL) != 0
14408
- || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
14623
+ if ((e.getModifiersEx() & CTRL) != 0 ||
14624
+ (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
1440914625 {
1441014626 //System.out.println("mouseDragged: " + e);
1441114627 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
....@@ -14429,9 +14645,17 @@
1442914645 return targetLookAt;
1443014646 }
1443114647
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
+
1443214653 class PingThread extends Thread
1443314654 {
1443414655 boolean jump;
14656
+ boolean live;
14657
+
14658
+ boolean mute = false;
1443514659
1443614660 // void JumpToTarget()
1443714661 // {
....@@ -14447,6 +14671,95 @@
1444714671 // only one thread!? synchronized
1444814672 void StepToTarget(boolean jump)
1444914673 {
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
+
1445014763 tmp.set(targetLookAt);
1445114764 tmp.sub(manipCamera.lookAt); // june 2014
1445214765
....@@ -14484,7 +14797,7 @@
1448414797
1448514798 if (tmp.dot(tmp) > 1) // may 2014. far away: jump to target
1448614799 {
14487
- jump = true; // step = 1;
14800
+ // sep 2019 jump = true; // step = 1;
1448814801 }
1448914802
1449014803 if (OEILONCE && OEIL)
....@@ -14519,7 +14832,10 @@
1451914832 if (tmp.dot(tmp) < 0.00001)
1452014833 {
1452114834 zoomonce = false;
14835
+ live = false;
1452214836 }
14837
+ else
14838
+ live = true;
1452314839
1452414840 tmp.mul(step > step2 ? step : step2);
1452514841 }
....@@ -14546,7 +14862,7 @@
1454614862 {
1454714863 if (LOOKAT)
1454814864 manipCamera.lookAt.add(tmp);
14549
- if (OEIL)
14865
+ if (OEIL && !capsLocked)
1455014866 manipCamera.location.add(tmp);
1455114867
1455214868 {
....@@ -14561,7 +14877,10 @@
1456114877 lightCamera.computeTransform();
1456214878 }
1456314879 }
14564
- manipCamera.computeTransform();
14880
+ if (tmp.x != 0 || tmp.y != 0 || tmp.z != 0)
14881
+ {
14882
+ manipCamera.computeTransform();
14883
+ }
1456514884 }
1456614885 // ?????? mouseDown = true;
1456714886 //System.out.println("---------------- ---------- Paint " + tmp.length2());
....@@ -14654,49 +14973,107 @@
1465414973 }
1465514974 }
1465614975 }
14976
+
1465714977 PingThread pingthread = new PingThread();
14658
- int delta = 5;
14659
- int speed = 5;
14978
+ int delta = 1;
14979
+ int speed = 1;
14980
+ int walk = 8;
1466014981 boolean autorepeat = false;
1466114982
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
+
1466215002 void GoDown(int mod)
1466315003 {
1466415004 MODIFIERS |= COMMAND;
15005
+ boolean isVR = (mouseMode&VR)!=0;
1466515006 /**/
1466615007 if((mod&SHIFT) == SHIFT)
14667
- manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14668
- else
14669
- manipCamera.RotatePosition(0, -speed);
14670
- /**/
14671
- if ((mod & SHIFT) == SHIFT)
1467215008 {
14673
- mouseMode = mouseMode; // VR??
14674
- } else
14675
- {
14676
- mouseMode |= BACKFORTH;
15009
+// if (isVR)
15010
+// manipCamera.RotateInterest(0, speed);
15011
+// else
15012
+ if (isVR)
15013
+ ViewAngle(-speed*delta);
15014
+ else
15015
+ manipCamera.Translate(0, -speed*delta, getWidth());
1467715016 }
15017
+ else
15018
+ {
15019
+ if (isVR)
15020
+ manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth());
15021
+ else
15022
+ manipCamera.RotatePosition(0, -speed);
15023
+ }
15024
+
15025
+ /**/
15026
+// if ((mod & SHIFT) == SHIFT)
15027
+// {
15028
+// mouseMode = mouseMode; // VR??
15029
+// } else
15030
+// {
15031
+// mouseMode |= BACKFORTH;
15032
+// }
1467815033
15034
+ targetLookAt.set(manipCamera.lookAt);
15035
+
1467915036 //prevX = X = anchorX;
1468015037 prevY = Y = anchorY - (int) (renderCamera.Distance());
1468115038 }
1468215039
1468315040 void GoUp(int mod)
1468415041 {
15042
+ RigidBody.justclicked = true;
15043
+
1468515044 MODIFIERS |= COMMAND;
1468615045 /**/
15046
+ boolean isVR = (mouseMode&VR)!=0;
15047
+
1468715048 if((mod&SHIFT) == SHIFT)
14688
- manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14689
- else
14690
- manipCamera.RotatePosition(0, speed);
14691
- /**/
14692
- if ((mod & SHIFT) == SHIFT)
1469315049 {
14694
- mouseMode = mouseMode;
14695
- } else
14696
- {
14697
- mouseMode |= BACKFORTH;
15050
+// if (isVR)
15051
+// manipCamera.RotateInterest(0, -speed);
15052
+// else
15053
+ if (isVR)
15054
+ ViewAngle(speed*delta);
15055
+ else
15056
+ manipCamera.Translate(0, speed*delta, getWidth());
1469815057 }
15058
+ else
15059
+ {
15060
+ if (isVR)
15061
+ manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth());
15062
+ else
15063
+ manipCamera.RotatePosition(0, speed);
15064
+ }
15065
+
15066
+ /**/
15067
+// if ((mod & SHIFT) == SHIFT)
15068
+// {
15069
+// mouseMode = mouseMode;
15070
+// } else
15071
+// {
15072
+// mouseMode |= BACKFORTH;
15073
+// }
1469915074
15075
+ targetLookAt.set(manipCamera.lookAt);
15076
+
1470015077 //prevX = X = anchorX;
1470115078 prevY = Y = anchorY + (int) (renderCamera.Distance());
1470215079 }
....@@ -14706,18 +15083,29 @@
1470615083 MODIFIERS |= COMMAND;
1470715084 /**/
1470815085 if((mod&SHIFT) == SHIFT)
14709
- manipCamera.Translate(speed*delta, 0, getWidth());
15086
+ manipCamera.Translate(speed, 0, getWidth());
1471015087 else
14711
- manipCamera.RotatePosition(speed, 0);
15088
+ {
15089
+ if ((mouseMode&VR)!=0)
15090
+ manipCamera.RotateInterest(-speed*manipCamera.shaper_fovy/90, 0);
15091
+ else
15092
+ manipCamera.RotatePosition(speed*manipCamera.shaper_fovy/90, 0);
15093
+ }
15094
+
1471215095 /**/
14713
- if ((mod & SHIFT) == SHIFT)
14714
- {
14715
- mouseMode = mouseMode;
14716
- } else
14717
- {
14718
- mouseMode |= ROTATE;
14719
- } // TRANSLATE;
15096
+// if ((mod & SHIFT) == SHIFT)
15097
+// {
15098
+// mouseMode = mouseMode;
15099
+// } else
15100
+// {
15101
+// mouseMode |= ROTATE;
15102
+// } // TRANSLATE;
1472015103
15104
+ //System.err.println("lookAt = " + manipCamera.lookAt);
15105
+ //System.err.println("location = " + manipCamera.location);
15106
+
15107
+ targetLookAt.set(manipCamera.lookAt);
15108
+
1472115109 prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance());
1472215110 prevY = Y = anchorY;
1472315111 }
....@@ -14727,18 +15115,26 @@
1472715115 MODIFIERS |= COMMAND;
1472815116 /**/
1472915117 if((mod&SHIFT) == SHIFT)
14730
- manipCamera.Translate(-speed*delta, 0, getWidth());
15118
+ manipCamera.Translate(-speed, 0, getWidth());
1473115119 else
14732
- manipCamera.RotatePosition(-speed, 0);
15120
+ {
15121
+ if ((mouseMode&VR)!=0)
15122
+ manipCamera.RotateInterest(speed*manipCamera.shaper_fovy/90, 0);
15123
+ else
15124
+ manipCamera.RotatePosition(-speed*manipCamera.shaper_fovy/90, 0);
15125
+ }
15126
+
1473315127 /**/
14734
- if ((mod & SHIFT) == SHIFT)
14735
- {
14736
- mouseMode = mouseMode;
14737
- } else
14738
- {
14739
- mouseMode |= ROTATE;
14740
- } // TRANSLATE;
15128
+// if ((mod & SHIFT) == SHIFT)
15129
+// {
15130
+// mouseMode = mouseMode;
15131
+// } else
15132
+// {
15133
+// mouseMode |= ROTATE;
15134
+// } // TRANSLATE;
1474115135
15136
+ targetLookAt.set(manipCamera.lookAt);
15137
+
1474215138 prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance());
1474315139 prevY = Y = anchorY;
1474415140 }
....@@ -14872,6 +15268,11 @@
1487215268 if ((mouseMode & ZOOM) != 0)
1487315269 {
1487415270 //if ((mouseMode & BACKFORTH) != 0)
15271
+ if ((modifiersex & SHIFT) == SHIFT)
15272
+ {
15273
+ ViewAngle(dy);
15274
+ }
15275
+ else
1487515276 if ((mouseMode & VR) != 0)
1487615277 manipCamera.BackForth(dx, dy, getWidth());
1487715278 else
....@@ -14942,6 +15343,9 @@
1494215343
1494315344 public void mouseMoved(MouseEvent e)
1494415345 {
15346
+//object.editWindow.frame.
15347
+ setCursor(Cursor.getDefaultCursor());
15348
+
1494515349 //System.out.println("mouseMoved: " + e);
1494615350 if (isRenderer)
1494715351 return;
....@@ -14970,6 +15374,12 @@
1497015374
1497115375 public void mouseReleased(MouseEvent e)
1497215376 {
15377
+ if (isRenderer && !movingcamera)
15378
+ {
15379
+ RigidBody.justclicked = true;
15380
+ System.out.println("justclicked: " + e);
15381
+ }
15382
+
1497315383 Globals.MOUSEDRAGGED = false;
1497415384
1497515385 movingcamera = false;
....@@ -15126,8 +15536,10 @@
1512615536 mouseMode |= ZOOM;
1512715537 }
1512815538
15129
- boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
15130
- 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)
1513115543 {
1513215544 mouseMode |= VR; // BACKFORTH;
1513315545 }
....@@ -15139,7 +15551,8 @@
1513915551 {
1514015552 mouseMode |= SELECT;
1514115553 }
15142
- if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
15554
+ if (//(modifiersex & SHIFT) == SHIFT ||
15555
+ forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1514315556 {
1514415557 mouseMode &= ~VR;
1514515558 mouseMode |= TRANSLATE;
....@@ -15183,8 +15596,18 @@
1518315596 float SATPOW = 1; // 2; // 0.5f;
1518415597 float BRIPOW = 1; // 0.5f; // 0.5f;
1518515598
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
+
1518615605 public void keyPressed(int key)
1518715606 {
15607
+// Set the blank cursor to the JFrame.
15608
+//object.editWindow.frame.
15609
+ setCursor(blankCursor);
15610
+
1518815611 if (key >= '0' && key <= '5')
1518915612 clampbit = (key-'0');
1519015613
....@@ -15241,8 +15664,8 @@
1524115664 case 'K':
1524215665 KOMPACTTEXTURE ^= true;
1524315666 //textures.clear();
15244
- break;
15245
- case 'P': // Texture Projection macros
15667
+ // break;
15668
+ //case 'P': // Texture Projection macros
1524615669 // SAVETEXTURE ^= true;
1524715670 macromode = true;
1524815671 Udebug = Vdebug = NORMALdebug = false; programInitialized = false;
....@@ -15343,8 +15766,8 @@
1534315766 RevertCamera();
1534415767 repaint();
1534515768 break;
15346
- case 'l':
15347
- //case 'L':
15769
+ //case 'l':
15770
+ case 'L':
1534815771 if (lightMode)
1534915772 {
1535015773 lightMode = false;
....@@ -15363,7 +15786,7 @@
1536315786 targetLookAt.set(manipCamera.lookAt);
1536415787 repaint();
1536515788 break;
15366
- case 'p':
15789
+ case 'P': // p':
1536715790 // c'est quoi ca au juste? spherical ^= true;
1536815791 Skinshader ^= true; programInitialized = false;
1536915792 repaint();
....@@ -15374,7 +15797,8 @@
1537415797 break;
1537515798 case 'm':
1537615799 {
15377
- PrintMemory();
15800
+ //PrintMemory();
15801
+ ToggleImageFlip();
1537815802 break;
1537915803 }
1538015804 case 'M':
....@@ -15401,9 +15825,9 @@
1540115825 repaint();
1540215826 break;
1540315827 case 'O':
15404
- Globals.drawMode = OCCLUSION; // WARNING
15405
- repaint();
15406
- break;
15828
+ // Too dangerous. Use menu. Globals.drawMode = OCCLUSION; // WARNING
15829
+ //repaint();
15830
+ //break;
1540715831 case 'o':
1540815832 OCCLUSION_CULLING ^= true;
1540915833 System.out.println("OCCLUSION CULLING = " + OCCLUSION_CULLING);
....@@ -15495,7 +15919,21 @@
1549515919 // kompactbit = 6;
1549615920 // break;
1549715921 case ' ':
15922
+ capsLocked ^= true;
15923
+ repaint();
15924
+ break;
15925
+ case 'l':
1549815926 lightMode ^= true;
15927
+ if (lightMode)
15928
+ {
15929
+ keepshadow = Globals.RENDERSHADOW;
15930
+ Globals.RENDERSHADOW = false;
15931
+ }
15932
+ else
15933
+ {
15934
+ Globals.RENDERSHADOW = keepshadow;
15935
+ }
15936
+
1549915937 Globals.lighttouched = true;
1550015938 manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
1550115939 targetLookAt.set(manipCamera.lookAt);
....@@ -15503,6 +15941,10 @@
1550315941 break;
1550415942 //case '`' :
1550515943 case ESC:
15944
+ if (FULLSCREEN)
15945
+ object.editWindow.ToggleFullScreen();
15946
+ break;
15947
+ case 'p':
1550615948 RENDERPROGRAM += 1;
1550715949 RENDERPROGRAM %= 3;
1550815950
....@@ -15541,6 +15983,10 @@
1554115983 case ENTER:
1554215984 // object.editWindow.ScreenFit(); // Edit();
1554315985 ToggleLive();
15986
+ if (capsLocked)
15987
+ {
15988
+ Globals.WALK ^= true;
15989
+ }
1554415990 break;
1554515991 case DELETE:
1554615992 ClearSelection();
....@@ -15577,17 +16023,23 @@
1557716023 object.GetWindow().refreshContents(true);
1557816024 break;
1557916025 case '{':
15580
- manipCamera.shaper_fovy /= 1.1;
16026
+ double factor = 1.1;
16027
+ if (manipCamera.shaper_fovy / factor > 0.1)
16028
+ manipCamera.shaper_fovy /= factor;
1558116029 System.out.println("FOV = " + manipCamera.shaper_fovy);
1558216030 repaint();
1558316031 break;
1558416032 case '}':
15585
- manipCamera.shaper_fovy *= 1.1;
16033
+ factor = 1.1;
16034
+ if (manipCamera.shaper_fovy * factor < 150)
16035
+ manipCamera.shaper_fovy *= factor;
1558616036 System.out.println("FOV = " + manipCamera.shaper_fovy);
1558716037 repaint();
1558816038 break;
1558916039 case '[':
15590
- manipCamera.shaper_fovy /= 1.01;
16040
+ factor = 1.01;
16041
+ if (manipCamera.shaper_fovy / factor > 0.1)
16042
+ manipCamera.shaper_fovy /= factor;
1559116043 if (false) //manipCamera.hAspect == 0)
1559216044 {
1559316045 double x = Math.tan(manipCamera.shaper_fovy * Math.PI / 180 / 2);
....@@ -15603,7 +16055,9 @@
1560316055 break;
1560416056 case ']':
1560516057 //manipCamera.shaper_fovy += (180 - manipCamera.shaper_fovy)*0.1;
15606
- manipCamera.shaper_fovy *= 1.01;
16058
+ factor = 1.01;
16059
+ if (manipCamera.shaper_fovy * factor < 150)
16060
+ manipCamera.shaper_fovy *= factor;
1560716061 if (false) //manipCamera.hAspect == 0)
1560816062 {
1560916063 double x = Math.tan(manipCamera.shaper_fovy * Math.PI / 180 / 2);
....@@ -15641,98 +16095,113 @@
1564116095 }
1564216096 }
1564316097
16098
+ boolean keys[] = new boolean[256];
16099
+ int speedkey[] = new int[256];
16100
+ int modifiers = 0;
16101
+
1564416102 public void processKeyEvent(KeyEvent e)
1564516103 {
1564616104 switch (e.getID())
1564716105 {
1564816106 case KeyEvent.KEY_PRESSED:
15649
- if (!autorepeat)
15650
- {
15651
- //System.out.println("processKeyEvent: " + KeyEvent.getKeyText(e.getKeyCode()));
15652
- keyPressed(e.getKeyChar(), e.getModifiersEx());
15653
- }
15654
- if (manipCamera == lightCamera)
15655
- {
15656
- switch (e.getKeyCode())
15657
- {
15658
- case DOWN_ARROW:
15659
- lightCamera.DECAL /= 2;
15660
- repaint();
15661
- break;
15662
- case UP_ARROW:
15663
- lightCamera.DECAL *= 2;
15664
- repaint();
15665
- break;
15666
- case LEFT_ARROW:
15667
- lightCamera.SCALE /= 2;
15668
- repaint();
15669
- break;
15670
- case RIGHT_ARROW:
15671
- lightCamera.SCALE *= 2;
15672
- repaint();
15673
- break;
15674
- default:
15675
- break;
15676
- }
15677
-
15678
- System.out.println("DECAL = " + lightCamera.DECAL + "; SCALE = " + lightCamera.SCALE);
15679
- } else
15680
- {
15681
- if (true) // !autorepeat)
15682
- {
15683
- boolean reset = true;
15684
-
15685
- switch (e.getKeyCode())
15686
- {
15687
- case DOWN_ARROW:
15688
- GoDown(e.getModifiersEx());
15689
- repaint();
15690
- break;
15691
- case UP_ARROW:
15692
- GoUp(e.getModifiersEx());
15693
- repaint();
15694
- break;
15695
- case LEFT_ARROW:
15696
- GoLeft(e.getModifiersEx());
15697
- repaint();
15698
- break;
15699
- case RIGHT_ARROW:
15700
- GoRight(e.getModifiersEx());
15701
- repaint();
15702
- break;
15703
- default:
15704
- reset = false;
15705
- break;
15706
- }
15707
-
15708
- if (reset)
15709
- {
15710
- autorepeat = true;
15711
-
15712
- targetLookAt.set(manipCamera.lookAt);
15713
- }
15714
- }
15715
- }
16107
+ keys[e.getKeyCode()] = true;
16108
+ modifiers = e.getModifiersEx();
16109
+ keyPressed(e.getKeyChar(), modifiers);
16110
+ //Globals.theRenderer.keyPressed(e.getKeyChar());
16111
+ repaint();
1571616112 break;
15717
- case KeyEvent.KEY_TYPED:
15718
- 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;
1571916183 case KeyEvent.KEY_RELEASED:
15720
- {
15721
- switch (e.getKeyCode())
15722
- {
15723
- case DOWN_ARROW:
15724
- case UP_ARROW:
15725
- case LEFT_ARROW:
15726
- case RIGHT_ARROW:
15727
- MODIFIERS &= ~COMMAND;
15728
- autorepeat = false;
15729
- break;
15730
- default:
15731
- break;
15732
- }
16184
+ keys[e.getKeyCode()] = false;
16185
+ modifiers = e.getModifiersEx();
1573316186 keyReleased(e.getKeyChar(), e.getModifiersEx());
16187
+ repaint();
1573416188 break;
15735
- }
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
+// }
1573616205 default:
1573716206 break;
1573816207 }
....@@ -16123,7 +16592,7 @@
1612316592 {
1612416593 switch (hitSomething)
1612516594 {
16126
- case Object3D.hitCenter: gr.setColor(Color.pink);
16595
+ case Object3D.hitCenter: gr.setColor(Color.white);
1612716596 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1612816597 break;
1612916598 case Object3D.hitRotate: gr.setColor(Color.yellow);
....@@ -16149,7 +16618,7 @@
1614916618 if (hasMarquee)
1615016619 {
1615116620 gr.setXORMode(Color.white);
16152
- gr.setColor(Color.red);
16621
+ gr.setColor(Color.white);
1615316622 if (!firstime)
1615416623 {
1615516624 gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH);
....@@ -16308,7 +16777,8 @@
1630816777
1630916778 public boolean mouseDrag(Event evt, int x, int y)
1631016779 {
16311
- //System.out.println("mouseDrag: " + evt);
16780
+ System.out.println("mouseDrag: " + evt);
16781
+ System.exit(0);
1631216782 /*
1631316783 drag = true;
1631416784 //System.out.println("Mouse DRAG");
....@@ -16427,6 +16897,7 @@
1642716897 public boolean mouseUp(Event evt, int x, int y)
1642816898 {
1642916899 System.out.println("mouseUp: " + evt);
16900
+ System.exit(0);
1643016901 /*
1643116902 locked = false;
1643216903 if (isRenderer)
....@@ -16697,7 +17168,7 @@
1669717168 return;
1669817169 }
1669917170
16700
- if (WIREFRAME)
17171
+ //if (WIREFRAME)
1670117172 gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL);
1670217173
1670317174 gl.glDisable(gl.GL_CULL_FACE);
....@@ -16788,7 +17259,8 @@
1678817259 gl.glDisable(GL.GL_TEXTURE_GEN_R);
1678917260
1679017261 cubemap.disable();
16791
- ////cubemap.unbind();
17262
+ //cubemap.dispose();
17263
+
1679217264 if (CULLFACE)
1679317265 {
1679417266 gl.glEnable(gl.GL_CULL_FACE);
....@@ -16796,6 +17268,8 @@
1679617268
1679717269 if (WIREFRAME)
1679817270 gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE);
17271
+ else
17272
+ gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL);
1679917273 }
1680017274
1680117275 private void DrawChecker(GL gl)
....@@ -16844,7 +17318,7 @@
1684417318 gl.glScalef(1.0f, -1.0f, 1.0f);
1684517319 }
1684617320
16847
- gl.glNormal3f(0.0f, 0.0f, 1.0f);
17321
+ SetGLNormal(gl, 0.0f, 0.0f, 1.0f);
1684817322
1684917323 float step = 2; // 0.1666f; //0.25f;
1685017324 float stepv = 2; // step * 1652 / 998;
....@@ -17133,7 +17607,7 @@
1713317607
1713417608 float depth = depths[y * TEX_SIZE + x];
1713517609
17136
- if (pointselection && mouseMode == SELECT && depth != 0 && depth != 1)
17610
+ if (pointselection && (mouseMode & SELECT) == SELECT && depth != 0 && depth != 1)
1713717611 {
1713817612 pointselection = false;
1713917613
....@@ -17324,6 +17798,7 @@
1732417798
1732517799 public void init(GLAutoDrawable drawable)
1732617800 {
17801
+ if (Globals.DEBUG)
1732717802 System.out.println("shadow buffer init");
1732817803
1732917804 GL gl = drawable.getGL();
....@@ -17796,6 +18271,11 @@
1779618271 static boolean DEBUG_SELECTION = false;
1779718272 boolean OCCLUSION_CULLING = false; //true;
1779818273 public boolean lightMode = false;
18274
+
18275
+ private boolean keepshadow;
18276
+
18277
+ static public boolean capsLocked = false; // VR
18278
+
1779918279 static public int indexcount = 0;
1780018280 /*static*/ cColor vertexOcclusion = new cColor();
1780118281 //private int selection_view = -1;