Normand Briere
2019-08-22 0c7b833be7d86598a6813cd1c6db0ca9e1b17966
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)
....@@ -241,6 +247,73 @@
241247 // this.bRep.support = null;
242248 // this.support = null;
243249 // this.fileparent = null;
250
+ }
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
+// }
274
+
275
+ transient boolean tag;
276
+
277
+ void TagObjects(Object3D o, boolean tag)
278
+ {
279
+ if (blockloop)
280
+ return;
281
+
282
+ o.tag = tag;
283
+
284
+ if (o == this)
285
+ return;
286
+
287
+ blockloop = true;
288
+
289
+ for (int i=0; i<Size(); i++)
290
+ {
291
+ get(i).TagObjects(o, tag);
292
+ }
293
+
294
+ blockloop = false;
295
+ }
296
+
297
+ boolean HasTags()
298
+ {
299
+ if (blockloop)
300
+ return false;
301
+
302
+ blockloop = true;
303
+
304
+ boolean hasTags = false;
305
+
306
+ for (int i=0; i<Size(); i++)
307
+ {
308
+ hasTags |= get(i).tag || get(i).HasTags();
309
+
310
+ if (hasTags)
311
+ break;
312
+ }
313
+
314
+ blockloop = false;
315
+
316
+ return hasTags;
244317 }
245318
246319 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
....@@ -277,7 +350,7 @@
277350
278351 this.selection = o.selection;
279352
280
- this.versions = o.versions;
353
+ this.versionlist = o.versionlist;
281354 this.versionindex = o.versionindex;
282355 // July 2019 if (this.bRep != null)
283356 // this.bRep.support = o.transientrep;
....@@ -1011,6 +1084,9 @@
10111084
10121085 if (material == null || material.multiply)
10131086 return true;
1087
+
1088
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1089
+ return false;
10141090
10151091 // Transparent objects are dynamic because we have to sort the triangles.
10161092 return material.opacity > 0.99;
....@@ -2438,6 +2514,11 @@
24382514 else
24392515 {
24402516 //((ObjEditor)editWindow).SetupUI2(null);
2517
+ if (objectUI != null)
2518
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2519
+ else
2520
+ //new Exception().printStackTrace();
2521
+ System.err.println("objectUI is null");
24412522 }
24422523 }
24432524
....@@ -2567,7 +2648,8 @@
25672648 private static final int editSelf = 1;
25682649 private static final int editChild = 2;
25692650
2570
- void drawEditHandles(ClickInfo info, int level)
2651
+ void drawEditHandles(//ClickInfo info,
2652
+ int level)
25712653 {
25722654 if (level == 0)
25732655 {
....@@ -2575,7 +2657,8 @@
25752657 return;
25762658
25772659 Object3D selectee;
2578
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2660
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2661
+ level + 1))
25792662 {
25802663 selectee = (Object3D) e.nextElement();
25812664 }
....@@ -2583,19 +2666,22 @@
25832666 } else
25842667 {
25852668 //super.
2586
- drawEditHandles0(info, level + 1);
2669
+ drawEditHandles0(//info,
2670
+ level + 1);
25872671 }
25882672 }
25892673
2590
- boolean doEditClick(ClickInfo info, int level)
2674
+ boolean doEditClick(//ClickInfo info,
2675
+ int level)
25912676 {
25922677 doSomething = 0;
25932678 if (level == 0)
25942679 {
2595
- return doParentClick(info);
2680
+ return doParentClick(); //info);
25962681 }
25972682 if (//super.
2598
- doEditClick0(info, level))
2683
+ doEditClick0(//info,
2684
+ level))
25992685 {
26002686 doSomething = 1;
26012687 return true;
....@@ -2605,7 +2691,7 @@
26052691 }
26062692 }
26072693
2608
- boolean doParentClick(ClickInfo info)
2694
+ boolean doParentClick() //ClickInfo info)
26092695 {
26102696 if (selection == null)
26112697 {
....@@ -2618,7 +2704,8 @@
26182704 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
26192705 {
26202706 Object3D selectee = (Object3D) e.nextElement();
2621
- if (selectee.doEditClick(info, 1))
2707
+ if (selectee.doEditClick(//info,
2708
+ 1))
26222709 {
26232710 childToDrag = selectee;
26242711 doSomething = 2;
....@@ -2630,13 +2717,15 @@
26302717 return retval;
26312718 }
26322719
2633
- void doEditDrag(ClickInfo info, boolean opposite)
2720
+ void doEditDrag(//ClickInfo clickInfo,
2721
+ boolean opposite)
26342722 {
26352723 switch (doSomething)
26362724 {
26372725 case 1: // '\001'
26382726 //super.
2639
- doEditDrag0(info, opposite);
2727
+ doEditDrag0(//clickInfo,
2728
+ opposite);
26402729 break;
26412730
26422731 case 2: // '\002'
....@@ -2649,11 +2738,13 @@
26492738 {
26502739 //sel.hitSomething = childToDrag.hitSomething;
26512740 //childToDrag.doEditDrag(info);
2652
- sel.doEditDrag(info, opposite);
2741
+ sel.doEditDrag(//clickInfo,
2742
+ opposite);
26532743 } else
26542744 {
26552745 //super.
2656
- doEditDrag0(info, opposite);
2746
+ doEditDrag0(//clickInfo,
2747
+ opposite);
26572748 }
26582749 }
26592750 break;
....@@ -2671,6 +2762,9 @@
26712762 {
26722763 deselectAll();
26732764 }
2765
+
2766
+ new Exception().printStackTrace();
2767
+
26742768 ClickInfo newInfo = new ClickInfo();
26752769 newInfo.flags = info.flags;
26762770 newInfo.bounds = info.bounds;
....@@ -3528,15 +3622,47 @@
35283622
35293623 void ClearMaterials()
35303624 {
3625
+ if (blockloop)
3626
+ return;
3627
+
3628
+ blockloop = true;
3629
+
35313630 ClearMaterial();
3532
- for (int i = 0; i < size(); i++)
3631
+ for (int i = 0; i < Size(); i++)
35333632 {
3534
- Object3D child = (Object3D) reserve(i);
3633
+ Object3D child = (Object3D) get(i);
35353634 if (child == null)
35363635 continue;
35373636 child.ClearMaterials();
3538
- release(i);
35393637 }
3638
+
3639
+ blockloop = false;
3640
+ }
3641
+
3642
+ void ClearVersionList()
3643
+ {
3644
+ this.versionlist = null;
3645
+ this.versionindex = -1;
3646
+ this.versiontable = null;
3647
+ }
3648
+
3649
+ void ClearVersions()
3650
+ {
3651
+ if (blockloop)
3652
+ return;
3653
+
3654
+ blockloop = true;
3655
+
3656
+ ClearVersionList();
3657
+ for (int i = 0; i < Size(); i++)
3658
+ {
3659
+ Object3D child = (Object3D) get(i);
3660
+ if (child == null)
3661
+ continue;
3662
+ child.ClearVersions();
3663
+ }
3664
+
3665
+ blockloop = false;
35403666 }
35413667
35423668 void FlipV(boolean flip)
....@@ -5526,6 +5652,11 @@
55265652 if (fullname == null)
55275653 return "";
55285654
5655
+ if (fullname.pigment != null)
5656
+ {
5657
+ return fullname.pigment;
5658
+ }
5659
+
55295660 // System.out.println("Fullname = " + fullname);
55305661
55315662 // Does not work on Windows due to C:
....@@ -5538,7 +5669,7 @@
55385669
55395670 if (split.length == 0)
55405671 {
5541
- return "";
5672
+ return fullname.pigment = "";
55425673 }
55435674
55445675 if (split.length <= 2)
....@@ -5546,22 +5677,27 @@
55465677 if (fullname.name.endsWith(":"))
55475678 {
55485679 // Windows
5549
- return fullname.name.substring(0, fullname.name.length()-1);
5680
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55505681 }
55515682
5552
- return split[0];
5683
+ return fullname.pigment = split[0];
55535684 }
55545685
55555686 // Windows
55565687 assert(split.length == 4);
55575688
5558
- return split[0] + ":" + split[1];
5689
+ return fullname.pigment = split[0] + ":" + split[1];
55595690 }
55605691
55615692 static String GetBump(cTexture fullname)
55625693 {
55635694 if (fullname == null)
55645695 return "";
5696
+
5697
+ if (fullname.bump != null)
5698
+ {
5699
+ return fullname.bump;
5700
+ }
55655701
55665702 // System.out.println("Fullname = " + fullname);
55675703 // Does not work on Windows due to C:
....@@ -5573,12 +5709,12 @@
55735709
55745710 if (split.length == 0)
55755711 {
5576
- return "";
5712
+ return fullname.bump = "";
55775713 }
55785714
55795715 if (split.length == 1)
55805716 {
5581
- return "";
5717
+ return fullname.bump = "";
55825718 }
55835719
55845720 if (split.length == 2)
....@@ -5586,16 +5722,16 @@
55865722 if (fullname.name.endsWith(":"))
55875723 {
55885724 // Windows
5589
- return "";
5725
+ return fullname.bump = "";
55905726 }
55915727
5592
- return split[1];
5728
+ return fullname.bump = split[1];
55935729 }
55945730
55955731 // Windows
55965732 assert(split.length == 4);
55975733
5598
- return split[2] + ":" + split[3];
5734
+ return fullname.bump = split[2] + ":" + split[3];
55995735 }
56005736
56015737 String GetPigmentTexture()
....@@ -5678,6 +5814,9 @@
56785814 texname = "";
56795815
56805816 GetTextures().name = texname + ":" + GetBump(GetTextures());
5817
+
5818
+ GetTextures().pigment = null;
5819
+
56815820 Touch();
56825821 }
56835822
....@@ -5750,6 +5889,8 @@
57505889 texname = "";
57515890
57525891 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5892
+
5893
+ GetTextures().bump = null;
57535894
57545895 Touch();
57555896 }
....@@ -5893,8 +6034,10 @@
58936034 if (support != null)
58946035 support = support;
58956036
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);
6037
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
6038
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
6039
+
6040
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
58986041
58996042 if (!usecalllists && bRep != null && bRep.displaylist > 0)
59006043 {
....@@ -5904,8 +6047,9 @@
59046047 // usecalllists &= !(parent instanceof RandomNode);
59056048 // usecalllists = false;
59066049
5907
- if (GetBRep() != null)
5908
- usecalllists = usecalllists;
6050
+ if (display.DrawMode() == display.SHADOW)
6051
+ //GetBRep() != null)
6052
+ usecalllists = !!usecalllists;
59096053 //System.out.println("draw " + this);
59106054 //new Exception().printStackTrace();
59116055
....@@ -5927,7 +6071,7 @@
59276071 if (!(this instanceof Composite))
59286072 touched = false;
59296073 //if (displaylist == -1 && usecalllists)
5930
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
6074
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59316075 {
59326076 bRep.displaylist = display.GenList();
59336077 assert(bRep.displaylist != 0);
....@@ -5938,7 +6082,7 @@
59386082
59396083 //System.out.println("\tnew list " + list);
59406084 //gl.glDrawBuffer(gl.GL_NONE);
5941
- if (usecalllists)
6085
+ if (usecalllists && bRep.displaylist > 0)
59426086 {
59436087 // System.err.println("new list " + bRep.displaylist + " for " + this);
59446088 display.NewList(bRep.displaylist);
....@@ -5947,7 +6091,7 @@
59476091 CallList(display, root, selected, blocked);
59486092
59496093 // compiled = true;
5950
- if (usecalllists)
6094
+ if (usecalllists && bRep.displaylist > 0)
59516095 {
59526096 // System.err.println("end list " + bRep.displaylist + " for " + this);
59536097 display.EndList();
....@@ -7298,20 +7442,23 @@
72987442 }
72997443 }
73007444
7301
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7445
+ static ClickInfo clickInfo = new ClickInfo();
7446
+
7447
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7448
+ Point outPt, Rectangle outRec)
73027449 {
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;
7450
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7451
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7452
+ double[][] toscreen = clickInfo.toScreen;
73067453 if (toscreen == null)
73077454 {
7308
- toscreen = new Camera(info.camera.viewCode).toScreen;
7455
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
73097456 }
73107457 cVector vec = in;
73117458 LA.xformPos(in, toscreen, in);
73127459 //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();
7460
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7461
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
73157462 outPt.x = hc + (int) vec.x;
73167463 outPt.y = vc - (int) vec.y;
73177464 outRec.x = outPt.x - 3;
....@@ -7319,15 +7466,18 @@
73197466 outRec.width = outRec.height = 6;
73207467 }
73217468
7322
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7469
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7470
+ )
73237471 {
73247472 Point pt = new Point(0, 0);
73257473 Rectangle rec = new Rectangle();
7326
- calcHotSpot(in, info, pt, rec);
7474
+ calcHotSpot(in, //clickInfo,
7475
+ pt, rec);
73277476 return rec;
73287477 }
73297478
7330
- void drawEditHandles0(ClickInfo info, int level)
7479
+ void drawEditHandles0(//ClickInfo clickInfo,
7480
+ int level)
73317481 {
73327482 if (level == 0)
73337483 {
....@@ -7336,16 +7486,19 @@
73367486 {
73377487 cVector origin = new cVector();
73387488 //LA.xformPos(origin, toParent, origin);
7339
- Rectangle spot = calcHotSpot(origin, info);
7489
+ if (this.clickInfo == null)
7490
+ this.clickInfo = new ClickInfo();
7491
+
7492
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
73407493 Rectangle boundary = new Rectangle();
73417494 boundary.x = spot.x - 30;
73427495 boundary.y = spot.y - 30;
73437496 boundary.width = spot.width + 60;
73447497 boundary.height = spot.height + 60;
7345
- info.g.setColor(Color.red);
7498
+ clickInfo.g.setColor(Color.white);
73467499 int spotw = spot.x + spot.width;
73477500 int spoth = spot.y + spot.height;
7348
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7501
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73497502 // if (CameraPane.Xmin > spot.x)
73507503 // {
73517504 // CameraPane.Xmin = spot.x;
....@@ -7362,11 +7515,6 @@
73627515 // {
73637516 // CameraPane.Ymax = spoth;
73647517 // }
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);
73707518 // if (CameraPane.Xmin > spot.x)
73717519 // {
73727520 // CameraPane.Xmin = spot.x;
....@@ -7385,10 +7533,15 @@
73857533 // }
73867534 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73877535 //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);
7536
+ spot.translate(32, 0);
7537
+ clickInfo.g.setColor(Color.yellow);
7538
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7539
+
7540
+ spot.translate(32, 64);
7541
+ spotw = spot.x + spot.width;
7542
+ spoth = spot.y + spot.height;
7543
+ clickInfo.g.setColor(Color.cyan);
7544
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73927545 // if (CameraPane.Xmin > spot.x)
73937546 // {
73947547 // CameraPane.Xmin = spot.x;
....@@ -7405,8 +7558,9 @@
74057558 // {
74067559 // CameraPane.Ymax = spoth;
74077560 // }
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);
7561
+ clickInfo.g.setColor(Color.green);
7562
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7563
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74107564 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
74117565 // if (CameraPane.Xmin > boundary.x)
74127566 // {
....@@ -7428,7 +7582,8 @@
74287582 }
74297583 }
74307584
7431
- boolean doEditClick0(ClickInfo info, int level)
7585
+ boolean doEditClick0(//ClickInfo clickInfo,
7586
+ int level)
74327587 {
74337588 if (level == 0)
74347589 {
....@@ -7437,8 +7592,8 @@
74377592
74387593 boolean retval = false;
74397594
7440
- startX = info.x;
7441
- startY = info.y;
7595
+ startX = clickInfo.x;
7596
+ startY = clickInfo.y;
74427597
74437598 hitSomething = -1;
74447599 cVector origin = new cVector();
....@@ -7448,22 +7603,53 @@
74487603 {
74497604 centerPt = new Point(0, 0);
74507605 }
7451
- calcHotSpot(origin, info, centerPt, spot);
7452
- if (spot.contains(info.x, info.y))
7606
+ calcHotSpot(origin, //info,
7607
+ centerPt, spot);
7608
+ if (spot.contains(clickInfo.x, clickInfo.y))
74537609 {
74547610 hitSomething = hitCenter;
74557611 retval = true;
74567612 }
74577613 spot.translate(32, 0);
7458
- if (spot.contains(info.x, info.y))
7614
+ if (spot.contains(clickInfo.x, clickInfo.y))
74597615 {
74607616 hitSomething = hitRotate;
74617617 retval = true;
74627618 }
74637619 spot.translate(0, 32);
7464
- if (spot.contains(info.x, info.y))
7620
+ spot.translate(32, 0);
7621
+ spot.translate(0, 32);
7622
+ if (spot.contains(clickInfo.x, clickInfo.y))
74657623 {
74667624 hitSomething = hitScale;
7625
+
7626
+ double scale = 0.005f * clickInfo.camera.Distance();
7627
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
7628
+ double sign = 1;
7629
+ if (hScale < 0)
7630
+ {
7631
+ sign = -1;
7632
+ }
7633
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7634
+ if (hScale < 0.01)
7635
+ {
7636
+ //hScale = 0.01;
7637
+ }
7638
+
7639
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
7640
+ sign = 1;
7641
+ if (vScale < 0)
7642
+ {
7643
+ sign = -1;
7644
+ }
7645
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7646
+ if (vScale < 0.01)
7647
+ {
7648
+ //vScale = 0.01;
7649
+ }
7650
+
7651
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7652
+
74677653 retval = true;
74687654 }
74697655
....@@ -7473,7 +7659,7 @@
74737659 }
74747660
74757661 //System.out.println("info.modifiers = " + info.modifiers);
7476
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7662
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
74777663 //System.out.println("modified = " + modified);
74787664 //new Exception().printStackTrace();
74797665 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7501,7 +7687,8 @@
75017687 return true;
75027688 }
75037689
7504
- void doEditDrag0(ClickInfo info, boolean opposite)
7690
+ void doEditDrag0(//ClickInfo info,
7691
+ boolean opposite)
75057692 {
75067693 if (hitSomething == 0)
75077694 {
....@@ -7515,7 +7702,7 @@
75157702
75167703 //System.out.println("hitSomething = " + hitSomething);
75177704
7518
- double scale = 0.005f * info.camera.Distance();
7705
+ double scale = 0.005f * clickInfo.camera.Distance();
75197706
75207707 cVector xlate = new cVector();
75217708 //cVector xlate2 = new cVector();
....@@ -7549,8 +7736,8 @@
75497736 toParent[3][i] = xlate.get(i);
75507737 LA.matInvert(toParent, fromParent);
75517738 */
7552
- cVector delta = LA.newVector(0, 0, startY - info.y);
7553
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7739
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7740
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75547741
75557742 LA.matCopy(startMat, toParent);
75567743 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7559,7 +7746,7 @@
75597746 } else
75607747 {
75617748 //LA.xformDir(delta, info.camera.fromScreen, delta);
7562
- cVector up = new cVector(info.camera.up);
7749
+ cVector up = new cVector(clickInfo.camera.up);
75637750 cVector away = new cVector();
75647751 //cVector right2 = new cVector();
75657752 //LA.vecCross(up, cVector.Z, right);
....@@ -7576,19 +7763,19 @@
75767763 LA.xformDir(up, ClickInfo.matbuffer, up);
75777764 // if (!CameraPane.LOCALTRANSFORM)
75787765 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7579
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7766
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
75807767 // if (!CameraPane.LOCALTRANSFORM)
75817768 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75827769 //LA.vecCross(up, cVector.Z, right2);
75837770
7584
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7771
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75857772
75867773 //System.out.println("DELTA0 = " + delta);
75877774 //System.out.println("AWAY = " + info.camera.away);
75887775 //System.out.println("UP = " + info.camera.up);
75897776 if (away.z > 0)
75907777 {
7591
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7778
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75927779 {
75937780 delta.x = -delta.x;
75947781 } else
....@@ -7603,7 +7790,7 @@
76037790 //System.out.println("DELTA1 = " + delta);
76047791 LA.xformDir(delta, ClickInfo.matbuffer, delta);
76057792 //System.out.println("DELTA2 = " + delta);
7606
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7793
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
76077794 LA.matCopy(startMat, toParent);
76087795 //System.out.println("DELTA3 = " + delta);
76097796 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7613,8 +7800,8 @@
76137800 break;
76147801
76157802 case hitRotate: // rotate
7616
- int dx = info.x - centerPt.x;
7617
- int dy = -(info.y - centerPt.y);
7803
+ int dx = clickInfo.x - centerPt.x;
7804
+ int dy = -(clickInfo.y - centerPt.y);
76187805 double angle = (double) Math.atan2(dx, dy);
76197806 angle = -(1.570796 - angle);
76207807
....@@ -7637,7 +7824,7 @@
76377824 }
76387825 /**/
76397826
7640
- switch (info.pane.RenderCamera().viewCode)
7827
+ switch (clickInfo.pane.RenderCamera().viewCode)
76417828 {
76427829 case 1: // '\001'
76437830 LA.matZRotate(toParent, angle);
....@@ -7664,7 +7851,7 @@
76647851 break;
76657852
76667853 case hitScale: // scale
7667
- double hScale = (double) (info.x - centerPt.x) / 32;
7854
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
76687855 double sign = 1;
76697856 if (hScale < 0)
76707857 {
....@@ -7676,7 +7863,7 @@
76767863 //hScale = 0.01;
76777864 }
76787865
7679
- double vScale = (double) (info.y - centerPt.y) / 32;
7866
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
76807867 sign = 1;
76817868 if (vScale < 0)
76827869 {
....@@ -7687,6 +7874,7 @@
76877874 {
76887875 //vScale = 0.01;
76897876 }
7877
+
76907878 LA.matCopy(startMat, toParent);
76917879 /**/
76927880 for (int i = 0; i < 3; i++)
....@@ -7696,33 +7884,39 @@
76967884 }
76977885 /**/
76987886
7699
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7887
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
77007888
77017889 if (totalScale < 0.01)
77027890 {
77037891 totalScale = 0.01;
77047892 }
77057893
7706
- switch (info.pane.RenderCamera().viewCode)
7894
+ switch (clickInfo.pane.RenderCamera().viewCode)
77077895 {
77087896 case 3: // '\001'
77097897 if (modified || opposite)
77107898 {
7899
+ if (modified && opposite)
7900
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7901
+ else
77117902 //LA.matScale(toParent, 1, hScale, vScale);
7712
- LA.matScale(toParent, totalScale, 1, 1);
7903
+ LA.matScale(toParent, totalScale, 1, 1);
77137904 } // vScale, 1);
77147905 else
77157906 {
77167907 // EXCEPTION!
7717
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7908
+ LA.matScale(toParent, 1, totalScale, totalScale);
77187909 } // vScale, 1);
77197910 break;
77207911
77217912 case 2: // '\002'
77227913 if (modified || opposite)
77237914 {
7724
- //LA.matScale(toParent, hScale, 1, vScale);
7725
- LA.matScale(toParent, 1, totalScale, 1);
7915
+ if (modified && opposite)
7916
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7917
+ else
7918
+ //LA.matScale(toParent, hScale, 1, vScale);
7919
+ LA.matScale(toParent, 1, totalScale, 1);
77267920 } else
77277921 {
77287922 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7732,8 +7926,11 @@
77327926 case 1: // '\003'
77337927 if (modified || opposite)
77347928 {
7735
- //LA.matScale(toParent, hScale, vScale, 1);
7736
- LA.matScale(toParent, 1, 1, totalScale);
7929
+ if (modified && opposite)
7930
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7931
+ else
7932
+ //LA.matScale(toParent, hScale, vScale, 1);
7933
+ LA.matScale(toParent, 1, 1, totalScale);
77377934 } else
77387935 {
77397936 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7770,7 +7967,7 @@
77707967 } // NEW ...
77717968
77727969
7773
- info.pane.repaint();
7970
+ clickInfo.pane.repaint();
77747971 }
77757972
77767973 boolean overflow = false;