Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
Object3D.java
....@@ -5574,6 +5574,11 @@
55745574 if (fullname == null)
55755575 return "";
55765576
5577
+ if (fullname.pigment != null)
5578
+ {
5579
+ return fullname.pigment;
5580
+ }
5581
+
55775582 // System.out.println("Fullname = " + fullname);
55785583
55795584 // Does not work on Windows due to C:
....@@ -5586,7 +5591,7 @@
55865591
55875592 if (split.length == 0)
55885593 {
5589
- return "";
5594
+ return fullname.pigment = "";
55905595 }
55915596
55925597 if (split.length <= 2)
....@@ -5594,22 +5599,27 @@
55945599 if (fullname.name.endsWith(":"))
55955600 {
55965601 // Windows
5597
- return fullname.name.substring(0, fullname.name.length()-1);
5602
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55985603 }
55995604
5600
- return split[0];
5605
+ return fullname.pigment = split[0];
56015606 }
56025607
56035608 // Windows
56045609 assert(split.length == 4);
56055610
5606
- return split[0] + ":" + split[1];
5611
+ return fullname.pigment = split[0] + ":" + split[1];
56075612 }
56085613
56095614 static String GetBump(cTexture fullname)
56105615 {
56115616 if (fullname == null)
56125617 return "";
5618
+
5619
+ if (fullname.bump != null)
5620
+ {
5621
+ return fullname.bump;
5622
+ }
56135623
56145624 // System.out.println("Fullname = " + fullname);
56155625 // Does not work on Windows due to C:
....@@ -5621,12 +5631,12 @@
56215631
56225632 if (split.length == 0)
56235633 {
5624
- return "";
5634
+ return fullname.bump = "";
56255635 }
56265636
56275637 if (split.length == 1)
56285638 {
5629
- return "";
5639
+ return fullname.bump = "";
56305640 }
56315641
56325642 if (split.length == 2)
....@@ -5634,16 +5644,16 @@
56345644 if (fullname.name.endsWith(":"))
56355645 {
56365646 // Windows
5637
- return "";
5647
+ return fullname.bump = "";
56385648 }
56395649
5640
- return split[1];
5650
+ return fullname.bump = split[1];
56415651 }
56425652
56435653 // Windows
56445654 assert(split.length == 4);
56455655
5646
- return split[2] + ":" + split[3];
5656
+ return fullname.bump = split[2] + ":" + split[3];
56475657 }
56485658
56495659 String GetPigmentTexture()
....@@ -5726,6 +5736,9 @@
57265736 texname = "";
57275737
57285738 GetTextures().name = texname + ":" + GetBump(GetTextures());
5739
+
5740
+ GetTextures().pigment = null;
5741
+
57295742 Touch();
57305743 }
57315744
....@@ -5798,6 +5811,8 @@
57985811 texname = "";
57995812
58005813 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5814
+
5815
+ GetTextures().bump = null;
58015816
58025817 Touch();
58035818 }
....@@ -7402,7 +7417,7 @@
74027417 boundary.y = spot.y - 30;
74037418 boundary.width = spot.width + 60;
74047419 boundary.height = spot.height + 60;
7405
- clickInfo.g.setColor(Color.red);
7420
+ clickInfo.g.setColor(Color.white);
74067421 int spotw = spot.x + spot.width;
74077422 int spoth = spot.y + spot.height;
74087423 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7422,7 +7437,29 @@
74227437 // {
74237438 // CameraPane.Ymax = spoth;
74247439 // }
7425
- spot.translate(32, 32);
7440
+// if (CameraPane.Xmin > spot.x)
7441
+// {
7442
+// CameraPane.Xmin = spot.x;
7443
+// }
7444
+// if (CameraPane.Xmax < spotw)
7445
+// {
7446
+// CameraPane.Xmax = spotw;
7447
+// }
7448
+// if (CameraPane.Ymin > spot.y)
7449
+// {
7450
+// CameraPane.Ymin = spot.y;
7451
+// }
7452
+// if (CameraPane.Ymax < spoth)
7453
+// {
7454
+// CameraPane.Ymax = spoth;
7455
+// }
7456
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7457
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
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);
74267463 spotw = spot.x + spot.width;
74277464 spoth = spot.y + spot.height;
74287465 clickInfo.g.setColor(Color.cyan);
....@@ -7443,28 +7480,7 @@
74437480 // {
74447481 // CameraPane.Ymax = spoth;
74457482 // }
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);
74517483 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
-// }
74687484 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74697485 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74707486 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7523,12 +7539,14 @@
75237539 retval = true;
75247540 }
75257541 spot.translate(0, 32);
7542
+ spot.translate(32, 0);
7543
+ spot.translate(0, 32);
75267544 if (spot.contains(clickInfo.x, clickInfo.y))
75277545 {
75287546 hitSomething = hitScale;
75297547
75307548 double scale = 0.005f * clickInfo.camera.Distance();
7531
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7549
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75327550 double sign = 1;
75337551 if (hScale < 0)
75347552 {
....@@ -7540,7 +7558,7 @@
75407558 //hScale = 0.01;
75417559 }
75427560
7543
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7561
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75447562 sign = 1;
75457563 if (vScale < 0)
75467564 {
....@@ -7755,7 +7773,7 @@
77557773 break;
77567774
77577775 case hitScale: // scale
7758
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7776
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77597777 double sign = 1;
77607778 if (hScale < 0)
77617779 {
....@@ -7767,7 +7785,7 @@
77677785 //hScale = 0.01;
77687786 }
77697787
7770
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7788
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77717789 sign = 1;
77727790 if (vScale < 0)
77737791 {
....@@ -7800,21 +7818,27 @@
78007818 case 3: // '\001'
78017819 if (modified || opposite)
78027820 {
7821
+ if (modified && opposite)
7822
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7823
+ else
78037824 //LA.matScale(toParent, 1, hScale, vScale);
7804
- LA.matScale(toParent, totalScale, 1, 1);
7825
+ LA.matScale(toParent, totalScale, 1, 1);
78057826 } // vScale, 1);
78067827 else
78077828 {
78087829 // EXCEPTION!
7809
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7830
+ LA.matScale(toParent, 1, totalScale, totalScale);
78107831 } // vScale, 1);
78117832 break;
78127833
78137834 case 2: // '\002'
78147835 if (modified || opposite)
78157836 {
7816
- //LA.matScale(toParent, hScale, 1, vScale);
7817
- LA.matScale(toParent, 1, totalScale, 1);
7837
+ if (modified && opposite)
7838
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7839
+ else
7840
+ //LA.matScale(toParent, hScale, 1, vScale);
7841
+ LA.matScale(toParent, 1, totalScale, 1);
78187842 } else
78197843 {
78207844 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7824,8 +7848,11 @@
78247848 case 1: // '\003'
78257849 if (modified || opposite)
78267850 {
7827
- //LA.matScale(toParent, hScale, vScale, 1);
7828
- LA.matScale(toParent, 1, 1, totalScale);
7851
+ if (modified && opposite)
7852
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7853
+ else
7854
+ //LA.matScale(toParent, hScale, vScale, 1);
7855
+ LA.matScale(toParent, 1, 1, totalScale);
78297856 } else
78307857 {
78317858 LA.matScale(toParent, totalScale, totalScale, 1);