Normand Briere
2019-08-17 ecc1309a04b527c62ffe97e814daf050dbd025cd
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[];
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,7 +225,7 @@
219225 // o.bRep.support = null;
220226 // }
221227 o.selection = this.selection;
222
- o.versions = this.versions;
228
+ o.versionlist = this.versionlist;
223229 o.versionindex = this.versionindex;
224230
225231 if (this.support != null)
....@@ -242,6 +248,29 @@
242248 // this.support = null;
243249 // this.fileparent = null;
244250 }
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
+// }
245274
246275 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
247276 {
....@@ -277,7 +306,7 @@
277306
278307 this.selection = o.selection;
279308
280
- this.versions = o.versions;
309
+ this.versionlist = o.versionlist;
281310 this.versionindex = o.versionindex;
282311 // July 2019 if (this.bRep != null)
283312 // this.bRep.support = o.transientrep;
....@@ -1011,6 +1040,9 @@
10111040
10121041 if (material == null || material.multiply)
10131042 return true;
1043
+
1044
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1045
+ return false;
10141046
10151047 // Transparent objects are dynamic because we have to sort the triangles.
10161048 return material.opacity > 0.99;
....@@ -2438,6 +2470,11 @@
24382470 else
24392471 {
24402472 //((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");
24412478 }
24422479 }
24432480
....@@ -5539,6 +5576,11 @@
55395576 if (fullname == null)
55405577 return "";
55415578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
55425584 // System.out.println("Fullname = " + fullname);
55435585
55445586 // Does not work on Windows due to C:
....@@ -5551,7 +5593,7 @@
55515593
55525594 if (split.length == 0)
55535595 {
5554
- return "";
5596
+ return fullname.pigment = "";
55555597 }
55565598
55575599 if (split.length <= 2)
....@@ -5559,22 +5601,27 @@
55595601 if (fullname.name.endsWith(":"))
55605602 {
55615603 // Windows
5562
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55635605 }
55645606
5565
- return split[0];
5607
+ return fullname.pigment = split[0];
55665608 }
55675609
55685610 // Windows
55695611 assert(split.length == 4);
55705612
5571
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
55725614 }
55735615
55745616 static String GetBump(cTexture fullname)
55755617 {
55765618 if (fullname == null)
55775619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
55785625
55795626 // System.out.println("Fullname = " + fullname);
55805627 // Does not work on Windows due to C:
....@@ -5586,12 +5633,12 @@
55865633
55875634 if (split.length == 0)
55885635 {
5589
- return "";
5636
+ return fullname.bump = "";
55905637 }
55915638
55925639 if (split.length == 1)
55935640 {
5594
- return "";
5641
+ return fullname.bump = "";
55955642 }
55965643
55975644 if (split.length == 2)
....@@ -5599,16 +5646,16 @@
55995646 if (fullname.name.endsWith(":"))
56005647 {
56015648 // Windows
5602
- return "";
5649
+ return fullname.bump = "";
56035650 }
56045651
5605
- return split[1];
5652
+ return fullname.bump = split[1];
56065653 }
56075654
56085655 // Windows
56095656 assert(split.length == 4);
56105657
5611
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
56125659 }
56135660
56145661 String GetPigmentTexture()
....@@ -5691,6 +5738,9 @@
56915738 texname = "";
56925739
56935740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
56945744 Touch();
56955745 }
56965746
....@@ -5763,6 +5813,8 @@
57635813 texname = "";
57645814
57655815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5816
+
5817
+ GetTextures().bump = null;
57665818
57675819 Touch();
57685820 }
....@@ -5906,8 +5958,10 @@
59065958 if (support != null)
59075959 support = support;
59085960
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);
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.
59115965
59125966 if (!usecalllists && bRep != null && bRep.displaylist > 0)
59135967 {
....@@ -5917,8 +5971,9 @@
59175971 // usecalllists &= !(parent instanceof RandomNode);
59185972 // usecalllists = false;
59195973
5920
- if (GetBRep() != null)
5921
- usecalllists = usecalllists;
5974
+ if (display.DrawMode() == display.SHADOW)
5975
+ //GetBRep() != null)
5976
+ usecalllists = !!usecalllists;
59225977 //System.out.println("draw " + this);
59235978 //new Exception().printStackTrace();
59245979
....@@ -5940,7 +5995,7 @@
59405995 if (!(this instanceof Composite))
59415996 touched = false;
59425997 //if (displaylist == -1 && usecalllists)
5943
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5998
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59445999 {
59456000 bRep.displaylist = display.GenList();
59466001 assert(bRep.displaylist != 0);
....@@ -5951,7 +6006,7 @@
59516006
59526007 //System.out.println("\tnew list " + list);
59536008 //gl.glDrawBuffer(gl.GL_NONE);
5954
- if (usecalllists)
6009
+ if (usecalllists && bRep.displaylist > 0)
59556010 {
59566011 // System.err.println("new list " + bRep.displaylist + " for " + this);
59576012 display.NewList(bRep.displaylist);
....@@ -5960,7 +6015,7 @@
59606015 CallList(display, root, selected, blocked);
59616016
59626017 // compiled = true;
5963
- if (usecalllists)
6018
+ if (usecalllists && bRep.displaylist > 0)
59646019 {
59656020 // System.err.println("end list " + bRep.displaylist + " for " + this);
59666021 display.EndList();
....@@ -7364,7 +7419,7 @@
73647419 boundary.y = spot.y - 30;
73657420 boundary.width = spot.width + 60;
73667421 boundary.height = spot.height + 60;
7367
- clickInfo.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
73687423 int spotw = spot.x + spot.width;
73697424 int spoth = spot.y + spot.height;
73707425 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7384,7 +7439,29 @@
73847439 // {
73857440 // CameraPane.Ymax = spoth;
73867441 // }
7387
- 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);
73887465 spotw = spot.x + spot.width;
73897466 spoth = spot.y + spot.height;
73907467 clickInfo.g.setColor(Color.cyan);
....@@ -7405,28 +7482,7 @@
74057482 // {
74067483 // CameraPane.Ymax = spoth;
74077484 // }
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);
74137485 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
-// }
74307486 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74317487 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74327488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7485,12 +7541,14 @@
74857541 retval = true;
74867542 }
74877543 spot.translate(0, 32);
7544
+ spot.translate(32, 0);
7545
+ spot.translate(0, 32);
74887546 if (spot.contains(clickInfo.x, clickInfo.y))
74897547 {
74907548 hitSomething = hitScale;
74917549
74927550 double scale = 0.005f * clickInfo.camera.Distance();
7493
- double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
7551
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
74947552 double sign = 1;
74957553 if (hScale < 0)
74967554 {
....@@ -7502,7 +7560,7 @@
75027560 //hScale = 0.01;
75037561 }
75047562
7505
- double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
7563
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75067564 sign = 1;
75077565 if (vScale < 0)
75087566 {
....@@ -7717,7 +7775,7 @@
77177775 break;
77187776
77197777 case hitScale: // scale
7720
- double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77217779 double sign = 1;
77227780 if (hScale < 0)
77237781 {
....@@ -7729,7 +7787,7 @@
77297787 //hScale = 0.01;
77307788 }
77317789
7732
- double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77337791 sign = 1;
77347792 if (vScale < 0)
77357793 {
....@@ -7762,21 +7820,27 @@
77627820 case 3: // '\001'
77637821 if (modified || opposite)
77647822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
77657826 //LA.matScale(toParent, 1, hScale, vScale);
7766
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
77677828 } // vScale, 1);
77687829 else
77697830 {
77707831 // EXCEPTION!
7771
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
77727833 } // vScale, 1);
77737834 break;
77747835
77757836 case 2: // '\002'
77767837 if (modified || opposite)
77777838 {
7778
- //LA.matScale(toParent, hScale, 1, vScale);
7779
- 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);
77807844 } else
77817845 {
77827846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7786,8 +7850,11 @@
77867850 case 1: // '\003'
77877851 if (modified || opposite)
77887852 {
7789
- //LA.matScale(toParent, hScale, vScale, 1);
7790
- 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);
77917858 } else
77927859 {
77937860 LA.matScale(toParent, totalScale, totalScale, 1);