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);
....@@ -7450,7 +7569,8 @@
74507569 } // vScale, 1);
74517570 else
74527571 {
7453
- LA.matScale(toParent, 1, totalScale, totalScale);
7572
+ // EXCEPTION!
7573
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
74547574 } // vScale, 1);
74557575 break;
74567576
....@@ -7686,6 +7806,10 @@
76867806 editWindow = null;
76877807 } // ?
76887808 }
7809
+ else
7810
+ {
7811
+ //editWindow.closeUI();
7812
+ }
76897813 }
76907814
76917815 boolean root; // patch for edit windows