Normand Briere
2019-06-09 cd87df088b1850ba0c90beb6c866c443e4eaf3b9
CameraPane.java
....@@ -56,8 +56,6 @@
5656 static int CURRENTANTIALIAS = 0; // 1;
5757 /*static*/ boolean RENDERSHADOW = true;
5858 /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal
59
- static boolean ANIMATION = false;
60
- static String filename;
6159
6260 boolean DISPLAYTEXT = false;
6361 //boolean REDUCETEXTURE = true;
....@@ -92,6 +90,8 @@
9290
9391 static int tickcount = 0; // slow pose issue
9492
93
+static boolean BUTTONLESSWHEEL = false;
94
+static boolean ZOOMBOXMODE = false;
9595 static boolean BOXMODE = false;
9696 static boolean IMAGEFLIP = false;
9797 static boolean SMOOTHFOCUS = false;
....@@ -106,7 +106,7 @@
106106 static boolean OEIL = true;
107107 static boolean OEILONCE = false; // do oeilon then oeiloff
108108 static boolean LOOKAT = true;
109
-static boolean RANDOM = true; // false;
109
+static boolean SWITCH = true; // false;
110110 static boolean HANDLES = false; // selection doesn't work!!
111111 static boolean PAINTMODE = false;
112112
....@@ -150,12 +150,10 @@
150150 defaultcaps.setAccumAlphaBits(16);
151151 }
152152
153
- static CameraPane theRenderer;
154
-
155153 void SetAsGLRenderer(boolean b)
156154 {
157155 isRenderer = b;
158
- theRenderer = this;
156
+ Globals.theRenderer = this;
159157 }
160158
161159 CameraPane(Object3D o, Camera cam, boolean withcontext)
....@@ -193,9 +191,43 @@
193191
194192 /// INTERFACE
195193
194
+ public javax.media.opengl.GL GetGL0()
195
+ {
196
+ return null;
197
+ }
198
+
199
+ public int GenList()
200
+ {
201
+ javax.media.opengl.GL gl = GetGL();
202
+ return gl.glGenLists(1);
203
+ }
204
+
205
+ public void NewList(int id)
206
+ {
207
+ javax.media.opengl.GL gl = GetGL();
208
+ gl.glNewList(id, gl.GL_COMPILE); //_AND_EXECUTE);
209
+ }
210
+
211
+ public void CallList(int id)
212
+ {
213
+ javax.media.opengl.GL gl = GetGL();
214
+ gl.glCallList(id);
215
+ }
216
+
217
+ public void EndList()
218
+ {
219
+ javax.media.opengl.GL gl = GetGL();
220
+ gl.glEndList();
221
+ }
222
+
196223 public boolean IsBoxMode()
197224 {
198225 return BOXMODE;
226
+ }
227
+
228
+ public boolean IsZoomBoxMode()
229
+ {
230
+ return ZOOMBOXMODE;
199231 }
200232
201233 public void ClearDepth()
....@@ -816,7 +848,7 @@
816848
817849 if ((i % 100) == 0 && i != 0)
818850 {
819
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
851
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
820852 //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done");
821853 System.out.println((int) (100.0 * i / (br.positions.length / 3)) + "% (" + i + " of " + (br.positions.length / 3) + ")");
822854 }
....@@ -848,7 +880,7 @@
848880
849881 if ((i % 100) == 0 && i != 0)
850882 {
851
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
883
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
852884 //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done");
853885 System.out.println((int) (100.0 * i / br.VertexCount()) + "% (" + i + " of " + br.VertexCount() + ")");
854886 }
....@@ -1061,7 +1093,336 @@
10611093 gl.glMatrixMode(gl.GL_MODELVIEW);
10621094 }
10631095
1096
+ public void DrawBox(cVector min, cVector max)
1097
+ {
1098
+ javax.media.opengl.GL gl = GetGL();
1099
+ gl.glBegin(gl.GL_LINES);
1100
+
1101
+ gl.glVertex3d(min.x, min.y, min.z);
1102
+ gl.glVertex3d(min.x, min.y, max.z);
1103
+ gl.glVertex3d(min.x, min.y, min.z);
1104
+ gl.glVertex3d(min.x, max.y, min.z);
1105
+ gl.glVertex3d(min.x, min.y, min.z);
1106
+ gl.glVertex3d(max.x, min.y, min.z);
1107
+
1108
+ gl.glVertex3d(max.x, max.y, max.z);
1109
+ gl.glVertex3d(min.x, max.y, max.z);
1110
+ gl.glVertex3d(max.x, max.y, max.z);
1111
+ gl.glVertex3d(max.x, min.y, max.z);
1112
+ gl.glVertex3d(max.x, max.y, max.z);
1113
+ gl.glVertex3d(max.x, max.y, min.z);
1114
+
1115
+ gl.glEnd();
1116
+ }
1117
+
1118
+ public void DrawGeometry(BoundaryRep bRep, boolean flipV, boolean selectmode)
1119
+ {
1120
+ int[] strips = bRep.getRawIndices();
1121
+
1122
+ javax.media.opengl.GL gl = GetGL();
1123
+
1124
+ // TRIANGLE STRIP ARRAY
1125
+ if (bRep.trimmed)
1126
+ {
1127
+ float[] v = bRep.getRawVertices();
1128
+ float[] n = bRep.getRawNormals();
1129
+ float[] c = bRep.getRawColors();
1130
+ float[] uv = bRep.getRawUVMap();
1131
+
1132
+ int count2 = 0;
1133
+ int count3 = 0;
1134
+
1135
+ if (n.length > 0)
1136
+ {
1137
+ for (int i = 0; i < strips.length; i++)
1138
+ {
1139
+ gl.glBegin(gl.GL_TRIANGLE_STRIP);
1140
+
1141
+ /*
1142
+ boolean locked = false;
1143
+ float eps = 0.1f;
1144
+ boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
1145
+
1146
+ int dot = 0;
1147
+
1148
+ if ((dot&1) == 0)
1149
+ dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
1150
+
1151
+ if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
1152
+ gl.glTexCoord2f((float) qv.s, (float) qv.t);
1153
+ else
1154
+ {
1155
+ locked = true;
1156
+ gl.glTexCoord2f((float) pv.s, (float) pv.t);
1157
+ }
1158
+ //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
1159
+ gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
1160
+ if (hasnorm)
1161
+ {
1162
+ //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
1163
+ gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
1164
+ }
1165
+
1166
+ if ((dot&4) == 0)
1167
+ dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
1168
+
1169
+ if (wrap || !locked && (dot&8) != 0)
1170
+ gl.glTexCoord2f((float) rv.s, (float) rv.t);
1171
+ else
1172
+ gl.glTexCoord2f((float) pv.s, (float) pv.t);
1173
+
1174
+ f.dot = dot;
1175
+ */
1176
+
1177
+ if (!selectmode)
1178
+ {
1179
+ if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
1180
+ {
1181
+ gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1182
+ } else
1183
+ {
1184
+ gl.glNormal3f(0, 0, 1);
1185
+ }
1186
+
1187
+ if (c != null)
1188
+ //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
1189
+ {
1190
+ gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
1191
+ }
1192
+ }
1193
+ if (flipV)
1194
+ gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
1195
+ else
1196
+ gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1197
+ //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
1198
+ gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1199
+
1200
+ count2 += 2;
1201
+ count3 += 3;
1202
+ if (!selectmode)
1203
+ {
1204
+ if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
1205
+ {
1206
+ gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1207
+ } else
1208
+ {
1209
+ gl.glNormal3f(0, 0, 1);
1210
+ }
1211
+ if (c != null)
1212
+ {
1213
+ gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
1214
+ }
1215
+ }
1216
+ if (flipV)
1217
+ gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
1218
+ else
1219
+ gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1220
+ //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
1221
+ gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1222
+
1223
+ count2 += 2;
1224
+ count3 += 3;
1225
+ for (int j = 0; j < strips[i] - 2; j++)
1226
+ {
1227
+ //gl.glTexCoord2d(...);
1228
+ if (!selectmode)
1229
+ {
1230
+ if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
1231
+ {
1232
+ gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1233
+ } else
1234
+ {
1235
+ gl.glNormal3f(0, 0, 1);
1236
+ }
1237
+ if (c != null)
1238
+ {
1239
+ gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
1240
+ }
1241
+ }
1242
+
1243
+ if (flipV)
1244
+ gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
1245
+ else
1246
+ gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1247
+ //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
1248
+ gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1249
+ count2 += 2;
1250
+ count3 += 3;
1251
+ }
1252
+
1253
+ gl.glEnd();
1254
+ }
1255
+ }
1256
+
1257
+ assert count3 == v.length;
1258
+ }
1259
+ else // !trimmed
1260
+ {
1261
+ int count = 0;
1262
+ for (int i = 0; i < strips.length; i++)
1263
+ {
1264
+ gl.glBegin(gl.GL_TRIANGLE_STRIP);
1265
+
1266
+ Vertex p = bRep.GetVertex(bRep.indices[count++]);
1267
+ Vertex q = bRep.GetVertex(bRep.indices[count++]);
1268
+
1269
+ drawVertex(gl, p, flipV, selectmode);
1270
+ drawVertex(gl, q, flipV, selectmode);
1271
+
1272
+ for (int j = 0; j < strips[i] - 2; j++)
1273
+ {
1274
+ Vertex r = bRep.GetVertex(bRep.indices[count++]);
1275
+
1276
+ // if (j%2 == 0)
1277
+ // drawFace(p, q, r, display, null);
1278
+ // else
1279
+ // drawFace(p, r, q, display, null);
1280
+
1281
+ // p = q;
1282
+ // q = r;
1283
+ drawVertex(gl, r, flipV, selectmode);
1284
+ }
1285
+
1286
+ gl.glEnd();
1287
+ }
1288
+ }
1289
+ }
1290
+
1291
+ static cSpring.Point3D temp = new cSpring.Point3D();
1292
+ static cSpring.Point3D temp2 = new cSpring.Point3D();
1293
+ static cSpring.Point3D temp3 = new cSpring.Point3D();
1294
+
1295
+ public void DrawDynamicMesh(cMesh mesh)
1296
+ {
1297
+ GL gl = GetGL(); // getGL();
1298
+
1299
+ cSpring.PhysicsController3D Phys = mesh.Phys;
1300
+
1301
+ gl.glDisable(gl.GL_LIGHTING);
1302
+
1303
+ gl.glLineWidth(1);
1304
+ gl.glColor3f(1,1,1);
1305
+ gl.glBegin(gl.GL_LINES);
1306
+ double scale = 0;
1307
+ int count = 0;
1308
+ for (int s=0; s<Phys.allSprings.size(); s++)
1309
+ {
1310
+ cSpring.Spring spring = Phys.allSprings.get(s);
1311
+ if(s == 0)
1312
+ {
1313
+ //System.out.println(" spring : " + spring.a.position + "; " + spring.b.position);
1314
+ }
1315
+ if (mesh.showsprings)
1316
+ {
1317
+ temp.set(spring.a.position);
1318
+ temp.add(spring.b.position);
1319
+ temp.mul(0.5);
1320
+ temp2.set(spring.a.position);
1321
+ temp2.sub(spring.b.position);
1322
+ temp2.mul(spring.restLength/2);
1323
+ temp.sub(temp2);
1324
+ gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z);
1325
+ temp.add(temp2);
1326
+ temp.add(temp2);
1327
+ gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z);
1328
+ }
1329
+
1330
+ if (spring.isHandle)
1331
+ continue;
1332
+
1333
+ //if (scale < spring.restLength)
1334
+ scale += spring.restLength;
1335
+ count++;
1336
+ }
1337
+ gl.glEnd();
1338
+
1339
+ if (count == 0)
1340
+ scale = 0.01;
1341
+ else
1342
+ scale /= count * 3;
1343
+
1344
+ //scale = 0.25;
1345
+
1346
+ if (mesh.ShowInfo())
1347
+ {
1348
+ gl.glLineWidth(4);
1349
+ for (int s=0; s<Phys.allNodes.size(); s++)
1350
+ {
1351
+ cSpring.DynamicNode node = Phys.allNodes.get(s);
1352
+ if (node.mass == 0)
1353
+ continue;
1354
+
1355
+ int i = node.springs==null?-1:node.springs.size();
1356
+ gl.glColor3f((i>>2)&1,(i>>1)&1,i&1);
1357
+ //temp.set(node.springForce.x, node.springForce.y, node.springForce.z);
1358
+ //temp.normalize();
1359
+ //gl.glColor3d((temp.x+1)/2, (temp.y+1)/2, (temp.z+1)/2);
1360
+ gl.glBegin(gl.GL_LINES);
1361
+ gl.glVertex3d(node.position.x, node.position.y, node.position.z);
1362
+ //gl.glVertex3d(node.position.x + node.normal.x*scale, node.position.y + node.normal.y*scale, node.position.z + node.normal.z*scale);
1363
+ gl.glVertex3d(node.position.x + mesh.bRep.GetVertex(s).norm.x*scale,
1364
+ node.position.y + mesh.bRep.GetVertex(s).norm.y*scale,
1365
+ node.position.z + mesh.bRep.GetVertex(s).norm.z*scale);
1366
+ gl.glEnd();
1367
+ }
1368
+
1369
+ gl.glLineWidth(8);
1370
+ for (int s=0; s<Phys.allNodes.size(); s++)
1371
+ {
1372
+ cSpring.DynamicNode node = Phys.allNodes.get(s);
1373
+
1374
+ if (node.springs != null)
1375
+ {
1376
+ for (int i=0; i<node.springs.size(); i+=1)
1377
+ {
1378
+ cSpring.DynamicNode f = node.springs.get(i).GetOther(node);
1379
+
1380
+ int c = i+1;
1381
+ // c = node.springs.get(i).nbcopies;
1382
+
1383
+ gl.glColor3f((c>>2)&1,(c>>1)&1,c&1);
1384
+ gl.glBegin(gl.GL_LINES);
1385
+ gl.glVertex3d(node.position.x, node.position.y, node.position.z);
1386
+ gl.glVertex3d(f.position.x/3+node.position.x*2/3, f.position.y/3+node.position.y*2/3, f.position.z/3+node.position.z*2/3);
1387
+ gl.glEnd();
1388
+ }
1389
+ }
1390
+ }
1391
+
1392
+ gl.glLineWidth(1);
1393
+ }
1394
+
1395
+ gl.glEnable(gl.GL_LIGHTING);
1396
+ }
1397
+
10641398 /// INTERFACE
1399
+
1400
+ public void StartTriangles()
1401
+ {
1402
+ javax.media.opengl.GL gl = GetGL();
1403
+ gl.glBegin(gl.GL_TRIANGLES);
1404
+ }
1405
+
1406
+ public void EndTriangles()
1407
+ {
1408
+ GetGL().glEnd();
1409
+ }
1410
+
1411
+ void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean flipV, boolean selectmode)
1412
+ {
1413
+ if (!selectmode)
1414
+ {
1415
+ gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
1416
+ gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
1417
+
1418
+ if (flipV)
1419
+ gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
1420
+ else
1421
+ gl.glTexCoord2f((float) pv.s, (float) pv.t);
1422
+ }
1423
+
1424
+ gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
1425
+ }
10651426
10661427 void SetColor(Object3D obj, Vertex p0)
10671428 {
....@@ -1256,18 +1617,18 @@
12561617 //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0);
12571618 if (!material.multiply)
12581619 {
1259
- display.color = color;
1620
+ display.color = material.color;
12601621 display.saturation = material.modulation;
12611622 }
12621623 else
12631624 {
1264
- display.color *= color*2;
1625
+ display.color *= material.color*2;
12651626 display.saturation *= material.modulation*2;
12661627 }
12671628
12681629 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
12691630
1270
- float[] colorV = GrafreeD.colorV;
1631
+ float[] colorV = Grafreed.colorV;
12711632
12721633 /**/
12731634 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -1624,7 +1985,7 @@
16241985
16251986 static int camerachangeframe;
16261987
1627
- boolean SetCamera(Camera cam)
1988
+ public boolean SetCamera(Camera cam)
16281989 {
16291990 // may 2014 if (cam == cameras[0] || cam == cameras[1])
16301991 // return false;
....@@ -1752,33 +2113,6 @@
17522113 mainDL ^= true;
17532114 }
17542115
1755
- void ToggleTexture()
1756
- {
1757
- textureon ^= true;
1758
- }
1759
-
1760
- void ToggleLive()
1761
- {
1762
- Globals.setLIVE(Globals.isLIVE() ^ true);
1763
-
1764
- System.err.println("LIVE = " + Globals.isLIVE());
1765
-
1766
- if (!Globals.isLIVE()) // save sound
1767
- GrafreeD.savesound = true; // wav.save();
1768
- // else
1769
- repaint(); // start loop // may 2013
1770
- }
1771
-
1772
- void ToggleSupport()
1773
- {
1774
- SUPPORT ^= true;
1775
- }
1776
-
1777
- void ToggleAbort()
1778
- {
1779
- ABORTMODE ^= true;
1780
- }
1781
-
17822116 void ToggleFullScreen()
17832117 {
17842118 FULLSCREEN ^= true;
....@@ -1789,72 +2123,94 @@
17892123 Globals.CROWD ^= true;
17902124 }
17912125
1792
- void ToggleInertia()
1793
- {
1794
- INERTIA ^= true;
1795
- }
1796
-
17972126 void ToggleLocal()
17982127 {
17992128 LOCALTRANSFORM ^= true;
18002129 }
18012130
1802
- void ToggleFast()
2131
+ public void ToggleTexture()
2132
+ {
2133
+ textureon ^= true;
2134
+ }
2135
+
2136
+ public void ToggleLive()
2137
+ {
2138
+ Globals.setLIVE(Globals.isLIVE() ^ true);
2139
+
2140
+ System.err.println("LIVE = " + Globals.isLIVE());
2141
+
2142
+ if (!Globals.isLIVE()) // save sound
2143
+ Grafreed.savesound = true; // wav.save();
2144
+ // else
2145
+ repaint(); // start loop // may 2013
2146
+ }
2147
+
2148
+ public void ToggleSupport()
2149
+ {
2150
+ SUPPORT ^= true;
2151
+ }
2152
+
2153
+ public void ToggleAbort()
2154
+ {
2155
+ ABORTMODE ^= true;
2156
+ }
2157
+
2158
+ public void ToggleInertia()
2159
+ {
2160
+ INERTIA ^= true;
2161
+ }
2162
+
2163
+ public void ToggleFast()
18032164 {
18042165 FAST ^= true;
18052166 }
18062167
1807
- void ToggleSlowPose()
2168
+ public void ToggleSlowPose()
18082169 {
18092170 SLOWPOSE ^= true;
18102171 }
18112172
1812
- void ToggleFootContact()
1813
- {
1814
- FOOTCONTACT ^= true;
1815
- }
1816
-
1817
- void ToggleBoxMode()
2173
+ public void ToggleBoxMode()
18182174 {
18192175 BOXMODE ^= true;
18202176 }
18212177
1822
- void ToggleSmoothFocus()
2178
+ public void ToggleZoomBoxMode()
2179
+ {
2180
+ ZOOMBOXMODE ^= true;
2181
+ }
2182
+
2183
+ public void ToggleSmoothFocus()
18232184 {
18242185 SMOOTHFOCUS ^= true;
18252186 }
18262187
1827
- void ToggleImageFlip()
2188
+ public void ToggleImageFlip()
18282189 {
18292190 IMAGEFLIP ^= true;
18302191 }
18312192
1832
- void ToggleSpeakerMocap()
2193
+ public void ToggleSpeakerMocap()
18332194 {
18342195 SPEAKERMOCAP ^= true;
18352196 }
18362197
1837
- void ToggleSpeakerCamera()
2198
+ public void ToggleSpeakerCamera()
18382199 {
18392200 SPEAKERCAMERA ^= true;
18402201 }
18412202
1842
- void ToggleSpeakerFocus()
2203
+ public void ToggleSpeakerFocus()
18432204 {
18442205 SPEAKERFOCUS ^= true;
18452206 }
18462207
1847
- void ToggleDebug()
1848
- {
1849
- DEBUG ^= true;
1850
- }
1851
-
1852
- void ToggleFrustum()
2208
+ public void ToggleFrustum()
18532209 {
18542210 FRUSTUM ^= true;
18552211 }
18562212
1857
- void ToggleTrack()
2213
+ public void ToggleTrack()
18582214 {
18592215 TRACK ^= true;
18602216 if (TRACK)
....@@ -1873,25 +2229,35 @@
18732229 repaint();
18742230 }
18752231
1876
- void ToggleTrackOnce()
2232
+ public void ToggleTrackOnce()
18772233 {
18782234 TRACKONCE ^= true;
18792235 }
18802236
1881
- void ToggleShadowTrack()
2237
+ public void ToggleShadowTrack()
18822238 {
18832239 SHADOWTRACK ^= true;
18842240 repaint();
18852241 }
18862242
1887
- void ToggleOeil()
2243
+ public void ToggleOeil()
18882244 {
18892245 OEIL ^= true;
18902246 }
18912247
1892
- void ToggleOeilOnce()
2248
+ public void ToggleOeilOnce()
18932249 {
18942250 OEILONCE ^= true;
2251
+ }
2252
+
2253
+ void ToggleFootContact()
2254
+ {
2255
+ FOOTCONTACT ^= true;
2256
+ }
2257
+
2258
+ void ToggleDebug()
2259
+ {
2260
+ DEBUG ^= true;
18952261 }
18962262
18972263 void ToggleLookAt()
....@@ -1901,7 +2267,7 @@
19012267
19022268 void ToggleRandom()
19032269 {
1904
- RANDOM ^= true;
2270
+ SWITCH ^= true;
19052271 }
19062272
19072273 void ToggleHandles()
....@@ -3840,6 +4206,7 @@
38404206
38414207 com.sun.opengl.util.texture.Texture CompressTexture2(String name)
38424208 {
4209
+ new Exception().printStackTrace();
38434210 System.exit(0);
38444211 com.sun.opengl.util.texture.Texture texture = null;
38454212
....@@ -7655,7 +8022,7 @@
76558022 }
76568023 }
76578024
7658
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8025
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
76598026 {
76608027 if (// DrawMode() != 0 || /*tex == null ||*/
76618028 ambientOcclusion ) // || !textureon)
....@@ -7700,7 +8067,7 @@
77008067 return; // true;
77018068 }
77028069
7703
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)
8070
+ CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
77048071 {
77058072 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
77068073
....@@ -7708,12 +8075,16 @@
77088075 {
77098076 String texname = tex;
77108077
7711
- String[] split = tex.split("Textures");
7712
- if (split.length > 1)
7713
- texname = "/Users/nbriere/Textures" + split[split.length-1];
7714
- else
7715
- if (!texname.startsWith("/"))
7716
- texname = "/Users/nbriere/Textures/" + texname;
8078
+// String[] split = tex.split("Textures");
8079
+// if (split.length > 1)
8080
+// texname = "/Users/nbriere/Textures" + split[split.length-1];
8081
+// else
8082
+// if (!texname.startsWith("/"))
8083
+// texname = "/Users/nbriere/Textures/" + texname;
8084
+ if (!new File(tex).exists())
8085
+ {
8086
+ texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname;
8087
+ }
77178088
77188089 if (CACHETEXTURE)
77198090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -7813,7 +8184,9 @@
78138184 texturedata = GetFileTexture(cachename, processbump, resolution);
78148185
78158186
7816
- if (texturedata != null)
8187
+ if (texturedata == null)
8188
+ throw new Exception();
8189
+
78178190 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
78188191 //texture = GetTexture(tex, bump);
78198192 }
....@@ -7935,7 +8308,7 @@
79358308 return texture;
79368309 }
79378310
7938
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution)
8311
+ com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
79398312 {
79408313 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
79418314
....@@ -7953,14 +8326,14 @@
79538326 return texture!=null?texture.texture:null;
79548327 }
79558328
7956
- com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution)
8329
+ public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
79578330 {
79588331 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
79598332
79608333 return texture!=null?texture.texturedata:null;
79618334 }
79628335
7963
- boolean BindTexture(String tex, boolean bump, int resolution)
8336
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
79648337 {
79658338 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
79668339 {
....@@ -9026,7 +9399,7 @@
90269399 //gl.glFlush();
90279400 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
90289401
9029
- if (ANIMATION && ABORTED)
9402
+ if (Globals.ANIMATION && ABORTED)
90309403 {
90319404 System.err.println(" ABORTED FRAME");
90329405 break;
....@@ -9056,7 +9429,7 @@
90569429 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
90579430
90589431 // save image
9059
- if (ANIMATION && !ABORTED)
9432
+ if (Globals.ANIMATION && !ABORTED)
90609433 {
90619434 VPwidth = viewport[2];
90629435 VPheight = viewport[3];
....@@ -9167,11 +9540,11 @@
91679540
91689541 // imagecount++;
91699542
9170
- String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
9543
+ String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
91719544
91729545 if (!BOXMODE)
91739546 {
9174
- System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
9547
+ System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")");
91759548 }
91769549
91779550 if (!BOXMODE)
....@@ -9209,7 +9582,7 @@
92099582 ABORTED = false;
92109583 }
92119584 else
9212
- GrafreeD.wav.cursor += 735 * ACSIZE;
9585
+ Grafreed.wav.cursor += 735 * ACSIZE;
92139586
92149587 if (false)
92159588 {
....@@ -9872,11 +10245,11 @@
987210245
987310246 public void display(GLAutoDrawable drawable)
987410247 {
9875
- if (GrafreeD.savesound && GrafreeD.hassound)
10248
+ if (Grafreed.savesound && Grafreed.hassound)
987610249 {
9877
- GrafreeD.wav.save();
9878
- GrafreeD.savesound = false;
9879
- GrafreeD.hassound = false;
10250
+ Grafreed.wav.save();
10251
+ Grafreed.savesound = false;
10252
+ Grafreed.hassound = false;
988010253 }
988110254 // if (DEBUG_SELECTION)
988210255 // {
....@@ -10006,7 +10379,7 @@
1000610379 Object3D theobject = object;
1000710380 Object3D theparent = object.parent;
1000810381 object.parent = null;
10009
- object = (Object3D)GrafreeD.clone(object);
10382
+ object = (Object3D)Grafreed.clone(object);
1001010383 object.Stripify();
1001110384 if (theobject.selection == null || theobject.selection.Size() == 0)
1001210385 theobject.PreprocessOcclusion(this);
....@@ -10427,7 +10800,16 @@
1042710800 // Bump noise
1042810801 gl.glActiveTexture(GL.GL_TEXTURE6);
1042910802 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10430
- BindTexture(NOISE_TEXTURE, false, 2);
10803
+
10804
+ try
10805
+ {
10806
+ BindTexture(NOISE_TEXTURE, false, 2);
10807
+ }
10808
+ catch (Exception e)
10809
+ {
10810
+ System.err.println("FAILED: " + NOISE_TEXTURE);
10811
+ }
10812
+
1043110813
1043210814 gl.glActiveTexture(GL.GL_TEXTURE0);
1043310815 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -10891,8 +11273,14 @@
1089111273 {
1089211274 renderpass++;
1089311275 // System.out.println("Draw object... ");
11276
+ STEP = 1;
1089411277 if (FAST) // in case there is no script
10895
- STEP = 16;
11278
+ STEP = 8;
11279
+
11280
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11281
+ {
11282
+ STEP *= 4;
11283
+ }
1089611284
1089711285 //object.FullInvariants();
1089811286
....@@ -10906,8 +11294,8 @@
1090611294 e.printStackTrace();
1090711295 }
1090811296
10909
- if (GrafreeD.RENDERME > 0)
10910
- GrafreeD.RENDERME--; // mechante magouille
11297
+ if (Grafreed.RENDERME > 0)
11298
+ Grafreed.RENDERME--; // mechante magouille
1091111299
1091211300 Globals.ONESTEP = false;
1091311301 }
....@@ -10977,7 +11365,14 @@
1097711365
1097811366 usedtextures.clear();
1097911367
10980
- BindTextures(DEFAULT_TEXTURES, 2);
11368
+ try
11369
+ {
11370
+ BindTextures(DEFAULT_TEXTURES, 2);
11371
+ }
11372
+ catch (Exception e)
11373
+ {
11374
+ System.err.println("FAILED: " + DEFAULT_TEXTURES);
11375
+ }
1098111376 }
1098211377 //System.out.println("--> " + stackdepth);
1098311378 // GrafreeD.traceon();
....@@ -11068,7 +11463,14 @@
1106811463 if (checker != null && DrawMode() == DEFAULT)
1106911464 {
1107011465 //BindTexture(IMMORTAL_TEXTURE);
11071
- BindTextures(checker.GetTextures(), checker.texres);
11466
+ try
11467
+ {
11468
+ BindTextures(checker.GetTextures(), checker.texres);
11469
+ }
11470
+ catch (Exception e)
11471
+ {
11472
+ System.err.println("FAILED: " + checker.GetTextures());
11473
+ }
1107211474 // NEAREST
1107311475 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1107411476 DrawChecker(gl);
....@@ -12100,8 +12502,8 @@
1210012502
1210112503 // display shadow only (bump == 0)
1210212504 "SUB temp.x, half.x, shadow.x;" +
12103
- "MOV temp.y, -params6.x;" +
12104
- "SLT temp.z, temp.y, zero.x;" +
12505
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12506
+ "SLT temp.z, temp.y, -one2048th.x;" +
1210512507 "SUB temp.y, one.x, temp.z;" +
1210612508 "MUL temp.x, temp.x, temp.y;" +
1210712509 "KIL temp.x;" +
....@@ -12230,8 +12632,10 @@
1223012632 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1223112633
1223212634 "SUB temp.x, one.x, ndotl.x;" +
12233
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12234
- "ADD temp.y, one.y, options2.y;" + // sursurface
12635
+ // Tuning for default skin
12636
+ //"ADD temp.x, temp.x, options2.z;" + // lightsheen
12637
+ "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen
12638
+ "ADD temp.y, one.y, options2.y;" + // subsurface
1223512639 "MUL temp.x, temp.x, temp.y;" +
1223612640
1223712641 "MUL saturation, saturation, temp.xxxx;" +
....@@ -12430,7 +12834,7 @@
1243012834 //once = true;
1243112835 }
1243212836
12433
- System.out.print("Program #" + mode + "; length = " + program.length());
12837
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1243412838 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1243512839 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1243612840
....@@ -12563,12 +12967,16 @@
1256312967
1256412968 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1256512969 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
12970
+
12971
+ // Compare fragment depth in light space with shadowmap.
1256612972 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1256712973 "SGE temp.y, temp.x, zero.x;" +
12568
- "SUB " + shadow + ".y, one.x, temp.y;" +
12974
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
12975
+
12976
+ // Reverse comparison
1256912977 "SUB temp.x, one.x, temp.x;" +
1257012978 "MUL " + shadow + ".x, temp.x, temp.y;" +
12571
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
12979
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1257212980 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1257312981
1257412982 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12582,6 +12990,10 @@
1258212990 // No shadow for backface
1258312991 "DP3 temp.x, normal, lightd;" +
1258412992 "SLT temp.x, temp.x, zero.x;" + // shadoweps
12993
+ "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
12994
+
12995
+ // No shadow when out of frustrum
12996
+ "SGE temp.x, " + depth + ".z, one.z;" +
1258512997 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1258612998 "";
1258712999 }
....@@ -13140,7 +13552,7 @@
1314013552 public void mousePressed(MouseEvent e)
1314113553 {
1314213554 //System.out.println("mousePressed: " + e);
13143
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13555
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1314413556 }
1314513557
1314613558 static long prevtime = 0;
....@@ -13167,6 +13579,7 @@
1316713579
1316813580 //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio);
1316913581
13582
+ if (BUTTONLESSWHEEL)
1317013583 if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30)
1317113584 {
1317213585 return;
....@@ -13175,7 +13588,7 @@
1317513588 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
1317613589
1317713590 // TIMER
13178
- if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
13591
+ if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
1317913592 {
1318013593 keepboxmode = BOXMODE;
1318113594 keepsupport = SUPPORT;
....@@ -13215,8 +13628,8 @@
1321513628 // mode |= META;
1321613629 //}
1321713630
13218
- SetMouseMode(WHEEL | e.getModifiersEx());
13219
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13631
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13632
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1322013633 anchorX = ax;
1322113634 anchorY = ay;
1322213635 prevX = px;
....@@ -13276,6 +13689,10 @@
1327613689 // wasliveok = true;
1327713690 // waslive = false;
1327813691
13692
+ // May 2019 Forget it:
13693
+ if (true)
13694
+ return;
13695
+
1327913696 // source == timer
1328013697 if (mouseDown)
1328113698 {
....@@ -13314,7 +13731,7 @@
1331413731
1331513732 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1331613733
13317
- void clickStart(int x, int y, int modifiers)
13734
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1331813735 {
1331913736 if (!wasliveok)
1332013737 return;
....@@ -13331,7 +13748,7 @@
1333113748 // touched = true; // main DL
1333213749 if (isRenderer)
1333313750 {
13334
- SetMouseMode(modifiers);
13751
+ SetMouseMode(modifiers, modifiersex);
1333513752 }
1333613753
1333713754 selectX = anchorX = x;
....@@ -13344,7 +13761,7 @@
1334413761 clicked = true;
1334513762 hold = false;
1334613763
13347
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13764
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1334813765 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1334913766 {
1335013767 // System.out.println("RESTART II " + modifiers);
....@@ -13375,7 +13792,7 @@
1337513792 info.camera = renderCamera;
1337613793 info.x = x;
1337713794 info.y = y;
13378
- info.modifiers = modifiers;
13795
+ info.modifiers = modifiersex;
1337913796 editObj = object.doEditClick(info, 0);
1338013797 if (!editObj)
1338113798 {
....@@ -13392,11 +13809,11 @@
1339213809
1339313810 public void mouseDragged(MouseEvent e)
1339413811 {
13812
+ //System.out.println("mouseDragged: " + e);
1339513813 if (isRenderer)
1339613814 movingcamera = true;
1339713815 //if (drawing)
1339813816 //return;
13399
- //System.out.println("mouseDragged: " + e);
1340013817 if ((e.getModifiersEx() & CTRL) != 0
1340113818 || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
1340213819 {
....@@ -13404,7 +13821,7 @@
1340413821 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1340513822 }
1340613823 else
13407
- drag(e.getX(), e.getY(), e.getModifiersEx());
13824
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1340813825
1340913826 //try { Thread.sleep(1); } catch (Exception ex) {}
1341013827 }
....@@ -13577,6 +13994,7 @@
1357713994
1357813995 public void run()
1357913996 {
13997
+ new Exception().printStackTrace();
1358013998 System.exit(0);
1358113999 for (;;)
1358214000 {
....@@ -13640,7 +14058,7 @@
1364014058 {
1364114059 Globals.lighttouched = true;
1364214060 }
13643
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14061
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1364414062 }
1364514063 //else
1364614064 }
....@@ -13740,7 +14158,7 @@
1374014158 int X, Y;
1374114159 boolean SX, SY;
1374214160
13743
- void drag(int x, int y, int modifiers)
14161
+ void drag(int x, int y, int modifiers, int modifiersex)
1374414162 {
1374514163 if (IsFrozen())
1374614164 {
....@@ -13749,17 +14167,17 @@
1374914167
1375014168 drag = true; // NEW
1375114169
13752
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14170
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1375314171
1375414172 X = x;
1375514173 Y = y;
1375614174 // floating state for animation
13757
- MODIFIERS = modifiers;
13758
- modifiers &= ~1024;
14175
+ MODIFIERS = modifiersex;
14176
+ modifiersex &= ~1024;
1375914177 if (false) // modifiers != 0)
1376014178 {
1376114179 //new Exception().printStackTrace();
13762
- System.out.println("mouseDragged: " + modifiers);
14180
+ System.out.println("mouseDragged: " + modifiersex);
1376314181 System.out.println("SHIFT = " + SHIFT);
1376414182 System.out.println("CONTROL = " + COMMAND);
1376514183 System.out.println("META = " + META);
....@@ -13779,7 +14197,7 @@
1377914197 info.camera = renderCamera;
1378014198 info.x = x;
1378114199 info.y = y;
13782
- object.editWindow.copy.doEditDrag(info);
14200
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1378314201 } else
1378414202 {
1378514203 if (x < startX)
....@@ -13931,7 +14349,6 @@
1393114349 public void mouseMoved(MouseEvent e)
1393214350 {
1393314351 //System.out.println("mouseMoved: " + e);
13934
-
1393514352 if (isRenderer)
1393614353 return;
1393714354
....@@ -13979,9 +14396,9 @@
1397914396 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1398014397 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1398114398
13982
- if (control || command || IsFrozen())
14399
+// No delay if (control || command || IsFrozen())
1398314400 timeout = true;
13984
- else
14401
+// ?? May 2019 else
1398514402 // timer.setDelay((modifiers & 128) != 0?0:350);
1398614403 mouseDown = false;
1398714404 if (!control && !command) // june 2013
....@@ -14091,7 +14508,7 @@
1409114508 System.out.println("keyReleased: " + e);
1409214509 }
1409314510
14094
- void SetMouseMode(int modifiers)
14511
+ void SetMouseMode(int modifiers, int modifiersex)
1409514512 {
1409614513 //System.out.println("SetMouseMode = " + modifiers);
1409714514 //modifiers &= ~1024;
....@@ -14103,25 +14520,25 @@
1410314520 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1410414521 // return;
1410514522 //System.out.println("SetMode = " + modifiers);
14106
- if ((modifiers & WHEEL) == WHEEL)
14523
+ if ((modifiersex & WHEEL) == WHEEL)
1410714524 {
1410814525 mouseMode |= ZOOM;
1410914526 }
1411014527
1411114528 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14112
- if (capsLocked || (modifiers & META) == META)
14529
+ if (capsLocked) // || (modifiers & META) == META)
1411314530 {
1411414531 mouseMode |= VR; // BACKFORTH;
1411514532 }
14116
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14533
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1411714534 {
1411814535 mouseMode |= SELECT;
1411914536 }
14120
- if ((modifiers & COMMAND) == COMMAND)
14537
+ if ((modifiersex & COMMAND) == COMMAND)
1412114538 {
1412214539 mouseMode |= SELECT;
1412314540 }
14124
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14541
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1412514542 {
1412614543 mouseMode &= ~VR;
1412714544 mouseMode |= TRANSLATE;
....@@ -14150,10 +14567,10 @@
1415014567
1415114568 if (isRenderer) //
1415214569 {
14153
- SetMouseMode(modifiers);
14570
+ SetMouseMode(0, modifiers);
1415414571 }
1415514572
14156
- theRenderer.keyPressed(key);
14573
+ Globals.theRenderer.keyPressed(key);
1415714574 }
1415814575
1415914576 int kompactbit = 4; // power bit
....@@ -14165,7 +14582,7 @@
1416514582 float SATPOW = 1; // 2; // 0.5f;
1416614583 float BRIPOW = 1; // 0.5f; // 0.5f;
1416714584
14168
- void keyPressed(int key)
14585
+ public void keyPressed(int key)
1416914586 {
1417014587 if (key >= '0' && key <= '5')
1417114588 clampbit = (key-'0');
....@@ -14486,7 +14903,7 @@
1448614903 //RESIZETEXTURE ^= true;
1448714904 //break;
1448814905 case 'z':
14489
- RENDERSHADOW ^= true;
14906
+ Globals.RENDERSHADOW ^= true;
1449014907 Globals.lighttouched = true;
1449114908 repaint();
1449214909 break;
....@@ -14602,6 +15019,7 @@
1460215019 }
1460315020 //System.out.println("shaper_fovy = " + manipCamera.shaper_fovy);
1460415021 }
15022
+
1460515023 static double OCCLUSIONBOOST = 1; // 0.5;
1460615024
1460715025 void keyReleased(int key, int modifiers)
....@@ -14609,11 +15027,11 @@
1460915027 //mode = ROTATE;
1461015028 if ((MODIFIERS & COMMAND) == 0) // VR??
1461115029 {
14612
- SetMouseMode(modifiers);
15030
+ SetMouseMode(0, modifiers);
1461315031 }
1461415032 }
1461515033
14616
- protected void processKeyEvent(KeyEvent e)
15034
+ public void processKeyEvent(KeyEvent e)
1461715035 {
1461815036 switch (e.getID())
1461915037 {
....@@ -14743,8 +15161,9 @@
1474315161
1474415162 protected void processMouseMotionEvent(MouseEvent e)
1474515163 {
14746
- //System.out.println("processMouseMotionEvent: " + mouseMode);
14747
- if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15164
+ //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
15165
+ //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15166
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1474815167 {
1474915168 mouseMoved(e);
1475015169 } else
....@@ -14774,6 +15193,7 @@
1477415193
1477515194 void SelectParent()
1477615195 {
15196
+ new Exception().printStackTrace();
1477715197 System.exit(0);
1477815198 Composite group = (Composite) object;
1477915199 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -14797,6 +15217,7 @@
1479715217
1479815218 void SelectChildren()
1479915219 {
15220
+ new Exception().printStackTrace();
1480015221 System.exit(0);
1480115222 /*
1480215223 Composite group = (Composite) object;
....@@ -15179,6 +15600,7 @@
1517915600 public boolean mouseDown(Event evt, int x, int y)
1518015601 {
1518115602 System.out.println("mouseDown: " + evt);
15603
+ System.exit(0);
1518215604 /*
1518315605 locked = true;
1518415606 drag = false;
....@@ -15222,7 +15644,7 @@
1522215644 {
1522315645 keyPressed(0, modifiers);
1522415646 }
15225
- clickStart(x, y, modifiers);
15647
+ // clickStart(x, y, modifiers);
1522615648 return true;
1522715649 }
1522815650
....@@ -15340,7 +15762,7 @@
1534015762 {
1534115763 keyReleased(0, 0);
1534215764 }
15343
- drag(x, y, modifiers);
15765
+ drag(x, y, 0, modifiers);
1534415766 return true;
1534515767 }
1534615768
....@@ -15910,6 +16332,7 @@
1591016332 {
1591116333 if (!selection)
1591216334 {
16335
+ new Exception().printStackTrace();
1591316336 System.exit(0);
1591416337 return;
1591516338 }
....@@ -16037,16 +16460,16 @@
1603716460 System.out.println("; fromto " + sel + " " + Trunk(previousselectedpoint.toParent[3][0]) + " " + Trunk(previousselectedpoint.toParent[3][2]) + " " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][2]));
1603816461 }
1603916462
16040
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16463
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1604116464 }
1604216465 }
1604316466
1604416467 if (!movingcamera && !PAINTMODE)
1604516468 object.editWindow.ScreenFitPoint(); // fev 2014
1604616469
16047
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16470
+ if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1604816471 {
16049
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16472
+ Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1605016473
1605116474 Object3D group = new Object3D("inst" + paintcount++);
1605216475
....@@ -16202,7 +16625,7 @@
1620216625 gl.glDisable(gl.GL_CULL_FACE);
1620316626 }
1620416627
16205
- if (!RENDERSHADOW)
16628
+ if (!Globals.RENDERSHADOW)
1620616629 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1620716630
1620816631 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16212,7 +16635,7 @@
1621216635 //gl.glColorMask(false, false, false, false);
1621316636
1621416637 //render_scene_from_light_view(gl, drawable, 0, 0);
16215
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16638
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1621616639 {
1621716640 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1621816641
....@@ -16696,10 +17119,11 @@
1669617119 static IntBuffer textbuffer = null; // IntBuffer.allocate(TEXT_WIDTH*8*8 * TEXT_HEIGHT);
1669717120 // Depth buffer format
1669817121 //private int depth_format;
16699
- static public void NextIndex(Object3D o, GL gl)
17122
+
17123
+ public void NextIndex()
1670017124 {
1670117125 indexcount+=16;
16702
- gl.glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0);
17126
+ GetGL().glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0);
1670317127 //objects[indexcount] = o;
1670417128 //System.out.println("indexcount = " + indexcount);
1670517129 }