Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
Object3D.java
....@@ -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;
....@@ -3503,7 +3504,8 @@
35033504 if (blockloop)
35043505 return;
35053506
3506
- if (marked || (bRep != null && material != null)) // borderline...
3507
+ if (//marked || // does not make sense
3508
+ (bRep != null || material != null)) // borderline...
35073509 live = h;
35083510
35093511 for (int i = 0; i < Size(); i++)
....@@ -3524,7 +3526,8 @@
35243526 return;
35253527
35263528 //if (bRep != null)
3527
- if (marked || (bRep != null && material != null)) // borderline...
3529
+ if (//marked || // does not make sense
3530
+ (bRep != null || material != null)) // borderline...
35283531 link2master = h;
35293532
35303533 for (int i = 0; i < Size(); i++)
....@@ -3544,7 +3547,8 @@
35443547 if (blockloop)
35453548 return;
35463549
3547
- if (marked || (bRep != null && material != null)) // borderline...
3550
+ if (//marked || // does not make sense
3551
+ (bRep != null || material != null)) // borderline...
35483552 hide = h;
35493553
35503554 for (int i = 0; i < Size(); i++)
....@@ -3564,7 +3568,7 @@
35643568 if (blockloop)
35653569 return;
35663570
3567
- if (bRep != null && material != null) // borderline...
3571
+ if (bRep != null || material != null) // borderline...
35683572 marked = h;
35693573
35703574 for (int i = 0; i < Size(); i++)
....@@ -3574,6 +3578,46 @@
35743578 continue;
35753579 blockloop = true;
35763580 child.MarkLeaves(h);
3581
+ blockloop = false;
3582
+ // release(i);
3583
+ }
3584
+ }
3585
+
3586
+ void RewindLeaves(boolean h)
3587
+ {
3588
+ if (blockloop)
3589
+ return;
3590
+
3591
+ if (bRep != null || material != null) // borderline...
3592
+ rewind = h;
3593
+
3594
+ for (int i = 0; i < Size(); i++)
3595
+ {
3596
+ Object3D child = (Object3D) get(i); // reserve(i);
3597
+ if (child == null)
3598
+ continue;
3599
+ blockloop = true;
3600
+ child.RewindLeaves(h);
3601
+ blockloop = false;
3602
+ // release(i);
3603
+ }
3604
+ }
3605
+
3606
+ void RandomLeaves(boolean h)
3607
+ {
3608
+ if (blockloop)
3609
+ return;
3610
+
3611
+ if (bRep != null || material != null) // borderline...
3612
+ random = h;
3613
+
3614
+ for (int i = 0; i < Size(); i++)
3615
+ {
3616
+ Object3D child = (Object3D) get(i); // reserve(i);
3617
+ if (child == null)
3618
+ continue;
3619
+ blockloop = true;
3620
+ child.RandomLeaves(h);
35773621 blockloop = false;
35783622 // release(i);
35793623 }
....@@ -4347,6 +4391,55 @@
43474391 {
43484392 blockloop = true;
43494393 get(i).RepairShadow();
4394
+ blockloop = false;
4395
+ }
4396
+ }
4397
+
4398
+ void RepairSOV()
4399
+ {
4400
+ if (blockloop)
4401
+ return;
4402
+
4403
+ String texname = this.GetPigmentTexture();
4404
+
4405
+ if (texname.startsWith("sov"))
4406
+ {
4407
+ String[] s = texname.split("/");
4408
+
4409
+ String[] sname = s[1].split("Color.pn");
4410
+
4411
+ texname = sname[0];
4412
+
4413
+ if (sname.length > 1)
4414
+ {
4415
+ texname += "Color.jpg";
4416
+ }
4417
+
4418
+ this.SetPigmentTexture("sov/" + texname);
4419
+ }
4420
+
4421
+ texname = this.GetBumpTexture();
4422
+
4423
+ if (texname.startsWith("sov"))
4424
+ {
4425
+ String[] s = texname.split("/");
4426
+
4427
+ String[] sname = s[1].split("Bump.pn");
4428
+
4429
+ texname = sname[0];
4430
+
4431
+ if (sname.length > 1)
4432
+ {
4433
+ texname += "Bump.jpg";
4434
+ }
4435
+
4436
+ this.SetBumpTexture("sov/" + texname);
4437
+ }
4438
+
4439
+ for (int i=0; i<Size(); i++)
4440
+ {
4441
+ blockloop = true;
4442
+ get(i).RepairSOV();
43504443 blockloop = false;
43514444 }
43524445 }
....@@ -5846,16 +5939,27 @@
58465939 tex = GetTextures();
58475940 }
58485941
5849
- boolean failed = false;
5942
+ boolean failedPigment = false;
5943
+ boolean failedBump = false;
58505944
58515945 try
58525946 {
5853
- display.BindTextures(tex, texres);
5947
+ display.BindPigmentTexture(tex, texres);
58545948 }
58555949 catch (Exception e)
58565950 {
58575951 System.err.println("FAILED: " + this);
5858
- failed = true;
5952
+ failedPigment = true;
5953
+ }
5954
+
5955
+ try
5956
+ {
5957
+ display.BindBumpTexture(tex, texres);
5958
+ }
5959
+ catch (Exception e)
5960
+ {
5961
+ //System.err.println("FAILED: " + this);
5962
+ failedBump = true;
58595963 }
58605964
58615965 if (!compiled)
....@@ -5878,8 +5982,11 @@
58785982 }
58795983 }
58805984
5881
- if (!failed)
5882
- display.ReleaseTextures(tex);
5985
+ if (!failedBump)
5986
+ display.ReleaseBumpTexture(tex);
5987
+
5988
+ if (!failedPigment)
5989
+ display.ReleasePigmentTexture(tex);
58835990
58845991 display.PopMaterial(this, selected);
58855992 }