Normand Briere
2019-08-17 5892f05411c3d4dce2d8a59e0966dc2e1843a971
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,6 +225,8 @@
219225 // o.bRep.support = null;
220226 // }
221227 o.selection = this.selection;
228
+ o.versionlist = this.versionlist;
229
+ o.versionindex = this.versionindex;
222230
223231 if (this.support != null)
224232 {
....@@ -240,6 +248,29 @@
240248 // this.support = null;
241249 // this.fileparent = null;
242250 }
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
+// }
243274
244275 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
245276 {
....@@ -274,6 +305,9 @@
274305 }
275306
276307 this.selection = o.selection;
308
+
309
+ this.versionlist = o.versionlist;
310
+ this.versionindex = o.versionindex;
277311 // July 2019 if (this.bRep != null)
278312 // this.bRep.support = o.transientrep;
279313 // this.support = o.support;
....@@ -421,6 +455,7 @@
421455 }
422456
423457 boolean live = false;
458
+ transient boolean keepdontselect;
424459 boolean dontselect = false;
425460 boolean hide = false;
426461 boolean link2master = false; // performs reset support/master at each frame
....@@ -1005,6 +1040,9 @@
10051040
10061041 if (material == null || material.multiply)
10071042 return true;
1043
+
1044
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1045
+ return false;
10081046
10091047 // Transparent objects are dynamic because we have to sort the triangles.
10101048 return material.opacity > 0.99;
....@@ -2432,6 +2470,11 @@
24322470 else
24332471 {
24342472 //((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");
24352478 }
24362479 }
24372480
....@@ -2561,7 +2604,8 @@
25612604 private static final int editSelf = 1;
25622605 private static final int editChild = 2;
25632606
2564
- void drawEditHandles(ClickInfo info, int level)
2607
+ void drawEditHandles(//ClickInfo info,
2608
+ int level)
25652609 {
25662610 if (level == 0)
25672611 {
....@@ -2569,7 +2613,8 @@
25692613 return;
25702614
25712615 Object3D selectee;
2572
- 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))
25732618 {
25742619 selectee = (Object3D) e.nextElement();
25752620 }
....@@ -2577,19 +2622,22 @@
25772622 } else
25782623 {
25792624 //super.
2580
- drawEditHandles0(info, level + 1);
2625
+ drawEditHandles0(//info,
2626
+ level + 1);
25812627 }
25822628 }
25832629
2584
- boolean doEditClick(ClickInfo info, int level)
2630
+ boolean doEditClick(//ClickInfo info,
2631
+ int level)
25852632 {
25862633 doSomething = 0;
25872634 if (level == 0)
25882635 {
2589
- return doParentClick(info);
2636
+ return doParentClick(); //info);
25902637 }
25912638 if (//super.
2592
- doEditClick0(info, level))
2639
+ doEditClick0(//info,
2640
+ level))
25932641 {
25942642 doSomething = 1;
25952643 return true;
....@@ -2599,7 +2647,7 @@
25992647 }
26002648 }
26012649
2602
- boolean doParentClick(ClickInfo info)
2650
+ boolean doParentClick() //ClickInfo info)
26032651 {
26042652 if (selection == null)
26052653 {
....@@ -2612,7 +2660,8 @@
26122660 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
26132661 {
26142662 Object3D selectee = (Object3D) e.nextElement();
2615
- if (selectee.doEditClick(info, 1))
2663
+ if (selectee.doEditClick(//info,
2664
+ 1))
26162665 {
26172666 childToDrag = selectee;
26182667 doSomething = 2;
....@@ -2624,13 +2673,15 @@
26242673 return retval;
26252674 }
26262675
2627
- void doEditDrag(ClickInfo info, boolean opposite)
2676
+ void doEditDrag(//ClickInfo clickInfo,
2677
+ boolean opposite)
26282678 {
26292679 switch (doSomething)
26302680 {
26312681 case 1: // '\001'
26322682 //super.
2633
- doEditDrag0(info, opposite);
2683
+ doEditDrag0(//clickInfo,
2684
+ opposite);
26342685 break;
26352686
26362687 case 2: // '\002'
....@@ -2643,11 +2694,13 @@
26432694 {
26442695 //sel.hitSomething = childToDrag.hitSomething;
26452696 //childToDrag.doEditDrag(info);
2646
- sel.doEditDrag(info, opposite);
2697
+ sel.doEditDrag(//clickInfo,
2698
+ opposite);
26472699 } else
26482700 {
26492701 //super.
2650
- doEditDrag0(info, opposite);
2702
+ doEditDrag0(//clickInfo,
2703
+ opposite);
26512704 }
26522705 }
26532706 break;
....@@ -2665,6 +2718,9 @@
26652718 {
26662719 deselectAll();
26672720 }
2721
+
2722
+ new Exception().printStackTrace();
2723
+
26682724 ClickInfo newInfo = new ClickInfo();
26692725 newInfo.flags = info.flags;
26702726 newInfo.bounds = info.bounds;
....@@ -3112,7 +3168,7 @@
31123168 {
31133169 if (bRep != null)
31143170 {
3115
- bRep.GenerateNormalsMINE();
3171
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
31163172 Touch();
31173173 }
31183174 }
....@@ -5415,6 +5471,51 @@
54155471 blockloop = false;
54165472 }
54175473
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
+
54185519 boolean IsSelected()
54195520 {
54205521 if (parent == null)
....@@ -5475,6 +5576,11 @@
54755576 if (fullname == null)
54765577 return "";
54775578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
54785584 // System.out.println("Fullname = " + fullname);
54795585
54805586 // Does not work on Windows due to C:
....@@ -5487,7 +5593,7 @@
54875593
54885594 if (split.length == 0)
54895595 {
5490
- return "";
5596
+ return fullname.pigment = "";
54915597 }
54925598
54935599 if (split.length <= 2)
....@@ -5495,22 +5601,27 @@
54955601 if (fullname.name.endsWith(":"))
54965602 {
54975603 // Windows
5498
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
54995605 }
55005606
5501
- return split[0];
5607
+ return fullname.pigment = split[0];
55025608 }
55035609
55045610 // Windows
55055611 assert(split.length == 4);
55065612
5507
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
55085614 }
55095615
55105616 static String GetBump(cTexture fullname)
55115617 {
55125618 if (fullname == null)
55135619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
55145625
55155626 // System.out.println("Fullname = " + fullname);
55165627 // Does not work on Windows due to C:
....@@ -5522,12 +5633,12 @@
55225633
55235634 if (split.length == 0)
55245635 {
5525
- return "";
5636
+ return fullname.bump = "";
55265637 }
55275638
55285639 if (split.length == 1)
55295640 {
5530
- return "";
5641
+ return fullname.bump = "";
55315642 }
55325643
55335644 if (split.length == 2)
....@@ -5535,16 +5646,16 @@
55355646 if (fullname.name.endsWith(":"))
55365647 {
55375648 // Windows
5538
- return "";
5649
+ return fullname.bump = "";
55395650 }
55405651
5541
- return split[1];
5652
+ return fullname.bump = split[1];
55425653 }
55435654
55445655 // Windows
55455656 assert(split.length == 4);
55465657
5547
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
55485659 }
55495660
55505661 String GetPigmentTexture()
....@@ -5627,6 +5738,9 @@
56275738 texname = "";
56285739
56295740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
56305744 Touch();
56315745 }
56325746
....@@ -5700,6 +5814,8 @@
57005814
57015815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
57025816
5817
+ GetTextures().bump = null;
5818
+
57035819 Touch();
57045820 }
57055821
....@@ -5720,6 +5836,38 @@
57205836
57215837 blockloop = true;
57225838 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);
57235871 blockloop = false;
57245872 }
57255873 }
....@@ -5810,8 +5958,10 @@
58105958 if (support != null)
58115959 support = support;
58125960
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);
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.
58155965
58165966 if (!usecalllists && bRep != null && bRep.displaylist > 0)
58175967 {
....@@ -5821,8 +5971,9 @@
58215971 // usecalllists &= !(parent instanceof RandomNode);
58225972 // usecalllists = false;
58235973
5824
- if (GetBRep() != null)
5825
- usecalllists = usecalllists;
5974
+ if (display.DrawMode() == display.SHADOW)
5975
+ //GetBRep() != null)
5976
+ usecalllists = !!usecalllists;
58265977 //System.out.println("draw " + this);
58275978 //new Exception().printStackTrace();
58285979
....@@ -5844,7 +5995,7 @@
58445995 if (!(this instanceof Composite))
58455996 touched = false;
58465997 //if (displaylist == -1 && usecalllists)
5847
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5998
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58485999 {
58496000 bRep.displaylist = display.GenList();
58506001 assert(bRep.displaylist != 0);
....@@ -5855,7 +6006,7 @@
58556006
58566007 //System.out.println("\tnew list " + list);
58576008 //gl.glDrawBuffer(gl.GL_NONE);
5858
- if (usecalllists)
6009
+ if (usecalllists && bRep.displaylist > 0)
58596010 {
58606011 // System.err.println("new list " + bRep.displaylist + " for " + this);
58616012 display.NewList(bRep.displaylist);
....@@ -5864,7 +6015,7 @@
58646015 CallList(display, root, selected, blocked);
58656016
58666017 // compiled = true;
5867
- if (usecalllists)
6018
+ if (usecalllists && bRep.displaylist > 0)
58686019 {
58696020 // System.err.println("end list " + bRep.displaylist + " for " + this);
58706021 display.EndList();
....@@ -7215,20 +7366,23 @@
72157366 }
72167367 }
72177368
7218
- 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)
72197373 {
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;
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;
72237377 if (toscreen == null)
72247378 {
7225
- toscreen = new Camera(info.camera.viewCode).toScreen;
7379
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
72267380 }
72277381 cVector vec = in;
72287382 LA.xformPos(in, toscreen, in);
72297383 //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();
7384
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7385
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
72327386 outPt.x = hc + (int) vec.x;
72337387 outPt.y = vc - (int) vec.y;
72347388 outRec.x = outPt.x - 3;
....@@ -7236,15 +7390,18 @@
72367390 outRec.width = outRec.height = 6;
72377391 }
72387392
7239
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7393
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7394
+ )
72407395 {
72417396 Point pt = new Point(0, 0);
72427397 Rectangle rec = new Rectangle();
7243
- calcHotSpot(in, info, pt, rec);
7398
+ calcHotSpot(in, //clickInfo,
7399
+ pt, rec);
72447400 return rec;
72457401 }
72467402
7247
- void drawEditHandles0(ClickInfo info, int level)
7403
+ void drawEditHandles0(//ClickInfo clickInfo,
7404
+ int level)
72487405 {
72497406 if (level == 0)
72507407 {
....@@ -7253,16 +7410,19 @@
72537410 {
72547411 cVector origin = new cVector();
72557412 //LA.xformPos(origin, toParent, origin);
7256
- Rectangle spot = calcHotSpot(origin, info);
7413
+ if (this.clickInfo == null)
7414
+ this.clickInfo = new ClickInfo();
7415
+
7416
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
72577417 Rectangle boundary = new Rectangle();
72587418 boundary.x = spot.x - 30;
72597419 boundary.y = spot.y - 30;
72607420 boundary.width = spot.width + 60;
72617421 boundary.height = spot.height + 60;
7262
- info.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
72637423 int spotw = spot.x + spot.width;
72647424 int spoth = spot.y + spot.height;
7265
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7425
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72667426 // if (CameraPane.Xmin > spot.x)
72677427 // {
72687428 // CameraPane.Xmin = spot.x;
....@@ -7279,11 +7439,6 @@
72797439 // {
72807440 // CameraPane.Ymax = spoth;
72817441 // }
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);
72877442 // if (CameraPane.Xmin > spot.x)
72887443 // {
72897444 // CameraPane.Xmin = spot.x;
....@@ -7302,10 +7457,15 @@
73027457 // }
73037458 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
73047459 //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);
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);
73097469 // if (CameraPane.Xmin > spot.x)
73107470 // {
73117471 // CameraPane.Xmin = spot.x;
....@@ -7322,8 +7482,9 @@
73227482 // {
73237483 // CameraPane.Ymax = spoth;
73247484 // }
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);
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);
73277488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
73287489 // if (CameraPane.Xmin > boundary.x)
73297490 // {
....@@ -7345,7 +7506,8 @@
73457506 }
73467507 }
73477508
7348
- boolean doEditClick0(ClickInfo info, int level)
7509
+ boolean doEditClick0(//ClickInfo clickInfo,
7510
+ int level)
73497511 {
73507512 if (level == 0)
73517513 {
....@@ -7354,8 +7516,8 @@
73547516
73557517 boolean retval = false;
73567518
7357
- startX = info.x;
7358
- startY = info.y;
7519
+ startX = clickInfo.x;
7520
+ startY = clickInfo.y;
73597521
73607522 hitSomething = -1;
73617523 cVector origin = new cVector();
....@@ -7365,22 +7527,53 @@
73657527 {
73667528 centerPt = new Point(0, 0);
73677529 }
7368
- calcHotSpot(origin, info, centerPt, spot);
7369
- if (spot.contains(info.x, info.y))
7530
+ calcHotSpot(origin, //info,
7531
+ centerPt, spot);
7532
+ if (spot.contains(clickInfo.x, clickInfo.y))
73707533 {
73717534 hitSomething = hitCenter;
73727535 retval = true;
73737536 }
73747537 spot.translate(32, 0);
7375
- if (spot.contains(info.x, info.y))
7538
+ if (spot.contains(clickInfo.x, clickInfo.y))
73767539 {
73777540 hitSomething = hitRotate;
73787541 retval = true;
73797542 }
73807543 spot.translate(0, 32);
7381
- 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))
73827547 {
73837548 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
+
73847577 retval = true;
73857578 }
73867579
....@@ -7390,7 +7583,7 @@
73907583 }
73917584
73927585 //System.out.println("info.modifiers = " + info.modifiers);
7393
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7586
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73947587 //System.out.println("modified = " + modified);
73957588 //new Exception().printStackTrace();
73967589 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7418,7 +7611,8 @@
74187611 return true;
74197612 }
74207613
7421
- void doEditDrag0(ClickInfo info, boolean opposite)
7614
+ void doEditDrag0(//ClickInfo info,
7615
+ boolean opposite)
74227616 {
74237617 if (hitSomething == 0)
74247618 {
....@@ -7432,7 +7626,7 @@
74327626
74337627 //System.out.println("hitSomething = " + hitSomething);
74347628
7435
- double scale = 0.005f * info.camera.Distance();
7629
+ double scale = 0.005f * clickInfo.camera.Distance();
74367630
74377631 cVector xlate = new cVector();
74387632 //cVector xlate2 = new cVector();
....@@ -7466,8 +7660,8 @@
74667660 toParent[3][i] = xlate.get(i);
74677661 LA.matInvert(toParent, fromParent);
74687662 */
7469
- cVector delta = LA.newVector(0, 0, startY - info.y);
7470
- 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);
74717665
74727666 LA.matCopy(startMat, toParent);
74737667 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7476,7 +7670,7 @@
74767670 } else
74777671 {
74787672 //LA.xformDir(delta, info.camera.fromScreen, delta);
7479
- cVector up = new cVector(info.camera.up);
7673
+ cVector up = new cVector(clickInfo.camera.up);
74807674 cVector away = new cVector();
74817675 //cVector right2 = new cVector();
74827676 //LA.vecCross(up, cVector.Z, right);
....@@ -7493,19 +7687,19 @@
74937687 LA.xformDir(up, ClickInfo.matbuffer, up);
74947688 // if (!CameraPane.LOCALTRANSFORM)
74957689 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7496
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7690
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74977691 // if (!CameraPane.LOCALTRANSFORM)
74987692 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74997693 //LA.vecCross(up, cVector.Z, right2);
75007694
7501
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7695
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
75027696
75037697 //System.out.println("DELTA0 = " + delta);
75047698 //System.out.println("AWAY = " + info.camera.away);
75057699 //System.out.println("UP = " + info.camera.up);
75067700 if (away.z > 0)
75077701 {
7508
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7702
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
75097703 {
75107704 delta.x = -delta.x;
75117705 } else
....@@ -7520,7 +7714,7 @@
75207714 //System.out.println("DELTA1 = " + delta);
75217715 LA.xformDir(delta, ClickInfo.matbuffer, delta);
75227716 //System.out.println("DELTA2 = " + delta);
7523
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7717
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
75247718 LA.matCopy(startMat, toParent);
75257719 //System.out.println("DELTA3 = " + delta);
75267720 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7530,8 +7724,8 @@
75307724 break;
75317725
75327726 case hitRotate: // rotate
7533
- int dx = info.x - centerPt.x;
7534
- int dy = -(info.y - centerPt.y);
7727
+ int dx = clickInfo.x - centerPt.x;
7728
+ int dy = -(clickInfo.y - centerPt.y);
75357729 double angle = (double) Math.atan2(dx, dy);
75367730 angle = -(1.570796 - angle);
75377731
....@@ -7554,7 +7748,7 @@
75547748 }
75557749 /**/
75567750
7557
- switch (info.pane.RenderCamera().viewCode)
7751
+ switch (clickInfo.pane.RenderCamera().viewCode)
75587752 {
75597753 case 1: // '\001'
75607754 LA.matZRotate(toParent, angle);
....@@ -7581,7 +7775,7 @@
75817775 break;
75827776
75837777 case hitScale: // scale
7584
- double hScale = (double) (info.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75857779 double sign = 1;
75867780 if (hScale < 0)
75877781 {
....@@ -7593,7 +7787,7 @@
75937787 //hScale = 0.01;
75947788 }
75957789
7596
- double vScale = (double) (info.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75977791 sign = 1;
75987792 if (vScale < 0)
75997793 {
....@@ -7604,6 +7798,7 @@
76047798 {
76057799 //vScale = 0.01;
76067800 }
7801
+
76077802 LA.matCopy(startMat, toParent);
76087803 /**/
76097804 for (int i = 0; i < 3; i++)
....@@ -7613,33 +7808,39 @@
76137808 }
76147809 /**/
76157810
7616
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7811
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
76177812
76187813 if (totalScale < 0.01)
76197814 {
76207815 totalScale = 0.01;
76217816 }
76227817
7623
- switch (info.pane.RenderCamera().viewCode)
7818
+ switch (clickInfo.pane.RenderCamera().viewCode)
76247819 {
76257820 case 3: // '\001'
76267821 if (modified || opposite)
76277822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
76287826 //LA.matScale(toParent, 1, hScale, vScale);
7629
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
76307828 } // vScale, 1);
76317829 else
76327830 {
76337831 // EXCEPTION!
7634
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
76357833 } // vScale, 1);
76367834 break;
76377835
76387836 case 2: // '\002'
76397837 if (modified || opposite)
76407838 {
7641
- //LA.matScale(toParent, hScale, 1, vScale);
7642
- 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);
76437844 } else
76447845 {
76457846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7649,8 +7850,11 @@
76497850 case 1: // '\003'
76507851 if (modified || opposite)
76517852 {
7652
- //LA.matScale(toParent, hScale, vScale, 1);
7653
- 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);
76547858 } else
76557859 {
76567860 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7687,7 +7891,7 @@
76877891 } // NEW ...
76887892
76897893
7690
- info.pane.repaint();
7894
+ clickInfo.pane.repaint();
76917895 }
76927896
76937897 boolean overflow = false;