Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
Object3D.java
....@@ -174,7 +174,7 @@
174174 {
175175 Object3D o = hashtable.get(GetUUID());
176176
177
- assert(this.bRep == o.bRep);
177
+ Grafreed.Assert(this.bRep == o.bRep);
178178 if (this.bRep != null)
179179 assert(this.bRep.support == o.transientrep);
180180
....@@ -563,12 +563,14 @@
563563 toParent = LA.newMatrix();
564564 fromParent = LA.newMatrix();
565565 }
566
+
566567 if (toParentMarked == null)
567568 {
568569 if (maxcount != 1)
569570 {
570571 new Exception().printStackTrace();
571572 }
573
+
572574 toParentMarked = LA.newMatrix();
573575 fromParentMarked = LA.newMatrix();
574576 }
....@@ -891,7 +893,8 @@
891893
892894 boolean changedir = random && Math.random() < 0.01; // && !link2master;
893895
894
- if (transformcount*factor > maxcount || (step == 1 && changedir))
896
+ if (transformcount*factor >= maxcount && (rewind || random) ||
897
+ (step == 1 && changedir))
895898 {
896899 countdown = 1;
897900 delay = speedup?8:1;
....@@ -3501,7 +3504,8 @@
35013504 if (blockloop)
35023505 return;
35033506
3504
- if (marked || (bRep != null && material != null)) // borderline...
3507
+ if (//marked || // does not make sense
3508
+ (bRep != null || material != null)) // borderline...
35053509 live = h;
35063510
35073511 for (int i = 0; i < Size(); i++)
....@@ -3522,7 +3526,8 @@
35223526 return;
35233527
35243528 //if (bRep != null)
3525
- if (marked || (bRep != null && material != null)) // borderline...
3529
+ if (//marked || // does not make sense
3530
+ (bRep != null || material != null)) // borderline...
35263531 link2master = h;
35273532
35283533 for (int i = 0; i < Size(); i++)
....@@ -3542,7 +3547,8 @@
35423547 if (blockloop)
35433548 return;
35443549
3545
- if (marked || (bRep != null && material != null)) // borderline...
3550
+ if (//marked || // does not make sense
3551
+ (bRep != null || material != null)) // borderline...
35463552 hide = h;
35473553
35483554 for (int i = 0; i < Size(); i++)
....@@ -3562,7 +3568,7 @@
35623568 if (blockloop)
35633569 return;
35643570
3565
- if (bRep != null && material != null) // borderline...
3571
+ if (bRep != null || material != null) // borderline...
35663572 marked = h;
35673573
35683574 for (int i = 0; i < Size(); i++)
....@@ -3572,6 +3578,46 @@
35723578 continue;
35733579 blockloop = true;
35743580 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);
35753621 blockloop = false;
35763622 // release(i);
35773623 }
....@@ -4345,6 +4391,55 @@
43454391 {
43464392 blockloop = true;
43474393 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();
43484443 blockloop = false;
43494444 }
43504445 }
....@@ -5572,12 +5667,23 @@
55725667 boolean NeedSupport()
55735668 {
55745669 return
5575
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5670
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
55765671 // PROBLEM with CROWD!!
55775672 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
55785673 }
55795674
55805675 static boolean DEBUG_SELECTION = false;
5676
+
5677
+ boolean IsLive()
5678
+ {
5679
+ if (live)
5680
+ return true;
5681
+
5682
+ if (parent == null)
5683
+ return false;
5684
+
5685
+ return parent.IsLive();
5686
+ }
55815687
55825688 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
55835689 {
....@@ -5640,7 +5746,7 @@
56405746 support = support;
56415747
56425748 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5643
- boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5749
+ boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
56445750
56455751 if (!usecalllists && bRep != null && bRep.displaylist > 0)
56465752 {
....@@ -5660,10 +5766,12 @@
56605766 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56615767
56625768 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5663
- (touched || (bRep != null && bRep.displaylist <= 0)))
5769
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5770
+ (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
56645771 {
56655772 Globals.lighttouched = true;
56665773 } // all panes...
5774
+
56675775 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56685776 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56695777 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5831,16 +5939,27 @@
58315939 tex = GetTextures();
58325940 }
58335941
5834
- boolean failed = false;
5942
+ boolean failedPigment = false;
5943
+ boolean failedBump = false;
58355944
58365945 try
58375946 {
5838
- display.BindTextures(tex, texres);
5947
+ display.BindPigmentTexture(tex, texres);
58395948 }
58405949 catch (Exception e)
58415950 {
58425951 System.err.println("FAILED: " + this);
5843
- 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;
58445963 }
58455964
58465965 if (!compiled)
....@@ -5863,8 +5982,11 @@
58635982 }
58645983 }
58655984
5866
- if (!failed)
5867
- display.ReleaseTextures(tex);
5985
+ if (!failedBump)
5986
+ display.ReleaseBumpTexture(tex);
5987
+
5988
+ if (!failedPigment)
5989
+ display.ReleasePigmentTexture(tex);
58685990
58695991 display.PopMaterial(this, selected);
58705992 }
....@@ -7089,7 +7211,7 @@
70897211 spot.translate(32, 32);
70907212 spotw = spot.x + spot.width;
70917213 spoth = spot.y + spot.height;
7092
- info.g.setColor(Color.blue);
7214
+ info.g.setColor(Color.cyan);
70937215 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70947216 // if (CameraPane.Xmin > spot.x)
70957217 // {
....@@ -7107,11 +7229,12 @@
71077229 // {
71087230 // CameraPane.Ymax = spoth;
71097231 // }
7110
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7111
- //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
71127234 spot.translate(0, -32);
7113
- info.g.setColor(Color.green);
7235
+ info.g.setColor(Color.yellow);
71147236 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7237
+ info.g.setColor(Color.green);
71157238 // if (CameraPane.Xmin > spot.x)
71167239 // {
71177240 // CameraPane.Xmin = spot.x;
....@@ -7429,19 +7552,20 @@
74297552 switch (info.pane.RenderCamera().viewCode)
74307553 {
74317554 case 3: // '\001'
7432
- if (modified)
7555
+ if (modified || opposite)
74337556 {
74347557 //LA.matScale(toParent, 1, hScale, vScale);
74357558 LA.matScale(toParent, totalScale, 1, 1);
74367559 } // vScale, 1);
74377560 else
74387561 {
7562
+ // EXCEPTION!
74397563 LA.matScale(toParent, totalScale, totalScale, totalScale);
74407564 } // vScale, 1);
74417565 break;
74427566
74437567 case 2: // '\002'
7444
- if (modified)
7568
+ if (modified || opposite)
74457569 {
74467570 //LA.matScale(toParent, hScale, 1, vScale);
74477571 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7452,7 +7576,7 @@
74527576 break;
74537577
74547578 case 1: // '\003'
7455
- if (modified)
7579
+ if (modified || opposite)
74567580 {
74577581 //LA.matScale(toParent, hScale, vScale, 1);
74587582 LA.matScale(toParent, 1, 1, totalScale);