Normand Briere
2019-08-22 6a145f6c81dfcbe0653eda27d042efb48daa7512
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
....@@ -5775,12 +5884,23 @@
57755884 }
57765885 }
57775886
5778
- void EmbedTextures()
5887
+ void EmbedTextures(boolean embed)
57795888 {
57805889 if (blockloop)
57815890 return;
57825891
5783
- CameraPane.EmbedTextures(texture);
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
+ }
57845904
57855905 int nb = Size();
57865906 for (int i = 0; i < nb; i++)
....@@ -5791,7 +5911,7 @@
57915911 continue;
57925912
57935913 blockloop = true;
5794
- child.EmbedTextures();
5914
+ child.EmbedTextures(embed);
57955915 blockloop = false;
57965916 }
57975917 }
....@@ -5882,8 +6002,10 @@
58826002 if (support != null)
58836003 support = support;
58846004
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);
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.
58876009
58886010 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58896011 {
....@@ -5893,8 +6015,9 @@
58936015 // usecalllists &= !(parent instanceof RandomNode);
58946016 // usecalllists = false;
58956017
5896
- if (GetBRep() != null)
5897
- usecalllists = usecalllists;
6018
+ if (display.DrawMode() == display.SHADOW)
6019
+ //GetBRep() != null)
6020
+ usecalllists = !!usecalllists;
58986021 //System.out.println("draw " + this);
58996022 //new Exception().printStackTrace();
59006023
....@@ -5916,7 +6039,7 @@
59166039 if (!(this instanceof Composite))
59176040 touched = false;
59186041 //if (displaylist == -1 && usecalllists)
5919
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
6042
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59206043 {
59216044 bRep.displaylist = display.GenList();
59226045 assert(bRep.displaylist != 0);
....@@ -5927,7 +6050,7 @@
59276050
59286051 //System.out.println("\tnew list " + list);
59296052 //gl.glDrawBuffer(gl.GL_NONE);
5930
- if (usecalllists)
6053
+ if (usecalllists && bRep.displaylist > 0)
59316054 {
59326055 // System.err.println("new list " + bRep.displaylist + " for " + this);
59336056 display.NewList(bRep.displaylist);
....@@ -5936,7 +6059,7 @@
59366059 CallList(display, root, selected, blocked);
59376060
59386061 // compiled = true;
5939
- if (usecalllists)
6062
+ if (usecalllists && bRep.displaylist > 0)
59406063 {
59416064 // System.err.println("end list " + bRep.displaylist + " for " + this);
59426065 display.EndList();
....@@ -7287,20 +7410,23 @@
72877410 }
72887411 }
72897412
7290
- 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)
72917417 {
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;
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;
72957421 if (toscreen == null)
72967422 {
7297
- toscreen = new Camera(info.camera.viewCode).toScreen;
7423
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72987424 }
72997425 cVector vec = in;
73007426 LA.xformPos(in, toscreen, in);
73017427 //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();
7428
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7429
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
73047430 outPt.x = hc + (int) vec.x;
73057431 outPt.y = vc - (int) vec.y;
73067432 outRec.x = outPt.x - 3;
....@@ -7308,15 +7434,18 @@
73087434 outRec.width = outRec.height = 6;
73097435 }
73107436
7311
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7437
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7438
+ )
73127439 {
73137440 Point pt = new Point(0, 0);
73147441 Rectangle rec = new Rectangle();
7315
- calcHotSpot(in, info, pt, rec);
7442
+ calcHotSpot(in, //clickInfo,
7443
+ pt, rec);
73167444 return rec;
73177445 }
73187446
7319
- void drawEditHandles0(ClickInfo info, int level)
7447
+ void drawEditHandles0(//ClickInfo clickInfo,
7448
+ int level)
73207449 {
73217450 if (level == 0)
73227451 {
....@@ -7325,16 +7454,19 @@
73257454 {
73267455 cVector origin = new cVector();
73277456 //LA.xformPos(origin, toParent, origin);
7328
- Rectangle spot = calcHotSpot(origin, info);
7457
+ if (this.clickInfo == null)
7458
+ this.clickInfo = new ClickInfo();
7459
+
7460
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
73297461 Rectangle boundary = new Rectangle();
73307462 boundary.x = spot.x - 30;
73317463 boundary.y = spot.y - 30;
73327464 boundary.width = spot.width + 60;
73337465 boundary.height = spot.height + 60;
7334
- info.g.setColor(Color.red);
7466
+ clickInfo.g.setColor(Color.white);
73357467 int spotw = spot.x + spot.width;
73367468 int spoth = spot.y + spot.height;
7337
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7469
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73387470 // if (CameraPane.Xmin > spot.x)
73397471 // {
73407472 // CameraPane.Xmin = spot.x;
....@@ -7351,11 +7483,6 @@
73517483 // {
73527484 // CameraPane.Ymax = spoth;
73537485 // }
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);
73597486 // if (CameraPane.Xmin > spot.x)
73607487 // {
73617488 // CameraPane.Xmin = spot.x;
....@@ -7374,10 +7501,15 @@
73747501 // }
73757502 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73767503 //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);
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);
73817513 // if (CameraPane.Xmin > spot.x)
73827514 // {
73837515 // CameraPane.Xmin = spot.x;
....@@ -7394,8 +7526,9 @@
73947526 // {
73957527 // CameraPane.Ymax = spoth;
73967528 // }
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);
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);
73997532 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
74007533 // if (CameraPane.Xmin > boundary.x)
74017534 // {
....@@ -7417,7 +7550,8 @@
74177550 }
74187551 }
74197552
7420
- boolean doEditClick0(ClickInfo info, int level)
7553
+ boolean doEditClick0(//ClickInfo clickInfo,
7554
+ int level)
74217555 {
74227556 if (level == 0)
74237557 {
....@@ -7426,8 +7560,8 @@
74267560
74277561 boolean retval = false;
74287562
7429
- startX = info.x;
7430
- startY = info.y;
7563
+ startX = clickInfo.x;
7564
+ startY = clickInfo.y;
74317565
74327566 hitSomething = -1;
74337567 cVector origin = new cVector();
....@@ -7437,22 +7571,53 @@
74377571 {
74387572 centerPt = new Point(0, 0);
74397573 }
7440
- calcHotSpot(origin, info, centerPt, spot);
7441
- if (spot.contains(info.x, info.y))
7574
+ calcHotSpot(origin, //info,
7575
+ centerPt, spot);
7576
+ if (spot.contains(clickInfo.x, clickInfo.y))
74427577 {
74437578 hitSomething = hitCenter;
74447579 retval = true;
74457580 }
74467581 spot.translate(32, 0);
7447
- if (spot.contains(info.x, info.y))
7582
+ if (spot.contains(clickInfo.x, clickInfo.y))
74487583 {
74497584 hitSomething = hitRotate;
74507585 retval = true;
74517586 }
74527587 spot.translate(0, 32);
7453
- 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))
74547591 {
74557592 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
+
74567621 retval = true;
74577622 }
74587623
....@@ -7462,7 +7627,7 @@
74627627 }
74637628
74647629 //System.out.println("info.modifiers = " + info.modifiers);
7465
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7630
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
74667631 //System.out.println("modified = " + modified);
74677632 //new Exception().printStackTrace();
74687633 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7490,7 +7655,8 @@
74907655 return true;
74917656 }
74927657
7493
- void doEditDrag0(ClickInfo info, boolean opposite)
7658
+ void doEditDrag0(//ClickInfo info,
7659
+ boolean opposite)
74947660 {
74957661 if (hitSomething == 0)
74967662 {
....@@ -7504,7 +7670,7 @@
75047670
75057671 //System.out.println("hitSomething = " + hitSomething);
75067672
7507
- double scale = 0.005f * info.camera.Distance();
7673
+ double scale = 0.005f * clickInfo.camera.Distance();
75087674
75097675 cVector xlate = new cVector();
75107676 //cVector xlate2 = new cVector();
....@@ -7538,8 +7704,8 @@
75387704 toParent[3][i] = xlate.get(i);
75397705 LA.matInvert(toParent, fromParent);
75407706 */
7541
- cVector delta = LA.newVector(0, 0, startY - info.y);
7542
- 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);
75437709
75447710 LA.matCopy(startMat, toParent);
75457711 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7548,7 +7714,7 @@
75487714 } else
75497715 {
75507716 //LA.xformDir(delta, info.camera.fromScreen, delta);
7551
- cVector up = new cVector(info.camera.up);
7717
+ cVector up = new cVector(clickInfo.camera.up);
75527718 cVector away = new cVector();
75537719 //cVector right2 = new cVector();
75547720 //LA.vecCross(up, cVector.Z, right);
....@@ -7565,19 +7731,19 @@
75657731 LA.xformDir(up, ClickInfo.matbuffer, up);
75667732 // if (!CameraPane.LOCALTRANSFORM)
75677733 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7568
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7734
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
75697735 // if (!CameraPane.LOCALTRANSFORM)
75707736 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75717737 //LA.vecCross(up, cVector.Z, right2);
75727738
7573
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7739
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75747740
75757741 //System.out.println("DELTA0 = " + delta);
75767742 //System.out.println("AWAY = " + info.camera.away);
75777743 //System.out.println("UP = " + info.camera.up);
75787744 if (away.z > 0)
75797745 {
7580
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7746
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75817747 {
75827748 delta.x = -delta.x;
75837749 } else
....@@ -7592,7 +7758,7 @@
75927758 //System.out.println("DELTA1 = " + delta);
75937759 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75947760 //System.out.println("DELTA2 = " + delta);
7595
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7761
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75967762 LA.matCopy(startMat, toParent);
75977763 //System.out.println("DELTA3 = " + delta);
75987764 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7602,8 +7768,8 @@
76027768 break;
76037769
76047770 case hitRotate: // rotate
7605
- int dx = info.x - centerPt.x;
7606
- int dy = -(info.y - centerPt.y);
7771
+ int dx = clickInfo.x - centerPt.x;
7772
+ int dy = -(clickInfo.y - centerPt.y);
76077773 double angle = (double) Math.atan2(dx, dy);
76087774 angle = -(1.570796 - angle);
76097775
....@@ -7626,7 +7792,7 @@
76267792 }
76277793 /**/
76287794
7629
- switch (info.pane.RenderCamera().viewCode)
7795
+ switch (clickInfo.pane.RenderCamera().viewCode)
76307796 {
76317797 case 1: // '\001'
76327798 LA.matZRotate(toParent, angle);
....@@ -7653,7 +7819,7 @@
76537819 break;
76547820
76557821 case hitScale: // scale
7656
- double hScale = (double) (info.x - centerPt.x) / 32;
7822
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
76577823 double sign = 1;
76587824 if (hScale < 0)
76597825 {
....@@ -7665,7 +7831,7 @@
76657831 //hScale = 0.01;
76667832 }
76677833
7668
- double vScale = (double) (info.y - centerPt.y) / 32;
7834
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
76697835 sign = 1;
76707836 if (vScale < 0)
76717837 {
....@@ -7676,6 +7842,7 @@
76767842 {
76777843 //vScale = 0.01;
76787844 }
7845
+
76797846 LA.matCopy(startMat, toParent);
76807847 /**/
76817848 for (int i = 0; i < 3; i++)
....@@ -7685,33 +7852,39 @@
76857852 }
76867853 /**/
76877854
7688
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7855
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76897856
76907857 if (totalScale < 0.01)
76917858 {
76927859 totalScale = 0.01;
76937860 }
76947861
7695
- switch (info.pane.RenderCamera().viewCode)
7862
+ switch (clickInfo.pane.RenderCamera().viewCode)
76967863 {
76977864 case 3: // '\001'
76987865 if (modified || opposite)
76997866 {
7867
+ if (modified && opposite)
7868
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7869
+ else
77007870 //LA.matScale(toParent, 1, hScale, vScale);
7701
- LA.matScale(toParent, totalScale, 1, 1);
7871
+ LA.matScale(toParent, totalScale, 1, 1);
77027872 } // vScale, 1);
77037873 else
77047874 {
77057875 // EXCEPTION!
7706
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7876
+ LA.matScale(toParent, 1, totalScale, totalScale);
77077877 } // vScale, 1);
77087878 break;
77097879
77107880 case 2: // '\002'
77117881 if (modified || opposite)
77127882 {
7713
- //LA.matScale(toParent, hScale, 1, vScale);
7714
- 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);
77157888 } else
77167889 {
77177890 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7721,8 +7894,11 @@
77217894 case 1: // '\003'
77227895 if (modified || opposite)
77237896 {
7724
- //LA.matScale(toParent, hScale, vScale, 1);
7725
- 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);
77267902 } else
77277903 {
77287904 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7759,7 +7935,7 @@
77597935 } // NEW ...
77607936
77617937
7762
- info.pane.repaint();
7938
+ clickInfo.pane.repaint();
77637939 }
77647940
77657941 boolean overflow = false;