Normand Briere
2019-05-05 631719825b865aaf9fa1cb124d9fc5bd9dd78bd4
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
....@@ -191,9 +191,43 @@
191191
192192 /// INTERFACE
193193
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
+
194223 public boolean IsBoxMode()
195224 {
196225 return BOXMODE;
226
+ }
227
+
228
+ public boolean IsZoomBoxMode()
229
+ {
230
+ return ZOOMBOXMODE;
197231 }
198232
199233 public void ClearDepth()
....@@ -1059,7 +1093,336 @@
10591093 gl.glMatrixMode(gl.GL_MODELVIEW);
10601094 }
10611095
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
+
10621398 /// 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
+ }
10631426
10641427 void SetColor(Object3D obj, Vertex p0)
10651428 {
....@@ -1254,12 +1617,12 @@
12541617 //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0);
12551618 if (!material.multiply)
12561619 {
1257
- display.color = color;
1620
+ display.color = material.color;
12581621 display.saturation = material.modulation;
12591622 }
12601623 else
12611624 {
1262
- display.color *= color*2;
1625
+ display.color *= material.color*2;
12631626 display.saturation *= material.modulation*2;
12641627 }
12651628
....@@ -1812,6 +2175,11 @@
18122175 BOXMODE ^= true;
18132176 }
18142177
2178
+ public void ToggleZoomBoxMode()
2179
+ {
2180
+ ZOOMBOXMODE ^= true;
2181
+ }
2182
+
18152183 public void ToggleSmoothFocus()
18162184 {
18172185 SMOOTHFOCUS ^= true;
....@@ -1899,7 +2267,7 @@
18992267
19002268 void ToggleRandom()
19012269 {
1902
- RANDOM ^= true;
2270
+ SWITCH ^= true;
19032271 }
19042272
19052273 void ToggleHandles()
....@@ -3838,6 +4206,7 @@
38384206
38394207 com.sun.opengl.util.texture.Texture CompressTexture2(String name)
38404208 {
4209
+ new Exception().printStackTrace();
38414210 System.exit(0);
38424211 com.sun.opengl.util.texture.Texture texture = null;
38434212
....@@ -7706,12 +8075,16 @@
77068075 {
77078076 String texname = tex;
77088077
7709
- String[] split = tex.split("Textures");
7710
- if (split.length > 1)
7711
- texname = "/Users/nbriere/Textures" + split[split.length-1];
7712
- else
7713
- if (!texname.startsWith("/"))
7714
- 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
+ }
77158088
77168089 if (CACHETEXTURE)
77178090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -9024,7 +9397,7 @@
90249397 //gl.glFlush();
90259398 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
90269399
9027
- if (ANIMATION && ABORTED)
9400
+ if (Globals.ANIMATION && ABORTED)
90289401 {
90299402 System.err.println(" ABORTED FRAME");
90309403 break;
....@@ -9054,7 +9427,7 @@
90549427 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
90559428
90569429 // save image
9057
- if (ANIMATION && !ABORTED)
9430
+ if (Globals.ANIMATION && !ABORTED)
90589431 {
90599432 VPwidth = viewport[2];
90609433 VPheight = viewport[3];
....@@ -9165,7 +9538,7 @@
91659538
91669539 // imagecount++;
91679540
9168
- String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
9541
+ String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
91699542
91709543 if (!BOXMODE)
91719544 {
....@@ -10889,8 +11262,14 @@
1088911262 {
1089011263 renderpass++;
1089111264 // System.out.println("Draw object... ");
11265
+ STEP = 1;
1089211266 if (FAST) // in case there is no script
10893
- STEP = 16;
11267
+ STEP = 8;
11268
+
11269
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11270
+ {
11271
+ STEP *= 4;
11272
+ }
1089411273
1089511274 //object.FullInvariants();
1089611275
....@@ -12228,8 +12607,10 @@
1222812607 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1222912608
1223012609 "SUB temp.x, one.x, ndotl.x;" +
12231
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12232
- "ADD temp.y, one.y, options2.y;" + // sursurface
12610
+ // Tuning for default skin
12611
+ //"ADD temp.x, temp.x, options2.z;" + // lightsheen
12612
+ "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen
12613
+ "ADD temp.y, one.y, options2.y;" + // subsurface
1223312614 "MUL temp.x, temp.x, temp.y;" +
1223412615
1223512616 "MUL saturation, saturation, temp.xxxx;" +
....@@ -13138,7 +13519,7 @@
1313813519 public void mousePressed(MouseEvent e)
1313913520 {
1314013521 //System.out.println("mousePressed: " + e);
13141
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13522
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1314213523 }
1314313524
1314413525 static long prevtime = 0;
....@@ -13165,6 +13546,7 @@
1316513546
1316613547 //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio);
1316713548
13549
+ if (BUTTONLESSWHEEL)
1316813550 if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30)
1316913551 {
1317013552 return;
....@@ -13173,7 +13555,7 @@
1317313555 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
1317413556
1317513557 // TIMER
13176
- if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
13558
+ if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
1317713559 {
1317813560 keepboxmode = BOXMODE;
1317913561 keepsupport = SUPPORT;
....@@ -13213,8 +13595,8 @@
1321313595 // mode |= META;
1321413596 //}
1321513597
13216
- SetMouseMode(WHEEL | e.getModifiersEx());
13217
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13598
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13599
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1321813600 anchorX = ax;
1321913601 anchorY = ay;
1322013602 prevX = px;
....@@ -13274,6 +13656,10 @@
1327413656 // wasliveok = true;
1327513657 // waslive = false;
1327613658
13659
+ // May 2019 Forget it:
13660
+ if (true)
13661
+ return;
13662
+
1327713663 // source == timer
1327813664 if (mouseDown)
1327913665 {
....@@ -13312,7 +13698,7 @@
1331213698
1331313699 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1331413700
13315
- void clickStart(int x, int y, int modifiers)
13701
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1331613702 {
1331713703 if (!wasliveok)
1331813704 return;
....@@ -13329,7 +13715,7 @@
1332913715 // touched = true; // main DL
1333013716 if (isRenderer)
1333113717 {
13332
- SetMouseMode(modifiers);
13718
+ SetMouseMode(modifiers, modifiersex);
1333313719 }
1333413720
1333513721 selectX = anchorX = x;
....@@ -13342,7 +13728,7 @@
1334213728 clicked = true;
1334313729 hold = false;
1334413730
13345
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13731
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1334613732 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1334713733 {
1334813734 // System.out.println("RESTART II " + modifiers);
....@@ -13373,7 +13759,7 @@
1337313759 info.camera = renderCamera;
1337413760 info.x = x;
1337513761 info.y = y;
13376
- info.modifiers = modifiers;
13762
+ info.modifiers = modifiersex;
1337713763 editObj = object.doEditClick(info, 0);
1337813764 if (!editObj)
1337913765 {
....@@ -13390,11 +13776,11 @@
1339013776
1339113777 public void mouseDragged(MouseEvent e)
1339213778 {
13779
+ //System.out.println("mouseDragged: " + e);
1339313780 if (isRenderer)
1339413781 movingcamera = true;
1339513782 //if (drawing)
1339613783 //return;
13397
- //System.out.println("mouseDragged: " + e);
1339813784 if ((e.getModifiersEx() & CTRL) != 0
1339913785 || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
1340013786 {
....@@ -13402,7 +13788,7 @@
1340213788 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1340313789 }
1340413790 else
13405
- drag(e.getX(), e.getY(), e.getModifiersEx());
13791
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1340613792
1340713793 //try { Thread.sleep(1); } catch (Exception ex) {}
1340813794 }
....@@ -13575,6 +13961,7 @@
1357513961
1357613962 public void run()
1357713963 {
13964
+ new Exception().printStackTrace();
1357813965 System.exit(0);
1357913966 for (;;)
1358013967 {
....@@ -13638,7 +14025,7 @@
1363814025 {
1363914026 Globals.lighttouched = true;
1364014027 }
13641
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14028
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1364214029 }
1364314030 //else
1364414031 }
....@@ -13738,7 +14125,7 @@
1373814125 int X, Y;
1373914126 boolean SX, SY;
1374014127
13741
- void drag(int x, int y, int modifiers)
14128
+ void drag(int x, int y, int modifiers, int modifiersex)
1374214129 {
1374314130 if (IsFrozen())
1374414131 {
....@@ -13747,17 +14134,17 @@
1374714134
1374814135 drag = true; // NEW
1374914136
13750
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14137
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1375114138
1375214139 X = x;
1375314140 Y = y;
1375414141 // floating state for animation
13755
- MODIFIERS = modifiers;
13756
- modifiers &= ~1024;
14142
+ MODIFIERS = modifiersex;
14143
+ modifiersex &= ~1024;
1375714144 if (false) // modifiers != 0)
1375814145 {
1375914146 //new Exception().printStackTrace();
13760
- System.out.println("mouseDragged: " + modifiers);
14147
+ System.out.println("mouseDragged: " + modifiersex);
1376114148 System.out.println("SHIFT = " + SHIFT);
1376214149 System.out.println("CONTROL = " + COMMAND);
1376314150 System.out.println("META = " + META);
....@@ -13777,7 +14164,7 @@
1377714164 info.camera = renderCamera;
1377814165 info.x = x;
1377914166 info.y = y;
13780
- object.editWindow.copy.doEditDrag(info);
14167
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1378114168 } else
1378214169 {
1378314170 if (x < startX)
....@@ -13929,7 +14316,6 @@
1392914316 public void mouseMoved(MouseEvent e)
1393014317 {
1393114318 //System.out.println("mouseMoved: " + e);
13932
-
1393314319 if (isRenderer)
1393414320 return;
1393514321
....@@ -13977,9 +14363,9 @@
1397714363 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1397814364 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1397914365
13980
- if (control || command || IsFrozen())
14366
+// No delay if (control || command || IsFrozen())
1398114367 timeout = true;
13982
- else
14368
+// ?? May 2019 else
1398314369 // timer.setDelay((modifiers & 128) != 0?0:350);
1398414370 mouseDown = false;
1398514371 if (!control && !command) // june 2013
....@@ -14089,7 +14475,7 @@
1408914475 System.out.println("keyReleased: " + e);
1409014476 }
1409114477
14092
- void SetMouseMode(int modifiers)
14478
+ void SetMouseMode(int modifiers, int modifiersex)
1409314479 {
1409414480 //System.out.println("SetMouseMode = " + modifiers);
1409514481 //modifiers &= ~1024;
....@@ -14101,25 +14487,25 @@
1410114487 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1410214488 // return;
1410314489 //System.out.println("SetMode = " + modifiers);
14104
- if ((modifiers & WHEEL) == WHEEL)
14490
+ if ((modifiersex & WHEEL) == WHEEL)
1410514491 {
1410614492 mouseMode |= ZOOM;
1410714493 }
1410814494
1410914495 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14110
- if (capsLocked || (modifiers & META) == META)
14496
+ if (capsLocked) // || (modifiers & META) == META)
1411114497 {
1411214498 mouseMode |= VR; // BACKFORTH;
1411314499 }
14114
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14500
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1411514501 {
1411614502 mouseMode |= SELECT;
1411714503 }
14118
- if ((modifiers & COMMAND) == COMMAND)
14504
+ if ((modifiersex & COMMAND) == COMMAND)
1411914505 {
1412014506 mouseMode |= SELECT;
1412114507 }
14122
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14508
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1412314509 {
1412414510 mouseMode &= ~VR;
1412514511 mouseMode |= TRANSLATE;
....@@ -14148,7 +14534,7 @@
1414814534
1414914535 if (isRenderer) //
1415014536 {
14151
- SetMouseMode(modifiers);
14537
+ SetMouseMode(0, modifiers);
1415214538 }
1415314539
1415414540 Globals.theRenderer.keyPressed(key);
....@@ -14608,7 +14994,7 @@
1460814994 //mode = ROTATE;
1460914995 if ((MODIFIERS & COMMAND) == 0) // VR??
1461014996 {
14611
- SetMouseMode(modifiers);
14997
+ SetMouseMode(0, modifiers);
1461214998 }
1461314999 }
1461415000
....@@ -14742,8 +15128,9 @@
1474215128
1474315129 protected void processMouseMotionEvent(MouseEvent e)
1474415130 {
14745
- //System.out.println("processMouseMotionEvent: " + mouseMode);
14746
- if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15131
+ //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
15132
+ //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15133
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1474715134 {
1474815135 mouseMoved(e);
1474915136 } else
....@@ -14773,6 +15160,7 @@
1477315160
1477415161 void SelectParent()
1477515162 {
15163
+ new Exception().printStackTrace();
1477615164 System.exit(0);
1477715165 Composite group = (Composite) object;
1477815166 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -14796,6 +15184,7 @@
1479615184
1479715185 void SelectChildren()
1479815186 {
15187
+ new Exception().printStackTrace();
1479915188 System.exit(0);
1480015189 /*
1480115190 Composite group = (Composite) object;
....@@ -15178,6 +15567,7 @@
1517815567 public boolean mouseDown(Event evt, int x, int y)
1517915568 {
1518015569 System.out.println("mouseDown: " + evt);
15570
+ System.exit(0);
1518115571 /*
1518215572 locked = true;
1518315573 drag = false;
....@@ -15221,7 +15611,7 @@
1522115611 {
1522215612 keyPressed(0, modifiers);
1522315613 }
15224
- clickStart(x, y, modifiers);
15614
+ // clickStart(x, y, modifiers);
1522515615 return true;
1522615616 }
1522715617
....@@ -15339,7 +15729,7 @@
1533915729 {
1534015730 keyReleased(0, 0);
1534115731 }
15342
- drag(x, y, modifiers);
15732
+ drag(x, y, 0, modifiers);
1534315733 return true;
1534415734 }
1534515735
....@@ -15909,6 +16299,7 @@
1590916299 {
1591016300 if (!selection)
1591116301 {
16302
+ new Exception().printStackTrace();
1591216303 System.exit(0);
1591316304 return;
1591416305 }
....@@ -16695,10 +17086,11 @@
1669517086 static IntBuffer textbuffer = null; // IntBuffer.allocate(TEXT_WIDTH*8*8 * TEXT_HEIGHT);
1669617087 // Depth buffer format
1669717088 //private int depth_format;
16698
- static public void NextIndex(Object3D o, GL gl)
17089
+
17090
+ public void NextIndex()
1669917091 {
1670017092 indexcount+=16;
16701
- gl.glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0);
17093
+ GetGL().glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0);
1670217094 //objects[indexcount] = o;
1670317095 //System.out.println("indexcount = " + indexcount);
1670417096 }