Normand Briere
2019-08-20 564f4d12d93813b5d680fc24d4f118c3886d96ed
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
....@@ -5751,6 +5858,8 @@
57515858
57525859 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
57535860
5861
+ GetTextures().bump = null;
5862
+
57545863 Touch();
57555864 }
57565865
....@@ -5771,6 +5880,38 @@
57715880
57725881 blockloop = true;
57735882 child.ResetBumpTexture();
5883
+ blockloop = false;
5884
+ }
5885
+ }
5886
+
5887
+ void EmbedTextures(boolean embed)
5888
+ {
5889
+ if (blockloop)
5890
+ return;
5891
+
5892
+ //if (GetTextures() != null)
5893
+ if (embed)
5894
+ CameraPane.EmbedTextures(GetTextures());
5895
+ else
5896
+ {
5897
+ GetTextures().pigmentdata = null;
5898
+ GetTextures().bumpdata = null;
5899
+ GetTextures().pw = 0;
5900
+ GetTextures().ph = 0;
5901
+ GetTextures().bw = 0;
5902
+ GetTextures().bh = 0;
5903
+ }
5904
+
5905
+ int nb = Size();
5906
+ for (int i = 0; i < nb; i++)
5907
+ {
5908
+ Object3D child = (Object3D) get(i);
5909
+
5910
+ if (child == null)
5911
+ continue;
5912
+
5913
+ blockloop = true;
5914
+ child.EmbedTextures(embed);
57745915 blockloop = false;
57755916 }
57765917 }
....@@ -5861,8 +6002,10 @@
58616002 if (support != null)
58626003 support = support;
58636004
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);
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.
58666009
58676010 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58686011 {
....@@ -5872,8 +6015,9 @@
58726015 // usecalllists &= !(parent instanceof RandomNode);
58736016 // usecalllists = false;
58746017
5875
- if (GetBRep() != null)
5876
- usecalllists = usecalllists;
6018
+ if (display.DrawMode() == display.SHADOW)
6019
+ //GetBRep() != null)
6020
+ usecalllists = !!usecalllists;
58776021 //System.out.println("draw " + this);
58786022 //new Exception().printStackTrace();
58796023
....@@ -5895,7 +6039,7 @@
58956039 if (!(this instanceof Composite))
58966040 touched = false;
58976041 //if (displaylist == -1 && usecalllists)
5898
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
6042
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58996043 {
59006044 bRep.displaylist = display.GenList();
59016045 assert(bRep.displaylist != 0);
....@@ -5906,7 +6050,7 @@
59066050
59076051 //System.out.println("\tnew list " + list);
59086052 //gl.glDrawBuffer(gl.GL_NONE);
5909
- if (usecalllists)
6053
+ if (usecalllists && bRep.displaylist > 0)
59106054 {
59116055 // System.err.println("new list " + bRep.displaylist + " for " + this);
59126056 display.NewList(bRep.displaylist);
....@@ -5915,7 +6059,7 @@
59156059 CallList(display, root, selected, blocked);
59166060
59176061 // compiled = true;
5918
- if (usecalllists)
6062
+ if (usecalllists && bRep.displaylist > 0)
59196063 {
59206064 // System.err.println("end list " + bRep.displaylist + " for " + this);
59216065 display.EndList();
....@@ -7266,20 +7410,23 @@
72667410 }
72677411 }
72687412
7269
- 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)
72707417 {
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;
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;
72747421 if (toscreen == null)
72757422 {
7276
- toscreen = new Camera(info.camera.viewCode).toScreen;
7423
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72777424 }
72787425 cVector vec = in;
72797426 LA.xformPos(in, toscreen, in);
72807427 //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();
7428
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7429
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
72837430 outPt.x = hc + (int) vec.x;
72847431 outPt.y = vc - (int) vec.y;
72857432 outRec.x = outPt.x - 3;
....@@ -7287,15 +7434,18 @@
72877434 outRec.width = outRec.height = 6;
72887435 }
72897436
7290
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7437
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7438
+ )
72917439 {
72927440 Point pt = new Point(0, 0);
72937441 Rectangle rec = new Rectangle();
7294
- calcHotSpot(in, info, pt, rec);
7442
+ calcHotSpot(in, //clickInfo,
7443
+ pt, rec);
72957444 return rec;
72967445 }
72977446
7298
- void drawEditHandles0(ClickInfo info, int level)
7447
+ void drawEditHandles0(//ClickInfo clickInfo,
7448
+ int level)
72997449 {
73007450 if (level == 0)
73017451 {
....@@ -7304,16 +7454,19 @@
73047454 {
73057455 cVector origin = new cVector();
73067456 //LA.xformPos(origin, toParent, origin);
7307
- Rectangle spot = calcHotSpot(origin, info);
7457
+ if (this.clickInfo == null)
7458
+ this.clickInfo = new ClickInfo();
7459
+
7460
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
73087461 Rectangle boundary = new Rectangle();
73097462 boundary.x = spot.x - 30;
73107463 boundary.y = spot.y - 30;
73117464 boundary.width = spot.width + 60;
73127465 boundary.height = spot.height + 60;
7313
- info.g.setColor(Color.red);
7466
+ clickInfo.g.setColor(Color.white);
73147467 int spotw = spot.x + spot.width;
73157468 int spoth = spot.y + spot.height;
7316
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7469
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73177470 // if (CameraPane.Xmin > spot.x)
73187471 // {
73197472 // CameraPane.Xmin = spot.x;
....@@ -7330,11 +7483,6 @@
73307483 // {
73317484 // CameraPane.Ymax = spoth;
73327485 // }
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);
73387486 // if (CameraPane.Xmin > spot.x)
73397487 // {
73407488 // CameraPane.Xmin = spot.x;
....@@ -7353,10 +7501,15 @@
73537501 // }
73547502 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73557503 //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);
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);
73607513 // if (CameraPane.Xmin > spot.x)
73617514 // {
73627515 // CameraPane.Xmin = spot.x;
....@@ -7373,8 +7526,9 @@
73737526 // {
73747527 // CameraPane.Ymax = spoth;
73757528 // }
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);
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);
73787532 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
73797533 // if (CameraPane.Xmin > boundary.x)
73807534 // {
....@@ -7396,7 +7550,8 @@
73967550 }
73977551 }
73987552
7399
- boolean doEditClick0(ClickInfo info, int level)
7553
+ boolean doEditClick0(//ClickInfo clickInfo,
7554
+ int level)
74007555 {
74017556 if (level == 0)
74027557 {
....@@ -7405,8 +7560,8 @@
74057560
74067561 boolean retval = false;
74077562
7408
- startX = info.x;
7409
- startY = info.y;
7563
+ startX = clickInfo.x;
7564
+ startY = clickInfo.y;
74107565
74117566 hitSomething = -1;
74127567 cVector origin = new cVector();
....@@ -7416,22 +7571,53 @@
74167571 {
74177572 centerPt = new Point(0, 0);
74187573 }
7419
- calcHotSpot(origin, info, centerPt, spot);
7420
- if (spot.contains(info.x, info.y))
7574
+ calcHotSpot(origin, //info,
7575
+ centerPt, spot);
7576
+ if (spot.contains(clickInfo.x, clickInfo.y))
74217577 {
74227578 hitSomething = hitCenter;
74237579 retval = true;
74247580 }
74257581 spot.translate(32, 0);
7426
- if (spot.contains(info.x, info.y))
7582
+ if (spot.contains(clickInfo.x, clickInfo.y))
74277583 {
74287584 hitSomething = hitRotate;
74297585 retval = true;
74307586 }
74317587 spot.translate(0, 32);
7432
- 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))
74337591 {
74347592 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
+
74357621 retval = true;
74367622 }
74377623
....@@ -7441,7 +7627,7 @@
74417627 }
74427628
74437629 //System.out.println("info.modifiers = " + info.modifiers);
7444
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7630
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
74457631 //System.out.println("modified = " + modified);
74467632 //new Exception().printStackTrace();
74477633 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7469,7 +7655,8 @@
74697655 return true;
74707656 }
74717657
7472
- void doEditDrag0(ClickInfo info, boolean opposite)
7658
+ void doEditDrag0(//ClickInfo info,
7659
+ boolean opposite)
74737660 {
74747661 if (hitSomething == 0)
74757662 {
....@@ -7483,7 +7670,7 @@
74837670
74847671 //System.out.println("hitSomething = " + hitSomething);
74857672
7486
- double scale = 0.005f * info.camera.Distance();
7673
+ double scale = 0.005f * clickInfo.camera.Distance();
74877674
74887675 cVector xlate = new cVector();
74897676 //cVector xlate2 = new cVector();
....@@ -7517,8 +7704,8 @@
75177704 toParent[3][i] = xlate.get(i);
75187705 LA.matInvert(toParent, fromParent);
75197706 */
7520
- cVector delta = LA.newVector(0, 0, startY - info.y);
7521
- 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);
75227709
75237710 LA.matCopy(startMat, toParent);
75247711 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7527,7 +7714,7 @@
75277714 } else
75287715 {
75297716 //LA.xformDir(delta, info.camera.fromScreen, delta);
7530
- cVector up = new cVector(info.camera.up);
7717
+ cVector up = new cVector(clickInfo.camera.up);
75317718 cVector away = new cVector();
75327719 //cVector right2 = new cVector();
75337720 //LA.vecCross(up, cVector.Z, right);
....@@ -7544,19 +7731,19 @@
75447731 LA.xformDir(up, ClickInfo.matbuffer, up);
75457732 // if (!CameraPane.LOCALTRANSFORM)
75467733 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7547
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7734
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
75487735 // if (!CameraPane.LOCALTRANSFORM)
75497736 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75507737 //LA.vecCross(up, cVector.Z, right2);
75517738
7552
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7739
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75537740
75547741 //System.out.println("DELTA0 = " + delta);
75557742 //System.out.println("AWAY = " + info.camera.away);
75567743 //System.out.println("UP = " + info.camera.up);
75577744 if (away.z > 0)
75587745 {
7559
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7746
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75607747 {
75617748 delta.x = -delta.x;
75627749 } else
....@@ -7571,7 +7758,7 @@
75717758 //System.out.println("DELTA1 = " + delta);
75727759 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75737760 //System.out.println("DELTA2 = " + delta);
7574
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7761
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75757762 LA.matCopy(startMat, toParent);
75767763 //System.out.println("DELTA3 = " + delta);
75777764 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7581,8 +7768,8 @@
75817768 break;
75827769
75837770 case hitRotate: // rotate
7584
- int dx = info.x - centerPt.x;
7585
- int dy = -(info.y - centerPt.y);
7771
+ int dx = clickInfo.x - centerPt.x;
7772
+ int dy = -(clickInfo.y - centerPt.y);
75867773 double angle = (double) Math.atan2(dx, dy);
75877774 angle = -(1.570796 - angle);
75887775
....@@ -7605,7 +7792,7 @@
76057792 }
76067793 /**/
76077794
7608
- switch (info.pane.RenderCamera().viewCode)
7795
+ switch (clickInfo.pane.RenderCamera().viewCode)
76097796 {
76107797 case 1: // '\001'
76117798 LA.matZRotate(toParent, angle);
....@@ -7632,7 +7819,7 @@
76327819 break;
76337820
76347821 case hitScale: // scale
7635
- double hScale = (double) (info.x - centerPt.x) / 32;
7822
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
76367823 double sign = 1;
76377824 if (hScale < 0)
76387825 {
....@@ -7644,7 +7831,7 @@
76447831 //hScale = 0.01;
76457832 }
76467833
7647
- double vScale = (double) (info.y - centerPt.y) / 32;
7834
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
76487835 sign = 1;
76497836 if (vScale < 0)
76507837 {
....@@ -7655,6 +7842,7 @@
76557842 {
76567843 //vScale = 0.01;
76577844 }
7845
+
76587846 LA.matCopy(startMat, toParent);
76597847 /**/
76607848 for (int i = 0; i < 3; i++)
....@@ -7664,33 +7852,39 @@
76647852 }
76657853 /**/
76667854
7667
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7855
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76687856
76697857 if (totalScale < 0.01)
76707858 {
76717859 totalScale = 0.01;
76727860 }
76737861
7674
- switch (info.pane.RenderCamera().viewCode)
7862
+ switch (clickInfo.pane.RenderCamera().viewCode)
76757863 {
76767864 case 3: // '\001'
76777865 if (modified || opposite)
76787866 {
7867
+ if (modified && opposite)
7868
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7869
+ else
76797870 //LA.matScale(toParent, 1, hScale, vScale);
7680
- LA.matScale(toParent, totalScale, 1, 1);
7871
+ LA.matScale(toParent, totalScale, 1, 1);
76817872 } // vScale, 1);
76827873 else
76837874 {
76847875 // EXCEPTION!
7685
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7876
+ LA.matScale(toParent, 1, totalScale, totalScale);
76867877 } // vScale, 1);
76877878 break;
76887879
76897880 case 2: // '\002'
76907881 if (modified || opposite)
76917882 {
7692
- //LA.matScale(toParent, hScale, 1, vScale);
7693
- 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);
76947888 } else
76957889 {
76967890 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7700,8 +7894,11 @@
77007894 case 1: // '\003'
77017895 if (modified || opposite)
77027896 {
7703
- //LA.matScale(toParent, hScale, vScale, 1);
7704
- 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);
77057902 } else
77067903 {
77077904 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7738,7 +7935,7 @@
77387935 } // NEW ...
77397936
77407937
7741
- info.pane.repaint();
7938
+ clickInfo.pane.repaint();
77427939 }
77437940
77447941 boolean overflow = false;