Normand Briere
2019-08-17 ecc1309a04b527c62ffe97e814daf050dbd025cd
Object3D.java
....@@ -22,12 +22,21 @@
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.
2829 mocap.reader.BVHReader.BVHResult savebvh;
2930 Object3D saveskeleton;
3031 //
32
+
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
37
+ int versionindex = -1;
38
+
39
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>();
3140
3241 ScriptNode scriptnode;
3342
....@@ -215,6 +224,9 @@
215224 // o.transientrep = this.bRep.support;
216225 // o.bRep.support = null;
217226 // }
227
+ o.selection = this.selection;
228
+ o.versionlist = this.versionlist;
229
+ o.versionindex = this.versionindex;
218230
219231 if (this.support != null)
220232 {
....@@ -236,6 +248,29 @@
236248 // this.support = null;
237249 // this.fileparent = null;
238250 }
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
+// }
239274
240275 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
241276 {
....@@ -268,6 +303,11 @@
268303 {
269304 this.support.bRep = o.transientrep;
270305 }
306
+
307
+ this.selection = o.selection;
308
+
309
+ this.versionlist = o.versionlist;
310
+ this.versionindex = o.versionindex;
271311 // July 2019 if (this.bRep != null)
272312 // this.bRep.support = o.transientrep;
273313 // this.support = o.support;
....@@ -415,6 +455,7 @@
415455 }
416456
417457 boolean live = false;
458
+ transient boolean keepdontselect;
418459 boolean dontselect = false;
419460 boolean hide = false;
420461 boolean link2master = false; // performs reset support/master at each frame
....@@ -999,6 +1040,9 @@
9991040
10001041 if (material == null || material.multiply)
10011042 return true;
1043
+
1044
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1045
+ return false;
10021046
10031047 // Transparent objects are dynamic because we have to sort the triangles.
10041048 return material.opacity > 0.99;
....@@ -2426,6 +2470,11 @@
24262470 else
24272471 {
24282472 //((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");
24292478 }
24302479 }
24312480
....@@ -2555,7 +2604,8 @@
25552604 private static final int editSelf = 1;
25562605 private static final int editChild = 2;
25572606
2558
- void drawEditHandles(ClickInfo info, int level)
2607
+ void drawEditHandles(//ClickInfo info,
2608
+ int level)
25592609 {
25602610 if (level == 0)
25612611 {
....@@ -2563,7 +2613,8 @@
25632613 return;
25642614
25652615 Object3D selectee;
2566
- 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))
25672618 {
25682619 selectee = (Object3D) e.nextElement();
25692620 }
....@@ -2571,19 +2622,22 @@
25712622 } else
25722623 {
25732624 //super.
2574
- drawEditHandles0(info, level + 1);
2625
+ drawEditHandles0(//info,
2626
+ level + 1);
25752627 }
25762628 }
25772629
2578
- boolean doEditClick(ClickInfo info, int level)
2630
+ boolean doEditClick(//ClickInfo info,
2631
+ int level)
25792632 {
25802633 doSomething = 0;
25812634 if (level == 0)
25822635 {
2583
- return doParentClick(info);
2636
+ return doParentClick(); //info);
25842637 }
25852638 if (//super.
2586
- doEditClick0(info, level))
2639
+ doEditClick0(//info,
2640
+ level))
25872641 {
25882642 doSomething = 1;
25892643 return true;
....@@ -2593,7 +2647,7 @@
25932647 }
25942648 }
25952649
2596
- boolean doParentClick(ClickInfo info)
2650
+ boolean doParentClick() //ClickInfo info)
25972651 {
25982652 if (selection == null)
25992653 {
....@@ -2606,7 +2660,8 @@
26062660 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
26072661 {
26082662 Object3D selectee = (Object3D) e.nextElement();
2609
- if (selectee.doEditClick(info, 1))
2663
+ if (selectee.doEditClick(//info,
2664
+ 1))
26102665 {
26112666 childToDrag = selectee;
26122667 doSomething = 2;
....@@ -2618,13 +2673,15 @@
26182673 return retval;
26192674 }
26202675
2621
- void doEditDrag(ClickInfo info, boolean opposite)
2676
+ void doEditDrag(//ClickInfo clickInfo,
2677
+ boolean opposite)
26222678 {
26232679 switch (doSomething)
26242680 {
26252681 case 1: // '\001'
26262682 //super.
2627
- doEditDrag0(info, opposite);
2683
+ doEditDrag0(//clickInfo,
2684
+ opposite);
26282685 break;
26292686
26302687 case 2: // '\002'
....@@ -2637,11 +2694,13 @@
26372694 {
26382695 //sel.hitSomething = childToDrag.hitSomething;
26392696 //childToDrag.doEditDrag(info);
2640
- sel.doEditDrag(info, opposite);
2697
+ sel.doEditDrag(//clickInfo,
2698
+ opposite);
26412699 } else
26422700 {
26432701 //super.
2644
- doEditDrag0(info, opposite);
2702
+ doEditDrag0(//clickInfo,
2703
+ opposite);
26452704 }
26462705 }
26472706 break;
....@@ -2659,6 +2718,9 @@
26592718 {
26602719 deselectAll();
26612720 }
2721
+
2722
+ new Exception().printStackTrace();
2723
+
26622724 ClickInfo newInfo = new ClickInfo();
26632725 newInfo.flags = info.flags;
26642726 newInfo.bounds = info.bounds;
....@@ -3106,7 +3168,7 @@
31063168 {
31073169 if (bRep != null)
31083170 {
3109
- bRep.GenerateNormalsMINE();
3171
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
31103172 Touch();
31113173 }
31123174 }
....@@ -5409,6 +5471,51 @@
54095471 blockloop = false;
54105472 }
54115473
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
+
54125519 boolean IsSelected()
54135520 {
54145521 if (parent == null)
....@@ -5469,6 +5576,11 @@
54695576 if (fullname == null)
54705577 return "";
54715578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
54725584 // System.out.println("Fullname = " + fullname);
54735585
54745586 // Does not work on Windows due to C:
....@@ -5481,7 +5593,7 @@
54815593
54825594 if (split.length == 0)
54835595 {
5484
- return "";
5596
+ return fullname.pigment = "";
54855597 }
54865598
54875599 if (split.length <= 2)
....@@ -5489,22 +5601,27 @@
54895601 if (fullname.name.endsWith(":"))
54905602 {
54915603 // Windows
5492
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
54935605 }
54945606
5495
- return split[0];
5607
+ return fullname.pigment = split[0];
54965608 }
54975609
54985610 // Windows
54995611 assert(split.length == 4);
55005612
5501
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
55025614 }
55035615
55045616 static String GetBump(cTexture fullname)
55055617 {
55065618 if (fullname == null)
55075619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
55085625
55095626 // System.out.println("Fullname = " + fullname);
55105627 // Does not work on Windows due to C:
....@@ -5516,12 +5633,12 @@
55165633
55175634 if (split.length == 0)
55185635 {
5519
- return "";
5636
+ return fullname.bump = "";
55205637 }
55215638
55225639 if (split.length == 1)
55235640 {
5524
- return "";
5641
+ return fullname.bump = "";
55255642 }
55265643
55275644 if (split.length == 2)
....@@ -5529,16 +5646,16 @@
55295646 if (fullname.name.endsWith(":"))
55305647 {
55315648 // Windows
5532
- return "";
5649
+ return fullname.bump = "";
55335650 }
55345651
5535
- return split[1];
5652
+ return fullname.bump = split[1];
55365653 }
55375654
55385655 // Windows
55395656 assert(split.length == 4);
55405657
5541
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
55425659 }
55435660
55445661 String GetPigmentTexture()
....@@ -5621,6 +5738,9 @@
56215738 texname = "";
56225739
56235740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
56245744 Touch();
56255745 }
56265746
....@@ -5694,6 +5814,8 @@
56945814
56955815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
56965816
5817
+ GetTextures().bump = null;
5818
+
56975819 Touch();
56985820 }
56995821
....@@ -5714,6 +5836,38 @@
57145836
57155837 blockloop = true;
57165838 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);
57175871 blockloop = false;
57185872 }
57195873 }
....@@ -5804,8 +5958,10 @@
58045958 if (support != null)
58055959 support = support;
58065960
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);
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.
58095965
58105966 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58115967 {
....@@ -5815,8 +5971,9 @@
58155971 // usecalllists &= !(parent instanceof RandomNode);
58165972 // usecalllists = false;
58175973
5818
- if (GetBRep() != null)
5819
- usecalllists = usecalllists;
5974
+ if (display.DrawMode() == display.SHADOW)
5975
+ //GetBRep() != null)
5976
+ usecalllists = !!usecalllists;
58205977 //System.out.println("draw " + this);
58215978 //new Exception().printStackTrace();
58225979
....@@ -5838,7 +5995,7 @@
58385995 if (!(this instanceof Composite))
58395996 touched = false;
58405997 //if (displaylist == -1 && usecalllists)
5841
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5998
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58425999 {
58436000 bRep.displaylist = display.GenList();
58446001 assert(bRep.displaylist != 0);
....@@ -5849,7 +6006,7 @@
58496006
58506007 //System.out.println("\tnew list " + list);
58516008 //gl.glDrawBuffer(gl.GL_NONE);
5852
- if (usecalllists)
6009
+ if (usecalllists && bRep.displaylist > 0)
58536010 {
58546011 // System.err.println("new list " + bRep.displaylist + " for " + this);
58556012 display.NewList(bRep.displaylist);
....@@ -5858,7 +6015,7 @@
58586015 CallList(display, root, selected, blocked);
58596016
58606017 // compiled = true;
5861
- if (usecalllists)
6018
+ if (usecalllists && bRep.displaylist > 0)
58626019 {
58636020 // System.err.println("end list " + bRep.displaylist + " for " + this);
58646021 display.EndList();
....@@ -7209,20 +7366,23 @@
72097366 }
72107367 }
72117368
7212
- 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)
72137373 {
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;
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;
72177377 if (toscreen == null)
72187378 {
7219
- toscreen = new Camera(info.camera.viewCode).toScreen;
7379
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72207380 }
72217381 cVector vec = in;
72227382 LA.xformPos(in, toscreen, in);
72237383 //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();
7384
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7385
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
72267386 outPt.x = hc + (int) vec.x;
72277387 outPt.y = vc - (int) vec.y;
72287388 outRec.x = outPt.x - 3;
....@@ -7230,15 +7390,18 @@
72307390 outRec.width = outRec.height = 6;
72317391 }
72327392
7233
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7393
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7394
+ )
72347395 {
72357396 Point pt = new Point(0, 0);
72367397 Rectangle rec = new Rectangle();
7237
- calcHotSpot(in, info, pt, rec);
7398
+ calcHotSpot(in, //clickInfo,
7399
+ pt, rec);
72387400 return rec;
72397401 }
72407402
7241
- void drawEditHandles0(ClickInfo info, int level)
7403
+ void drawEditHandles0(//ClickInfo clickInfo,
7404
+ int level)
72427405 {
72437406 if (level == 0)
72447407 {
....@@ -7247,16 +7410,19 @@
72477410 {
72487411 cVector origin = new cVector();
72497412 //LA.xformPos(origin, toParent, origin);
7250
- Rectangle spot = calcHotSpot(origin, info);
7413
+ if (this.clickInfo == null)
7414
+ this.clickInfo = new ClickInfo();
7415
+
7416
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
72517417 Rectangle boundary = new Rectangle();
72527418 boundary.x = spot.x - 30;
72537419 boundary.y = spot.y - 30;
72547420 boundary.width = spot.width + 60;
72557421 boundary.height = spot.height + 60;
7256
- info.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
72577423 int spotw = spot.x + spot.width;
72587424 int spoth = spot.y + spot.height;
7259
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7425
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72607426 // if (CameraPane.Xmin > spot.x)
72617427 // {
72627428 // CameraPane.Xmin = spot.x;
....@@ -7273,11 +7439,6 @@
72737439 // {
72747440 // CameraPane.Ymax = spoth;
72757441 // }
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);
72817442 // if (CameraPane.Xmin > spot.x)
72827443 // {
72837444 // CameraPane.Xmin = spot.x;
....@@ -7296,10 +7457,15 @@
72967457 // }
72977458 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
72987459 //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);
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);
73037469 // if (CameraPane.Xmin > spot.x)
73047470 // {
73057471 // CameraPane.Xmin = spot.x;
....@@ -7316,8 +7482,9 @@
73167482 // {
73177483 // CameraPane.Ymax = spoth;
73187484 // }
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);
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);
73217488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
73227489 // if (CameraPane.Xmin > boundary.x)
73237490 // {
....@@ -7339,7 +7506,8 @@
73397506 }
73407507 }
73417508
7342
- boolean doEditClick0(ClickInfo info, int level)
7509
+ boolean doEditClick0(//ClickInfo clickInfo,
7510
+ int level)
73437511 {
73447512 if (level == 0)
73457513 {
....@@ -7348,8 +7516,8 @@
73487516
73497517 boolean retval = false;
73507518
7351
- startX = info.x;
7352
- startY = info.y;
7519
+ startX = clickInfo.x;
7520
+ startY = clickInfo.y;
73537521
73547522 hitSomething = -1;
73557523 cVector origin = new cVector();
....@@ -7359,22 +7527,53 @@
73597527 {
73607528 centerPt = new Point(0, 0);
73617529 }
7362
- calcHotSpot(origin, info, centerPt, spot);
7363
- if (spot.contains(info.x, info.y))
7530
+ calcHotSpot(origin, //info,
7531
+ centerPt, spot);
7532
+ if (spot.contains(clickInfo.x, clickInfo.y))
73647533 {
73657534 hitSomething = hitCenter;
73667535 retval = true;
73677536 }
73687537 spot.translate(32, 0);
7369
- if (spot.contains(info.x, info.y))
7538
+ if (spot.contains(clickInfo.x, clickInfo.y))
73707539 {
73717540 hitSomething = hitRotate;
73727541 retval = true;
73737542 }
73747543 spot.translate(0, 32);
7375
- 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))
73767547 {
73777548 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
+
73787577 retval = true;
73797578 }
73807579
....@@ -7384,7 +7583,7 @@
73847583 }
73857584
73867585 //System.out.println("info.modifiers = " + info.modifiers);
7387
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7586
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73887587 //System.out.println("modified = " + modified);
73897588 //new Exception().printStackTrace();
73907589 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7412,7 +7611,8 @@
74127611 return true;
74137612 }
74147613
7415
- void doEditDrag0(ClickInfo info, boolean opposite)
7614
+ void doEditDrag0(//ClickInfo info,
7615
+ boolean opposite)
74167616 {
74177617 if (hitSomething == 0)
74187618 {
....@@ -7426,7 +7626,7 @@
74267626
74277627 //System.out.println("hitSomething = " + hitSomething);
74287628
7429
- double scale = 0.005f * info.camera.Distance();
7629
+ double scale = 0.005f * clickInfo.camera.Distance();
74307630
74317631 cVector xlate = new cVector();
74327632 //cVector xlate2 = new cVector();
....@@ -7460,8 +7660,8 @@
74607660 toParent[3][i] = xlate.get(i);
74617661 LA.matInvert(toParent, fromParent);
74627662 */
7463
- cVector delta = LA.newVector(0, 0, startY - info.y);
7464
- 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);
74657665
74667666 LA.matCopy(startMat, toParent);
74677667 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7470,7 +7670,7 @@
74707670 } else
74717671 {
74727672 //LA.xformDir(delta, info.camera.fromScreen, delta);
7473
- cVector up = new cVector(info.camera.up);
7673
+ cVector up = new cVector(clickInfo.camera.up);
74747674 cVector away = new cVector();
74757675 //cVector right2 = new cVector();
74767676 //LA.vecCross(up, cVector.Z, right);
....@@ -7487,19 +7687,19 @@
74877687 LA.xformDir(up, ClickInfo.matbuffer, up);
74887688 // if (!CameraPane.LOCALTRANSFORM)
74897689 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7490
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7690
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74917691 // if (!CameraPane.LOCALTRANSFORM)
74927692 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74937693 //LA.vecCross(up, cVector.Z, right2);
74947694
7495
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7695
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
74967696
74977697 //System.out.println("DELTA0 = " + delta);
74987698 //System.out.println("AWAY = " + info.camera.away);
74997699 //System.out.println("UP = " + info.camera.up);
75007700 if (away.z > 0)
75017701 {
7502
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7702
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75037703 {
75047704 delta.x = -delta.x;
75057705 } else
....@@ -7514,7 +7714,7 @@
75147714 //System.out.println("DELTA1 = " + delta);
75157715 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75167716 //System.out.println("DELTA2 = " + delta);
7517
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7717
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75187718 LA.matCopy(startMat, toParent);
75197719 //System.out.println("DELTA3 = " + delta);
75207720 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7524,8 +7724,8 @@
75247724 break;
75257725
75267726 case hitRotate: // rotate
7527
- int dx = info.x - centerPt.x;
7528
- int dy = -(info.y - centerPt.y);
7727
+ int dx = clickInfo.x - centerPt.x;
7728
+ int dy = -(clickInfo.y - centerPt.y);
75297729 double angle = (double) Math.atan2(dx, dy);
75307730 angle = -(1.570796 - angle);
75317731
....@@ -7548,7 +7748,7 @@
75487748 }
75497749 /**/
75507750
7551
- switch (info.pane.RenderCamera().viewCode)
7751
+ switch (clickInfo.pane.RenderCamera().viewCode)
75527752 {
75537753 case 1: // '\001'
75547754 LA.matZRotate(toParent, angle);
....@@ -7575,7 +7775,7 @@
75757775 break;
75767776
75777777 case hitScale: // scale
7578
- double hScale = (double) (info.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75797779 double sign = 1;
75807780 if (hScale < 0)
75817781 {
....@@ -7587,7 +7787,7 @@
75877787 //hScale = 0.01;
75887788 }
75897789
7590
- double vScale = (double) (info.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75917791 sign = 1;
75927792 if (vScale < 0)
75937793 {
....@@ -7598,6 +7798,7 @@
75987798 {
75997799 //vScale = 0.01;
76007800 }
7801
+
76017802 LA.matCopy(startMat, toParent);
76027803 /**/
76037804 for (int i = 0; i < 3; i++)
....@@ -7607,33 +7808,39 @@
76077808 }
76087809 /**/
76097810
7610
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7811
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76117812
76127813 if (totalScale < 0.01)
76137814 {
76147815 totalScale = 0.01;
76157816 }
76167817
7617
- switch (info.pane.RenderCamera().viewCode)
7818
+ switch (clickInfo.pane.RenderCamera().viewCode)
76187819 {
76197820 case 3: // '\001'
76207821 if (modified || opposite)
76217822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
76227826 //LA.matScale(toParent, 1, hScale, vScale);
7623
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
76247828 } // vScale, 1);
76257829 else
76267830 {
76277831 // EXCEPTION!
7628
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
76297833 } // vScale, 1);
76307834 break;
76317835
76327836 case 2: // '\002'
76337837 if (modified || opposite)
76347838 {
7635
- //LA.matScale(toParent, hScale, 1, vScale);
7636
- 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);
76377844 } else
76387845 {
76397846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7643,8 +7850,11 @@
76437850 case 1: // '\003'
76447851 if (modified || opposite)
76457852 {
7646
- //LA.matScale(toParent, hScale, vScale, 1);
7647
- 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);
76487858 } else
76497859 {
76507860 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7681,7 +7891,7 @@
76817891 } // NEW ...
76827892
76837893
7684
- info.pane.repaint();
7894
+ clickInfo.pane.repaint();
76857895 }
76867896
76877897 boolean overflow = false;