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
....@@ -5751,6 +5814,8 @@
57515814
57525815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
57535816
5817
+ GetTextures().bump = null;
5818
+
57545819 Touch();
57555820 }
57565821
....@@ -5775,12 +5840,23 @@
57755840 }
57765841 }
57775842
5778
- void EmbedTextures()
5843
+ void EmbedTextures(boolean embed)
57795844 {
57805845 if (blockloop)
57815846 return;
57825847
5783
- CameraPane.EmbedTextures(texture);
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
+ }
57845860
57855861 int nb = Size();
57865862 for (int i = 0; i < nb; i++)
....@@ -5791,7 +5867,7 @@
57915867 continue;
57925868
57935869 blockloop = true;
5794
- child.EmbedTextures();
5870
+ child.EmbedTextures(embed);
57955871 blockloop = false;
57965872 }
57975873 }
....@@ -5882,8 +5958,10 @@
58825958 if (support != null)
58835959 support = support;
58845960
5885
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5886
- 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.
58875965
58885966 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58895967 {
....@@ -5893,8 +5971,9 @@
58935971 // usecalllists &= !(parent instanceof RandomNode);
58945972 // usecalllists = false;
58955973
5896
- if (GetBRep() != null)
5897
- usecalllists = usecalllists;
5974
+ if (display.DrawMode() == display.SHADOW)
5975
+ //GetBRep() != null)
5976
+ usecalllists = !!usecalllists;
58985977 //System.out.println("draw " + this);
58995978 //new Exception().printStackTrace();
59005979
....@@ -5916,7 +5995,7 @@
59165995 if (!(this instanceof Composite))
59175996 touched = false;
59185997 //if (displaylist == -1 && usecalllists)
5919
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5998
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59205999 {
59216000 bRep.displaylist = display.GenList();
59226001 assert(bRep.displaylist != 0);
....@@ -5927,7 +6006,7 @@
59276006
59286007 //System.out.println("\tnew list " + list);
59296008 //gl.glDrawBuffer(gl.GL_NONE);
5930
- if (usecalllists)
6009
+ if (usecalllists && bRep.displaylist > 0)
59316010 {
59326011 // System.err.println("new list " + bRep.displaylist + " for " + this);
59336012 display.NewList(bRep.displaylist);
....@@ -5936,7 +6015,7 @@
59366015 CallList(display, root, selected, blocked);
59376016
59386017 // compiled = true;
5939
- if (usecalllists)
6018
+ if (usecalllists && bRep.displaylist > 0)
59406019 {
59416020 // System.err.println("end list " + bRep.displaylist + " for " + this);
59426021 display.EndList();
....@@ -7287,20 +7366,23 @@
72877366 }
72887367 }
72897368
7290
- 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)
72917373 {
7292
- int hc = info.bounds.x + info.bounds.width / 2;
7293
- int vc = info.bounds.y + info.bounds.height / 2;
7294
- 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;
72957377 if (toscreen == null)
72967378 {
7297
- toscreen = new Camera(info.camera.viewCode).toScreen;
7379
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72987380 }
72997381 cVector vec = in;
73007382 LA.xformPos(in, toscreen, in);
73017383 //System.out.println("Distance = " + info.camera.Distance());
7302
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7303
- 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();
73047386 outPt.x = hc + (int) vec.x;
73057387 outPt.y = vc - (int) vec.y;
73067388 outRec.x = outPt.x - 3;
....@@ -7308,15 +7390,18 @@
73087390 outRec.width = outRec.height = 6;
73097391 }
73107392
7311
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7393
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7394
+ )
73127395 {
73137396 Point pt = new Point(0, 0);
73147397 Rectangle rec = new Rectangle();
7315
- calcHotSpot(in, info, pt, rec);
7398
+ calcHotSpot(in, //clickInfo,
7399
+ pt, rec);
73167400 return rec;
73177401 }
73187402
7319
- void drawEditHandles0(ClickInfo info, int level)
7403
+ void drawEditHandles0(//ClickInfo clickInfo,
7404
+ int level)
73207405 {
73217406 if (level == 0)
73227407 {
....@@ -7325,16 +7410,19 @@
73257410 {
73267411 cVector origin = new cVector();
73277412 //LA.xformPos(origin, toParent, origin);
7328
- Rectangle spot = calcHotSpot(origin, info);
7413
+ if (this.clickInfo == null)
7414
+ this.clickInfo = new ClickInfo();
7415
+
7416
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
73297417 Rectangle boundary = new Rectangle();
73307418 boundary.x = spot.x - 30;
73317419 boundary.y = spot.y - 30;
73327420 boundary.width = spot.width + 60;
73337421 boundary.height = spot.height + 60;
7334
- info.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
73357423 int spotw = spot.x + spot.width;
73367424 int spoth = spot.y + spot.height;
7337
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7425
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73387426 // if (CameraPane.Xmin > spot.x)
73397427 // {
73407428 // CameraPane.Xmin = spot.x;
....@@ -7351,11 +7439,6 @@
73517439 // {
73527440 // CameraPane.Ymax = spoth;
73537441 // }
7354
- spot.translate(32, 32);
7355
- spotw = spot.x + spot.width;
7356
- spoth = spot.y + spot.height;
7357
- info.g.setColor(Color.cyan);
7358
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73597442 // if (CameraPane.Xmin > spot.x)
73607443 // {
73617444 // CameraPane.Xmin = spot.x;
....@@ -7374,10 +7457,15 @@
73747457 // }
73757458 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73767459 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7377
- spot.translate(0, -32);
7378
- info.g.setColor(Color.yellow);
7379
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7380
- 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);
73817469 // if (CameraPane.Xmin > spot.x)
73827470 // {
73837471 // CameraPane.Xmin = spot.x;
....@@ -7394,8 +7482,9 @@
73947482 // {
73957483 // CameraPane.Ymax = spoth;
73967484 // }
7397
- info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7398
- (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);
73997488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
74007489 // if (CameraPane.Xmin > boundary.x)
74017490 // {
....@@ -7417,7 +7506,8 @@
74177506 }
74187507 }
74197508
7420
- boolean doEditClick0(ClickInfo info, int level)
7509
+ boolean doEditClick0(//ClickInfo clickInfo,
7510
+ int level)
74217511 {
74227512 if (level == 0)
74237513 {
....@@ -7426,8 +7516,8 @@
74267516
74277517 boolean retval = false;
74287518
7429
- startX = info.x;
7430
- startY = info.y;
7519
+ startX = clickInfo.x;
7520
+ startY = clickInfo.y;
74317521
74327522 hitSomething = -1;
74337523 cVector origin = new cVector();
....@@ -7437,22 +7527,53 @@
74377527 {
74387528 centerPt = new Point(0, 0);
74397529 }
7440
- calcHotSpot(origin, info, centerPt, spot);
7441
- if (spot.contains(info.x, info.y))
7530
+ calcHotSpot(origin, //info,
7531
+ centerPt, spot);
7532
+ if (spot.contains(clickInfo.x, clickInfo.y))
74427533 {
74437534 hitSomething = hitCenter;
74447535 retval = true;
74457536 }
74467537 spot.translate(32, 0);
7447
- if (spot.contains(info.x, info.y))
7538
+ if (spot.contains(clickInfo.x, clickInfo.y))
74487539 {
74497540 hitSomething = hitRotate;
74507541 retval = true;
74517542 }
74527543 spot.translate(0, 32);
7453
- 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))
74547547 {
74557548 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
+
74567577 retval = true;
74577578 }
74587579
....@@ -7462,7 +7583,7 @@
74627583 }
74637584
74647585 //System.out.println("info.modifiers = " + info.modifiers);
7465
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7586
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
74667587 //System.out.println("modified = " + modified);
74677588 //new Exception().printStackTrace();
74687589 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7490,7 +7611,8 @@
74907611 return true;
74917612 }
74927613
7493
- void doEditDrag0(ClickInfo info, boolean opposite)
7614
+ void doEditDrag0(//ClickInfo info,
7615
+ boolean opposite)
74947616 {
74957617 if (hitSomething == 0)
74967618 {
....@@ -7504,7 +7626,7 @@
75047626
75057627 //System.out.println("hitSomething = " + hitSomething);
75067628
7507
- double scale = 0.005f * info.camera.Distance();
7629
+ double scale = 0.005f * clickInfo.camera.Distance();
75087630
75097631 cVector xlate = new cVector();
75107632 //cVector xlate2 = new cVector();
....@@ -7538,8 +7660,8 @@
75387660 toParent[3][i] = xlate.get(i);
75397661 LA.matInvert(toParent, fromParent);
75407662 */
7541
- cVector delta = LA.newVector(0, 0, startY - info.y);
7542
- 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);
75437665
75447666 LA.matCopy(startMat, toParent);
75457667 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7548,7 +7670,7 @@
75487670 } else
75497671 {
75507672 //LA.xformDir(delta, info.camera.fromScreen, delta);
7551
- cVector up = new cVector(info.camera.up);
7673
+ cVector up = new cVector(clickInfo.camera.up);
75527674 cVector away = new cVector();
75537675 //cVector right2 = new cVector();
75547676 //LA.vecCross(up, cVector.Z, right);
....@@ -7565,19 +7687,19 @@
75657687 LA.xformDir(up, ClickInfo.matbuffer, up);
75667688 // if (!CameraPane.LOCALTRANSFORM)
75677689 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7568
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7690
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
75697691 // if (!CameraPane.LOCALTRANSFORM)
75707692 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75717693 //LA.vecCross(up, cVector.Z, right2);
75727694
7573
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7695
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75747696
75757697 //System.out.println("DELTA0 = " + delta);
75767698 //System.out.println("AWAY = " + info.camera.away);
75777699 //System.out.println("UP = " + info.camera.up);
75787700 if (away.z > 0)
75797701 {
7580
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7702
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75817703 {
75827704 delta.x = -delta.x;
75837705 } else
....@@ -7592,7 +7714,7 @@
75927714 //System.out.println("DELTA1 = " + delta);
75937715 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75947716 //System.out.println("DELTA2 = " + delta);
7595
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7717
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75967718 LA.matCopy(startMat, toParent);
75977719 //System.out.println("DELTA3 = " + delta);
75987720 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7602,8 +7724,8 @@
76027724 break;
76037725
76047726 case hitRotate: // rotate
7605
- int dx = info.x - centerPt.x;
7606
- int dy = -(info.y - centerPt.y);
7727
+ int dx = clickInfo.x - centerPt.x;
7728
+ int dy = -(clickInfo.y - centerPt.y);
76077729 double angle = (double) Math.atan2(dx, dy);
76087730 angle = -(1.570796 - angle);
76097731
....@@ -7626,7 +7748,7 @@
76267748 }
76277749 /**/
76287750
7629
- switch (info.pane.RenderCamera().viewCode)
7751
+ switch (clickInfo.pane.RenderCamera().viewCode)
76307752 {
76317753 case 1: // '\001'
76327754 LA.matZRotate(toParent, angle);
....@@ -7653,7 +7775,7 @@
76537775 break;
76547776
76557777 case hitScale: // scale
7656
- double hScale = (double) (info.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
76577779 double sign = 1;
76587780 if (hScale < 0)
76597781 {
....@@ -7665,7 +7787,7 @@
76657787 //hScale = 0.01;
76667788 }
76677789
7668
- double vScale = (double) (info.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
76697791 sign = 1;
76707792 if (vScale < 0)
76717793 {
....@@ -7676,6 +7798,7 @@
76767798 {
76777799 //vScale = 0.01;
76787800 }
7801
+
76797802 LA.matCopy(startMat, toParent);
76807803 /**/
76817804 for (int i = 0; i < 3; i++)
....@@ -7685,33 +7808,39 @@
76857808 }
76867809 /**/
76877810
7688
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7811
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76897812
76907813 if (totalScale < 0.01)
76917814 {
76927815 totalScale = 0.01;
76937816 }
76947817
7695
- switch (info.pane.RenderCamera().viewCode)
7818
+ switch (clickInfo.pane.RenderCamera().viewCode)
76967819 {
76977820 case 3: // '\001'
76987821 if (modified || opposite)
76997822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
77007826 //LA.matScale(toParent, 1, hScale, vScale);
7701
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
77027828 } // vScale, 1);
77037829 else
77047830 {
77057831 // EXCEPTION!
7706
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
77077833 } // vScale, 1);
77087834 break;
77097835
77107836 case 2: // '\002'
77117837 if (modified || opposite)
77127838 {
7713
- //LA.matScale(toParent, hScale, 1, vScale);
7714
- 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);
77157844 } else
77167845 {
77177846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7721,8 +7850,11 @@
77217850 case 1: // '\003'
77227851 if (modified || opposite)
77237852 {
7724
- //LA.matScale(toParent, hScale, vScale, 1);
7725
- 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);
77267858 } else
77277859 {
77287860 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7759,7 +7891,7 @@
77597891 } // NEW ...
77607892
77617893
7762
- info.pane.repaint();
7894
+ clickInfo.pane.repaint();
77637895 }
77647896
77657897 boolean overflow = false;