Normand Briere
2019-08-16 83d0c2fa0bd2e96448f776144e1a89cdb1bb6998
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
....@@ -5751,6 +5814,8 @@
57515814
57525815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
57535816
5817
+ GetTextures().bump = null;
5818
+
57545819 Touch();
57555820 }
57565821
....@@ -5771,6 +5836,38 @@
57715836
57725837 blockloop = true;
57735838 child.ResetBumpTexture();
5839
+ blockloop = false;
5840
+ }
5841
+ }
5842
+
5843
+ void EmbedTextures(boolean embed)
5844
+ {
5845
+ if (blockloop)
5846
+ return;
5847
+
5848
+ //if (GetTextures() != null)
5849
+ if (embed)
5850
+ CameraPane.EmbedTextures(GetTextures());
5851
+ else
5852
+ {
5853
+ GetTextures().pigmentdata = null;
5854
+ GetTextures().bumpdata = null;
5855
+ GetTextures().pw = 0;
5856
+ GetTextures().ph = 0;
5857
+ GetTextures().bw = 0;
5858
+ GetTextures().bh = 0;
5859
+ }
5860
+
5861
+ int nb = Size();
5862
+ for (int i = 0; i < nb; i++)
5863
+ {
5864
+ Object3D child = (Object3D) get(i);
5865
+
5866
+ if (child == null)
5867
+ continue;
5868
+
5869
+ blockloop = true;
5870
+ child.EmbedTextures(embed);
57745871 blockloop = false;
57755872 }
57765873 }
....@@ -5861,8 +5958,10 @@
58615958 if (support != null)
58625959 support = support;
58635960
5864
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5865
- 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.
58665965
58675966 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58685967 {
....@@ -5872,8 +5971,9 @@
58725971 // usecalllists &= !(parent instanceof RandomNode);
58735972 // usecalllists = false;
58745973
5875
- if (GetBRep() != null)
5876
- usecalllists = usecalllists;
5974
+ if (display.DrawMode() == display.SHADOW)
5975
+ //GetBRep() != null)
5976
+ usecalllists = !!usecalllists;
58775977 //System.out.println("draw " + this);
58785978 //new Exception().printStackTrace();
58795979
....@@ -5895,7 +5995,7 @@
58955995 if (!(this instanceof Composite))
58965996 touched = false;
58975997 //if (displaylist == -1 && usecalllists)
5898
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5998
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58995999 {
59006000 bRep.displaylist = display.GenList();
59016001 assert(bRep.displaylist != 0);
....@@ -5906,7 +6006,7 @@
59066006
59076007 //System.out.println("\tnew list " + list);
59086008 //gl.glDrawBuffer(gl.GL_NONE);
5909
- if (usecalllists)
6009
+ if (usecalllists && bRep.displaylist > 0)
59106010 {
59116011 // System.err.println("new list " + bRep.displaylist + " for " + this);
59126012 display.NewList(bRep.displaylist);
....@@ -5915,7 +6015,7 @@
59156015 CallList(display, root, selected, blocked);
59166016
59176017 // compiled = true;
5918
- if (usecalllists)
6018
+ if (usecalllists && bRep.displaylist > 0)
59196019 {
59206020 // System.err.println("end list " + bRep.displaylist + " for " + this);
59216021 display.EndList();
....@@ -7266,20 +7366,23 @@
72667366 }
72677367 }
72687368
7269
- 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)
72707373 {
7271
- int hc = info.bounds.x + info.bounds.width / 2;
7272
- int vc = info.bounds.y + info.bounds.height / 2;
7273
- 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;
72747377 if (toscreen == null)
72757378 {
7276
- toscreen = new Camera(info.camera.viewCode).toScreen;
7379
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72777380 }
72787381 cVector vec = in;
72797382 LA.xformPos(in, toscreen, in);
72807383 //System.out.println("Distance = " + info.camera.Distance());
7281
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7282
- 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();
72837386 outPt.x = hc + (int) vec.x;
72847387 outPt.y = vc - (int) vec.y;
72857388 outRec.x = outPt.x - 3;
....@@ -7287,15 +7390,18 @@
72877390 outRec.width = outRec.height = 6;
72887391 }
72897392
7290
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7393
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7394
+ )
72917395 {
72927396 Point pt = new Point(0, 0);
72937397 Rectangle rec = new Rectangle();
7294
- calcHotSpot(in, info, pt, rec);
7398
+ calcHotSpot(in, //clickInfo,
7399
+ pt, rec);
72957400 return rec;
72967401 }
72977402
7298
- void drawEditHandles0(ClickInfo info, int level)
7403
+ void drawEditHandles0(//ClickInfo clickInfo,
7404
+ int level)
72997405 {
73007406 if (level == 0)
73017407 {
....@@ -7304,16 +7410,19 @@
73047410 {
73057411 cVector origin = new cVector();
73067412 //LA.xformPos(origin, toParent, origin);
7307
- Rectangle spot = calcHotSpot(origin, info);
7413
+ if (this.clickInfo == null)
7414
+ this.clickInfo = new ClickInfo();
7415
+
7416
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
73087417 Rectangle boundary = new Rectangle();
73097418 boundary.x = spot.x - 30;
73107419 boundary.y = spot.y - 30;
73117420 boundary.width = spot.width + 60;
73127421 boundary.height = spot.height + 60;
7313
- info.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
73147423 int spotw = spot.x + spot.width;
73157424 int spoth = spot.y + spot.height;
7316
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7425
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73177426 // if (CameraPane.Xmin > spot.x)
73187427 // {
73197428 // CameraPane.Xmin = spot.x;
....@@ -7330,11 +7439,6 @@
73307439 // {
73317440 // CameraPane.Ymax = spoth;
73327441 // }
7333
- spot.translate(32, 32);
7334
- spotw = spot.x + spot.width;
7335
- spoth = spot.y + spot.height;
7336
- info.g.setColor(Color.cyan);
7337
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73387442 // if (CameraPane.Xmin > spot.x)
73397443 // {
73407444 // CameraPane.Xmin = spot.x;
....@@ -7353,10 +7457,15 @@
73537457 // }
73547458 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73557459 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7356
- spot.translate(0, -32);
7357
- info.g.setColor(Color.yellow);
7358
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7359
- 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);
73607469 // if (CameraPane.Xmin > spot.x)
73617470 // {
73627471 // CameraPane.Xmin = spot.x;
....@@ -7373,8 +7482,9 @@
73737482 // {
73747483 // CameraPane.Ymax = spoth;
73757484 // }
7376
- info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7377
- (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);
73787488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
73797489 // if (CameraPane.Xmin > boundary.x)
73807490 // {
....@@ -7396,7 +7506,8 @@
73967506 }
73977507 }
73987508
7399
- boolean doEditClick0(ClickInfo info, int level)
7509
+ boolean doEditClick0(//ClickInfo clickInfo,
7510
+ int level)
74007511 {
74017512 if (level == 0)
74027513 {
....@@ -7405,8 +7516,8 @@
74057516
74067517 boolean retval = false;
74077518
7408
- startX = info.x;
7409
- startY = info.y;
7519
+ startX = clickInfo.x;
7520
+ startY = clickInfo.y;
74107521
74117522 hitSomething = -1;
74127523 cVector origin = new cVector();
....@@ -7416,22 +7527,53 @@
74167527 {
74177528 centerPt = new Point(0, 0);
74187529 }
7419
- calcHotSpot(origin, info, centerPt, spot);
7420
- if (spot.contains(info.x, info.y))
7530
+ calcHotSpot(origin, //info,
7531
+ centerPt, spot);
7532
+ if (spot.contains(clickInfo.x, clickInfo.y))
74217533 {
74227534 hitSomething = hitCenter;
74237535 retval = true;
74247536 }
74257537 spot.translate(32, 0);
7426
- if (spot.contains(info.x, info.y))
7538
+ if (spot.contains(clickInfo.x, clickInfo.y))
74277539 {
74287540 hitSomething = hitRotate;
74297541 retval = true;
74307542 }
74317543 spot.translate(0, 32);
7432
- 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))
74337547 {
74347548 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
+
74357577 retval = true;
74367578 }
74377579
....@@ -7441,7 +7583,7 @@
74417583 }
74427584
74437585 //System.out.println("info.modifiers = " + info.modifiers);
7444
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7586
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
74457587 //System.out.println("modified = " + modified);
74467588 //new Exception().printStackTrace();
74477589 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7469,7 +7611,8 @@
74697611 return true;
74707612 }
74717613
7472
- void doEditDrag0(ClickInfo info, boolean opposite)
7614
+ void doEditDrag0(//ClickInfo info,
7615
+ boolean opposite)
74737616 {
74747617 if (hitSomething == 0)
74757618 {
....@@ -7483,7 +7626,7 @@
74837626
74847627 //System.out.println("hitSomething = " + hitSomething);
74857628
7486
- double scale = 0.005f * info.camera.Distance();
7629
+ double scale = 0.005f * clickInfo.camera.Distance();
74877630
74887631 cVector xlate = new cVector();
74897632 //cVector xlate2 = new cVector();
....@@ -7517,8 +7660,8 @@
75177660 toParent[3][i] = xlate.get(i);
75187661 LA.matInvert(toParent, fromParent);
75197662 */
7520
- cVector delta = LA.newVector(0, 0, startY - info.y);
7521
- 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);
75227665
75237666 LA.matCopy(startMat, toParent);
75247667 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7527,7 +7670,7 @@
75277670 } else
75287671 {
75297672 //LA.xformDir(delta, info.camera.fromScreen, delta);
7530
- cVector up = new cVector(info.camera.up);
7673
+ cVector up = new cVector(clickInfo.camera.up);
75317674 cVector away = new cVector();
75327675 //cVector right2 = new cVector();
75337676 //LA.vecCross(up, cVector.Z, right);
....@@ -7544,19 +7687,19 @@
75447687 LA.xformDir(up, ClickInfo.matbuffer, up);
75457688 // if (!CameraPane.LOCALTRANSFORM)
75467689 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7547
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7690
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
75487691 // if (!CameraPane.LOCALTRANSFORM)
75497692 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75507693 //LA.vecCross(up, cVector.Z, right2);
75517694
7552
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7695
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75537696
75547697 //System.out.println("DELTA0 = " + delta);
75557698 //System.out.println("AWAY = " + info.camera.away);
75567699 //System.out.println("UP = " + info.camera.up);
75577700 if (away.z > 0)
75587701 {
7559
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7702
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75607703 {
75617704 delta.x = -delta.x;
75627705 } else
....@@ -7571,7 +7714,7 @@
75717714 //System.out.println("DELTA1 = " + delta);
75727715 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75737716 //System.out.println("DELTA2 = " + delta);
7574
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7717
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75757718 LA.matCopy(startMat, toParent);
75767719 //System.out.println("DELTA3 = " + delta);
75777720 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7581,8 +7724,8 @@
75817724 break;
75827725
75837726 case hitRotate: // rotate
7584
- int dx = info.x - centerPt.x;
7585
- int dy = -(info.y - centerPt.y);
7727
+ int dx = clickInfo.x - centerPt.x;
7728
+ int dy = -(clickInfo.y - centerPt.y);
75867729 double angle = (double) Math.atan2(dx, dy);
75877730 angle = -(1.570796 - angle);
75887731
....@@ -7605,7 +7748,7 @@
76057748 }
76067749 /**/
76077750
7608
- switch (info.pane.RenderCamera().viewCode)
7751
+ switch (clickInfo.pane.RenderCamera().viewCode)
76097752 {
76107753 case 1: // '\001'
76117754 LA.matZRotate(toParent, angle);
....@@ -7632,7 +7775,7 @@
76327775 break;
76337776
76347777 case hitScale: // scale
7635
- double hScale = (double) (info.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
76367779 double sign = 1;
76377780 if (hScale < 0)
76387781 {
....@@ -7644,7 +7787,7 @@
76447787 //hScale = 0.01;
76457788 }
76467789
7647
- double vScale = (double) (info.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
76487791 sign = 1;
76497792 if (vScale < 0)
76507793 {
....@@ -7655,6 +7798,7 @@
76557798 {
76567799 //vScale = 0.01;
76577800 }
7801
+
76587802 LA.matCopy(startMat, toParent);
76597803 /**/
76607804 for (int i = 0; i < 3; i++)
....@@ -7664,33 +7808,39 @@
76647808 }
76657809 /**/
76667810
7667
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7811
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76687812
76697813 if (totalScale < 0.01)
76707814 {
76717815 totalScale = 0.01;
76727816 }
76737817
7674
- switch (info.pane.RenderCamera().viewCode)
7818
+ switch (clickInfo.pane.RenderCamera().viewCode)
76757819 {
76767820 case 3: // '\001'
76777821 if (modified || opposite)
76787822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
76797826 //LA.matScale(toParent, 1, hScale, vScale);
7680
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
76817828 } // vScale, 1);
76827829 else
76837830 {
76847831 // EXCEPTION!
7685
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
76867833 } // vScale, 1);
76877834 break;
76887835
76897836 case 2: // '\002'
76907837 if (modified || opposite)
76917838 {
7692
- //LA.matScale(toParent, hScale, 1, vScale);
7693
- 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);
76947844 } else
76957845 {
76967846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7700,8 +7850,11 @@
77007850 case 1: // '\003'
77017851 if (modified || opposite)
77027852 {
7703
- //LA.matScale(toParent, hScale, vScale, 1);
7704
- 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);
77057858 } else
77067859 {
77077860 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7738,7 +7891,7 @@
77387891 } // NEW ...
77397892
77407893
7741
- info.pane.repaint();
7894
+ clickInfo.pane.repaint();
77427895 }
77437896
77447897 boolean overflow = false;