Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
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,7 +30,10 @@
2930 Object3D saveskeleton;
3031 //
3132
32
- byte[] versions[];
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
3337 int versionindex = -1;
3438
3539 ScriptNode scriptnode;
....@@ -219,7 +223,7 @@
219223 // o.bRep.support = null;
220224 // }
221225 o.selection = this.selection;
222
- o.versions = this.versions;
226
+ o.versionlist = this.versionlist;
223227 o.versionindex = this.versionindex;
224228
225229 if (this.support != null)
....@@ -242,6 +246,29 @@
242246 // this.support = null;
243247 // this.fileparent = null;
244248 }
249
+
250
+// Object3D GetObject(java.util.UUID uuid)
251
+// {
252
+// if (this.uuid.equals(uuid))
253
+// return this;
254
+//
255
+// if (blockloop)
256
+// return null;
257
+//
258
+// blockloop = true;
259
+//
260
+// for (int i=0; i<Size(); i++)
261
+// {
262
+// Object3D o = get(i).GetObject(uuid);
263
+//
264
+// if (o != null)
265
+// return o;
266
+// }
267
+//
268
+// blockloop = false;
269
+//
270
+// return null;
271
+// }
245272
246273 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
247274 {
....@@ -277,7 +304,7 @@
277304
278305 this.selection = o.selection;
279306
280
- this.versions = o.versions;
307
+ this.versionlist = o.versionlist;
281308 this.versionindex = o.versionindex;
282309 // July 2019 if (this.bRep != null)
283310 // this.bRep.support = o.transientrep;
....@@ -1011,6 +1038,9 @@
10111038
10121039 if (material == null || material.multiply)
10131040 return true;
1041
+
1042
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1043
+ return false;
10141044
10151045 // Transparent objects are dynamic because we have to sort the triangles.
10161046 return material.opacity > 0.99;
....@@ -2438,6 +2468,11 @@
24382468 else
24392469 {
24402470 //((ObjEditor)editWindow).SetupUI2(null);
2471
+ if (objectUI != null)
2472
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2473
+ else
2474
+ //new Exception().printStackTrace();
2475
+ System.err.println("objectUI is null");
24412476 }
24422477 }
24432478
....@@ -5539,6 +5574,11 @@
55395574 if (fullname == null)
55405575 return "";
55415576
5577
+ if (fullname.pigment != null)
5578
+ {
5579
+ return fullname.pigment;
5580
+ }
5581
+
55425582 // System.out.println("Fullname = " + fullname);
55435583
55445584 // Does not work on Windows due to C:
....@@ -5551,7 +5591,7 @@
55515591
55525592 if (split.length == 0)
55535593 {
5554
- return "";
5594
+ return fullname.pigment = "";
55555595 }
55565596
55575597 if (split.length <= 2)
....@@ -5559,22 +5599,27 @@
55595599 if (fullname.name.endsWith(":"))
55605600 {
55615601 // Windows
5562
- return fullname.name.substring(0, fullname.name.length()-1);
5602
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55635603 }
55645604
5565
- return split[0];
5605
+ return fullname.pigment = split[0];
55665606 }
55675607
55685608 // Windows
55695609 assert(split.length == 4);
55705610
5571
- return split[0] + ":" + split[1];
5611
+ return fullname.pigment = split[0] + ":" + split[1];
55725612 }
55735613
55745614 static String GetBump(cTexture fullname)
55755615 {
55765616 if (fullname == null)
55775617 return "";
5618
+
5619
+ if (fullname.bump != null)
5620
+ {
5621
+ return fullname.bump;
5622
+ }
55785623
55795624 // System.out.println("Fullname = " + fullname);
55805625 // Does not work on Windows due to C:
....@@ -5586,12 +5631,12 @@
55865631
55875632 if (split.length == 0)
55885633 {
5589
- return "";
5634
+ return fullname.bump = "";
55905635 }
55915636
55925637 if (split.length == 1)
55935638 {
5594
- return "";
5639
+ return fullname.bump = "";
55955640 }
55965641
55975642 if (split.length == 2)
....@@ -5599,16 +5644,16 @@
55995644 if (fullname.name.endsWith(":"))
56005645 {
56015646 // Windows
5602
- return "";
5647
+ return fullname.bump = "";
56035648 }
56045649
5605
- return split[1];
5650
+ return fullname.bump = split[1];
56065651 }
56075652
56085653 // Windows
56095654 assert(split.length == 4);
56105655
5611
- return split[2] + ":" + split[3];
5656
+ return fullname.bump = split[2] + ":" + split[3];
56125657 }
56135658
56145659 String GetPigmentTexture()
....@@ -5691,6 +5736,9 @@
56915736 texname = "";
56925737
56935738 GetTextures().name = texname + ":" + GetBump(GetTextures());
5739
+
5740
+ GetTextures().pigment = null;
5741
+
56945742 Touch();
56955743 }
56965744
....@@ -5763,6 +5811,8 @@
57635811 texname = "";
57645812
57655813 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5814
+
5815
+ GetTextures().bump = null;
57665816
57675817 Touch();
57685818 }
....@@ -5906,8 +5956,10 @@
59065956 if (support != null)
59075957 support = support;
59085958
5909
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5910
- boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5959
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5960
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5961
+
5962
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
59115963
59125964 if (!usecalllists && bRep != null && bRep.displaylist > 0)
59135965 {
....@@ -5917,8 +5969,9 @@
59175969 // usecalllists &= !(parent instanceof RandomNode);
59185970 // usecalllists = false;
59195971
5920
- if (GetBRep() != null)
5921
- usecalllists = usecalllists;
5972
+ if (display.DrawMode() == display.SHADOW)
5973
+ //GetBRep() != null)
5974
+ usecalllists = !!usecalllists;
59225975 //System.out.println("draw " + this);
59235976 //new Exception().printStackTrace();
59245977
....@@ -5940,7 +5993,7 @@
59405993 if (!(this instanceof Composite))
59415994 touched = false;
59425995 //if (displaylist == -1 && usecalllists)
5943
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5996
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59445997 {
59455998 bRep.displaylist = display.GenList();
59465999 assert(bRep.displaylist != 0);
....@@ -5951,7 +6004,7 @@
59516004
59526005 //System.out.println("\tnew list " + list);
59536006 //gl.glDrawBuffer(gl.GL_NONE);
5954
- if (usecalllists)
6007
+ if (usecalllists && bRep.displaylist > 0)
59556008 {
59566009 // System.err.println("new list " + bRep.displaylist + " for " + this);
59576010 display.NewList(bRep.displaylist);
....@@ -5960,7 +6013,7 @@
59606013 CallList(display, root, selected, blocked);
59616014
59626015 // compiled = true;
5963
- if (usecalllists)
6016
+ if (usecalllists && bRep.displaylist > 0)
59646017 {
59656018 // System.err.println("end list " + bRep.displaylist + " for " + this);
59666019 display.EndList();
....@@ -7364,7 +7417,7 @@
73647417 boundary.y = spot.y - 30;
73657418 boundary.width = spot.width + 60;
73667419 boundary.height = spot.height + 60;
7367
- clickInfo.g.setColor(Color.red);
7420
+ clickInfo.g.setColor(Color.white);
73687421 int spotw = spot.x + spot.width;
73697422 int spoth = spot.y + spot.height;
73707423 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7384,7 +7437,29 @@
73847437 // {
73857438 // CameraPane.Ymax = spoth;
73867439 // }
7387
- 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);
73887463 spotw = spot.x + spot.width;
73897464 spoth = spot.y + spot.height;
73907465 clickInfo.g.setColor(Color.cyan);
....@@ -7405,28 +7480,7 @@
74057480 // {
74067481 // CameraPane.Ymax = spoth;
74077482 // }
7408
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7409
- //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7410
- spot.translate(0, -32);
7411
- clickInfo.g.setColor(Color.yellow);
7412
- clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
74137483 clickInfo.g.setColor(Color.green);
7414
-// if (CameraPane.Xmin > spot.x)
7415
-// {
7416
-// CameraPane.Xmin = spot.x;
7417
-// }
7418
-// if (CameraPane.Xmax < spotw)
7419
-// {
7420
-// CameraPane.Xmax = spotw;
7421
-// }
7422
-// if (CameraPane.Ymin > spot.y)
7423
-// {
7424
-// CameraPane.Ymin = spot.y;
7425
-// }
7426
-// if (CameraPane.Ymax < spoth)
7427
-// {
7428
-// CameraPane.Ymax = spoth;
7429
-// }
74307484 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74317485 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74327486 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7485,12 +7539,14 @@
74857539 retval = true;
74867540 }
74877541 spot.translate(0, 32);
7542
+ spot.translate(32, 0);
7543
+ spot.translate(0, 32);
74887544 if (spot.contains(clickInfo.x, clickInfo.y))
74897545 {
74907546 hitSomething = hitScale;
74917547
74927548 double scale = 0.005f * clickInfo.camera.Distance();
7493
- double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
7549
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
74947550 double sign = 1;
74957551 if (hScale < 0)
74967552 {
....@@ -7502,7 +7558,7 @@
75027558 //hScale = 0.01;
75037559 }
75047560
7505
- double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
7561
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75067562 sign = 1;
75077563 if (vScale < 0)
75087564 {
....@@ -7717,7 +7773,7 @@
77177773 break;
77187774
77197775 case hitScale: // scale
7720
- double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
7776
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77217777 double sign = 1;
77227778 if (hScale < 0)
77237779 {
....@@ -7729,7 +7785,7 @@
77297785 //hScale = 0.01;
77307786 }
77317787
7732
- double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
7788
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77337789 sign = 1;
77347790 if (vScale < 0)
77357791 {
....@@ -7762,21 +7818,27 @@
77627818 case 3: // '\001'
77637819 if (modified || opposite)
77647820 {
7821
+ if (modified && opposite)
7822
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7823
+ else
77657824 //LA.matScale(toParent, 1, hScale, vScale);
7766
- LA.matScale(toParent, totalScale, 1, 1);
7825
+ LA.matScale(toParent, totalScale, 1, 1);
77677826 } // vScale, 1);
77687827 else
77697828 {
77707829 // EXCEPTION!
7771
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7830
+ LA.matScale(toParent, 1, totalScale, totalScale);
77727831 } // vScale, 1);
77737832 break;
77747833
77757834 case 2: // '\002'
77767835 if (modified || opposite)
77777836 {
7778
- //LA.matScale(toParent, hScale, 1, vScale);
7779
- 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);
77807842 } else
77817843 {
77827844 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7786,8 +7848,11 @@
77867848 case 1: // '\003'
77877849 if (modified || opposite)
77887850 {
7789
- //LA.matScale(toParent, hScale, vScale, 1);
7790
- 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);
77917856 } else
77927857 {
77937858 LA.matScale(toParent, totalScale, totalScale, 1);