Normand Briere
2019-08-15 24a2a946b35279605e645349bd6b82e9e60aac88
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,7 +33,7 @@
3233 String skyboxname;
3334 String skyboxext;
3435
35
- byte[] versions[];
36
+ Object3D versionlist[];
3637 int versionindex = -1;
3738
3839 ScriptNode scriptnode;
....@@ -222,7 +223,7 @@
222223 // o.bRep.support = null;
223224 // }
224225 o.selection = this.selection;
225
- o.versions = this.versions;
226
+ o.versionlist = this.versionlist;
226227 o.versionindex = this.versionindex;
227228
228229 if (this.support != null)
....@@ -245,6 +246,29 @@
245246 // this.support = null;
246247 // this.fileparent = null;
247248 }
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
+// }
248272
249273 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
250274 {
....@@ -280,7 +304,7 @@
280304
281305 this.selection = o.selection;
282306
283
- this.versions = o.versions;
307
+ this.versionlist = o.versionlist;
284308 this.versionindex = o.versionindex;
285309 // July 2019 if (this.bRep != null)
286310 // this.bRep.support = o.transientrep;
....@@ -1014,6 +1038,9 @@
10141038
10151039 if (material == null || material.multiply)
10161040 return true;
1041
+
1042
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1043
+ return false;
10171044
10181045 // Transparent objects are dynamic because we have to sort the triangles.
10191046 return material.opacity > 0.99;
....@@ -2441,6 +2468,11 @@
24412468 else
24422469 {
24432470 //((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");
24442476 }
24452477 }
24462478
....@@ -5542,6 +5574,11 @@
55425574 if (fullname == null)
55435575 return "";
55445576
5577
+ if (fullname.pigment != null)
5578
+ {
5579
+ return fullname.pigment;
5580
+ }
5581
+
55455582 // System.out.println("Fullname = " + fullname);
55465583
55475584 // Does not work on Windows due to C:
....@@ -5554,7 +5591,7 @@
55545591
55555592 if (split.length == 0)
55565593 {
5557
- return "";
5594
+ return fullname.pigment = "";
55585595 }
55595596
55605597 if (split.length <= 2)
....@@ -5562,22 +5599,27 @@
55625599 if (fullname.name.endsWith(":"))
55635600 {
55645601 // Windows
5565
- return fullname.name.substring(0, fullname.name.length()-1);
5602
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55665603 }
55675604
5568
- return split[0];
5605
+ return fullname.pigment = split[0];
55695606 }
55705607
55715608 // Windows
55725609 assert(split.length == 4);
55735610
5574
- return split[0] + ":" + split[1];
5611
+ return fullname.pigment = split[0] + ":" + split[1];
55755612 }
55765613
55775614 static String GetBump(cTexture fullname)
55785615 {
55795616 if (fullname == null)
55805617 return "";
5618
+
5619
+ if (fullname.bump != null)
5620
+ {
5621
+ return fullname.bump;
5622
+ }
55815623
55825624 // System.out.println("Fullname = " + fullname);
55835625 // Does not work on Windows due to C:
....@@ -5589,12 +5631,12 @@
55895631
55905632 if (split.length == 0)
55915633 {
5592
- return "";
5634
+ return fullname.bump = "";
55935635 }
55945636
55955637 if (split.length == 1)
55965638 {
5597
- return "";
5639
+ return fullname.bump = "";
55985640 }
55995641
56005642 if (split.length == 2)
....@@ -5602,16 +5644,16 @@
56025644 if (fullname.name.endsWith(":"))
56035645 {
56045646 // Windows
5605
- return "";
5647
+ return fullname.bump = "";
56065648 }
56075649
5608
- return split[1];
5650
+ return fullname.bump = split[1];
56095651 }
56105652
56115653 // Windows
56125654 assert(split.length == 4);
56135655
5614
- return split[2] + ":" + split[3];
5656
+ return fullname.bump = split[2] + ":" + split[3];
56155657 }
56165658
56175659 String GetPigmentTexture()
....@@ -5694,6 +5736,9 @@
56945736 texname = "";
56955737
56965738 GetTextures().name = texname + ":" + GetBump(GetTextures());
5739
+
5740
+ GetTextures().pigment = null;
5741
+
56975742 Touch();
56985743 }
56995744
....@@ -5766,6 +5811,8 @@
57665811 texname = "";
57675812
57685813 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5814
+
5815
+ GetTextures().bump = null;
57695816
57705817 Touch();
57715818 }
....@@ -5909,8 +5956,10 @@
59095956 if (support != null)
59105957 support = support;
59115958
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);
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.
59145963
59155964 if (!usecalllists && bRep != null && bRep.displaylist > 0)
59165965 {
....@@ -5920,8 +5969,9 @@
59205969 // usecalllists &= !(parent instanceof RandomNode);
59215970 // usecalllists = false;
59225971
5923
- if (GetBRep() != null)
5924
- usecalllists = usecalllists;
5972
+ if (display.DrawMode() == display.SHADOW)
5973
+ //GetBRep() != null)
5974
+ usecalllists = !!usecalllists;
59255975 //System.out.println("draw " + this);
59265976 //new Exception().printStackTrace();
59275977
....@@ -5943,7 +5993,7 @@
59435993 if (!(this instanceof Composite))
59445994 touched = false;
59455995 //if (displaylist == -1 && usecalllists)
5946
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5996
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
59475997 {
59485998 bRep.displaylist = display.GenList();
59495999 assert(bRep.displaylist != 0);
....@@ -5954,7 +6004,7 @@
59546004
59556005 //System.out.println("\tnew list " + list);
59566006 //gl.glDrawBuffer(gl.GL_NONE);
5957
- if (usecalllists)
6007
+ if (usecalllists && bRep.displaylist > 0)
59586008 {
59596009 // System.err.println("new list " + bRep.displaylist + " for " + this);
59606010 display.NewList(bRep.displaylist);
....@@ -5963,7 +6013,7 @@
59636013 CallList(display, root, selected, blocked);
59646014
59656015 // compiled = true;
5966
- if (usecalllists)
6016
+ if (usecalllists && bRep.displaylist > 0)
59676017 {
59686018 // System.err.println("end list " + bRep.displaylist + " for " + this);
59696019 display.EndList();
....@@ -7387,7 +7437,29 @@
73877437 // {
73887438 // CameraPane.Ymax = spoth;
73897439 // }
7390
- 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);
73917463 spotw = spot.x + spot.width;
73927464 spoth = spot.y + spot.height;
73937465 clickInfo.g.setColor(Color.cyan);
....@@ -7408,28 +7480,7 @@
74087480 // {
74097481 // CameraPane.Ymax = spoth;
74107482 // }
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);
74167483 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
-// }
74337484 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74347485 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74357486 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7488,12 +7539,14 @@
74887539 retval = true;
74897540 }
74907541 spot.translate(0, 32);
7542
+ spot.translate(32, 0);
7543
+ spot.translate(0, 32);
74917544 if (spot.contains(clickInfo.x, clickInfo.y))
74927545 {
74937546 hitSomething = hitScale;
74947547
74957548 double scale = 0.005f * clickInfo.camera.Distance();
7496
- double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
7549
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
74977550 double sign = 1;
74987551 if (hScale < 0)
74997552 {
....@@ -7505,7 +7558,7 @@
75057558 //hScale = 0.01;
75067559 }
75077560
7508
- double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
7561
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75097562 sign = 1;
75107563 if (vScale < 0)
75117564 {
....@@ -7720,7 +7773,7 @@
77207773 break;
77217774
77227775 case hitScale: // scale
7723
- double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
7776
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77247777 double sign = 1;
77257778 if (hScale < 0)
77267779 {
....@@ -7732,7 +7785,7 @@
77327785 //hScale = 0.01;
77337786 }
77347787
7735
- double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
7788
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77367789 sign = 1;
77377790 if (vScale < 0)
77387791 {