Normand Briere
2019-08-16 83d0c2fa0bd2e96448f776144e1a89cdb1bb6998
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.
....@@ -32,9 +33,11 @@
3233 String skyboxname;
3334 String skyboxext;
3435
35
- byte[] versions[];
36
+ Object3D versionlist[];
3637 int versionindex = -1;
3738
39
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>();
40
+
3841 ScriptNode scriptnode;
3942
4043 void InitOthers()
....@@ -222,7 +225,7 @@
222225 // o.bRep.support = null;
223226 // }
224227 o.selection = this.selection;
225
- o.versions = this.versions;
228
+ o.versionlist = this.versionlist;
226229 o.versionindex = this.versionindex;
227230
228231 if (this.support != null)
....@@ -245,6 +248,29 @@
245248 // this.support = null;
246249 // this.fileparent = null;
247250 }
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
+// }
248274
249275 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
250276 {
....@@ -280,7 +306,7 @@
280306
281307 this.selection = o.selection;
282308
283
- this.versions = o.versions;
309
+ this.versionlist = o.versionlist;
284310 this.versionindex = o.versionindex;
285311 // July 2019 if (this.bRep != null)
286312 // this.bRep.support = o.transientrep;
....@@ -1014,6 +1040,9 @@
10141040
10151041 if (material == null || material.multiply)
10161042 return true;
1043
+
1044
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1045
+ return false;
10171046
10181047 // Transparent objects are dynamic because we have to sort the triangles.
10191048 return material.opacity > 0.99;
....@@ -2441,6 +2470,11 @@
24412470 else
24422471 {
24432472 //((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");
24442478 }
24452479 }
24462480
....@@ -5542,6 +5576,11 @@
55425576 if (fullname == null)
55435577 return "";
55445578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
55455584 // System.out.println("Fullname = " + fullname);
55465585
55475586 // Does not work on Windows due to C:
....@@ -5554,7 +5593,7 @@
55545593
55555594 if (split.length == 0)
55565595 {
5557
- return "";
5596
+ return fullname.pigment = "";
55585597 }
55595598
55605599 if (split.length <= 2)
....@@ -5562,22 +5601,27 @@
55625601 if (fullname.name.endsWith(":"))
55635602 {
55645603 // Windows
5565
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55665605 }
55675606
5568
- return split[0];
5607
+ return fullname.pigment = split[0];
55695608 }
55705609
55715610 // Windows
55725611 assert(split.length == 4);
55735612
5574
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
55755614 }
55765615
55775616 static String GetBump(cTexture fullname)
55785617 {
55795618 if (fullname == null)
55805619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
55815625
55825626 // System.out.println("Fullname = " + fullname);
55835627 // Does not work on Windows due to C:
....@@ -5589,12 +5633,12 @@
55895633
55905634 if (split.length == 0)
55915635 {
5592
- return "";
5636
+ return fullname.bump = "";
55935637 }
55945638
55955639 if (split.length == 1)
55965640 {
5597
- return "";
5641
+ return fullname.bump = "";
55985642 }
55995643
56005644 if (split.length == 2)
....@@ -5602,16 +5646,16 @@
56025646 if (fullname.name.endsWith(":"))
56035647 {
56045648 // Windows
5605
- return "";
5649
+ return fullname.bump = "";
56065650 }
56075651
5608
- return split[1];
5652
+ return fullname.bump = split[1];
56095653 }
56105654
56115655 // Windows
56125656 assert(split.length == 4);
56135657
5614
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
56155659 }
56165660
56175661 String GetPigmentTexture()
....@@ -5694,6 +5738,9 @@
56945738 texname = "";
56955739
56965740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
56975744 Touch();
56985745 }
56995746
....@@ -5766,6 +5813,8 @@
57665813 texname = "";
57675814
57685815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5816
+
5817
+ GetTextures().bump = null;
57695818
57705819 Touch();
57715820 }
....@@ -5909,8 +5958,10 @@
59095958 if (support != null)
59105959 support = support;
59115960
5912
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5913
- boolean usecalllists = false; //!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.
59145965
59155966 if (!usecalllists && bRep != null && bRep.displaylist > 0)
59165967 {
....@@ -5920,8 +5971,9 @@
59205971 // usecalllists &= !(parent instanceof RandomNode);
59215972 // usecalllists = false;
59225973
5923
- if (GetBRep() != null)
5924
- usecalllists = usecalllists;
5974
+ if (display.DrawMode() == display.SHADOW)
5975
+ //GetBRep() != null)
5976
+ usecalllists = !!usecalllists;
59255977 //System.out.println("draw " + this);
59265978 //new Exception().printStackTrace();
59275979
....@@ -5943,7 +5995,7 @@
59435995 if (!(this instanceof Composite))
59445996 touched = false;
59455997 //if (displaylist == -1 && usecalllists)
5946
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5998
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59475999 {
59486000 bRep.displaylist = display.GenList();
59496001 assert(bRep.displaylist != 0);
....@@ -5954,7 +6006,7 @@
59546006
59556007 //System.out.println("\tnew list " + list);
59566008 //gl.glDrawBuffer(gl.GL_NONE);
5957
- if (usecalllists)
6009
+ if (usecalllists && bRep.displaylist > 0)
59586010 {
59596011 // System.err.println("new list " + bRep.displaylist + " for " + this);
59606012 display.NewList(bRep.displaylist);
....@@ -5963,7 +6015,7 @@
59636015 CallList(display, root, selected, blocked);
59646016
59656017 // compiled = true;
5966
- if (usecalllists)
6018
+ if (usecalllists && bRep.displaylist > 0)
59676019 {
59686020 // System.err.println("end list " + bRep.displaylist + " for " + this);
59696021 display.EndList();
....@@ -7367,7 +7419,7 @@
73677419 boundary.y = spot.y - 30;
73687420 boundary.width = spot.width + 60;
73697421 boundary.height = spot.height + 60;
7370
- clickInfo.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
73717423 int spotw = spot.x + spot.width;
73727424 int spoth = spot.y + spot.height;
73737425 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7387,7 +7439,29 @@
73877439 // {
73887440 // CameraPane.Ymax = spoth;
73897441 // }
7390
- 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);
73917465 spotw = spot.x + spot.width;
73927466 spoth = spot.y + spot.height;
73937467 clickInfo.g.setColor(Color.cyan);
....@@ -7408,28 +7482,7 @@
74087482 // {
74097483 // CameraPane.Ymax = spoth;
74107484 // }
7411
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7412
- //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7413
- spot.translate(0, -32);
7414
- clickInfo.g.setColor(Color.yellow);
7415
- clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
74167485 clickInfo.g.setColor(Color.green);
7417
-// if (CameraPane.Xmin > spot.x)
7418
-// {
7419
-// CameraPane.Xmin = spot.x;
7420
-// }
7421
-// if (CameraPane.Xmax < spotw)
7422
-// {
7423
-// CameraPane.Xmax = spotw;
7424
-// }
7425
-// if (CameraPane.Ymin > spot.y)
7426
-// {
7427
-// CameraPane.Ymin = spot.y;
7428
-// }
7429
-// if (CameraPane.Ymax < spoth)
7430
-// {
7431
-// CameraPane.Ymax = spoth;
7432
-// }
74337486 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74347487 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74357488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7488,12 +7541,14 @@
74887541 retval = true;
74897542 }
74907543 spot.translate(0, 32);
7544
+ spot.translate(32, 0);
7545
+ spot.translate(0, 32);
74917546 if (spot.contains(clickInfo.x, clickInfo.y))
74927547 {
74937548 hitSomething = hitScale;
74947549
74957550 double scale = 0.005f * clickInfo.camera.Distance();
7496
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7551
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
74977552 double sign = 1;
74987553 if (hScale < 0)
74997554 {
....@@ -7505,7 +7560,7 @@
75057560 //hScale = 0.01;
75067561 }
75077562
7508
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7563
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75097564 sign = 1;
75107565 if (vScale < 0)
75117566 {
....@@ -7720,7 +7775,7 @@
77207775 break;
77217776
77227777 case hitScale: // scale
7723
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77247779 double sign = 1;
77257780 if (hScale < 0)
77267781 {
....@@ -7732,7 +7787,7 @@
77327787 //hScale = 0.01;
77337788 }
77347789
7735
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77367791 sign = 1;
77377792 if (vScale < 0)
77387793 {
....@@ -7765,21 +7820,27 @@
77657820 case 3: // '\001'
77667821 if (modified || opposite)
77677822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
77687826 //LA.matScale(toParent, 1, hScale, vScale);
7769
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
77707828 } // vScale, 1);
77717829 else
77727830 {
77737831 // EXCEPTION!
7774
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
77757833 } // vScale, 1);
77767834 break;
77777835
77787836 case 2: // '\002'
77797837 if (modified || opposite)
77807838 {
7781
- //LA.matScale(toParent, hScale, 1, vScale);
7782
- 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);
77837844 } else
77847845 {
77857846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7789,8 +7850,11 @@
77897850 case 1: // '\003'
77907851 if (modified || opposite)
77917852 {
7792
- //LA.matScale(toParent, hScale, vScale, 1);
7793
- 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);
77947858 } else
77957859 {
77967860 LA.matScale(toParent, totalScale, totalScale, 1);