Normand Briere
2019-08-17 ecc1309a04b527c62ffe97e814daf050dbd025cd
Object3D.java
....@@ -22,6 +22,7 @@
2222 //static final long serialVersionUID = -607422624994562685L;
2323 static final long serialVersionUID = 5022536242724664900L;
2424
25
+ // Use GetUUID for backward compatibility with null.
2526 private UUID uuid = UUID.randomUUID();
2627
2728 // TEMPORARY for mocap undo. No need to be transient.
....@@ -29,9 +30,14 @@
2930 Object3D saveskeleton;
3031 //
3132
32
- byte[] versions[];
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
3337 int versionindex = -1;
3438
39
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>();
40
+
3541 ScriptNode scriptnode;
3642
3743 void InitOthers()
....@@ -219,7 +225,7 @@
219225 // o.bRep.support = null;
220226 // }
221227 o.selection = this.selection;
222
- o.versions = this.versions;
228
+ o.versionlist = this.versionlist;
223229 o.versionindex = this.versionindex;
224230
225231 if (this.support != null)
....@@ -242,6 +248,29 @@
242248 // this.support = null;
243249 // this.fileparent = null;
244250 }
251
+
252
+// Object3D GetObject(java.util.UUID uuid)
253
+// {
254
+// if (this.uuid.equals(uuid))
255
+// return this;
256
+//
257
+// if (blockloop)
258
+// return null;
259
+//
260
+// blockloop = true;
261
+//
262
+// for (int i=0; i<Size(); i++)
263
+// {
264
+// Object3D o = get(i).GetObject(uuid);
265
+//
266
+// if (o != null)
267
+// return o;
268
+// }
269
+//
270
+// blockloop = false;
271
+//
272
+// return null;
273
+// }
245274
246275 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
247276 {
....@@ -277,7 +306,7 @@
277306
278307 this.selection = o.selection;
279308
280
- this.versions = o.versions;
309
+ this.versionlist = o.versionlist;
281310 this.versionindex = o.versionindex;
282311 // July 2019 if (this.bRep != null)
283312 // this.bRep.support = o.transientrep;
....@@ -1011,6 +1040,9 @@
10111040
10121041 if (material == null || material.multiply)
10131042 return true;
1043
+
1044
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1045
+ return false;
10141046
10151047 // Transparent objects are dynamic because we have to sort the triangles.
10161048 return material.opacity > 0.99;
....@@ -2438,6 +2470,11 @@
24382470 else
24392471 {
24402472 //((ObjEditor)editWindow).SetupUI2(null);
2473
+ if (objectUI != null)
2474
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2475
+ else
2476
+ //new Exception().printStackTrace();
2477
+ System.err.println("objectUI is null");
24412478 }
24422479 }
24432480
....@@ -2567,7 +2604,8 @@
25672604 private static final int editSelf = 1;
25682605 private static final int editChild = 2;
25692606
2570
- void drawEditHandles(ClickInfo info, int level)
2607
+ void drawEditHandles(//ClickInfo info,
2608
+ int level)
25712609 {
25722610 if (level == 0)
25732611 {
....@@ -2575,7 +2613,8 @@
25752613 return;
25762614
25772615 Object3D selectee;
2578
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2616
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2617
+ level + 1))
25792618 {
25802619 selectee = (Object3D) e.nextElement();
25812620 }
....@@ -2583,19 +2622,22 @@
25832622 } else
25842623 {
25852624 //super.
2586
- drawEditHandles0(info, level + 1);
2625
+ drawEditHandles0(//info,
2626
+ level + 1);
25872627 }
25882628 }
25892629
2590
- boolean doEditClick(ClickInfo info, int level)
2630
+ boolean doEditClick(//ClickInfo info,
2631
+ int level)
25912632 {
25922633 doSomething = 0;
25932634 if (level == 0)
25942635 {
2595
- return doParentClick(info);
2636
+ return doParentClick(); //info);
25962637 }
25972638 if (//super.
2598
- doEditClick0(info, level))
2639
+ doEditClick0(//info,
2640
+ level))
25992641 {
26002642 doSomething = 1;
26012643 return true;
....@@ -2605,7 +2647,7 @@
26052647 }
26062648 }
26072649
2608
- boolean doParentClick(ClickInfo info)
2650
+ boolean doParentClick() //ClickInfo info)
26092651 {
26102652 if (selection == null)
26112653 {
....@@ -2618,7 +2660,8 @@
26182660 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
26192661 {
26202662 Object3D selectee = (Object3D) e.nextElement();
2621
- if (selectee.doEditClick(info, 1))
2663
+ if (selectee.doEditClick(//info,
2664
+ 1))
26222665 {
26232666 childToDrag = selectee;
26242667 doSomething = 2;
....@@ -2630,13 +2673,15 @@
26302673 return retval;
26312674 }
26322675
2633
- void doEditDrag(ClickInfo info, boolean opposite)
2676
+ void doEditDrag(//ClickInfo clickInfo,
2677
+ boolean opposite)
26342678 {
26352679 switch (doSomething)
26362680 {
26372681 case 1: // '\001'
26382682 //super.
2639
- doEditDrag0(info, opposite);
2683
+ doEditDrag0(//clickInfo,
2684
+ opposite);
26402685 break;
26412686
26422687 case 2: // '\002'
....@@ -2649,11 +2694,13 @@
26492694 {
26502695 //sel.hitSomething = childToDrag.hitSomething;
26512696 //childToDrag.doEditDrag(info);
2652
- sel.doEditDrag(info, opposite);
2697
+ sel.doEditDrag(//clickInfo,
2698
+ opposite);
26532699 } else
26542700 {
26552701 //super.
2656
- doEditDrag0(info, opposite);
2702
+ doEditDrag0(//clickInfo,
2703
+ opposite);
26572704 }
26582705 }
26592706 break;
....@@ -2671,6 +2718,9 @@
26712718 {
26722719 deselectAll();
26732720 }
2721
+
2722
+ new Exception().printStackTrace();
2723
+
26742724 ClickInfo newInfo = new ClickInfo();
26752725 newInfo.flags = info.flags;
26762726 newInfo.bounds = info.bounds;
....@@ -5526,6 +5576,11 @@
55265576 if (fullname == null)
55275577 return "";
55285578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
55295584 // System.out.println("Fullname = " + fullname);
55305585
55315586 // Does not work on Windows due to C:
....@@ -5538,7 +5593,7 @@
55385593
55395594 if (split.length == 0)
55405595 {
5541
- return "";
5596
+ return fullname.pigment = "";
55425597 }
55435598
55445599 if (split.length <= 2)
....@@ -5546,22 +5601,27 @@
55465601 if (fullname.name.endsWith(":"))
55475602 {
55485603 // Windows
5549
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55505605 }
55515606
5552
- return split[0];
5607
+ return fullname.pigment = split[0];
55535608 }
55545609
55555610 // Windows
55565611 assert(split.length == 4);
55575612
5558
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
55595614 }
55605615
55615616 static String GetBump(cTexture fullname)
55625617 {
55635618 if (fullname == null)
55645619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
55655625
55665626 // System.out.println("Fullname = " + fullname);
55675627 // Does not work on Windows due to C:
....@@ -5573,12 +5633,12 @@
55735633
55745634 if (split.length == 0)
55755635 {
5576
- return "";
5636
+ return fullname.bump = "";
55775637 }
55785638
55795639 if (split.length == 1)
55805640 {
5581
- return "";
5641
+ return fullname.bump = "";
55825642 }
55835643
55845644 if (split.length == 2)
....@@ -5586,16 +5646,16 @@
55865646 if (fullname.name.endsWith(":"))
55875647 {
55885648 // Windows
5589
- return "";
5649
+ return fullname.bump = "";
55905650 }
55915651
5592
- return split[1];
5652
+ return fullname.bump = split[1];
55935653 }
55945654
55955655 // Windows
55965656 assert(split.length == 4);
55975657
5598
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
55995659 }
56005660
56015661 String GetPigmentTexture()
....@@ -5678,6 +5738,9 @@
56785738 texname = "";
56795739
56805740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
56815744 Touch();
56825745 }
56835746
....@@ -5750,6 +5813,8 @@
57505813 texname = "";
57515814
57525815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5816
+
5817
+ GetTextures().bump = null;
57535818
57545819 Touch();
57555820 }
....@@ -5893,8 +5958,10 @@
58935958 if (support != null)
58945959 support = support;
58955960
5896
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5897
- boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5961
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5962
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5963
+
5964
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
58985965
58995966 if (!usecalllists && bRep != null && bRep.displaylist > 0)
59005967 {
....@@ -5904,8 +5971,9 @@
59045971 // usecalllists &= !(parent instanceof RandomNode);
59055972 // usecalllists = false;
59065973
5907
- if (GetBRep() != null)
5908
- usecalllists = usecalllists;
5974
+ if (display.DrawMode() == display.SHADOW)
5975
+ //GetBRep() != null)
5976
+ usecalllists = !!usecalllists;
59095977 //System.out.println("draw " + this);
59105978 //new Exception().printStackTrace();
59115979
....@@ -5927,7 +5995,7 @@
59275995 if (!(this instanceof Composite))
59285996 touched = false;
59295997 //if (displaylist == -1 && usecalllists)
5930
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5998
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59315999 {
59326000 bRep.displaylist = display.GenList();
59336001 assert(bRep.displaylist != 0);
....@@ -5938,7 +6006,7 @@
59386006
59396007 //System.out.println("\tnew list " + list);
59406008 //gl.glDrawBuffer(gl.GL_NONE);
5941
- if (usecalllists)
6009
+ if (usecalllists && bRep.displaylist > 0)
59426010 {
59436011 // System.err.println("new list " + bRep.displaylist + " for " + this);
59446012 display.NewList(bRep.displaylist);
....@@ -5947,7 +6015,7 @@
59476015 CallList(display, root, selected, blocked);
59486016
59496017 // compiled = true;
5950
- if (usecalllists)
6018
+ if (usecalllists && bRep.displaylist > 0)
59516019 {
59526020 // System.err.println("end list " + bRep.displaylist + " for " + this);
59536021 display.EndList();
....@@ -7298,20 +7366,23 @@
72987366 }
72997367 }
73007368
7301
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7369
+ static ClickInfo clickInfo = new ClickInfo();
7370
+
7371
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7372
+ Point outPt, Rectangle outRec)
73027373 {
7303
- int hc = info.bounds.x + info.bounds.width / 2;
7304
- int vc = info.bounds.y + info.bounds.height / 2;
7305
- double[][] toscreen = info.toScreen;
7374
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7375
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7376
+ double[][] toscreen = clickInfo.toScreen;
73067377 if (toscreen == null)
73077378 {
7308
- toscreen = new Camera(info.camera.viewCode).toScreen;
7379
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
73097380 }
73107381 cVector vec = in;
73117382 LA.xformPos(in, toscreen, in);
73127383 //System.out.println("Distance = " + info.camera.Distance());
7313
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7314
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7384
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7385
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
73157386 outPt.x = hc + (int) vec.x;
73167387 outPt.y = vc - (int) vec.y;
73177388 outRec.x = outPt.x - 3;
....@@ -7319,15 +7390,18 @@
73197390 outRec.width = outRec.height = 6;
73207391 }
73217392
7322
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7393
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7394
+ )
73237395 {
73247396 Point pt = new Point(0, 0);
73257397 Rectangle rec = new Rectangle();
7326
- calcHotSpot(in, info, pt, rec);
7398
+ calcHotSpot(in, //clickInfo,
7399
+ pt, rec);
73277400 return rec;
73287401 }
73297402
7330
- void drawEditHandles0(ClickInfo info, int level)
7403
+ void drawEditHandles0(//ClickInfo clickInfo,
7404
+ int level)
73317405 {
73327406 if (level == 0)
73337407 {
....@@ -7336,16 +7410,19 @@
73367410 {
73377411 cVector origin = new cVector();
73387412 //LA.xformPos(origin, toParent, origin);
7339
- Rectangle spot = calcHotSpot(origin, info);
7413
+ if (this.clickInfo == null)
7414
+ this.clickInfo = new ClickInfo();
7415
+
7416
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
73407417 Rectangle boundary = new Rectangle();
73417418 boundary.x = spot.x - 30;
73427419 boundary.y = spot.y - 30;
73437420 boundary.width = spot.width + 60;
73447421 boundary.height = spot.height + 60;
7345
- info.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
73467423 int spotw = spot.x + spot.width;
73477424 int spoth = spot.y + spot.height;
7348
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7425
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73497426 // if (CameraPane.Xmin > spot.x)
73507427 // {
73517428 // CameraPane.Xmin = spot.x;
....@@ -7362,11 +7439,6 @@
73627439 // {
73637440 // CameraPane.Ymax = spoth;
73647441 // }
7365
- spot.translate(32, 32);
7366
- spotw = spot.x + spot.width;
7367
- spoth = spot.y + spot.height;
7368
- info.g.setColor(Color.cyan);
7369
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73707442 // if (CameraPane.Xmin > spot.x)
73717443 // {
73727444 // CameraPane.Xmin = spot.x;
....@@ -7385,10 +7457,15 @@
73857457 // }
73867458 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73877459 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7388
- spot.translate(0, -32);
7389
- info.g.setColor(Color.yellow);
7390
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7391
- info.g.setColor(Color.green);
7460
+ spot.translate(32, 0);
7461
+ clickInfo.g.setColor(Color.yellow);
7462
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7463
+
7464
+ spot.translate(32, 64);
7465
+ spotw = spot.x + spot.width;
7466
+ spoth = spot.y + spot.height;
7467
+ clickInfo.g.setColor(Color.cyan);
7468
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73927469 // if (CameraPane.Xmin > spot.x)
73937470 // {
73947471 // CameraPane.Xmin = spot.x;
....@@ -7405,8 +7482,9 @@
74057482 // {
74067483 // CameraPane.Ymax = spoth;
74077484 // }
7408
- info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7409
- (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
7485
+ clickInfo.g.setColor(Color.green);
7486
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7487
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74107488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
74117489 // if (CameraPane.Xmin > boundary.x)
74127490 // {
....@@ -7428,7 +7506,8 @@
74287506 }
74297507 }
74307508
7431
- boolean doEditClick0(ClickInfo info, int level)
7509
+ boolean doEditClick0(//ClickInfo clickInfo,
7510
+ int level)
74327511 {
74337512 if (level == 0)
74347513 {
....@@ -7437,8 +7516,8 @@
74377516
74387517 boolean retval = false;
74397518
7440
- startX = info.x;
7441
- startY = info.y;
7519
+ startX = clickInfo.x;
7520
+ startY = clickInfo.y;
74427521
74437522 hitSomething = -1;
74447523 cVector origin = new cVector();
....@@ -7448,22 +7527,53 @@
74487527 {
74497528 centerPt = new Point(0, 0);
74507529 }
7451
- calcHotSpot(origin, info, centerPt, spot);
7452
- if (spot.contains(info.x, info.y))
7530
+ calcHotSpot(origin, //info,
7531
+ centerPt, spot);
7532
+ if (spot.contains(clickInfo.x, clickInfo.y))
74537533 {
74547534 hitSomething = hitCenter;
74557535 retval = true;
74567536 }
74577537 spot.translate(32, 0);
7458
- if (spot.contains(info.x, info.y))
7538
+ if (spot.contains(clickInfo.x, clickInfo.y))
74597539 {
74607540 hitSomething = hitRotate;
74617541 retval = true;
74627542 }
74637543 spot.translate(0, 32);
7464
- if (spot.contains(info.x, info.y))
7544
+ spot.translate(32, 0);
7545
+ spot.translate(0, 32);
7546
+ if (spot.contains(clickInfo.x, clickInfo.y))
74657547 {
74667548 hitSomething = hitScale;
7549
+
7550
+ double scale = 0.005f * clickInfo.camera.Distance();
7551
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
7552
+ double sign = 1;
7553
+ if (hScale < 0)
7554
+ {
7555
+ sign = -1;
7556
+ }
7557
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7558
+ if (hScale < 0.01)
7559
+ {
7560
+ //hScale = 0.01;
7561
+ }
7562
+
7563
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
7564
+ sign = 1;
7565
+ if (vScale < 0)
7566
+ {
7567
+ sign = -1;
7568
+ }
7569
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7570
+ if (vScale < 0.01)
7571
+ {
7572
+ //vScale = 0.01;
7573
+ }
7574
+
7575
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7576
+
74677577 retval = true;
74687578 }
74697579
....@@ -7473,7 +7583,7 @@
74737583 }
74747584
74757585 //System.out.println("info.modifiers = " + info.modifiers);
7476
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7586
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
74777587 //System.out.println("modified = " + modified);
74787588 //new Exception().printStackTrace();
74797589 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7501,7 +7611,8 @@
75017611 return true;
75027612 }
75037613
7504
- void doEditDrag0(ClickInfo info, boolean opposite)
7614
+ void doEditDrag0(//ClickInfo info,
7615
+ boolean opposite)
75057616 {
75067617 if (hitSomething == 0)
75077618 {
....@@ -7515,7 +7626,7 @@
75157626
75167627 //System.out.println("hitSomething = " + hitSomething);
75177628
7518
- double scale = 0.005f * info.camera.Distance();
7629
+ double scale = 0.005f * clickInfo.camera.Distance();
75197630
75207631 cVector xlate = new cVector();
75217632 //cVector xlate2 = new cVector();
....@@ -7549,8 +7660,8 @@
75497660 toParent[3][i] = xlate.get(i);
75507661 LA.matInvert(toParent, fromParent);
75517662 */
7552
- cVector delta = LA.newVector(0, 0, startY - info.y);
7553
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7663
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7664
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75547665
75557666 LA.matCopy(startMat, toParent);
75567667 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7559,7 +7670,7 @@
75597670 } else
75607671 {
75617672 //LA.xformDir(delta, info.camera.fromScreen, delta);
7562
- cVector up = new cVector(info.camera.up);
7673
+ cVector up = new cVector(clickInfo.camera.up);
75637674 cVector away = new cVector();
75647675 //cVector right2 = new cVector();
75657676 //LA.vecCross(up, cVector.Z, right);
....@@ -7576,19 +7687,19 @@
75767687 LA.xformDir(up, ClickInfo.matbuffer, up);
75777688 // if (!CameraPane.LOCALTRANSFORM)
75787689 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7579
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7690
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
75807691 // if (!CameraPane.LOCALTRANSFORM)
75817692 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75827693 //LA.vecCross(up, cVector.Z, right2);
75837694
7584
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7695
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75857696
75867697 //System.out.println("DELTA0 = " + delta);
75877698 //System.out.println("AWAY = " + info.camera.away);
75887699 //System.out.println("UP = " + info.camera.up);
75897700 if (away.z > 0)
75907701 {
7591
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7702
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75927703 {
75937704 delta.x = -delta.x;
75947705 } else
....@@ -7603,7 +7714,7 @@
76037714 //System.out.println("DELTA1 = " + delta);
76047715 LA.xformDir(delta, ClickInfo.matbuffer, delta);
76057716 //System.out.println("DELTA2 = " + delta);
7606
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7717
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
76077718 LA.matCopy(startMat, toParent);
76087719 //System.out.println("DELTA3 = " + delta);
76097720 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7613,8 +7724,8 @@
76137724 break;
76147725
76157726 case hitRotate: // rotate
7616
- int dx = info.x - centerPt.x;
7617
- int dy = -(info.y - centerPt.y);
7727
+ int dx = clickInfo.x - centerPt.x;
7728
+ int dy = -(clickInfo.y - centerPt.y);
76187729 double angle = (double) Math.atan2(dx, dy);
76197730 angle = -(1.570796 - angle);
76207731
....@@ -7637,7 +7748,7 @@
76377748 }
76387749 /**/
76397750
7640
- switch (info.pane.RenderCamera().viewCode)
7751
+ switch (clickInfo.pane.RenderCamera().viewCode)
76417752 {
76427753 case 1: // '\001'
76437754 LA.matZRotate(toParent, angle);
....@@ -7664,7 +7775,7 @@
76647775 break;
76657776
76667777 case hitScale: // scale
7667
- double hScale = (double) (info.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
76687779 double sign = 1;
76697780 if (hScale < 0)
76707781 {
....@@ -7676,7 +7787,7 @@
76767787 //hScale = 0.01;
76777788 }
76787789
7679
- double vScale = (double) (info.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
76807791 sign = 1;
76817792 if (vScale < 0)
76827793 {
....@@ -7687,6 +7798,7 @@
76877798 {
76887799 //vScale = 0.01;
76897800 }
7801
+
76907802 LA.matCopy(startMat, toParent);
76917803 /**/
76927804 for (int i = 0; i < 3; i++)
....@@ -7696,33 +7808,39 @@
76967808 }
76977809 /**/
76987810
7699
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7811
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
77007812
77017813 if (totalScale < 0.01)
77027814 {
77037815 totalScale = 0.01;
77047816 }
77057817
7706
- switch (info.pane.RenderCamera().viewCode)
7818
+ switch (clickInfo.pane.RenderCamera().viewCode)
77077819 {
77087820 case 3: // '\001'
77097821 if (modified || opposite)
77107822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
77117826 //LA.matScale(toParent, 1, hScale, vScale);
7712
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
77137828 } // vScale, 1);
77147829 else
77157830 {
77167831 // EXCEPTION!
7717
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
77187833 } // vScale, 1);
77197834 break;
77207835
77217836 case 2: // '\002'
77227837 if (modified || opposite)
77237838 {
7724
- //LA.matScale(toParent, hScale, 1, vScale);
7725
- LA.matScale(toParent, 1, totalScale, 1);
7839
+ if (modified && opposite)
7840
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7841
+ else
7842
+ //LA.matScale(toParent, hScale, 1, vScale);
7843
+ LA.matScale(toParent, 1, totalScale, 1);
77267844 } else
77277845 {
77287846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7732,8 +7850,11 @@
77327850 case 1: // '\003'
77337851 if (modified || opposite)
77347852 {
7735
- //LA.matScale(toParent, hScale, vScale, 1);
7736
- LA.matScale(toParent, 1, 1, totalScale);
7853
+ if (modified && opposite)
7854
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7855
+ else
7856
+ //LA.matScale(toParent, hScale, vScale, 1);
7857
+ LA.matScale(toParent, 1, 1, totalScale);
77377858 } else
77387859 {
77397860 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7770,7 +7891,7 @@
77707891 } // NEW ...
77717892
77727893
7773
- info.pane.repaint();
7894
+ clickInfo.pane.repaint();
77747895 }
77757896
77767897 boolean overflow = false;