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 }
....@@ -5673,10 +5766,12 @@
56735766 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56745767
56755768 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5676
- (touched || (bRep != null && bRep.displaylist <= 0)))
5769
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5770
+ (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
56775771 {
56785772 Globals.lighttouched = true;
56795773 } // all panes...
5774
+
56805775 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56815776 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56825777 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5844,16 +5939,27 @@
58445939 tex = GetTextures();
58455940 }
58465941
5847
- boolean failed = false;
5942
+ boolean failedPigment = false;
5943
+ boolean failedBump = false;
58485944
58495945 try
58505946 {
5851
- display.BindTextures(tex, texres);
5947
+ display.BindPigmentTexture(tex, texres);
58525948 }
58535949 catch (Exception e)
58545950 {
58555951 System.err.println("FAILED: " + this);
5856
- 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;
58575963 }
58585964
58595965 if (!compiled)
....@@ -5876,8 +5982,11 @@
58765982 }
58775983 }
58785984
5879
- if (!failed)
5880
- display.ReleaseTextures(tex);
5985
+ if (!failedBump)
5986
+ display.ReleaseBumpTexture(tex);
5987
+
5988
+ if (!failedPigment)
5989
+ display.ReleasePigmentTexture(tex);
58815990
58825991 display.PopMaterial(this, selected);
58835992 }
....@@ -7102,7 +7211,7 @@
71027211 spot.translate(32, 32);
71037212 spotw = spot.x + spot.width;
71047213 spoth = spot.y + spot.height;
7105
- info.g.setColor(Color.blue);
7214
+ info.g.setColor(Color.cyan);
71067215 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
71077216 // if (CameraPane.Xmin > spot.x)
71087217 // {
....@@ -7120,11 +7229,12 @@
71207229 // {
71217230 // CameraPane.Ymax = spoth;
71227231 // }
7123
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7124
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7232
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7233
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
71257234 spot.translate(0, -32);
7126
- info.g.setColor(Color.green);
7235
+ info.g.setColor(Color.yellow);
71277236 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7237
+ info.g.setColor(Color.green);
71287238 // if (CameraPane.Xmin > spot.x)
71297239 // {
71307240 // CameraPane.Xmin = spot.x;
....@@ -7442,19 +7552,20 @@
74427552 switch (info.pane.RenderCamera().viewCode)
74437553 {
74447554 case 3: // '\001'
7445
- if (modified)
7555
+ if (modified || opposite)
74467556 {
74477557 //LA.matScale(toParent, 1, hScale, vScale);
74487558 LA.matScale(toParent, totalScale, 1, 1);
74497559 } // vScale, 1);
74507560 else
74517561 {
7562
+ // EXCEPTION!
74527563 LA.matScale(toParent, totalScale, totalScale, totalScale);
74537564 } // vScale, 1);
74547565 break;
74557566
74567567 case 2: // '\002'
7457
- if (modified)
7568
+ if (modified || opposite)
74587569 {
74597570 //LA.matScale(toParent, hScale, 1, vScale);
74607571 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7465,7 +7576,7 @@
74657576 break;
74667577
74677578 case 1: // '\003'
7468
- if (modified)
7579
+ if (modified || opposite)
74697580 {
74707581 //LA.matScale(toParent, hScale, vScale, 1);
74717582 LA.matScale(toParent, 1, 1, totalScale);