Normand Briere
2019-08-20 537f4ac57ae2b34f0a04fa63874c8ca6534c9a6d
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()
....@@ -269,6 +271,50 @@
269271 //
270272 // return null;
271273 // }
274
+
275
+ transient boolean tag;
276
+
277
+ void TagObjects(Object3D o, boolean tag)
278
+ {
279
+ if (blockloop)
280
+ return;
281
+
282
+ o.tag = tag;
283
+
284
+ if (o == this)
285
+ return;
286
+
287
+ blockloop = true;
288
+
289
+ for (int i=0; i<Size(); i++)
290
+ {
291
+ get(i).TagObjects(o, tag);
292
+ }
293
+
294
+ blockloop = false;
295
+ }
296
+
297
+ boolean HasTags()
298
+ {
299
+ if (blockloop)
300
+ return false;
301
+
302
+ blockloop = true;
303
+
304
+ boolean hasTags = false;
305
+
306
+ for (int i=0; i<Size(); i++)
307
+ {
308
+ hasTags |= get(i).tag || get(i).HasTags();
309
+
310
+ if (hasTags)
311
+ break;
312
+ }
313
+
314
+ blockloop = false;
315
+
316
+ return hasTags;
317
+ }
272318
273319 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
274320 {
....@@ -5574,6 +5620,11 @@
55745620 if (fullname == null)
55755621 return "";
55765622
5623
+ if (fullname.pigment != null)
5624
+ {
5625
+ return fullname.pigment;
5626
+ }
5627
+
55775628 // System.out.println("Fullname = " + fullname);
55785629
55795630 // Does not work on Windows due to C:
....@@ -5586,7 +5637,7 @@
55865637
55875638 if (split.length == 0)
55885639 {
5589
- return "";
5640
+ return fullname.pigment = "";
55905641 }
55915642
55925643 if (split.length <= 2)
....@@ -5594,22 +5645,27 @@
55945645 if (fullname.name.endsWith(":"))
55955646 {
55965647 // Windows
5597
- return fullname.name.substring(0, fullname.name.length()-1);
5648
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55985649 }
55995650
5600
- return split[0];
5651
+ return fullname.pigment = split[0];
56015652 }
56025653
56035654 // Windows
56045655 assert(split.length == 4);
56055656
5606
- return split[0] + ":" + split[1];
5657
+ return fullname.pigment = split[0] + ":" + split[1];
56075658 }
56085659
56095660 static String GetBump(cTexture fullname)
56105661 {
56115662 if (fullname == null)
56125663 return "";
5664
+
5665
+ if (fullname.bump != null)
5666
+ {
5667
+ return fullname.bump;
5668
+ }
56135669
56145670 // System.out.println("Fullname = " + fullname);
56155671 // Does not work on Windows due to C:
....@@ -5621,12 +5677,12 @@
56215677
56225678 if (split.length == 0)
56235679 {
5624
- return "";
5680
+ return fullname.bump = "";
56255681 }
56265682
56275683 if (split.length == 1)
56285684 {
5629
- return "";
5685
+ return fullname.bump = "";
56305686 }
56315687
56325688 if (split.length == 2)
....@@ -5634,16 +5690,16 @@
56345690 if (fullname.name.endsWith(":"))
56355691 {
56365692 // Windows
5637
- return "";
5693
+ return fullname.bump = "";
56385694 }
56395695
5640
- return split[1];
5696
+ return fullname.bump = split[1];
56415697 }
56425698
56435699 // Windows
56445700 assert(split.length == 4);
56455701
5646
- return split[2] + ":" + split[3];
5702
+ return fullname.bump = split[2] + ":" + split[3];
56475703 }
56485704
56495705 String GetPigmentTexture()
....@@ -5726,6 +5782,9 @@
57265782 texname = "";
57275783
57285784 GetTextures().name = texname + ":" + GetBump(GetTextures());
5785
+
5786
+ GetTextures().pigment = null;
5787
+
57295788 Touch();
57305789 }
57315790
....@@ -5798,6 +5857,8 @@
57985857 texname = "";
57995858
58005859 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5860
+
5861
+ GetTextures().bump = null;
58015862
58025863 Touch();
58035864 }
....@@ -7402,7 +7463,7 @@
74027463 boundary.y = spot.y - 30;
74037464 boundary.width = spot.width + 60;
74047465 boundary.height = spot.height + 60;
7405
- clickInfo.g.setColor(Color.red);
7466
+ clickInfo.g.setColor(Color.white);
74067467 int spotw = spot.x + spot.width;
74077468 int spoth = spot.y + spot.height;
74087469 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7422,7 +7483,29 @@
74227483 // {
74237484 // CameraPane.Ymax = spoth;
74247485 // }
7425
- spot.translate(32, 32);
7486
+// if (CameraPane.Xmin > spot.x)
7487
+// {
7488
+// CameraPane.Xmin = spot.x;
7489
+// }
7490
+// if (CameraPane.Xmax < spotw)
7491
+// {
7492
+// CameraPane.Xmax = spotw;
7493
+// }
7494
+// if (CameraPane.Ymin > spot.y)
7495
+// {
7496
+// CameraPane.Ymin = spot.y;
7497
+// }
7498
+// if (CameraPane.Ymax < spoth)
7499
+// {
7500
+// CameraPane.Ymax = spoth;
7501
+// }
7502
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7503
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7504
+ spot.translate(32, 0);
7505
+ clickInfo.g.setColor(Color.yellow);
7506
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7507
+
7508
+ spot.translate(32, 64);
74267509 spotw = spot.x + spot.width;
74277510 spoth = spot.y + spot.height;
74287511 clickInfo.g.setColor(Color.cyan);
....@@ -7443,28 +7526,7 @@
74437526 // {
74447527 // CameraPane.Ymax = spoth;
74457528 // }
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);
74517529 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
-// }
74687530 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74697531 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74707532 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7523,12 +7585,14 @@
75237585 retval = true;
75247586 }
75257587 spot.translate(0, 32);
7588
+ spot.translate(32, 0);
7589
+ spot.translate(0, 32);
75267590 if (spot.contains(clickInfo.x, clickInfo.y))
75277591 {
75287592 hitSomething = hitScale;
75297593
75307594 double scale = 0.005f * clickInfo.camera.Distance();
7531
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7595
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75327596 double sign = 1;
75337597 if (hScale < 0)
75347598 {
....@@ -7540,7 +7604,7 @@
75407604 //hScale = 0.01;
75417605 }
75427606
7543
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7607
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75447608 sign = 1;
75457609 if (vScale < 0)
75467610 {
....@@ -7755,7 +7819,7 @@
77557819 break;
77567820
77577821 case hitScale: // scale
7758
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7822
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77597823 double sign = 1;
77607824 if (hScale < 0)
77617825 {
....@@ -7767,7 +7831,7 @@
77677831 //hScale = 0.01;
77687832 }
77697833
7770
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7834
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77717835 sign = 1;
77727836 if (vScale < 0)
77737837 {
....@@ -7800,21 +7864,27 @@
78007864 case 3: // '\001'
78017865 if (modified || opposite)
78027866 {
7867
+ if (modified && opposite)
7868
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7869
+ else
78037870 //LA.matScale(toParent, 1, hScale, vScale);
7804
- LA.matScale(toParent, totalScale, 1, 1);
7871
+ LA.matScale(toParent, totalScale, 1, 1);
78057872 } // vScale, 1);
78067873 else
78077874 {
78087875 // EXCEPTION!
7809
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7876
+ LA.matScale(toParent, 1, totalScale, totalScale);
78107877 } // vScale, 1);
78117878 break;
78127879
78137880 case 2: // '\002'
78147881 if (modified || opposite)
78157882 {
7816
- //LA.matScale(toParent, hScale, 1, vScale);
7817
- LA.matScale(toParent, 1, totalScale, 1);
7883
+ if (modified && opposite)
7884
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7885
+ else
7886
+ //LA.matScale(toParent, hScale, 1, vScale);
7887
+ LA.matScale(toParent, 1, totalScale, 1);
78187888 } else
78197889 {
78207890 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7824,8 +7894,11 @@
78247894 case 1: // '\003'
78257895 if (modified || opposite)
78267896 {
7827
- //LA.matScale(toParent, hScale, vScale, 1);
7828
- LA.matScale(toParent, 1, 1, totalScale);
7897
+ if (modified && opposite)
7898
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7899
+ else
7900
+ //LA.matScale(toParent, hScale, vScale, 1);
7901
+ LA.matScale(toParent, 1, 1, totalScale);
78297902 } else
78307903 {
78317904 LA.matScale(toParent, totalScale, totalScale, 1);