Normand Briere
2019-08-17 5892f05411c3d4dce2d8a59e0966dc2e1843a971
Object3D.java
....@@ -36,6 +36,8 @@
3636 Object3D versionlist[];
3737 int versionindex = -1;
3838
39
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>();
40
+
3941 ScriptNode scriptnode;
4042
4143 void InitOthers()
....@@ -5574,6 +5576,11 @@
55745576 if (fullname == null)
55755577 return "";
55765578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
55775584 // System.out.println("Fullname = " + fullname);
55785585
55795586 // Does not work on Windows due to C:
....@@ -5586,7 +5593,7 @@
55865593
55875594 if (split.length == 0)
55885595 {
5589
- return "";
5596
+ return fullname.pigment = "";
55905597 }
55915598
55925599 if (split.length <= 2)
....@@ -5594,22 +5601,27 @@
55945601 if (fullname.name.endsWith(":"))
55955602 {
55965603 // Windows
5597
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55985605 }
55995606
5600
- return split[0];
5607
+ return fullname.pigment = split[0];
56015608 }
56025609
56035610 // Windows
56045611 assert(split.length == 4);
56055612
5606
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
56075614 }
56085615
56095616 static String GetBump(cTexture fullname)
56105617 {
56115618 if (fullname == null)
56125619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
56135625
56145626 // System.out.println("Fullname = " + fullname);
56155627 // Does not work on Windows due to C:
....@@ -5621,12 +5633,12 @@
56215633
56225634 if (split.length == 0)
56235635 {
5624
- return "";
5636
+ return fullname.bump = "";
56255637 }
56265638
56275639 if (split.length == 1)
56285640 {
5629
- return "";
5641
+ return fullname.bump = "";
56305642 }
56315643
56325644 if (split.length == 2)
....@@ -5634,16 +5646,16 @@
56345646 if (fullname.name.endsWith(":"))
56355647 {
56365648 // Windows
5637
- return "";
5649
+ return fullname.bump = "";
56385650 }
56395651
5640
- return split[1];
5652
+ return fullname.bump = split[1];
56415653 }
56425654
56435655 // Windows
56445656 assert(split.length == 4);
56455657
5646
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
56475659 }
56485660
56495661 String GetPigmentTexture()
....@@ -5726,6 +5738,9 @@
57265738 texname = "";
57275739
57285740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
57295744 Touch();
57305745 }
57315746
....@@ -5798,6 +5813,8 @@
57985813 texname = "";
57995814
58005815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5816
+
5817
+ GetTextures().bump = null;
58015818
58025819 Touch();
58035820 }
....@@ -7402,7 +7419,7 @@
74027419 boundary.y = spot.y - 30;
74037420 boundary.width = spot.width + 60;
74047421 boundary.height = spot.height + 60;
7405
- clickInfo.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
74067423 int spotw = spot.x + spot.width;
74077424 int spoth = spot.y + spot.height;
74087425 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7422,7 +7439,29 @@
74227439 // {
74237440 // CameraPane.Ymax = spoth;
74247441 // }
7425
- spot.translate(32, 32);
7442
+// if (CameraPane.Xmin > spot.x)
7443
+// {
7444
+// CameraPane.Xmin = spot.x;
7445
+// }
7446
+// if (CameraPane.Xmax < spotw)
7447
+// {
7448
+// CameraPane.Xmax = spotw;
7449
+// }
7450
+// if (CameraPane.Ymin > spot.y)
7451
+// {
7452
+// CameraPane.Ymin = spot.y;
7453
+// }
7454
+// if (CameraPane.Ymax < spoth)
7455
+// {
7456
+// CameraPane.Ymax = spoth;
7457
+// }
7458
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7459
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
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);
74267465 spotw = spot.x + spot.width;
74277466 spoth = spot.y + spot.height;
74287467 clickInfo.g.setColor(Color.cyan);
....@@ -7443,28 +7482,7 @@
74437482 // {
74447483 // CameraPane.Ymax = spoth;
74457484 // }
7446
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7447
- //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7448
- spot.translate(0, -32);
7449
- clickInfo.g.setColor(Color.yellow);
7450
- clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
74517485 clickInfo.g.setColor(Color.green);
7452
-// if (CameraPane.Xmin > spot.x)
7453
-// {
7454
-// CameraPane.Xmin = spot.x;
7455
-// }
7456
-// if (CameraPane.Xmax < spotw)
7457
-// {
7458
-// CameraPane.Xmax = spotw;
7459
-// }
7460
-// if (CameraPane.Ymin > spot.y)
7461
-// {
7462
-// CameraPane.Ymin = spot.y;
7463
-// }
7464
-// if (CameraPane.Ymax < spoth)
7465
-// {
7466
-// CameraPane.Ymax = spoth;
7467
-// }
74687486 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74697487 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74707488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7523,12 +7541,14 @@
75237541 retval = true;
75247542 }
75257543 spot.translate(0, 32);
7544
+ spot.translate(32, 0);
7545
+ spot.translate(0, 32);
75267546 if (spot.contains(clickInfo.x, clickInfo.y))
75277547 {
75287548 hitSomething = hitScale;
75297549
75307550 double scale = 0.005f * clickInfo.camera.Distance();
7531
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7551
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75327552 double sign = 1;
75337553 if (hScale < 0)
75347554 {
....@@ -7540,7 +7560,7 @@
75407560 //hScale = 0.01;
75417561 }
75427562
7543
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7563
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75447564 sign = 1;
75457565 if (vScale < 0)
75467566 {
....@@ -7755,7 +7775,7 @@
77557775 break;
77567776
77577777 case hitScale: // scale
7758
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77597779 double sign = 1;
77607780 if (hScale < 0)
77617781 {
....@@ -7767,7 +7787,7 @@
77677787 //hScale = 0.01;
77687788 }
77697789
7770
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77717791 sign = 1;
77727792 if (vScale < 0)
77737793 {
....@@ -7800,21 +7820,27 @@
78007820 case 3: // '\001'
78017821 if (modified || opposite)
78027822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
78037826 //LA.matScale(toParent, 1, hScale, vScale);
7804
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
78057828 } // vScale, 1);
78067829 else
78077830 {
78087831 // EXCEPTION!
7809
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
78107833 } // vScale, 1);
78117834 break;
78127835
78137836 case 2: // '\002'
78147837 if (modified || opposite)
78157838 {
7816
- //LA.matScale(toParent, hScale, 1, vScale);
7817
- 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);
78187844 } else
78197845 {
78207846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7824,8 +7850,11 @@
78247850 case 1: // '\003'
78257851 if (modified || opposite)
78267852 {
7827
- //LA.matScale(toParent, hScale, vScale, 1);
7828
- 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);
78297858 } else
78307859 {
78317860 LA.matScale(toParent, totalScale, totalScale, 1);