Normand Briere
2019-08-22 6a823ffbfcda4c843f46e02e83c869d5bc323e25
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;
....@@ -5526,6 +5620,11 @@
55265620 if (fullname == null)
55275621 return "";
55285622
5623
+ if (fullname.pigment != null)
5624
+ {
5625
+ return fullname.pigment;
5626
+ }
5627
+
55295628 // System.out.println("Fullname = " + fullname);
55305629
55315630 // Does not work on Windows due to C:
....@@ -5538,7 +5637,7 @@
55385637
55395638 if (split.length == 0)
55405639 {
5541
- return "";
5640
+ return fullname.pigment = "";
55425641 }
55435642
55445643 if (split.length <= 2)
....@@ -5546,22 +5645,27 @@
55465645 if (fullname.name.endsWith(":"))
55475646 {
55485647 // Windows
5549
- return fullname.name.substring(0, fullname.name.length()-1);
5648
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55505649 }
55515650
5552
- return split[0];
5651
+ return fullname.pigment = split[0];
55535652 }
55545653
55555654 // Windows
55565655 assert(split.length == 4);
55575656
5558
- return split[0] + ":" + split[1];
5657
+ return fullname.pigment = split[0] + ":" + split[1];
55595658 }
55605659
55615660 static String GetBump(cTexture fullname)
55625661 {
55635662 if (fullname == null)
55645663 return "";
5664
+
5665
+ if (fullname.bump != null)
5666
+ {
5667
+ return fullname.bump;
5668
+ }
55655669
55665670 // System.out.println("Fullname = " + fullname);
55675671 // Does not work on Windows due to C:
....@@ -5573,12 +5677,12 @@
55735677
55745678 if (split.length == 0)
55755679 {
5576
- return "";
5680
+ return fullname.bump = "";
55775681 }
55785682
55795683 if (split.length == 1)
55805684 {
5581
- return "";
5685
+ return fullname.bump = "";
55825686 }
55835687
55845688 if (split.length == 2)
....@@ -5586,16 +5690,16 @@
55865690 if (fullname.name.endsWith(":"))
55875691 {
55885692 // Windows
5589
- return "";
5693
+ return fullname.bump = "";
55905694 }
55915695
5592
- return split[1];
5696
+ return fullname.bump = split[1];
55935697 }
55945698
55955699 // Windows
55965700 assert(split.length == 4);
55975701
5598
- return split[2] + ":" + split[3];
5702
+ return fullname.bump = split[2] + ":" + split[3];
55995703 }
56005704
56015705 String GetPigmentTexture()
....@@ -5678,6 +5782,9 @@
56785782 texname = "";
56795783
56805784 GetTextures().name = texname + ":" + GetBump(GetTextures());
5785
+
5786
+ GetTextures().pigment = null;
5787
+
56815788 Touch();
56825789 }
56835790
....@@ -5750,6 +5857,8 @@
57505857 texname = "";
57515858
57525859 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5860
+
5861
+ GetTextures().bump = null;
57535862
57545863 Touch();
57555864 }
....@@ -5893,8 +6002,10 @@
58936002 if (support != null)
58946003 support = support;
58956004
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);
6005
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
6006
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
6007
+
6008
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
58986009
58996010 if (!usecalllists && bRep != null && bRep.displaylist > 0)
59006011 {
....@@ -5904,8 +6015,9 @@
59046015 // usecalllists &= !(parent instanceof RandomNode);
59056016 // usecalllists = false;
59066017
5907
- if (GetBRep() != null)
5908
- usecalllists = usecalllists;
6018
+ if (display.DrawMode() == display.SHADOW)
6019
+ //GetBRep() != null)
6020
+ usecalllists = !!usecalllists;
59096021 //System.out.println("draw " + this);
59106022 //new Exception().printStackTrace();
59116023
....@@ -5927,7 +6039,7 @@
59276039 if (!(this instanceof Composite))
59286040 touched = false;
59296041 //if (displaylist == -1 && usecalllists)
5930
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
6042
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59316043 {
59326044 bRep.displaylist = display.GenList();
59336045 assert(bRep.displaylist != 0);
....@@ -5938,7 +6050,7 @@
59386050
59396051 //System.out.println("\tnew list " + list);
59406052 //gl.glDrawBuffer(gl.GL_NONE);
5941
- if (usecalllists)
6053
+ if (usecalllists && bRep.displaylist > 0)
59426054 {
59436055 // System.err.println("new list " + bRep.displaylist + " for " + this);
59446056 display.NewList(bRep.displaylist);
....@@ -5947,7 +6059,7 @@
59476059 CallList(display, root, selected, blocked);
59486060
59496061 // compiled = true;
5950
- if (usecalllists)
6062
+ if (usecalllists && bRep.displaylist > 0)
59516063 {
59526064 // System.err.println("end list " + bRep.displaylist + " for " + this);
59536065 display.EndList();
....@@ -7298,20 +7410,23 @@
72987410 }
72997411 }
73007412
7301
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7413
+ static ClickInfo clickInfo = new ClickInfo();
7414
+
7415
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7416
+ Point outPt, Rectangle outRec)
73027417 {
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;
7418
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7419
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7420
+ double[][] toscreen = clickInfo.toScreen;
73067421 if (toscreen == null)
73077422 {
7308
- toscreen = new Camera(info.camera.viewCode).toScreen;
7423
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
73097424 }
73107425 cVector vec = in;
73117426 LA.xformPos(in, toscreen, in);
73127427 //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();
7428
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7429
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
73157430 outPt.x = hc + (int) vec.x;
73167431 outPt.y = vc - (int) vec.y;
73177432 outRec.x = outPt.x - 3;
....@@ -7319,15 +7434,18 @@
73197434 outRec.width = outRec.height = 6;
73207435 }
73217436
7322
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7437
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7438
+ )
73237439 {
73247440 Point pt = new Point(0, 0);
73257441 Rectangle rec = new Rectangle();
7326
- calcHotSpot(in, info, pt, rec);
7442
+ calcHotSpot(in, //clickInfo,
7443
+ pt, rec);
73277444 return rec;
73287445 }
73297446
7330
- void drawEditHandles0(ClickInfo info, int level)
7447
+ void drawEditHandles0(//ClickInfo clickInfo,
7448
+ int level)
73317449 {
73327450 if (level == 0)
73337451 {
....@@ -7336,16 +7454,19 @@
73367454 {
73377455 cVector origin = new cVector();
73387456 //LA.xformPos(origin, toParent, origin);
7339
- Rectangle spot = calcHotSpot(origin, info);
7457
+ if (this.clickInfo == null)
7458
+ this.clickInfo = new ClickInfo();
7459
+
7460
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
73407461 Rectangle boundary = new Rectangle();
73417462 boundary.x = spot.x - 30;
73427463 boundary.y = spot.y - 30;
73437464 boundary.width = spot.width + 60;
73447465 boundary.height = spot.height + 60;
7345
- info.g.setColor(Color.red);
7466
+ clickInfo.g.setColor(Color.white);
73467467 int spotw = spot.x + spot.width;
73477468 int spoth = spot.y + spot.height;
7348
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7469
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73497470 // if (CameraPane.Xmin > spot.x)
73507471 // {
73517472 // CameraPane.Xmin = spot.x;
....@@ -7362,11 +7483,6 @@
73627483 // {
73637484 // CameraPane.Ymax = spoth;
73647485 // }
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);
73707486 // if (CameraPane.Xmin > spot.x)
73717487 // {
73727488 // CameraPane.Xmin = spot.x;
....@@ -7385,10 +7501,15 @@
73857501 // }
73867502 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73877503 //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);
7504
+ spot.translate(32, 0);
7505
+ clickInfo.g.setColor(Color.yellow);
7506
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7507
+
7508
+ spot.translate(32, 64);
7509
+ spotw = spot.x + spot.width;
7510
+ spoth = spot.y + spot.height;
7511
+ clickInfo.g.setColor(Color.cyan);
7512
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73927513 // if (CameraPane.Xmin > spot.x)
73937514 // {
73947515 // CameraPane.Xmin = spot.x;
....@@ -7405,8 +7526,9 @@
74057526 // {
74067527 // CameraPane.Ymax = spoth;
74077528 // }
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);
7529
+ clickInfo.g.setColor(Color.green);
7530
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7531
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74107532 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
74117533 // if (CameraPane.Xmin > boundary.x)
74127534 // {
....@@ -7428,7 +7550,8 @@
74287550 }
74297551 }
74307552
7431
- boolean doEditClick0(ClickInfo info, int level)
7553
+ boolean doEditClick0(//ClickInfo clickInfo,
7554
+ int level)
74327555 {
74337556 if (level == 0)
74347557 {
....@@ -7437,8 +7560,8 @@
74377560
74387561 boolean retval = false;
74397562
7440
- startX = info.x;
7441
- startY = info.y;
7563
+ startX = clickInfo.x;
7564
+ startY = clickInfo.y;
74427565
74437566 hitSomething = -1;
74447567 cVector origin = new cVector();
....@@ -7448,22 +7571,53 @@
74487571 {
74497572 centerPt = new Point(0, 0);
74507573 }
7451
- calcHotSpot(origin, info, centerPt, spot);
7452
- if (spot.contains(info.x, info.y))
7574
+ calcHotSpot(origin, //info,
7575
+ centerPt, spot);
7576
+ if (spot.contains(clickInfo.x, clickInfo.y))
74537577 {
74547578 hitSomething = hitCenter;
74557579 retval = true;
74567580 }
74577581 spot.translate(32, 0);
7458
- if (spot.contains(info.x, info.y))
7582
+ if (spot.contains(clickInfo.x, clickInfo.y))
74597583 {
74607584 hitSomething = hitRotate;
74617585 retval = true;
74627586 }
74637587 spot.translate(0, 32);
7464
- if (spot.contains(info.x, info.y))
7588
+ spot.translate(32, 0);
7589
+ spot.translate(0, 32);
7590
+ if (spot.contains(clickInfo.x, clickInfo.y))
74657591 {
74667592 hitSomething = hitScale;
7593
+
7594
+ double scale = 0.005f * clickInfo.camera.Distance();
7595
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
7596
+ double sign = 1;
7597
+ if (hScale < 0)
7598
+ {
7599
+ sign = -1;
7600
+ }
7601
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7602
+ if (hScale < 0.01)
7603
+ {
7604
+ //hScale = 0.01;
7605
+ }
7606
+
7607
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
7608
+ sign = 1;
7609
+ if (vScale < 0)
7610
+ {
7611
+ sign = -1;
7612
+ }
7613
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7614
+ if (vScale < 0.01)
7615
+ {
7616
+ //vScale = 0.01;
7617
+ }
7618
+
7619
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7620
+
74677621 retval = true;
74687622 }
74697623
....@@ -7473,7 +7627,7 @@
74737627 }
74747628
74757629 //System.out.println("info.modifiers = " + info.modifiers);
7476
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7630
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
74777631 //System.out.println("modified = " + modified);
74787632 //new Exception().printStackTrace();
74797633 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7501,7 +7655,8 @@
75017655 return true;
75027656 }
75037657
7504
- void doEditDrag0(ClickInfo info, boolean opposite)
7658
+ void doEditDrag0(//ClickInfo info,
7659
+ boolean opposite)
75057660 {
75067661 if (hitSomething == 0)
75077662 {
....@@ -7515,7 +7670,7 @@
75157670
75167671 //System.out.println("hitSomething = " + hitSomething);
75177672
7518
- double scale = 0.005f * info.camera.Distance();
7673
+ double scale = 0.005f * clickInfo.camera.Distance();
75197674
75207675 cVector xlate = new cVector();
75217676 //cVector xlate2 = new cVector();
....@@ -7549,8 +7704,8 @@
75497704 toParent[3][i] = xlate.get(i);
75507705 LA.matInvert(toParent, fromParent);
75517706 */
7552
- cVector delta = LA.newVector(0, 0, startY - info.y);
7553
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7707
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7708
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75547709
75557710 LA.matCopy(startMat, toParent);
75567711 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7559,7 +7714,7 @@
75597714 } else
75607715 {
75617716 //LA.xformDir(delta, info.camera.fromScreen, delta);
7562
- cVector up = new cVector(info.camera.up);
7717
+ cVector up = new cVector(clickInfo.camera.up);
75637718 cVector away = new cVector();
75647719 //cVector right2 = new cVector();
75657720 //LA.vecCross(up, cVector.Z, right);
....@@ -7576,19 +7731,19 @@
75767731 LA.xformDir(up, ClickInfo.matbuffer, up);
75777732 // if (!CameraPane.LOCALTRANSFORM)
75787733 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7579
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7734
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
75807735 // if (!CameraPane.LOCALTRANSFORM)
75817736 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75827737 //LA.vecCross(up, cVector.Z, right2);
75837738
7584
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7739
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75857740
75867741 //System.out.println("DELTA0 = " + delta);
75877742 //System.out.println("AWAY = " + info.camera.away);
75887743 //System.out.println("UP = " + info.camera.up);
75897744 if (away.z > 0)
75907745 {
7591
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7746
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75927747 {
75937748 delta.x = -delta.x;
75947749 } else
....@@ -7603,7 +7758,7 @@
76037758 //System.out.println("DELTA1 = " + delta);
76047759 LA.xformDir(delta, ClickInfo.matbuffer, delta);
76057760 //System.out.println("DELTA2 = " + delta);
7606
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7761
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
76077762 LA.matCopy(startMat, toParent);
76087763 //System.out.println("DELTA3 = " + delta);
76097764 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7613,8 +7768,8 @@
76137768 break;
76147769
76157770 case hitRotate: // rotate
7616
- int dx = info.x - centerPt.x;
7617
- int dy = -(info.y - centerPt.y);
7771
+ int dx = clickInfo.x - centerPt.x;
7772
+ int dy = -(clickInfo.y - centerPt.y);
76187773 double angle = (double) Math.atan2(dx, dy);
76197774 angle = -(1.570796 - angle);
76207775
....@@ -7637,7 +7792,7 @@
76377792 }
76387793 /**/
76397794
7640
- switch (info.pane.RenderCamera().viewCode)
7795
+ switch (clickInfo.pane.RenderCamera().viewCode)
76417796 {
76427797 case 1: // '\001'
76437798 LA.matZRotate(toParent, angle);
....@@ -7664,7 +7819,7 @@
76647819 break;
76657820
76667821 case hitScale: // scale
7667
- double hScale = (double) (info.x - centerPt.x) / 32;
7822
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
76687823 double sign = 1;
76697824 if (hScale < 0)
76707825 {
....@@ -7676,7 +7831,7 @@
76767831 //hScale = 0.01;
76777832 }
76787833
7679
- double vScale = (double) (info.y - centerPt.y) / 32;
7834
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
76807835 sign = 1;
76817836 if (vScale < 0)
76827837 {
....@@ -7687,6 +7842,7 @@
76877842 {
76887843 //vScale = 0.01;
76897844 }
7845
+
76907846 LA.matCopy(startMat, toParent);
76917847 /**/
76927848 for (int i = 0; i < 3; i++)
....@@ -7696,33 +7852,39 @@
76967852 }
76977853 /**/
76987854
7699
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7855
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
77007856
77017857 if (totalScale < 0.01)
77027858 {
77037859 totalScale = 0.01;
77047860 }
77057861
7706
- switch (info.pane.RenderCamera().viewCode)
7862
+ switch (clickInfo.pane.RenderCamera().viewCode)
77077863 {
77087864 case 3: // '\001'
77097865 if (modified || opposite)
77107866 {
7867
+ if (modified && opposite)
7868
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7869
+ else
77117870 //LA.matScale(toParent, 1, hScale, vScale);
7712
- LA.matScale(toParent, totalScale, 1, 1);
7871
+ LA.matScale(toParent, totalScale, 1, 1);
77137872 } // vScale, 1);
77147873 else
77157874 {
77167875 // EXCEPTION!
7717
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7876
+ LA.matScale(toParent, 1, totalScale, totalScale);
77187877 } // vScale, 1);
77197878 break;
77207879
77217880 case 2: // '\002'
77227881 if (modified || opposite)
77237882 {
7724
- //LA.matScale(toParent, hScale, 1, vScale);
7725
- LA.matScale(toParent, 1, totalScale, 1);
7883
+ if (modified && opposite)
7884
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7885
+ else
7886
+ //LA.matScale(toParent, hScale, 1, vScale);
7887
+ LA.matScale(toParent, 1, totalScale, 1);
77267888 } else
77277889 {
77287890 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7732,8 +7894,11 @@
77327894 case 1: // '\003'
77337895 if (modified || opposite)
77347896 {
7735
- //LA.matScale(toParent, hScale, vScale, 1);
7736
- LA.matScale(toParent, 1, 1, totalScale);
7897
+ if (modified && opposite)
7898
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7899
+ else
7900
+ //LA.matScale(toParent, hScale, vScale, 1);
7901
+ LA.matScale(toParent, 1, 1, totalScale);
77377902 } else
77387903 {
77397904 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7770,7 +7935,7 @@
77707935 } // NEW ...
77717936
77727937
7773
- info.pane.repaint();
7938
+ clickInfo.pane.repaint();
77747939 }
77757940
77767941 boolean overflow = false;