Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
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,7 +30,10 @@
2930 Object3D saveskeleton;
3031 //
3132
32
- byte[] versions[] = new byte[100][];
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
3337 int versionindex = -1;
3438
3539 ScriptNode scriptnode;
....@@ -219,6 +223,8 @@
219223 // o.bRep.support = null;
220224 // }
221225 o.selection = this.selection;
226
+ o.versionlist = this.versionlist;
227
+ o.versionindex = this.versionindex;
222228
223229 if (this.support != null)
224230 {
....@@ -240,6 +246,29 @@
240246 // this.support = null;
241247 // this.fileparent = null;
242248 }
249
+
250
+// Object3D GetObject(java.util.UUID uuid)
251
+// {
252
+// if (this.uuid.equals(uuid))
253
+// return this;
254
+//
255
+// if (blockloop)
256
+// return null;
257
+//
258
+// blockloop = true;
259
+//
260
+// for (int i=0; i<Size(); i++)
261
+// {
262
+// Object3D o = get(i).GetObject(uuid);
263
+//
264
+// if (o != null)
265
+// return o;
266
+// }
267
+//
268
+// blockloop = false;
269
+//
270
+// return null;
271
+// }
243272
244273 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
245274 {
....@@ -274,6 +303,9 @@
274303 }
275304
276305 this.selection = o.selection;
306
+
307
+ this.versionlist = o.versionlist;
308
+ this.versionindex = o.versionindex;
277309 // July 2019 if (this.bRep != null)
278310 // this.bRep.support = o.transientrep;
279311 // this.support = o.support;
....@@ -421,6 +453,7 @@
421453 }
422454
423455 boolean live = false;
456
+ transient boolean keepdontselect;
424457 boolean dontselect = false;
425458 boolean hide = false;
426459 boolean link2master = false; // performs reset support/master at each frame
....@@ -1005,6 +1038,9 @@
10051038
10061039 if (material == null || material.multiply)
10071040 return true;
1041
+
1042
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1043
+ return false;
10081044
10091045 // Transparent objects are dynamic because we have to sort the triangles.
10101046 return material.opacity > 0.99;
....@@ -2432,6 +2468,11 @@
24322468 else
24332469 {
24342470 //((ObjEditor)editWindow).SetupUI2(null);
2471
+ if (objectUI != null)
2472
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2473
+ else
2474
+ //new Exception().printStackTrace();
2475
+ System.err.println("objectUI is null");
24352476 }
24362477 }
24372478
....@@ -2561,7 +2602,8 @@
25612602 private static final int editSelf = 1;
25622603 private static final int editChild = 2;
25632604
2564
- void drawEditHandles(ClickInfo info, int level)
2605
+ void drawEditHandles(//ClickInfo info,
2606
+ int level)
25652607 {
25662608 if (level == 0)
25672609 {
....@@ -2569,7 +2611,8 @@
25692611 return;
25702612
25712613 Object3D selectee;
2572
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2614
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2615
+ level + 1))
25732616 {
25742617 selectee = (Object3D) e.nextElement();
25752618 }
....@@ -2577,19 +2620,22 @@
25772620 } else
25782621 {
25792622 //super.
2580
- drawEditHandles0(info, level + 1);
2623
+ drawEditHandles0(//info,
2624
+ level + 1);
25812625 }
25822626 }
25832627
2584
- boolean doEditClick(ClickInfo info, int level)
2628
+ boolean doEditClick(//ClickInfo info,
2629
+ int level)
25852630 {
25862631 doSomething = 0;
25872632 if (level == 0)
25882633 {
2589
- return doParentClick(info);
2634
+ return doParentClick(); //info);
25902635 }
25912636 if (//super.
2592
- doEditClick0(info, level))
2637
+ doEditClick0(//info,
2638
+ level))
25932639 {
25942640 doSomething = 1;
25952641 return true;
....@@ -2599,7 +2645,7 @@
25992645 }
26002646 }
26012647
2602
- boolean doParentClick(ClickInfo info)
2648
+ boolean doParentClick() //ClickInfo info)
26032649 {
26042650 if (selection == null)
26052651 {
....@@ -2612,7 +2658,8 @@
26122658 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
26132659 {
26142660 Object3D selectee = (Object3D) e.nextElement();
2615
- if (selectee.doEditClick(info, 1))
2661
+ if (selectee.doEditClick(//info,
2662
+ 1))
26162663 {
26172664 childToDrag = selectee;
26182665 doSomething = 2;
....@@ -2624,13 +2671,15 @@
26242671 return retval;
26252672 }
26262673
2627
- void doEditDrag(ClickInfo info, boolean opposite)
2674
+ void doEditDrag(//ClickInfo clickInfo,
2675
+ boolean opposite)
26282676 {
26292677 switch (doSomething)
26302678 {
26312679 case 1: // '\001'
26322680 //super.
2633
- doEditDrag0(info, opposite);
2681
+ doEditDrag0(//clickInfo,
2682
+ opposite);
26342683 break;
26352684
26362685 case 2: // '\002'
....@@ -2643,11 +2692,13 @@
26432692 {
26442693 //sel.hitSomething = childToDrag.hitSomething;
26452694 //childToDrag.doEditDrag(info);
2646
- sel.doEditDrag(info, opposite);
2695
+ sel.doEditDrag(//clickInfo,
2696
+ opposite);
26472697 } else
26482698 {
26492699 //super.
2650
- doEditDrag0(info, opposite);
2700
+ doEditDrag0(//clickInfo,
2701
+ opposite);
26512702 }
26522703 }
26532704 break;
....@@ -2665,6 +2716,9 @@
26652716 {
26662717 deselectAll();
26672718 }
2719
+
2720
+ new Exception().printStackTrace();
2721
+
26682722 ClickInfo newInfo = new ClickInfo();
26692723 newInfo.flags = info.flags;
26702724 newInfo.bounds = info.bounds;
....@@ -3112,7 +3166,7 @@
31123166 {
31133167 if (bRep != null)
31143168 {
3115
- bRep.GenerateNormalsMINE();
3169
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
31163170 Touch();
31173171 }
31183172 }
....@@ -5415,6 +5469,51 @@
54155469 blockloop = false;
54165470 }
54175471
5472
+ void ResetSelectable()
5473
+ {
5474
+ if (blockloop)
5475
+ return;
5476
+
5477
+ blockloop = true;
5478
+
5479
+ keepdontselect = dontselect;
5480
+ dontselect = true;
5481
+
5482
+ Object3D child;
5483
+ int nb = Size();
5484
+ for (int i = 0; i < nb; i++)
5485
+ {
5486
+ child = (Object3D) get(i);
5487
+ if (child == null)
5488
+ continue;
5489
+ child.ResetSelectable();
5490
+ }
5491
+
5492
+ blockloop = false;
5493
+ }
5494
+
5495
+ void RestoreSelectable()
5496
+ {
5497
+ if (blockloop)
5498
+ return;
5499
+
5500
+ blockloop = true;
5501
+
5502
+ dontselect = keepdontselect;
5503
+
5504
+ Object3D child;
5505
+ int nb = Size();
5506
+ for (int i = 0; i < nb; i++)
5507
+ {
5508
+ child = (Object3D) get(i);
5509
+ if (child == null)
5510
+ continue;
5511
+ child.RestoreSelectable();
5512
+ }
5513
+
5514
+ blockloop = false;
5515
+ }
5516
+
54185517 boolean IsSelected()
54195518 {
54205519 if (parent == null)
....@@ -5475,6 +5574,11 @@
54755574 if (fullname == null)
54765575 return "";
54775576
5577
+ if (fullname.pigment != null)
5578
+ {
5579
+ return fullname.pigment;
5580
+ }
5581
+
54785582 // System.out.println("Fullname = " + fullname);
54795583
54805584 // Does not work on Windows due to C:
....@@ -5487,7 +5591,7 @@
54875591
54885592 if (split.length == 0)
54895593 {
5490
- return "";
5594
+ return fullname.pigment = "";
54915595 }
54925596
54935597 if (split.length <= 2)
....@@ -5495,22 +5599,27 @@
54955599 if (fullname.name.endsWith(":"))
54965600 {
54975601 // Windows
5498
- return fullname.name.substring(0, fullname.name.length()-1);
5602
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
54995603 }
55005604
5501
- return split[0];
5605
+ return fullname.pigment = split[0];
55025606 }
55035607
55045608 // Windows
55055609 assert(split.length == 4);
55065610
5507
- return split[0] + ":" + split[1];
5611
+ return fullname.pigment = split[0] + ":" + split[1];
55085612 }
55095613
55105614 static String GetBump(cTexture fullname)
55115615 {
55125616 if (fullname == null)
55135617 return "";
5618
+
5619
+ if (fullname.bump != null)
5620
+ {
5621
+ return fullname.bump;
5622
+ }
55145623
55155624 // System.out.println("Fullname = " + fullname);
55165625 // Does not work on Windows due to C:
....@@ -5522,12 +5631,12 @@
55225631
55235632 if (split.length == 0)
55245633 {
5525
- return "";
5634
+ return fullname.bump = "";
55265635 }
55275636
55285637 if (split.length == 1)
55295638 {
5530
- return "";
5639
+ return fullname.bump = "";
55315640 }
55325641
55335642 if (split.length == 2)
....@@ -5535,16 +5644,16 @@
55355644 if (fullname.name.endsWith(":"))
55365645 {
55375646 // Windows
5538
- return "";
5647
+ return fullname.bump = "";
55395648 }
55405649
5541
- return split[1];
5650
+ return fullname.bump = split[1];
55425651 }
55435652
55445653 // Windows
55455654 assert(split.length == 4);
55465655
5547
- return split[2] + ":" + split[3];
5656
+ return fullname.bump = split[2] + ":" + split[3];
55485657 }
55495658
55505659 String GetPigmentTexture()
....@@ -5627,6 +5736,9 @@
56275736 texname = "";
56285737
56295738 GetTextures().name = texname + ":" + GetBump(GetTextures());
5739
+
5740
+ GetTextures().pigment = null;
5741
+
56305742 Touch();
56315743 }
56325744
....@@ -5700,6 +5812,8 @@
57005812
57015813 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
57025814
5815
+ GetTextures().bump = null;
5816
+
57035817 Touch();
57045818 }
57055819
....@@ -5720,6 +5834,38 @@
57205834
57215835 blockloop = true;
57225836 child.ResetBumpTexture();
5837
+ blockloop = false;
5838
+ }
5839
+ }
5840
+
5841
+ void EmbedTextures(boolean embed)
5842
+ {
5843
+ if (blockloop)
5844
+ return;
5845
+
5846
+ //if (GetTextures() != null)
5847
+ if (embed)
5848
+ CameraPane.EmbedTextures(GetTextures());
5849
+ else
5850
+ {
5851
+ GetTextures().pigmentdata = null;
5852
+ GetTextures().bumpdata = null;
5853
+ GetTextures().pw = 0;
5854
+ GetTextures().ph = 0;
5855
+ GetTextures().bw = 0;
5856
+ GetTextures().bh = 0;
5857
+ }
5858
+
5859
+ int nb = Size();
5860
+ for (int i = 0; i < nb; i++)
5861
+ {
5862
+ Object3D child = (Object3D) get(i);
5863
+
5864
+ if (child == null)
5865
+ continue;
5866
+
5867
+ blockloop = true;
5868
+ child.EmbedTextures(embed);
57235869 blockloop = false;
57245870 }
57255871 }
....@@ -5810,8 +5956,10 @@
58105956 if (support != null)
58115957 support = support;
58125958
5813
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5814
- boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5959
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5960
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5961
+
5962
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
58155963
58165964 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58175965 {
....@@ -5821,8 +5969,9 @@
58215969 // usecalllists &= !(parent instanceof RandomNode);
58225970 // usecalllists = false;
58235971
5824
- if (GetBRep() != null)
5825
- usecalllists = usecalllists;
5972
+ if (display.DrawMode() == display.SHADOW)
5973
+ //GetBRep() != null)
5974
+ usecalllists = !!usecalllists;
58265975 //System.out.println("draw " + this);
58275976 //new Exception().printStackTrace();
58285977
....@@ -5844,7 +5993,7 @@
58445993 if (!(this instanceof Composite))
58455994 touched = false;
58465995 //if (displaylist == -1 && usecalllists)
5847
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5996
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58485997 {
58495998 bRep.displaylist = display.GenList();
58505999 assert(bRep.displaylist != 0);
....@@ -5855,7 +6004,7 @@
58556004
58566005 //System.out.println("\tnew list " + list);
58576006 //gl.glDrawBuffer(gl.GL_NONE);
5858
- if (usecalllists)
6007
+ if (usecalllists && bRep.displaylist > 0)
58596008 {
58606009 // System.err.println("new list " + bRep.displaylist + " for " + this);
58616010 display.NewList(bRep.displaylist);
....@@ -5864,7 +6013,7 @@
58646013 CallList(display, root, selected, blocked);
58656014
58666015 // compiled = true;
5867
- if (usecalllists)
6016
+ if (usecalllists && bRep.displaylist > 0)
58686017 {
58696018 // System.err.println("end list " + bRep.displaylist + " for " + this);
58706019 display.EndList();
....@@ -7215,20 +7364,23 @@
72157364 }
72167365 }
72177366
7218
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7367
+ static ClickInfo clickInfo = new ClickInfo();
7368
+
7369
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7370
+ Point outPt, Rectangle outRec)
72197371 {
7220
- int hc = info.bounds.x + info.bounds.width / 2;
7221
- int vc = info.bounds.y + info.bounds.height / 2;
7222
- double[][] toscreen = info.toScreen;
7372
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7373
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7374
+ double[][] toscreen = clickInfo.toScreen;
72237375 if (toscreen == null)
72247376 {
7225
- toscreen = new Camera(info.camera.viewCode).toScreen;
7377
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72267378 }
72277379 cVector vec = in;
72287380 LA.xformPos(in, toscreen, in);
72297381 //System.out.println("Distance = " + info.camera.Distance());
7230
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7231
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7382
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7383
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
72327384 outPt.x = hc + (int) vec.x;
72337385 outPt.y = vc - (int) vec.y;
72347386 outRec.x = outPt.x - 3;
....@@ -7236,15 +7388,18 @@
72367388 outRec.width = outRec.height = 6;
72377389 }
72387390
7239
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7391
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7392
+ )
72407393 {
72417394 Point pt = new Point(0, 0);
72427395 Rectangle rec = new Rectangle();
7243
- calcHotSpot(in, info, pt, rec);
7396
+ calcHotSpot(in, //clickInfo,
7397
+ pt, rec);
72447398 return rec;
72457399 }
72467400
7247
- void drawEditHandles0(ClickInfo info, int level)
7401
+ void drawEditHandles0(//ClickInfo clickInfo,
7402
+ int level)
72487403 {
72497404 if (level == 0)
72507405 {
....@@ -7253,16 +7408,19 @@
72537408 {
72547409 cVector origin = new cVector();
72557410 //LA.xformPos(origin, toParent, origin);
7256
- Rectangle spot = calcHotSpot(origin, info);
7411
+ if (this.clickInfo == null)
7412
+ this.clickInfo = new ClickInfo();
7413
+
7414
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
72577415 Rectangle boundary = new Rectangle();
72587416 boundary.x = spot.x - 30;
72597417 boundary.y = spot.y - 30;
72607418 boundary.width = spot.width + 60;
72617419 boundary.height = spot.height + 60;
7262
- info.g.setColor(Color.red);
7420
+ clickInfo.g.setColor(Color.white);
72637421 int spotw = spot.x + spot.width;
72647422 int spoth = spot.y + spot.height;
7265
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7423
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72667424 // if (CameraPane.Xmin > spot.x)
72677425 // {
72687426 // CameraPane.Xmin = spot.x;
....@@ -7279,11 +7437,6 @@
72797437 // {
72807438 // CameraPane.Ymax = spoth;
72817439 // }
7282
- spot.translate(32, 32);
7283
- spotw = spot.x + spot.width;
7284
- spoth = spot.y + spot.height;
7285
- info.g.setColor(Color.cyan);
7286
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72877440 // if (CameraPane.Xmin > spot.x)
72887441 // {
72897442 // CameraPane.Xmin = spot.x;
....@@ -7302,10 +7455,15 @@
73027455 // }
73037456 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73047457 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7305
- spot.translate(0, -32);
7306
- info.g.setColor(Color.yellow);
7307
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7308
- info.g.setColor(Color.green);
7458
+ spot.translate(32, 0);
7459
+ clickInfo.g.setColor(Color.yellow);
7460
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7461
+
7462
+ spot.translate(32, 64);
7463
+ spotw = spot.x + spot.width;
7464
+ spoth = spot.y + spot.height;
7465
+ clickInfo.g.setColor(Color.cyan);
7466
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73097467 // if (CameraPane.Xmin > spot.x)
73107468 // {
73117469 // CameraPane.Xmin = spot.x;
....@@ -7322,8 +7480,9 @@
73227480 // {
73237481 // CameraPane.Ymax = spoth;
73247482 // }
7325
- info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7326
- (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
7483
+ clickInfo.g.setColor(Color.green);
7484
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7485
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
73277486 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
73287487 // if (CameraPane.Xmin > boundary.x)
73297488 // {
....@@ -7345,7 +7504,8 @@
73457504 }
73467505 }
73477506
7348
- boolean doEditClick0(ClickInfo info, int level)
7507
+ boolean doEditClick0(//ClickInfo clickInfo,
7508
+ int level)
73497509 {
73507510 if (level == 0)
73517511 {
....@@ -7354,8 +7514,8 @@
73547514
73557515 boolean retval = false;
73567516
7357
- startX = info.x;
7358
- startY = info.y;
7517
+ startX = clickInfo.x;
7518
+ startY = clickInfo.y;
73597519
73607520 hitSomething = -1;
73617521 cVector origin = new cVector();
....@@ -7365,22 +7525,53 @@
73657525 {
73667526 centerPt = new Point(0, 0);
73677527 }
7368
- calcHotSpot(origin, info, centerPt, spot);
7369
- if (spot.contains(info.x, info.y))
7528
+ calcHotSpot(origin, //info,
7529
+ centerPt, spot);
7530
+ if (spot.contains(clickInfo.x, clickInfo.y))
73707531 {
73717532 hitSomething = hitCenter;
73727533 retval = true;
73737534 }
73747535 spot.translate(32, 0);
7375
- if (spot.contains(info.x, info.y))
7536
+ if (spot.contains(clickInfo.x, clickInfo.y))
73767537 {
73777538 hitSomething = hitRotate;
73787539 retval = true;
73797540 }
73807541 spot.translate(0, 32);
7381
- if (spot.contains(info.x, info.y))
7542
+ spot.translate(32, 0);
7543
+ spot.translate(0, 32);
7544
+ if (spot.contains(clickInfo.x, clickInfo.y))
73827545 {
73837546 hitSomething = hitScale;
7547
+
7548
+ double scale = 0.005f * clickInfo.camera.Distance();
7549
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
7550
+ double sign = 1;
7551
+ if (hScale < 0)
7552
+ {
7553
+ sign = -1;
7554
+ }
7555
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7556
+ if (hScale < 0.01)
7557
+ {
7558
+ //hScale = 0.01;
7559
+ }
7560
+
7561
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
7562
+ sign = 1;
7563
+ if (vScale < 0)
7564
+ {
7565
+ sign = -1;
7566
+ }
7567
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7568
+ if (vScale < 0.01)
7569
+ {
7570
+ //vScale = 0.01;
7571
+ }
7572
+
7573
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7574
+
73847575 retval = true;
73857576 }
73867577
....@@ -7390,7 +7581,7 @@
73907581 }
73917582
73927583 //System.out.println("info.modifiers = " + info.modifiers);
7393
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7584
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73947585 //System.out.println("modified = " + modified);
73957586 //new Exception().printStackTrace();
73967587 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7418,7 +7609,8 @@
74187609 return true;
74197610 }
74207611
7421
- void doEditDrag0(ClickInfo info, boolean opposite)
7612
+ void doEditDrag0(//ClickInfo info,
7613
+ boolean opposite)
74227614 {
74237615 if (hitSomething == 0)
74247616 {
....@@ -7432,7 +7624,7 @@
74327624
74337625 //System.out.println("hitSomething = " + hitSomething);
74347626
7435
- double scale = 0.005f * info.camera.Distance();
7627
+ double scale = 0.005f * clickInfo.camera.Distance();
74367628
74377629 cVector xlate = new cVector();
74387630 //cVector xlate2 = new cVector();
....@@ -7466,8 +7658,8 @@
74667658 toParent[3][i] = xlate.get(i);
74677659 LA.matInvert(toParent, fromParent);
74687660 */
7469
- cVector delta = LA.newVector(0, 0, startY - info.y);
7470
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7661
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7662
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74717663
74727664 LA.matCopy(startMat, toParent);
74737665 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7476,7 +7668,7 @@
74767668 } else
74777669 {
74787670 //LA.xformDir(delta, info.camera.fromScreen, delta);
7479
- cVector up = new cVector(info.camera.up);
7671
+ cVector up = new cVector(clickInfo.camera.up);
74807672 cVector away = new cVector();
74817673 //cVector right2 = new cVector();
74827674 //LA.vecCross(up, cVector.Z, right);
....@@ -7493,19 +7685,19 @@
74937685 LA.xformDir(up, ClickInfo.matbuffer, up);
74947686 // if (!CameraPane.LOCALTRANSFORM)
74957687 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7496
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7688
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74977689 // if (!CameraPane.LOCALTRANSFORM)
74987690 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74997691 //LA.vecCross(up, cVector.Z, right2);
75007692
7501
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7693
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75027694
75037695 //System.out.println("DELTA0 = " + delta);
75047696 //System.out.println("AWAY = " + info.camera.away);
75057697 //System.out.println("UP = " + info.camera.up);
75067698 if (away.z > 0)
75077699 {
7508
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7700
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75097701 {
75107702 delta.x = -delta.x;
75117703 } else
....@@ -7520,7 +7712,7 @@
75207712 //System.out.println("DELTA1 = " + delta);
75217713 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75227714 //System.out.println("DELTA2 = " + delta);
7523
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7715
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75247716 LA.matCopy(startMat, toParent);
75257717 //System.out.println("DELTA3 = " + delta);
75267718 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7530,8 +7722,8 @@
75307722 break;
75317723
75327724 case hitRotate: // rotate
7533
- int dx = info.x - centerPt.x;
7534
- int dy = -(info.y - centerPt.y);
7725
+ int dx = clickInfo.x - centerPt.x;
7726
+ int dy = -(clickInfo.y - centerPt.y);
75357727 double angle = (double) Math.atan2(dx, dy);
75367728 angle = -(1.570796 - angle);
75377729
....@@ -7554,7 +7746,7 @@
75547746 }
75557747 /**/
75567748
7557
- switch (info.pane.RenderCamera().viewCode)
7749
+ switch (clickInfo.pane.RenderCamera().viewCode)
75587750 {
75597751 case 1: // '\001'
75607752 LA.matZRotate(toParent, angle);
....@@ -7581,7 +7773,7 @@
75817773 break;
75827774
75837775 case hitScale: // scale
7584
- double hScale = (double) (info.x - centerPt.x) / 32;
7776
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75857777 double sign = 1;
75867778 if (hScale < 0)
75877779 {
....@@ -7593,7 +7785,7 @@
75937785 //hScale = 0.01;
75947786 }
75957787
7596
- double vScale = (double) (info.y - centerPt.y) / 32;
7788
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75977789 sign = 1;
75987790 if (vScale < 0)
75997791 {
....@@ -7604,6 +7796,7 @@
76047796 {
76057797 //vScale = 0.01;
76067798 }
7799
+
76077800 LA.matCopy(startMat, toParent);
76087801 /**/
76097802 for (int i = 0; i < 3; i++)
....@@ -7613,33 +7806,39 @@
76137806 }
76147807 /**/
76157808
7616
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7809
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76177810
76187811 if (totalScale < 0.01)
76197812 {
76207813 totalScale = 0.01;
76217814 }
76227815
7623
- switch (info.pane.RenderCamera().viewCode)
7816
+ switch (clickInfo.pane.RenderCamera().viewCode)
76247817 {
76257818 case 3: // '\001'
76267819 if (modified || opposite)
76277820 {
7821
+ if (modified && opposite)
7822
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7823
+ else
76287824 //LA.matScale(toParent, 1, hScale, vScale);
7629
- LA.matScale(toParent, totalScale, 1, 1);
7825
+ LA.matScale(toParent, totalScale, 1, 1);
76307826 } // vScale, 1);
76317827 else
76327828 {
76337829 // EXCEPTION!
7634
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7830
+ LA.matScale(toParent, 1, totalScale, totalScale);
76357831 } // vScale, 1);
76367832 break;
76377833
76387834 case 2: // '\002'
76397835 if (modified || opposite)
76407836 {
7641
- //LA.matScale(toParent, hScale, 1, vScale);
7642
- LA.matScale(toParent, 1, totalScale, 1);
7837
+ if (modified && opposite)
7838
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7839
+ else
7840
+ //LA.matScale(toParent, hScale, 1, vScale);
7841
+ LA.matScale(toParent, 1, totalScale, 1);
76437842 } else
76447843 {
76457844 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7649,8 +7848,11 @@
76497848 case 1: // '\003'
76507849 if (modified || opposite)
76517850 {
7652
- //LA.matScale(toParent, hScale, vScale, 1);
7653
- LA.matScale(toParent, 1, 1, totalScale);
7851
+ if (modified && opposite)
7852
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7853
+ else
7854
+ //LA.matScale(toParent, hScale, vScale, 1);
7855
+ LA.matScale(toParent, 1, 1, totalScale);
76547856 } else
76557857 {
76567858 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7687,7 +7889,7 @@
76877889 } // NEW ...
76887890
76897891
7690
- info.pane.repaint();
7892
+ clickInfo.pane.repaint();
76917893 }
76927894
76937895 boolean overflow = false;