Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
CameraPane.java
....@@ -2065,7 +2065,7 @@
20652065 //System.err.println("Oeil on");
20662066 OEIL = true;
20672067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2068
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20692069 //pingthread.StepToTarget(true);
20702070 }
20712071
....@@ -2396,128 +2396,6 @@
23962396 public GL GetGL() // INTERFACE
23972397 {
23982398 return currentGL;
2399
- }
2400
-
2401
- private void GetRemoteZip(String url, String name, boolean unzip, boolean save)
2402
- {
2403
- java.net.URL u;
2404
- InputStream is = null;
2405
- DataInputStream dis;
2406
- java.util.zip.ZipInputStream zis;
2407
- //String s;
2408
-
2409
- System.out.println("GetRemoteZip " + name);
2410
-
2411
- int total = 0; // dis.available();
2412
-
2413
- byte[] bytes = new byte[16384];
2414
-
2415
- try
2416
- {
2417
- u = new java.net.URL(url + name);
2418
- is = u.openStream();
2419
-
2420
- System.out.println(url + name);
2421
-
2422
- if (unzip)
2423
- {
2424
- //dis = new DataInputStream(new BufferedInputStream(is));
2425
- zis = new java.util.zip.ZipInputStream(new BufferedInputStream(is));
2426
- //while ((s = dis.readLine()) != null)
2427
-
2428
- if (save)
2429
- new java.io.File(name).mkdirs();
2430
-
2431
- // FileOutputStream stream = new FileOutputStream("test.zip");
2432
- //
2433
- // int count;
2434
- //
2435
- // while ((count = dis.read(bytes)) != -1)
2436
- // {
2437
- // //System.out.println(s);
2438
- // System.out.println(count);
2439
- // total += count;
2440
- // stream.write(bytes);
2441
- // }
2442
- //
2443
- // stream.close();
2444
-
2445
- // now iterate through each item in the stream. The get next
2446
- // entry call will return a ZipEntry for each file in the
2447
- // stream
2448
- java.util.zip.ZipEntry entry;
2449
- while((entry = zis.getNextEntry())!=null)
2450
- {
2451
- if (entry.getName().endsWith(".gsm"))
2452
- {
2453
- continue;
2454
- }
2455
-
2456
- String s = String.format("Entry: %s len %d added %TD",
2457
- entry.getName(), entry.getSize(),
2458
- new java.util.Date(entry.getTime()));
2459
- System.out.println(s);
2460
-
2461
- if (save)
2462
- {
2463
- // Once we get the entry from the stream, the stream is
2464
- // positioned read to read the raw data, and we keep
2465
- // reading until read returns 0 or less.
2466
- String outpath = name + "/" + entry.getName();
2467
- FileOutputStream output = null;
2468
- try
2469
- {
2470
- output = new FileOutputStream(outpath);
2471
- int len = 0;
2472
- while ((len = zis.read(bytes)) > 0)
2473
- {
2474
- output.write(bytes, 0, len);
2475
- }
2476
- }
2477
- finally
2478
- {
2479
- // we must always close the output file
2480
- if(output!=null) output.close();
2481
- }
2482
- }
2483
- }
2484
- }
2485
- }
2486
- catch (java.net.MalformedURLException mue)
2487
- {
2488
- System.err.println("Ouch - a MalformedURLException happened.");
2489
- mue.printStackTrace();
2490
- //System.exit(2);
2491
- }
2492
- catch (IOException ioe)
2493
- {
2494
- //System.err.println("Oops - an IOException happened.");
2495
- //ioe.printStackTrace();
2496
- //System.exit(3);
2497
- }
2498
- finally
2499
- {
2500
- try
2501
- {
2502
- if (is != null)
2503
- is.close();
2504
- }
2505
- catch (IOException ioe)
2506
- {
2507
- }
2508
- }
2509
-
2510
- // System.out.println("length = " + total);
2511
-
2512
-// try
2513
-// {
2514
-// Runtime.getRuntime().exec("/usr/local/bin/wget https://archive3d.net/?a=download&do=get&id=7caca905");
2515
-// }
2516
-// catch (Exception e)
2517
-// {
2518
-// e.printStackTrace();
2519
-// }
2520
-
25212399 }
25222400
25232401 /**/
....@@ -11150,9 +11028,9 @@
1115011028
1115111029 gl.glMatrixMode(GL.GL_MODELVIEW);
1115211030
11153
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11154
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
11155
-//gl.glEnable(gl.GL_MULTISAMPLE);
11031
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11032
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11033
+gl.glEnable(gl.GL_MULTISAMPLE);
1115611034 } else
1115711035 {
1115811036 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11163,7 +11041,7 @@
1116311041 //System.out.println("BLENDING ON");
1116411042 gl.glEnable(GL.GL_BLEND);
1116511043 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11166
-
11044
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1116711045 gl.glMatrixMode(gl.GL_PROJECTION);
1116811046 gl.glLoadIdentity();
1116911047
....@@ -11649,7 +11527,7 @@
1164911527 if ((TRACK || SHADOWTRACK) || zoomonce)
1165011528 {
1165111529 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11652
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11530
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1165311531 pingthread.StepToTarget(true); // true);
1165411532 // zoomonce = false;
1165511533 }
....@@ -14065,7 +13943,7 @@
1406513943
1406613944 // fev 2014???
1406713945 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
14068
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13946
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1406913947 pingthread.StepToTarget(true); // true);
1407013948 }
1407113949 // if (!LIVE)
....@@ -14419,12 +14297,12 @@
1441914297 void GoDown(int mod)
1442014298 {
1442114299 MODIFIERS |= COMMAND;
14422
- /*
14300
+ /**/
1442314301 if((mod&SHIFT) == SHIFT)
1442414302 manipCamera.RotatePosition(0, -speed);
1442514303 else
14426
- manipCamera.BackForth(0, -speed*delta, getWidth());
14427
- */
14304
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14305
+ /**/
1442814306 if ((mod & SHIFT) == SHIFT)
1442914307 {
1443014308 mouseMode = mouseMode; // VR??
....@@ -14440,12 +14318,12 @@
1444014318 void GoUp(int mod)
1444114319 {
1444214320 MODIFIERS |= COMMAND;
14443
- /*
14321
+ /**/
1444414322 if((mod&SHIFT) == SHIFT)
1444514323 manipCamera.RotatePosition(0, speed);
1444614324 else
14447
- manipCamera.BackForth(0, speed*delta, getWidth());
14448
- */
14325
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14326
+ /**/
1444914327 if ((mod & SHIFT) == SHIFT)
1445014328 {
1445114329 mouseMode = mouseMode;
....@@ -14461,12 +14339,12 @@
1446114339 void GoLeft(int mod)
1446214340 {
1446314341 MODIFIERS |= COMMAND;
14464
- /*
14342
+ /**/
1446514343 if((mod&SHIFT) == SHIFT)
14466
- manipCamera.RotatePosition(speed, 0);
14467
- else
1446814344 manipCamera.Translate(speed*delta, 0, getWidth());
14469
- */
14345
+ else
14346
+ manipCamera.RotatePosition(speed, 0);
14347
+ /**/
1447014348 if ((mod & SHIFT) == SHIFT)
1447114349 {
1447214350 mouseMode = mouseMode;
....@@ -14482,12 +14360,12 @@
1448214360 void GoRight(int mod)
1448314361 {
1448414362 MODIFIERS |= COMMAND;
14485
- /*
14363
+ /**/
1448614364 if((mod&SHIFT) == SHIFT)
14487
- manipCamera.RotatePosition(-speed, 0);
14488
- else
1448914365 manipCamera.Translate(-speed*delta, 0, getWidth());
14490
- */
14366
+ else
14367
+ manipCamera.RotatePosition(-speed, 0);
14368
+ /**/
1449114369 if ((mod & SHIFT) == SHIFT)
1449214370 {
1449314371 mouseMode = mouseMode;
....@@ -14726,7 +14604,8 @@
1472614604 Globals.MOUSEDRAGGED = false;
1472714605
1472814606 movingcamera = false;
14729
- X = Y = 0;
14607
+ X = 0; // getBounds().width/2;
14608
+ Y = 0; // getBounds().height/2;
1473014609 //System.out.println("mouseReleased: " + e);
1473114610 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1473214611 }
....@@ -15067,7 +14946,9 @@
1506714946 case 'E' : COMPACT ^= true;
1506814947 repaint();
1506914948 break;
15070
- case 'W' : DEBUGHSB ^= true;
14949
+ case 'W' : // Wide Window (fullscreen)
14950
+ //DEBUGHSB ^= true;
14951
+ ObjEditor.theFrame.ToggleFullScreen();
1507114952 repaint();
1507214953 break;
1507314954 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -15093,13 +14974,7 @@
1509314974 repaint();
1509414975 break;
1509514976 case 'l':
15096
- lightMode ^= true;
15097
- Globals.lighttouched = true;
15098
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15099
- targetLookAt.set(manipCamera.lookAt);
15100
- repaint();
15101
- break;
15102
- case 'L':
14977
+ //case 'L':
1510314978 if (lightMode)
1510414979 {
1510514980 lightMode = false;
....@@ -15246,7 +15121,10 @@
1524615121 // kompactbit = 6;
1524715122 // break;
1524815123 case ' ':
15249
- ObjEditor.theFrame.ToggleFullScreen();
15124
+ lightMode ^= true;
15125
+ Globals.lighttouched = true;
15126
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15127
+ targetLookAt.set(manipCamera.lookAt);
1525015128 repaint();
1525115129 break;
1525215130 //case '`' :
....@@ -15295,12 +15173,6 @@
1529515173 break;
1529615174 case '+':
1529715175
15298
- //for (int i=0; i<0x7FFFFFFF; i++)
15299
- {
15300
- //String.format("%08X", i); // "7caca905"
15301
- GetRemoteZip("https://archive3d.net/?a=download&do=get&id=", "7caca905", true, true);
15302
- }
15303
-
1530415176 /*
1530515177 //fontsize += 1;
1530615178 bbzoom *= 2;
....@@ -15318,17 +15190,17 @@
1531815190 case '=':
1531915191 IncDepth();
1532015192 //fontsize += 1;
15321
- object.editWindow.refreshContents(true);
15193
+ object.GetWindow().refreshContents(true);
1532215194 maskbit = 6;
1532315195 break;
1532415196 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1532515197 DecDepth();
1532615198 maskbit = 5;
1532715199 //if(fontsize > 1) fontsize -= 1;
15328
- if (object.editWindow == null)
15329
- new Exception().printStackTrace();
15330
- else
15331
- object.editWindow.refreshContents(true);
15200
+// if (object.editWindow == null)
15201
+// new Exception().printStackTrace();
15202
+// else
15203
+ object.GetWindow().refreshContents(true);
1533215204 break;
1533315205 case '{':
1533415206 manipCamera.shaper_fovy /= 1.1;
....@@ -15552,7 +15424,7 @@
1555215424 }
1555315425 */
1555415426
15555
- object.editWindow.EditSelection(false);
15427
+ object.GetWindow().EditSelection(false);
1555615428 }
1555715429
1555815430 void SelectParent()
....@@ -15569,10 +15441,10 @@
1556915441 {
1557015442 //selectees.remove(i);
1557115443 System.out.println("select parent of " + elem);
15572
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15444
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1557315445 } else
1557415446 {
15575
- group.editWindow.Select(elem.GetTreePath(), first, true);
15447
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1557615448 }
1557715449
1557815450 first = false;
....@@ -15614,12 +15486,12 @@
1561415486 for (int j = 0; j < group.children.size(); j++)
1561515487 {
1561615488 elem = (Object3D) group.children.elementAt(j);
15617
- object.editWindow.Select(elem.GetTreePath(), first, true);
15489
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1561815490 first = false;
1561915491 }
1562015492 } else
1562115493 {
15622
- object.editWindow.Select(elem.GetTreePath(), first, true);
15494
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1562315495 }
1562415496
1562515497 first = false;
....@@ -15630,21 +15502,21 @@
1563015502 {
1563115503 //Composite group = (Composite) object;
1563215504 Object3D group = object;
15633
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15505
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1563415506 }
1563515507
1563615508 void ResetTransform(int mask)
1563715509 {
1563815510 //Composite group = (Composite) object;
1563915511 Object3D group = object;
15640
- group.editWindow.ResetTransform(mask);
15512
+ group.GetWindow().ResetTransform(mask);
1564115513 }
1564215514
1564315515 void FlipTransform()
1564415516 {
1564515517 //Composite group = (Composite) object;
1564615518 Object3D group = object;
15647
- group.editWindow.FlipTransform();
15519
+ group.GetWindow().FlipTransform();
1564815520 // group.editWindow.ReduceMesh(true);
1564915521 }
1565015522
....@@ -15652,7 +15524,7 @@
1565215524 {
1565315525 //Composite group = (Composite) object;
1565415526 Object3D group = object;
15655
- group.editWindow.PrintMemory();
15527
+ group.GetWindow().PrintMemory();
1565615528 // group.editWindow.ReduceMesh(true);
1565715529 }
1565815530
....@@ -15660,7 +15532,7 @@
1566015532 {
1566115533 //Composite group = (Composite) object;
1566215534 Object3D group = object;
15663
- group.editWindow.ResetCentroid();
15535
+ group.GetWindow().ResetCentroid();
1566415536 }
1566515537
1566615538 void IncDepth()
....@@ -15845,23 +15717,42 @@
1584515717 */
1584615718 if (!isRenderer)
1584715719 {
15848
- object.drawEditHandles(info, 0);
15849
-
15850
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15720
+ if (object.selection.Size() > 0)
1585115721 {
15852
- switch (object.selection.get(0).hitSomething)
15722
+ int hitSomething = object.selection.get(0).hitSomething;
15723
+
15724
+ info.DX = 0;
15725
+ info.DY = 0;
15726
+ info.W = 1;
15727
+ if (hitSomething == Object3D.hitCenter)
1585315728 {
15854
- case Object3D.hitCenter: gr.setColor(Color.pink);
15855
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15856
- break;
15857
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15858
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15859
- break;
15860
- case Object3D.hitScale: gr.setColor(Color.cyan);
15861
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15862
- break;
15729
+ info.DX = X;
15730
+ if (X != 0)
15731
+ info.DX -= info.bounds.width/2;
15732
+
15733
+ info.DY = Y;
15734
+ if (Y != 0)
15735
+ info.DY -= info.bounds.height/2;
1586315736 }
15864
-
15737
+
15738
+ object.drawEditHandles(info, 0);
15739
+
15740
+ if (drag && (X != 0 || Y != 0))
15741
+ {
15742
+ switch (hitSomething)
15743
+ {
15744
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15745
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15746
+ break;
15747
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15748
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15749
+ break;
15750
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15751
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15752
+ break;
15753
+ }
15754
+
15755
+ }
1586515756 }
1586615757 }
1586715758 }
....@@ -16852,7 +16743,7 @@
1685216743 }
1685316744
1685416745 if (!movingcamera && !PAINTMODE)
16855
- object.editWindow.ScreenFitPoint(); // fev 2014
16746
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1685616747
1685716748 if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1685816749 {
....@@ -16864,17 +16755,17 @@
1686416755
1686516756 group.add(paintobj); // link
1686616757
16867
- object.editWindow.SnapObject(group);
16758
+ object.GetWindow().SnapObject(group);
1686816759
16869
- Object3D folder = object.editWindow.copy;
16760
+ Object3D folder = object.GetWindow().copy;
1687016761
16871
- if (object.editWindow.copy.selection.Size() > 0)
16872
- folder = object.editWindow.copy.selection.elementAt(0);
16762
+ if (object.GetWindow().copy.selection.Size() > 0)
16763
+ folder = object.GetWindow().copy.selection.elementAt(0);
1687316764
1687416765 folder.add(group);
1687516766
16876
- object.editWindow.ResetModel();
16877
- object.editWindow.refreshContents();
16767
+ object.GetWindow().ResetModel();
16768
+ object.GetWindow().refreshContents();
1687816769 }
1687916770 else
1688016771 paintcount = 0;