Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
Object3D.java
....@@ -881,7 +881,7 @@
881881
882882 if (marked && Globals.isLIVE() && live &&
883883 //TEMP21aug2018
884
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
884
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
885885 currentframe != Globals.framecount)
886886 {
887887 currentframe = Globals.framecount;
....@@ -893,7 +893,8 @@
893893
894894 boolean changedir = random && Math.random() < 0.01; // && !link2master;
895895
896
- if (transformcount*factor > maxcount || (step == 1 && changedir))
896
+ if (transformcount*factor >= maxcount && (rewind || random) ||
897
+ (step == 1 && changedir))
897898 {
898899 countdown = 1;
899900 delay = speedup?8:1;
....@@ -965,6 +966,7 @@
965966 if (material == null || material.multiply)
966967 return true;
967968
969
+ // Transparent objects are dynamic because we have to sort the triangles.
968970 return material.opacity > 0.99;
969971 }
970972
....@@ -2386,6 +2388,10 @@
23862388 }
23872389 */
23882390 }
2391
+ else
2392
+ {
2393
+ //((ObjEditor)editWindow).SetupUI2(null);
2394
+ }
23892395 }
23902396
23912397 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -3503,7 +3509,8 @@
35033509 if (blockloop)
35043510 return;
35053511
3506
- if (marked || (bRep != null && material != null)) // borderline...
3512
+ if (//marked || // does not make sense
3513
+ (bRep != null || material != null)) // borderline...
35073514 live = h;
35083515
35093516 for (int i = 0; i < Size(); i++)
....@@ -3524,7 +3531,8 @@
35243531 return;
35253532
35263533 //if (bRep != null)
3527
- if (marked || (bRep != null && material != null)) // borderline...
3534
+ if (//marked || // does not make sense
3535
+ (bRep != null || material != null)) // borderline...
35283536 link2master = h;
35293537
35303538 for (int i = 0; i < Size(); i++)
....@@ -3544,7 +3552,8 @@
35443552 if (blockloop)
35453553 return;
35463554
3547
- if (marked || (bRep != null && material != null)) // borderline...
3555
+ if (//marked || // does not make sense
3556
+ (bRep != null || material != null)) // borderline...
35483557 hide = h;
35493558
35503559 for (int i = 0; i < Size(); i++)
....@@ -3564,7 +3573,7 @@
35643573 if (blockloop)
35653574 return;
35663575
3567
- if (bRep != null && material != null) // borderline...
3576
+ if (bRep != null || material != null) // borderline...
35683577 marked = h;
35693578
35703579 for (int i = 0; i < Size(); i++)
....@@ -3574,6 +3583,46 @@
35743583 continue;
35753584 blockloop = true;
35763585 child.MarkLeaves(h);
3586
+ blockloop = false;
3587
+ // release(i);
3588
+ }
3589
+ }
3590
+
3591
+ void RewindLeaves(boolean h)
3592
+ {
3593
+ if (blockloop)
3594
+ return;
3595
+
3596
+ if (bRep != null || material != null) // borderline...
3597
+ rewind = h;
3598
+
3599
+ for (int i = 0; i < Size(); i++)
3600
+ {
3601
+ Object3D child = (Object3D) get(i); // reserve(i);
3602
+ if (child == null)
3603
+ continue;
3604
+ blockloop = true;
3605
+ child.RewindLeaves(h);
3606
+ blockloop = false;
3607
+ // release(i);
3608
+ }
3609
+ }
3610
+
3611
+ void RandomLeaves(boolean h)
3612
+ {
3613
+ if (blockloop)
3614
+ return;
3615
+
3616
+ if (bRep != null || material != null) // borderline...
3617
+ random = h;
3618
+
3619
+ for (int i = 0; i < Size(); i++)
3620
+ {
3621
+ Object3D child = (Object3D) get(i); // reserve(i);
3622
+ if (child == null)
3623
+ continue;
3624
+ blockloop = true;
3625
+ child.RandomLeaves(h);
35773626 blockloop = false;
35783627 // release(i);
35793628 }
....@@ -4347,6 +4396,55 @@
43474396 {
43484397 blockloop = true;
43494398 get(i).RepairShadow();
4399
+ blockloop = false;
4400
+ }
4401
+ }
4402
+
4403
+ void RepairSOV()
4404
+ {
4405
+ if (blockloop)
4406
+ return;
4407
+
4408
+ String texname = this.GetPigmentTexture();
4409
+
4410
+ if (texname.startsWith("sov"))
4411
+ {
4412
+ String[] s = texname.split("/");
4413
+
4414
+ String[] sname = s[1].split("Color.pn");
4415
+
4416
+ texname = sname[0];
4417
+
4418
+ if (sname.length > 1)
4419
+ {
4420
+ texname += "Color.jpg";
4421
+ }
4422
+
4423
+ this.SetPigmentTexture("sov/" + texname);
4424
+ }
4425
+
4426
+ texname = this.GetBumpTexture();
4427
+
4428
+ if (texname.startsWith("sov"))
4429
+ {
4430
+ String[] s = texname.split("/");
4431
+
4432
+ String[] sname = s[1].split("Bump.pn");
4433
+
4434
+ texname = sname[0];
4435
+
4436
+ if (sname.length > 1)
4437
+ {
4438
+ texname += "Bump.jpg";
4439
+ }
4440
+
4441
+ this.SetBumpTexture("sov/" + texname);
4442
+ }
4443
+
4444
+ for (int i=0; i<Size(); i++)
4445
+ {
4446
+ blockloop = true;
4447
+ get(i).RepairSOV();
43504448 blockloop = false;
43514449 }
43524450 }
....@@ -5653,7 +5751,7 @@
56535751 support = support;
56545752
56555753 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5656
- boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5754
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
56575755
56585756 if (!usecalllists && bRep != null && bRep.displaylist > 0)
56595757 {
....@@ -5673,10 +5771,12 @@
56735771 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56745772
56755773 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5676
- (touched || (bRep != null && bRep.displaylist <= 0)))
5774
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5775
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0)))
56775776 {
56785777 Globals.lighttouched = true;
56795778 } // all panes...
5779
+
56805780 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56815781 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56825782 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5844,16 +5944,27 @@
58445944 tex = GetTextures();
58455945 }
58465946
5847
- boolean failed = false;
5947
+ boolean failedPigment = false;
5948
+ boolean failedBump = false;
58485949
58495950 try
58505951 {
5851
- display.BindTextures(tex, texres);
5952
+ display.BindPigmentTexture(tex, texres);
58525953 }
58535954 catch (Exception e)
58545955 {
58555956 System.err.println("FAILED: " + this);
5856
- failed = true;
5957
+ failedPigment = true;
5958
+ }
5959
+
5960
+ try
5961
+ {
5962
+ display.BindBumpTexture(tex, texres);
5963
+ }
5964
+ catch (Exception e)
5965
+ {
5966
+ //System.err.println("FAILED: " + this);
5967
+ failedBump = true;
58575968 }
58585969
58595970 if (!compiled)
....@@ -5876,8 +5987,11 @@
58765987 }
58775988 }
58785989
5879
- if (!failed)
5880
- display.ReleaseTextures(tex);
5990
+ if (!failedBump)
5991
+ display.ReleaseBumpTexture(tex);
5992
+
5993
+ if (!failedPigment)
5994
+ display.ReleasePigmentTexture(tex);
58815995
58825996 display.PopMaterial(this, selected);
58835997 }
....@@ -6250,6 +6364,11 @@
62506364 // dec 2012
62516365 new Exception().printStackTrace();
62526366 return;
6367
+ }
6368
+
6369
+ if (dontselect)
6370
+ {
6371
+ //bRep.GenerateNormalsMINE();
62536372 }
62546373
62556374 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7102,7 +7221,7 @@
71027221 spot.translate(32, 32);
71037222 spotw = spot.x + spot.width;
71047223 spoth = spot.y + spot.height;
7105
- info.g.setColor(Color.blue);
7224
+ info.g.setColor(Color.cyan);
71067225 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
71077226 // if (CameraPane.Xmin > spot.x)
71087227 // {
....@@ -7120,11 +7239,12 @@
71207239 // {
71217240 // CameraPane.Ymax = spoth;
71227241 // }
7123
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7124
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7242
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7243
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
71257244 spot.translate(0, -32);
7126
- info.g.setColor(Color.green);
7245
+ info.g.setColor(Color.yellow);
71277246 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7247
+ info.g.setColor(Color.green);
71287248 // if (CameraPane.Xmin > spot.x)
71297249 // {
71307250 // CameraPane.Xmin = spot.x;
....@@ -7442,19 +7562,20 @@
74427562 switch (info.pane.RenderCamera().viewCode)
74437563 {
74447564 case 3: // '\001'
7445
- if (modified)
7565
+ if (modified || opposite)
74467566 {
74477567 //LA.matScale(toParent, 1, hScale, vScale);
74487568 LA.matScale(toParent, totalScale, 1, 1);
74497569 } // vScale, 1);
74507570 else
74517571 {
7572
+ // EXCEPTION!
74527573 LA.matScale(toParent, totalScale, totalScale, totalScale);
74537574 } // vScale, 1);
74547575 break;
74557576
74567577 case 2: // '\002'
7457
- if (modified)
7578
+ if (modified || opposite)
74587579 {
74597580 //LA.matScale(toParent, hScale, 1, vScale);
74607581 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7465,7 +7586,7 @@
74657586 break;
74667587
74677588 case 1: // '\003'
7468
- if (modified)
7589
+ if (modified || opposite)
74697590 {
74707591 //LA.matScale(toParent, hScale, vScale, 1);
74717592 LA.matScale(toParent, 1, 1, totalScale);
....@@ -7685,6 +7806,10 @@
76857806 editWindow = null;
76867807 } // ?
76877808 }
7809
+ else
7810
+ {
7811
+ //editWindow.closeUI();
7812
+ }
76887813 }
76897814
76907815 boolean root; // patch for edit windows