Normand Briere
2019-08-17 ecc1309a04b527c62ffe97e814daf050dbd025cd
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[] = new byte[100][];
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)
....@@ -242,6 +248,29 @@
242248 // this.support = null;
243249 // this.fileparent = null;
244250 }
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
+// }
245274
246275 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
247276 {
....@@ -277,7 +306,7 @@
277306
278307 this.selection = o.selection;
279308
280
- this.versions = o.versions;
309
+ this.versionlist = o.versionlist;
281310 this.versionindex = o.versionindex;
282311 // July 2019 if (this.bRep != null)
283312 // this.bRep.support = o.transientrep;
....@@ -426,6 +455,7 @@
426455 }
427456
428457 boolean live = false;
458
+ transient boolean keepdontselect;
429459 boolean dontselect = false;
430460 boolean hide = false;
431461 boolean link2master = false; // performs reset support/master at each frame
....@@ -1010,6 +1040,9 @@
10101040
10111041 if (material == null || material.multiply)
10121042 return true;
1043
+
1044
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1045
+ return false;
10131046
10141047 // Transparent objects are dynamic because we have to sort the triangles.
10151048 return material.opacity > 0.99;
....@@ -2437,6 +2470,11 @@
24372470 else
24382471 {
24392472 //((ObjEditor)editWindow).SetupUI2(null);
2473
+ if (objectUI != null)
2474
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2475
+ else
2476
+ //new Exception().printStackTrace();
2477
+ System.err.println("objectUI is null");
24402478 }
24412479 }
24422480
....@@ -2566,7 +2604,8 @@
25662604 private static final int editSelf = 1;
25672605 private static final int editChild = 2;
25682606
2569
- void drawEditHandles(ClickInfo info, int level)
2607
+ void drawEditHandles(//ClickInfo info,
2608
+ int level)
25702609 {
25712610 if (level == 0)
25722611 {
....@@ -2574,7 +2613,8 @@
25742613 return;
25752614
25762615 Object3D selectee;
2577
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2616
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2617
+ level + 1))
25782618 {
25792619 selectee = (Object3D) e.nextElement();
25802620 }
....@@ -2582,19 +2622,22 @@
25822622 } else
25832623 {
25842624 //super.
2585
- drawEditHandles0(info, level + 1);
2625
+ drawEditHandles0(//info,
2626
+ level + 1);
25862627 }
25872628 }
25882629
2589
- boolean doEditClick(ClickInfo info, int level)
2630
+ boolean doEditClick(//ClickInfo info,
2631
+ int level)
25902632 {
25912633 doSomething = 0;
25922634 if (level == 0)
25932635 {
2594
- return doParentClick(info);
2636
+ return doParentClick(); //info);
25952637 }
25962638 if (//super.
2597
- doEditClick0(info, level))
2639
+ doEditClick0(//info,
2640
+ level))
25982641 {
25992642 doSomething = 1;
26002643 return true;
....@@ -2604,7 +2647,7 @@
26042647 }
26052648 }
26062649
2607
- boolean doParentClick(ClickInfo info)
2650
+ boolean doParentClick() //ClickInfo info)
26082651 {
26092652 if (selection == null)
26102653 {
....@@ -2617,7 +2660,8 @@
26172660 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
26182661 {
26192662 Object3D selectee = (Object3D) e.nextElement();
2620
- if (selectee.doEditClick(info, 1))
2663
+ if (selectee.doEditClick(//info,
2664
+ 1))
26212665 {
26222666 childToDrag = selectee;
26232667 doSomething = 2;
....@@ -2629,13 +2673,15 @@
26292673 return retval;
26302674 }
26312675
2632
- void doEditDrag(ClickInfo info, boolean opposite)
2676
+ void doEditDrag(//ClickInfo clickInfo,
2677
+ boolean opposite)
26332678 {
26342679 switch (doSomething)
26352680 {
26362681 case 1: // '\001'
26372682 //super.
2638
- doEditDrag0(info, opposite);
2683
+ doEditDrag0(//clickInfo,
2684
+ opposite);
26392685 break;
26402686
26412687 case 2: // '\002'
....@@ -2648,11 +2694,13 @@
26482694 {
26492695 //sel.hitSomething = childToDrag.hitSomething;
26502696 //childToDrag.doEditDrag(info);
2651
- sel.doEditDrag(info, opposite);
2697
+ sel.doEditDrag(//clickInfo,
2698
+ opposite);
26522699 } else
26532700 {
26542701 //super.
2655
- doEditDrag0(info, opposite);
2702
+ doEditDrag0(//clickInfo,
2703
+ opposite);
26562704 }
26572705 }
26582706 break;
....@@ -2670,6 +2718,9 @@
26702718 {
26712719 deselectAll();
26722720 }
2721
+
2722
+ new Exception().printStackTrace();
2723
+
26732724 ClickInfo newInfo = new ClickInfo();
26742725 newInfo.flags = info.flags;
26752726 newInfo.bounds = info.bounds;
....@@ -5420,6 +5471,51 @@
54205471 blockloop = false;
54215472 }
54225473
5474
+ void ResetSelectable()
5475
+ {
5476
+ if (blockloop)
5477
+ return;
5478
+
5479
+ blockloop = true;
5480
+
5481
+ keepdontselect = dontselect;
5482
+ dontselect = true;
5483
+
5484
+ Object3D child;
5485
+ int nb = Size();
5486
+ for (int i = 0; i < nb; i++)
5487
+ {
5488
+ child = (Object3D) get(i);
5489
+ if (child == null)
5490
+ continue;
5491
+ child.ResetSelectable();
5492
+ }
5493
+
5494
+ blockloop = false;
5495
+ }
5496
+
5497
+ void RestoreSelectable()
5498
+ {
5499
+ if (blockloop)
5500
+ return;
5501
+
5502
+ blockloop = true;
5503
+
5504
+ dontselect = keepdontselect;
5505
+
5506
+ Object3D child;
5507
+ int nb = Size();
5508
+ for (int i = 0; i < nb; i++)
5509
+ {
5510
+ child = (Object3D) get(i);
5511
+ if (child == null)
5512
+ continue;
5513
+ child.RestoreSelectable();
5514
+ }
5515
+
5516
+ blockloop = false;
5517
+ }
5518
+
54235519 boolean IsSelected()
54245520 {
54255521 if (parent == null)
....@@ -5480,6 +5576,11 @@
54805576 if (fullname == null)
54815577 return "";
54825578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
54835584 // System.out.println("Fullname = " + fullname);
54845585
54855586 // Does not work on Windows due to C:
....@@ -5492,7 +5593,7 @@
54925593
54935594 if (split.length == 0)
54945595 {
5495
- return "";
5596
+ return fullname.pigment = "";
54965597 }
54975598
54985599 if (split.length <= 2)
....@@ -5500,22 +5601,27 @@
55005601 if (fullname.name.endsWith(":"))
55015602 {
55025603 // Windows
5503
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55045605 }
55055606
5506
- return split[0];
5607
+ return fullname.pigment = split[0];
55075608 }
55085609
55095610 // Windows
55105611 assert(split.length == 4);
55115612
5512
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
55135614 }
55145615
55155616 static String GetBump(cTexture fullname)
55165617 {
55175618 if (fullname == null)
55185619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
55195625
55205626 // System.out.println("Fullname = " + fullname);
55215627 // Does not work on Windows due to C:
....@@ -5527,12 +5633,12 @@
55275633
55285634 if (split.length == 0)
55295635 {
5530
- return "";
5636
+ return fullname.bump = "";
55315637 }
55325638
55335639 if (split.length == 1)
55345640 {
5535
- return "";
5641
+ return fullname.bump = "";
55365642 }
55375643
55385644 if (split.length == 2)
....@@ -5540,16 +5646,16 @@
55405646 if (fullname.name.endsWith(":"))
55415647 {
55425648 // Windows
5543
- return "";
5649
+ return fullname.bump = "";
55445650 }
55455651
5546
- return split[1];
5652
+ return fullname.bump = split[1];
55475653 }
55485654
55495655 // Windows
55505656 assert(split.length == 4);
55515657
5552
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
55535659 }
55545660
55555661 String GetPigmentTexture()
....@@ -5632,6 +5738,9 @@
56325738 texname = "";
56335739
56345740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
56355744 Touch();
56365745 }
56375746
....@@ -5705,6 +5814,8 @@
57055814
57065815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
57075816
5817
+ GetTextures().bump = null;
5818
+
57085819 Touch();
57095820 }
57105821
....@@ -5725,6 +5836,38 @@
57255836
57265837 blockloop = true;
57275838 child.ResetBumpTexture();
5839
+ blockloop = false;
5840
+ }
5841
+ }
5842
+
5843
+ void EmbedTextures(boolean embed)
5844
+ {
5845
+ if (blockloop)
5846
+ return;
5847
+
5848
+ //if (GetTextures() != null)
5849
+ if (embed)
5850
+ CameraPane.EmbedTextures(GetTextures());
5851
+ else
5852
+ {
5853
+ GetTextures().pigmentdata = null;
5854
+ GetTextures().bumpdata = null;
5855
+ GetTextures().pw = 0;
5856
+ GetTextures().ph = 0;
5857
+ GetTextures().bw = 0;
5858
+ GetTextures().bh = 0;
5859
+ }
5860
+
5861
+ int nb = Size();
5862
+ for (int i = 0; i < nb; i++)
5863
+ {
5864
+ Object3D child = (Object3D) get(i);
5865
+
5866
+ if (child == null)
5867
+ continue;
5868
+
5869
+ blockloop = true;
5870
+ child.EmbedTextures(embed);
57285871 blockloop = false;
57295872 }
57305873 }
....@@ -5815,8 +5958,10 @@
58155958 if (support != null)
58165959 support = support;
58175960
5818
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5819
- boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5961
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5962
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5963
+
5964
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
58205965
58215966 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58225967 {
....@@ -5826,8 +5971,9 @@
58265971 // usecalllists &= !(parent instanceof RandomNode);
58275972 // usecalllists = false;
58285973
5829
- if (GetBRep() != null)
5830
- usecalllists = usecalllists;
5974
+ if (display.DrawMode() == display.SHADOW)
5975
+ //GetBRep() != null)
5976
+ usecalllists = !!usecalllists;
58315977 //System.out.println("draw " + this);
58325978 //new Exception().printStackTrace();
58335979
....@@ -5849,7 +5995,7 @@
58495995 if (!(this instanceof Composite))
58505996 touched = false;
58515997 //if (displaylist == -1 && usecalllists)
5852
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5998
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58535999 {
58546000 bRep.displaylist = display.GenList();
58556001 assert(bRep.displaylist != 0);
....@@ -5860,7 +6006,7 @@
58606006
58616007 //System.out.println("\tnew list " + list);
58626008 //gl.glDrawBuffer(gl.GL_NONE);
5863
- if (usecalllists)
6009
+ if (usecalllists && bRep.displaylist > 0)
58646010 {
58656011 // System.err.println("new list " + bRep.displaylist + " for " + this);
58666012 display.NewList(bRep.displaylist);
....@@ -5869,7 +6015,7 @@
58696015 CallList(display, root, selected, blocked);
58706016
58716017 // compiled = true;
5872
- if (usecalllists)
6018
+ if (usecalllists && bRep.displaylist > 0)
58736019 {
58746020 // System.err.println("end list " + bRep.displaylist + " for " + this);
58756021 display.EndList();
....@@ -7220,20 +7366,23 @@
72207366 }
72217367 }
72227368
7223
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7369
+ static ClickInfo clickInfo = new ClickInfo();
7370
+
7371
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7372
+ Point outPt, Rectangle outRec)
72247373 {
7225
- int hc = info.bounds.x + info.bounds.width / 2;
7226
- int vc = info.bounds.y + info.bounds.height / 2;
7227
- double[][] toscreen = info.toScreen;
7374
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7375
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7376
+ double[][] toscreen = clickInfo.toScreen;
72287377 if (toscreen == null)
72297378 {
7230
- toscreen = new Camera(info.camera.viewCode).toScreen;
7379
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72317380 }
72327381 cVector vec = in;
72337382 LA.xformPos(in, toscreen, in);
72347383 //System.out.println("Distance = " + info.camera.Distance());
7235
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7236
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7384
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7385
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
72377386 outPt.x = hc + (int) vec.x;
72387387 outPt.y = vc - (int) vec.y;
72397388 outRec.x = outPt.x - 3;
....@@ -7241,15 +7390,18 @@
72417390 outRec.width = outRec.height = 6;
72427391 }
72437392
7244
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7393
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7394
+ )
72457395 {
72467396 Point pt = new Point(0, 0);
72477397 Rectangle rec = new Rectangle();
7248
- calcHotSpot(in, info, pt, rec);
7398
+ calcHotSpot(in, //clickInfo,
7399
+ pt, rec);
72497400 return rec;
72507401 }
72517402
7252
- void drawEditHandles0(ClickInfo info, int level)
7403
+ void drawEditHandles0(//ClickInfo clickInfo,
7404
+ int level)
72537405 {
72547406 if (level == 0)
72557407 {
....@@ -7258,16 +7410,19 @@
72587410 {
72597411 cVector origin = new cVector();
72607412 //LA.xformPos(origin, toParent, origin);
7261
- Rectangle spot = calcHotSpot(origin, info);
7413
+ if (this.clickInfo == null)
7414
+ this.clickInfo = new ClickInfo();
7415
+
7416
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
72627417 Rectangle boundary = new Rectangle();
72637418 boundary.x = spot.x - 30;
72647419 boundary.y = spot.y - 30;
72657420 boundary.width = spot.width + 60;
72667421 boundary.height = spot.height + 60;
7267
- info.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
72687423 int spotw = spot.x + spot.width;
72697424 int spoth = spot.y + spot.height;
7270
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7425
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72717426 // if (CameraPane.Xmin > spot.x)
72727427 // {
72737428 // CameraPane.Xmin = spot.x;
....@@ -7284,11 +7439,6 @@
72847439 // {
72857440 // CameraPane.Ymax = spoth;
72867441 // }
7287
- spot.translate(32, 32);
7288
- spotw = spot.x + spot.width;
7289
- spoth = spot.y + spot.height;
7290
- info.g.setColor(Color.cyan);
7291
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72927442 // if (CameraPane.Xmin > spot.x)
72937443 // {
72947444 // CameraPane.Xmin = spot.x;
....@@ -7307,10 +7457,15 @@
73077457 // }
73087458 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73097459 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7310
- spot.translate(0, -32);
7311
- info.g.setColor(Color.yellow);
7312
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7313
- info.g.setColor(Color.green);
7460
+ spot.translate(32, 0);
7461
+ clickInfo.g.setColor(Color.yellow);
7462
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7463
+
7464
+ spot.translate(32, 64);
7465
+ spotw = spot.x + spot.width;
7466
+ spoth = spot.y + spot.height;
7467
+ clickInfo.g.setColor(Color.cyan);
7468
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
73147469 // if (CameraPane.Xmin > spot.x)
73157470 // {
73167471 // CameraPane.Xmin = spot.x;
....@@ -7327,8 +7482,9 @@
73277482 // {
73287483 // CameraPane.Ymax = spoth;
73297484 // }
7330
- info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7331
- (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
7485
+ clickInfo.g.setColor(Color.green);
7486
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7487
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
73327488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
73337489 // if (CameraPane.Xmin > boundary.x)
73347490 // {
....@@ -7350,7 +7506,8 @@
73507506 }
73517507 }
73527508
7353
- boolean doEditClick0(ClickInfo info, int level)
7509
+ boolean doEditClick0(//ClickInfo clickInfo,
7510
+ int level)
73547511 {
73557512 if (level == 0)
73567513 {
....@@ -7359,8 +7516,8 @@
73597516
73607517 boolean retval = false;
73617518
7362
- startX = info.x;
7363
- startY = info.y;
7519
+ startX = clickInfo.x;
7520
+ startY = clickInfo.y;
73647521
73657522 hitSomething = -1;
73667523 cVector origin = new cVector();
....@@ -7370,22 +7527,53 @@
73707527 {
73717528 centerPt = new Point(0, 0);
73727529 }
7373
- calcHotSpot(origin, info, centerPt, spot);
7374
- if (spot.contains(info.x, info.y))
7530
+ calcHotSpot(origin, //info,
7531
+ centerPt, spot);
7532
+ if (spot.contains(clickInfo.x, clickInfo.y))
73757533 {
73767534 hitSomething = hitCenter;
73777535 retval = true;
73787536 }
73797537 spot.translate(32, 0);
7380
- if (spot.contains(info.x, info.y))
7538
+ if (spot.contains(clickInfo.x, clickInfo.y))
73817539 {
73827540 hitSomething = hitRotate;
73837541 retval = true;
73847542 }
73857543 spot.translate(0, 32);
7386
- if (spot.contains(info.x, info.y))
7544
+ spot.translate(32, 0);
7545
+ spot.translate(0, 32);
7546
+ if (spot.contains(clickInfo.x, clickInfo.y))
73877547 {
73887548 hitSomething = hitScale;
7549
+
7550
+ double scale = 0.005f * clickInfo.camera.Distance();
7551
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
7552
+ double sign = 1;
7553
+ if (hScale < 0)
7554
+ {
7555
+ sign = -1;
7556
+ }
7557
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7558
+ if (hScale < 0.01)
7559
+ {
7560
+ //hScale = 0.01;
7561
+ }
7562
+
7563
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
7564
+ sign = 1;
7565
+ if (vScale < 0)
7566
+ {
7567
+ sign = -1;
7568
+ }
7569
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7570
+ if (vScale < 0.01)
7571
+ {
7572
+ //vScale = 0.01;
7573
+ }
7574
+
7575
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7576
+
73897577 retval = true;
73907578 }
73917579
....@@ -7395,7 +7583,7 @@
73957583 }
73967584
73977585 //System.out.println("info.modifiers = " + info.modifiers);
7398
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7586
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73997587 //System.out.println("modified = " + modified);
74007588 //new Exception().printStackTrace();
74017589 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7423,7 +7611,8 @@
74237611 return true;
74247612 }
74257613
7426
- void doEditDrag0(ClickInfo info, boolean opposite)
7614
+ void doEditDrag0(//ClickInfo info,
7615
+ boolean opposite)
74277616 {
74287617 if (hitSomething == 0)
74297618 {
....@@ -7437,7 +7626,7 @@
74377626
74387627 //System.out.println("hitSomething = " + hitSomething);
74397628
7440
- double scale = 0.005f * info.camera.Distance();
7629
+ double scale = 0.005f * clickInfo.camera.Distance();
74417630
74427631 cVector xlate = new cVector();
74437632 //cVector xlate2 = new cVector();
....@@ -7471,8 +7660,8 @@
74717660 toParent[3][i] = xlate.get(i);
74727661 LA.matInvert(toParent, fromParent);
74737662 */
7474
- cVector delta = LA.newVector(0, 0, startY - info.y);
7475
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7663
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7664
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74767665
74777666 LA.matCopy(startMat, toParent);
74787667 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7481,7 +7670,7 @@
74817670 } else
74827671 {
74837672 //LA.xformDir(delta, info.camera.fromScreen, delta);
7484
- cVector up = new cVector(info.camera.up);
7673
+ cVector up = new cVector(clickInfo.camera.up);
74857674 cVector away = new cVector();
74867675 //cVector right2 = new cVector();
74877676 //LA.vecCross(up, cVector.Z, right);
....@@ -7498,19 +7687,19 @@
74987687 LA.xformDir(up, ClickInfo.matbuffer, up);
74997688 // if (!CameraPane.LOCALTRANSFORM)
75007689 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7501
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7690
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
75027691 // if (!CameraPane.LOCALTRANSFORM)
75037692 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75047693 //LA.vecCross(up, cVector.Z, right2);
75057694
7506
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7695
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75077696
75087697 //System.out.println("DELTA0 = " + delta);
75097698 //System.out.println("AWAY = " + info.camera.away);
75107699 //System.out.println("UP = " + info.camera.up);
75117700 if (away.z > 0)
75127701 {
7513
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7702
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75147703 {
75157704 delta.x = -delta.x;
75167705 } else
....@@ -7525,7 +7714,7 @@
75257714 //System.out.println("DELTA1 = " + delta);
75267715 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75277716 //System.out.println("DELTA2 = " + delta);
7528
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7717
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75297718 LA.matCopy(startMat, toParent);
75307719 //System.out.println("DELTA3 = " + delta);
75317720 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7535,8 +7724,8 @@
75357724 break;
75367725
75377726 case hitRotate: // rotate
7538
- int dx = info.x - centerPt.x;
7539
- int dy = -(info.y - centerPt.y);
7727
+ int dx = clickInfo.x - centerPt.x;
7728
+ int dy = -(clickInfo.y - centerPt.y);
75407729 double angle = (double) Math.atan2(dx, dy);
75417730 angle = -(1.570796 - angle);
75427731
....@@ -7559,7 +7748,7 @@
75597748 }
75607749 /**/
75617750
7562
- switch (info.pane.RenderCamera().viewCode)
7751
+ switch (clickInfo.pane.RenderCamera().viewCode)
75637752 {
75647753 case 1: // '\001'
75657754 LA.matZRotate(toParent, angle);
....@@ -7586,7 +7775,7 @@
75867775 break;
75877776
75887777 case hitScale: // scale
7589
- double hScale = (double) (info.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75907779 double sign = 1;
75917780 if (hScale < 0)
75927781 {
....@@ -7598,7 +7787,7 @@
75987787 //hScale = 0.01;
75997788 }
76007789
7601
- double vScale = (double) (info.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
76027791 sign = 1;
76037792 if (vScale < 0)
76047793 {
....@@ -7609,6 +7798,7 @@
76097798 {
76107799 //vScale = 0.01;
76117800 }
7801
+
76127802 LA.matCopy(startMat, toParent);
76137803 /**/
76147804 for (int i = 0; i < 3; i++)
....@@ -7618,33 +7808,39 @@
76187808 }
76197809 /**/
76207810
7621
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7811
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76227812
76237813 if (totalScale < 0.01)
76247814 {
76257815 totalScale = 0.01;
76267816 }
76277817
7628
- switch (info.pane.RenderCamera().viewCode)
7818
+ switch (clickInfo.pane.RenderCamera().viewCode)
76297819 {
76307820 case 3: // '\001'
76317821 if (modified || opposite)
76327822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
76337826 //LA.matScale(toParent, 1, hScale, vScale);
7634
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
76357828 } // vScale, 1);
76367829 else
76377830 {
76387831 // EXCEPTION!
7639
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
76407833 } // vScale, 1);
76417834 break;
76427835
76437836 case 2: // '\002'
76447837 if (modified || opposite)
76457838 {
7646
- //LA.matScale(toParent, hScale, 1, vScale);
7647
- LA.matScale(toParent, 1, totalScale, 1);
7839
+ if (modified && opposite)
7840
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7841
+ else
7842
+ //LA.matScale(toParent, hScale, 1, vScale);
7843
+ LA.matScale(toParent, 1, totalScale, 1);
76487844 } else
76497845 {
76507846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7654,8 +7850,11 @@
76547850 case 1: // '\003'
76557851 if (modified || opposite)
76567852 {
7657
- //LA.matScale(toParent, hScale, vScale, 1);
7658
- LA.matScale(toParent, 1, 1, totalScale);
7853
+ if (modified && opposite)
7854
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7855
+ else
7856
+ //LA.matScale(toParent, hScale, vScale, 1);
7857
+ LA.matScale(toParent, 1, 1, totalScale);
76597858 } else
76607859 {
76617860 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7692,7 +7891,7 @@
76927891 } // NEW ...
76937892
76947893
7695
- info.pane.repaint();
7894
+ clickInfo.pane.repaint();
76967895 }
76977896
76987897 boolean overflow = false;