Normand Briere
2019-08-15 24a2a946b35279605e645349bd6b82e9e60aac88
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,6 +30,12 @@
2930 Object3D saveskeleton;
3031 //
3132
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
37
+ int versionindex = -1;
38
+
3239 ScriptNode scriptnode;
3340
3441 void InitOthers()
....@@ -215,6 +222,9 @@
215222 // o.transientrep = this.bRep.support;
216223 // o.bRep.support = null;
217224 // }
225
+ o.selection = this.selection;
226
+ o.versionlist = this.versionlist;
227
+ o.versionindex = this.versionindex;
218228
219229 if (this.support != null)
220230 {
....@@ -236,6 +246,29 @@
236246 // this.support = null;
237247 // this.fileparent = null;
238248 }
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
+// }
239272
240273 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
241274 {
....@@ -268,6 +301,11 @@
268301 {
269302 this.support.bRep = o.transientrep;
270303 }
304
+
305
+ this.selection = o.selection;
306
+
307
+ this.versionlist = o.versionlist;
308
+ this.versionindex = o.versionindex;
271309 // July 2019 if (this.bRep != null)
272310 // this.bRep.support = o.transientrep;
273311 // this.support = o.support;
....@@ -415,6 +453,7 @@
415453 }
416454
417455 boolean live = false;
456
+ transient boolean keepdontselect;
418457 boolean dontselect = false;
419458 boolean hide = false;
420459 boolean link2master = false; // performs reset support/master at each frame
....@@ -999,6 +1038,9 @@
9991038
10001039 if (material == null || material.multiply)
10011040 return true;
1041
+
1042
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1043
+ return false;
10021044
10031045 // Transparent objects are dynamic because we have to sort the triangles.
10041046 return material.opacity > 0.99;
....@@ -2426,6 +2468,11 @@
24262468 else
24272469 {
24282470 //((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");
24292476 }
24302477 }
24312478
....@@ -2555,7 +2602,8 @@
25552602 private static final int editSelf = 1;
25562603 private static final int editChild = 2;
25572604
2558
- void drawEditHandles(ClickInfo info, int level)
2605
+ void drawEditHandles(//ClickInfo info,
2606
+ int level)
25592607 {
25602608 if (level == 0)
25612609 {
....@@ -2563,7 +2611,8 @@
25632611 return;
25642612
25652613 Object3D selectee;
2566
- 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))
25672616 {
25682617 selectee = (Object3D) e.nextElement();
25692618 }
....@@ -2571,19 +2620,22 @@
25712620 } else
25722621 {
25732622 //super.
2574
- drawEditHandles0(info, level + 1);
2623
+ drawEditHandles0(//info,
2624
+ level + 1);
25752625 }
25762626 }
25772627
2578
- boolean doEditClick(ClickInfo info, int level)
2628
+ boolean doEditClick(//ClickInfo info,
2629
+ int level)
25792630 {
25802631 doSomething = 0;
25812632 if (level == 0)
25822633 {
2583
- return doParentClick(info);
2634
+ return doParentClick(); //info);
25842635 }
25852636 if (//super.
2586
- doEditClick0(info, level))
2637
+ doEditClick0(//info,
2638
+ level))
25872639 {
25882640 doSomething = 1;
25892641 return true;
....@@ -2593,7 +2645,7 @@
25932645 }
25942646 }
25952647
2596
- boolean doParentClick(ClickInfo info)
2648
+ boolean doParentClick() //ClickInfo info)
25972649 {
25982650 if (selection == null)
25992651 {
....@@ -2606,7 +2658,8 @@
26062658 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
26072659 {
26082660 Object3D selectee = (Object3D) e.nextElement();
2609
- if (selectee.doEditClick(info, 1))
2661
+ if (selectee.doEditClick(//info,
2662
+ 1))
26102663 {
26112664 childToDrag = selectee;
26122665 doSomething = 2;
....@@ -2618,13 +2671,15 @@
26182671 return retval;
26192672 }
26202673
2621
- void doEditDrag(ClickInfo info, boolean opposite)
2674
+ void doEditDrag(//ClickInfo clickInfo,
2675
+ boolean opposite)
26222676 {
26232677 switch (doSomething)
26242678 {
26252679 case 1: // '\001'
26262680 //super.
2627
- doEditDrag0(info, opposite);
2681
+ doEditDrag0(//clickInfo,
2682
+ opposite);
26282683 break;
26292684
26302685 case 2: // '\002'
....@@ -2637,11 +2692,13 @@
26372692 {
26382693 //sel.hitSomething = childToDrag.hitSomething;
26392694 //childToDrag.doEditDrag(info);
2640
- sel.doEditDrag(info, opposite);
2695
+ sel.doEditDrag(//clickInfo,
2696
+ opposite);
26412697 } else
26422698 {
26432699 //super.
2644
- doEditDrag0(info, opposite);
2700
+ doEditDrag0(//clickInfo,
2701
+ opposite);
26452702 }
26462703 }
26472704 break;
....@@ -2659,6 +2716,9 @@
26592716 {
26602717 deselectAll();
26612718 }
2719
+
2720
+ new Exception().printStackTrace();
2721
+
26622722 ClickInfo newInfo = new ClickInfo();
26632723 newInfo.flags = info.flags;
26642724 newInfo.bounds = info.bounds;
....@@ -3106,7 +3166,7 @@
31063166 {
31073167 if (bRep != null)
31083168 {
3109
- bRep.GenerateNormalsMINE();
3169
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
31103170 Touch();
31113171 }
31123172 }
....@@ -5409,6 +5469,51 @@
54095469 blockloop = false;
54105470 }
54115471
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
+
54125517 boolean IsSelected()
54135518 {
54145519 if (parent == null)
....@@ -5469,6 +5574,11 @@
54695574 if (fullname == null)
54705575 return "";
54715576
5577
+ if (fullname.pigment != null)
5578
+ {
5579
+ return fullname.pigment;
5580
+ }
5581
+
54725582 // System.out.println("Fullname = " + fullname);
54735583
54745584 // Does not work on Windows due to C:
....@@ -5481,7 +5591,7 @@
54815591
54825592 if (split.length == 0)
54835593 {
5484
- return "";
5594
+ return fullname.pigment = "";
54855595 }
54865596
54875597 if (split.length <= 2)
....@@ -5489,22 +5599,27 @@
54895599 if (fullname.name.endsWith(":"))
54905600 {
54915601 // Windows
5492
- return fullname.name.substring(0, fullname.name.length()-1);
5602
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
54935603 }
54945604
5495
- return split[0];
5605
+ return fullname.pigment = split[0];
54965606 }
54975607
54985608 // Windows
54995609 assert(split.length == 4);
55005610
5501
- return split[0] + ":" + split[1];
5611
+ return fullname.pigment = split[0] + ":" + split[1];
55025612 }
55035613
55045614 static String GetBump(cTexture fullname)
55055615 {
55065616 if (fullname == null)
55075617 return "";
5618
+
5619
+ if (fullname.bump != null)
5620
+ {
5621
+ return fullname.bump;
5622
+ }
55085623
55095624 // System.out.println("Fullname = " + fullname);
55105625 // Does not work on Windows due to C:
....@@ -5516,12 +5631,12 @@
55165631
55175632 if (split.length == 0)
55185633 {
5519
- return "";
5634
+ return fullname.bump = "";
55205635 }
55215636
55225637 if (split.length == 1)
55235638 {
5524
- return "";
5639
+ return fullname.bump = "";
55255640 }
55265641
55275642 if (split.length == 2)
....@@ -5529,16 +5644,16 @@
55295644 if (fullname.name.endsWith(":"))
55305645 {
55315646 // Windows
5532
- return "";
5647
+ return fullname.bump = "";
55335648 }
55345649
5535
- return split[1];
5650
+ return fullname.bump = split[1];
55365651 }
55375652
55385653 // Windows
55395654 assert(split.length == 4);
55405655
5541
- return split[2] + ":" + split[3];
5656
+ return fullname.bump = split[2] + ":" + split[3];
55425657 }
55435658
55445659 String GetPigmentTexture()
....@@ -5621,6 +5736,9 @@
56215736 texname = "";
56225737
56235738 GetTextures().name = texname + ":" + GetBump(GetTextures());
5739
+
5740
+ GetTextures().pigment = null;
5741
+
56245742 Touch();
56255743 }
56265744
....@@ -5694,6 +5812,8 @@
56945812
56955813 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
56965814
5815
+ GetTextures().bump = null;
5816
+
56975817 Touch();
56985818 }
56995819
....@@ -5714,6 +5834,38 @@
57145834
57155835 blockloop = true;
57165836 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);
57175869 blockloop = false;
57185870 }
57195871 }
....@@ -5804,8 +5956,10 @@
58045956 if (support != null)
58055957 support = support;
58065958
5807
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5808
- 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.
58095963
58105964 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58115965 {
....@@ -5815,8 +5969,9 @@
58155969 // usecalllists &= !(parent instanceof RandomNode);
58165970 // usecalllists = false;
58175971
5818
- if (GetBRep() != null)
5819
- usecalllists = usecalllists;
5972
+ if (display.DrawMode() == display.SHADOW)
5973
+ //GetBRep() != null)
5974
+ usecalllists = !!usecalllists;
58205975 //System.out.println("draw " + this);
58215976 //new Exception().printStackTrace();
58225977
....@@ -5838,7 +5993,7 @@
58385993 if (!(this instanceof Composite))
58395994 touched = false;
58405995 //if (displaylist == -1 && usecalllists)
5841
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5996
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58425997 {
58435998 bRep.displaylist = display.GenList();
58445999 assert(bRep.displaylist != 0);
....@@ -5849,7 +6004,7 @@
58496004
58506005 //System.out.println("\tnew list " + list);
58516006 //gl.glDrawBuffer(gl.GL_NONE);
5852
- if (usecalllists)
6007
+ if (usecalllists && bRep.displaylist > 0)
58536008 {
58546009 // System.err.println("new list " + bRep.displaylist + " for " + this);
58556010 display.NewList(bRep.displaylist);
....@@ -5858,7 +6013,7 @@
58586013 CallList(display, root, selected, blocked);
58596014
58606015 // compiled = true;
5861
- if (usecalllists)
6016
+ if (usecalllists && bRep.displaylist > 0)
58626017 {
58636018 // System.err.println("end list " + bRep.displaylist + " for " + this);
58646019 display.EndList();
....@@ -7209,20 +7364,23 @@
72097364 }
72107365 }
72117366
7212
- 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)
72137371 {
7214
- int hc = info.bounds.x + info.bounds.width / 2;
7215
- int vc = info.bounds.y + info.bounds.height / 2;
7216
- 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;
72177375 if (toscreen == null)
72187376 {
7219
- toscreen = new Camera(info.camera.viewCode).toScreen;
7377
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72207378 }
72217379 cVector vec = in;
72227380 LA.xformPos(in, toscreen, in);
72237381 //System.out.println("Distance = " + info.camera.Distance());
7224
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7225
- 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();
72267384 outPt.x = hc + (int) vec.x;
72277385 outPt.y = vc - (int) vec.y;
72287386 outRec.x = outPt.x - 3;
....@@ -7230,15 +7388,18 @@
72307388 outRec.width = outRec.height = 6;
72317389 }
72327390
7233
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7391
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7392
+ )
72347393 {
72357394 Point pt = new Point(0, 0);
72367395 Rectangle rec = new Rectangle();
7237
- calcHotSpot(in, info, pt, rec);
7396
+ calcHotSpot(in, //clickInfo,
7397
+ pt, rec);
72387398 return rec;
72397399 }
72407400
7241
- void drawEditHandles0(ClickInfo info, int level)
7401
+ void drawEditHandles0(//ClickInfo clickInfo,
7402
+ int level)
72427403 {
72437404 if (level == 0)
72447405 {
....@@ -7247,16 +7408,19 @@
72477408 {
72487409 cVector origin = new cVector();
72497410 //LA.xformPos(origin, toParent, origin);
7250
- Rectangle spot = calcHotSpot(origin, info);
7411
+ if (this.clickInfo == null)
7412
+ this.clickInfo = new ClickInfo();
7413
+
7414
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
72517415 Rectangle boundary = new Rectangle();
72527416 boundary.x = spot.x - 30;
72537417 boundary.y = spot.y - 30;
72547418 boundary.width = spot.width + 60;
72557419 boundary.height = spot.height + 60;
7256
- info.g.setColor(Color.red);
7420
+ clickInfo.g.setColor(Color.red);
72577421 int spotw = spot.x + spot.width;
72587422 int spoth = spot.y + spot.height;
7259
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7423
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72607424 // if (CameraPane.Xmin > spot.x)
72617425 // {
72627426 // CameraPane.Xmin = spot.x;
....@@ -7273,11 +7437,6 @@
72737437 // {
72747438 // CameraPane.Ymax = spoth;
72757439 // }
7276
- spot.translate(32, 32);
7277
- spotw = spot.x + spot.width;
7278
- spoth = spot.y + spot.height;
7279
- info.g.setColor(Color.cyan);
7280
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72817440 // if (CameraPane.Xmin > spot.x)
72827441 // {
72837442 // CameraPane.Xmin = spot.x;
....@@ -7296,10 +7455,15 @@
72967455 // }
72977456 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
72987457 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7299
- spot.translate(0, -32);
7300
- info.g.setColor(Color.yellow);
7301
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7302
- 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);
73037467 // if (CameraPane.Xmin > spot.x)
73047468 // {
73057469 // CameraPane.Xmin = spot.x;
....@@ -7316,8 +7480,9 @@
73167480 // {
73177481 // CameraPane.Ymax = spoth;
73187482 // }
7319
- info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7320
- (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);
73217486 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
73227487 // if (CameraPane.Xmin > boundary.x)
73237488 // {
....@@ -7339,7 +7504,8 @@
73397504 }
73407505 }
73417506
7342
- boolean doEditClick0(ClickInfo info, int level)
7507
+ boolean doEditClick0(//ClickInfo clickInfo,
7508
+ int level)
73437509 {
73447510 if (level == 0)
73457511 {
....@@ -7348,8 +7514,8 @@
73487514
73497515 boolean retval = false;
73507516
7351
- startX = info.x;
7352
- startY = info.y;
7517
+ startX = clickInfo.x;
7518
+ startY = clickInfo.y;
73537519
73547520 hitSomething = -1;
73557521 cVector origin = new cVector();
....@@ -7359,22 +7525,53 @@
73597525 {
73607526 centerPt = new Point(0, 0);
73617527 }
7362
- calcHotSpot(origin, info, centerPt, spot);
7363
- if (spot.contains(info.x, info.y))
7528
+ calcHotSpot(origin, //info,
7529
+ centerPt, spot);
7530
+ if (spot.contains(clickInfo.x, clickInfo.y))
73647531 {
73657532 hitSomething = hitCenter;
73667533 retval = true;
73677534 }
73687535 spot.translate(32, 0);
7369
- if (spot.contains(info.x, info.y))
7536
+ if (spot.contains(clickInfo.x, clickInfo.y))
73707537 {
73717538 hitSomething = hitRotate;
73727539 retval = true;
73737540 }
73747541 spot.translate(0, 32);
7375
- 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))
73767545 {
73777546 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
+
73787575 retval = true;
73797576 }
73807577
....@@ -7384,7 +7581,7 @@
73847581 }
73857582
73867583 //System.out.println("info.modifiers = " + info.modifiers);
7387
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7584
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73887585 //System.out.println("modified = " + modified);
73897586 //new Exception().printStackTrace();
73907587 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7412,7 +7609,8 @@
74127609 return true;
74137610 }
74147611
7415
- void doEditDrag0(ClickInfo info, boolean opposite)
7612
+ void doEditDrag0(//ClickInfo info,
7613
+ boolean opposite)
74167614 {
74177615 if (hitSomething == 0)
74187616 {
....@@ -7426,7 +7624,7 @@
74267624
74277625 //System.out.println("hitSomething = " + hitSomething);
74287626
7429
- double scale = 0.005f * info.camera.Distance();
7627
+ double scale = 0.005f * clickInfo.camera.Distance();
74307628
74317629 cVector xlate = new cVector();
74327630 //cVector xlate2 = new cVector();
....@@ -7460,8 +7658,8 @@
74607658 toParent[3][i] = xlate.get(i);
74617659 LA.matInvert(toParent, fromParent);
74627660 */
7463
- cVector delta = LA.newVector(0, 0, startY - info.y);
7464
- 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);
74657663
74667664 LA.matCopy(startMat, toParent);
74677665 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7470,7 +7668,7 @@
74707668 } else
74717669 {
74727670 //LA.xformDir(delta, info.camera.fromScreen, delta);
7473
- cVector up = new cVector(info.camera.up);
7671
+ cVector up = new cVector(clickInfo.camera.up);
74747672 cVector away = new cVector();
74757673 //cVector right2 = new cVector();
74767674 //LA.vecCross(up, cVector.Z, right);
....@@ -7487,19 +7685,19 @@
74877685 LA.xformDir(up, ClickInfo.matbuffer, up);
74887686 // if (!CameraPane.LOCALTRANSFORM)
74897687 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7490
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7688
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74917689 // if (!CameraPane.LOCALTRANSFORM)
74927690 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74937691 //LA.vecCross(up, cVector.Z, right2);
74947692
7495
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7693
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
74967694
74977695 //System.out.println("DELTA0 = " + delta);
74987696 //System.out.println("AWAY = " + info.camera.away);
74997697 //System.out.println("UP = " + info.camera.up);
75007698 if (away.z > 0)
75017699 {
7502
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7700
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75037701 {
75047702 delta.x = -delta.x;
75057703 } else
....@@ -7514,7 +7712,7 @@
75147712 //System.out.println("DELTA1 = " + delta);
75157713 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75167714 //System.out.println("DELTA2 = " + delta);
7517
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7715
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75187716 LA.matCopy(startMat, toParent);
75197717 //System.out.println("DELTA3 = " + delta);
75207718 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7524,8 +7722,8 @@
75247722 break;
75257723
75267724 case hitRotate: // rotate
7527
- int dx = info.x - centerPt.x;
7528
- int dy = -(info.y - centerPt.y);
7725
+ int dx = clickInfo.x - centerPt.x;
7726
+ int dy = -(clickInfo.y - centerPt.y);
75297727 double angle = (double) Math.atan2(dx, dy);
75307728 angle = -(1.570796 - angle);
75317729
....@@ -7548,7 +7746,7 @@
75487746 }
75497747 /**/
75507748
7551
- switch (info.pane.RenderCamera().viewCode)
7749
+ switch (clickInfo.pane.RenderCamera().viewCode)
75527750 {
75537751 case 1: // '\001'
75547752 LA.matZRotate(toParent, angle);
....@@ -7575,7 +7773,7 @@
75757773 break;
75767774
75777775 case hitScale: // scale
7578
- double hScale = (double) (info.x - centerPt.x) / 32;
7776
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75797777 double sign = 1;
75807778 if (hScale < 0)
75817779 {
....@@ -7587,7 +7785,7 @@
75877785 //hScale = 0.01;
75887786 }
75897787
7590
- double vScale = (double) (info.y - centerPt.y) / 32;
7788
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75917789 sign = 1;
75927790 if (vScale < 0)
75937791 {
....@@ -7598,6 +7796,7 @@
75987796 {
75997797 //vScale = 0.01;
76007798 }
7799
+
76017800 LA.matCopy(startMat, toParent);
76027801 /**/
76037802 for (int i = 0; i < 3; i++)
....@@ -7607,14 +7806,14 @@
76077806 }
76087807 /**/
76097808
7610
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7809
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76117810
76127811 if (totalScale < 0.01)
76137812 {
76147813 totalScale = 0.01;
76157814 }
76167815
7617
- switch (info.pane.RenderCamera().viewCode)
7816
+ switch (clickInfo.pane.RenderCamera().viewCode)
76187817 {
76197818 case 3: // '\001'
76207819 if (modified || opposite)
....@@ -7681,7 +7880,7 @@
76817880 } // NEW ...
76827881
76837882
7684
- info.pane.repaint();
7883
+ clickInfo.pane.repaint();
76857884 }
76867885
76877886 boolean overflow = false;