Normand Briere
2019-06-23 8088590686a45e71278f9a52bb9cc37943dc0c37
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;
....@@ -2384,6 +2387,10 @@
23842387 }
23852388 */
23862389 }
2390
+ else
2391
+ {
2392
+ //((ObjEditor)editWindow).SetupUI2(null);
2393
+ }
23872394 }
23882395
23892396 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -3501,7 +3508,8 @@
35013508 if (blockloop)
35023509 return;
35033510
3504
- if (marked || (bRep != null && material != null)) // borderline...
3511
+ if (//marked || // does not make sense
3512
+ (bRep != null || material != null)) // borderline...
35053513 live = h;
35063514
35073515 for (int i = 0; i < Size(); i++)
....@@ -3522,7 +3530,8 @@
35223530 return;
35233531
35243532 //if (bRep != null)
3525
- if (marked || (bRep != null && material != null)) // borderline...
3533
+ if (//marked || // does not make sense
3534
+ (bRep != null || material != null)) // borderline...
35263535 link2master = h;
35273536
35283537 for (int i = 0; i < Size(); i++)
....@@ -3542,7 +3551,8 @@
35423551 if (blockloop)
35433552 return;
35443553
3545
- if (marked || (bRep != null && material != null)) // borderline...
3554
+ if (//marked || // does not make sense
3555
+ (bRep != null || material != null)) // borderline...
35463556 hide = h;
35473557
35483558 for (int i = 0; i < Size(); i++)
....@@ -3562,7 +3572,7 @@
35623572 if (blockloop)
35633573 return;
35643574
3565
- if (bRep != null && material != null) // borderline...
3575
+ if (bRep != null || material != null) // borderline...
35663576 marked = h;
35673577
35683578 for (int i = 0; i < Size(); i++)
....@@ -3572,6 +3582,46 @@
35723582 continue;
35733583 blockloop = true;
35743584 child.MarkLeaves(h);
3585
+ blockloop = false;
3586
+ // release(i);
3587
+ }
3588
+ }
3589
+
3590
+ void RewindLeaves(boolean h)
3591
+ {
3592
+ if (blockloop)
3593
+ return;
3594
+
3595
+ if (bRep != null || material != null) // borderline...
3596
+ rewind = h;
3597
+
3598
+ for (int i = 0; i < Size(); i++)
3599
+ {
3600
+ Object3D child = (Object3D) get(i); // reserve(i);
3601
+ if (child == null)
3602
+ continue;
3603
+ blockloop = true;
3604
+ child.RewindLeaves(h);
3605
+ blockloop = false;
3606
+ // release(i);
3607
+ }
3608
+ }
3609
+
3610
+ void RandomLeaves(boolean h)
3611
+ {
3612
+ if (blockloop)
3613
+ return;
3614
+
3615
+ if (bRep != null || material != null) // borderline...
3616
+ random = h;
3617
+
3618
+ for (int i = 0; i < Size(); i++)
3619
+ {
3620
+ Object3D child = (Object3D) get(i); // reserve(i);
3621
+ if (child == null)
3622
+ continue;
3623
+ blockloop = true;
3624
+ child.RandomLeaves(h);
35753625 blockloop = false;
35763626 // release(i);
35773627 }
....@@ -4345,6 +4395,55 @@
43454395 {
43464396 blockloop = true;
43474397 get(i).RepairShadow();
4398
+ blockloop = false;
4399
+ }
4400
+ }
4401
+
4402
+ void RepairSOV()
4403
+ {
4404
+ if (blockloop)
4405
+ return;
4406
+
4407
+ String texname = this.GetPigmentTexture();
4408
+
4409
+ if (texname.startsWith("sov"))
4410
+ {
4411
+ String[] s = texname.split("/");
4412
+
4413
+ String[] sname = s[1].split("Color.pn");
4414
+
4415
+ texname = sname[0];
4416
+
4417
+ if (sname.length > 1)
4418
+ {
4419
+ texname += "Color.jpg";
4420
+ }
4421
+
4422
+ this.SetPigmentTexture("sov/" + texname);
4423
+ }
4424
+
4425
+ texname = this.GetBumpTexture();
4426
+
4427
+ if (texname.startsWith("sov"))
4428
+ {
4429
+ String[] s = texname.split("/");
4430
+
4431
+ String[] sname = s[1].split("Bump.pn");
4432
+
4433
+ texname = sname[0];
4434
+
4435
+ if (sname.length > 1)
4436
+ {
4437
+ texname += "Bump.jpg";
4438
+ }
4439
+
4440
+ this.SetBumpTexture("sov/" + texname);
4441
+ }
4442
+
4443
+ for (int i=0; i<Size(); i++)
4444
+ {
4445
+ blockloop = true;
4446
+ get(i).RepairSOV();
43484447 blockloop = false;
43494448 }
43504449 }
....@@ -5572,12 +5671,23 @@
55725671 boolean NeedSupport()
55735672 {
55745673 return
5575
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5674
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
55765675 // PROBLEM with CROWD!!
55775676 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
55785677 }
55795678
55805679 static boolean DEBUG_SELECTION = false;
5680
+
5681
+ boolean IsLive()
5682
+ {
5683
+ if (live)
5684
+ return true;
5685
+
5686
+ if (parent == null)
5687
+ return false;
5688
+
5689
+ return parent.IsLive();
5690
+ }
55815691
55825692 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
55835693 {
....@@ -5640,7 +5750,7 @@
56405750 support = support;
56415751
56425752 //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);
5753
+ boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
56445754
56455755 if (!usecalllists && bRep != null && bRep.displaylist > 0)
56465756 {
....@@ -5660,10 +5770,12 @@
56605770 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56615771
56625772 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5663
- (touched || (bRep != null && bRep.displaylist <= 0)))
5773
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5774
+ (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
56645775 {
56655776 Globals.lighttouched = true;
56665777 } // all panes...
5778
+
56675779 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56685780 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56695781 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5831,16 +5943,27 @@
58315943 tex = GetTextures();
58325944 }
58335945
5834
- boolean failed = false;
5946
+ boolean failedPigment = false;
5947
+ boolean failedBump = false;
58355948
58365949 try
58375950 {
5838
- display.BindTextures(tex, texres);
5951
+ display.BindPigmentTexture(tex, texres);
58395952 }
58405953 catch (Exception e)
58415954 {
58425955 System.err.println("FAILED: " + this);
5843
- failed = true;
5956
+ failedPigment = true;
5957
+ }
5958
+
5959
+ try
5960
+ {
5961
+ display.BindBumpTexture(tex, texres);
5962
+ }
5963
+ catch (Exception e)
5964
+ {
5965
+ //System.err.println("FAILED: " + this);
5966
+ failedBump = true;
58445967 }
58455968
58465969 if (!compiled)
....@@ -5863,8 +5986,11 @@
58635986 }
58645987 }
58655988
5866
- if (!failed)
5867
- display.ReleaseTextures(tex);
5989
+ if (!failedBump)
5990
+ display.ReleaseBumpTexture(tex);
5991
+
5992
+ if (!failedPigment)
5993
+ display.ReleasePigmentTexture(tex);
58685994
58695995 display.PopMaterial(this, selected);
58705996 }
....@@ -6237,6 +6363,11 @@
62376363 // dec 2012
62386364 new Exception().printStackTrace();
62396365 return;
6366
+ }
6367
+
6368
+ if (dontselect)
6369
+ {
6370
+ //bRep.GenerateNormalsMINE();
62406371 }
62416372
62426373 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7089,7 +7220,7 @@
70897220 spot.translate(32, 32);
70907221 spotw = spot.x + spot.width;
70917222 spoth = spot.y + spot.height;
7092
- info.g.setColor(Color.blue);
7223
+ info.g.setColor(Color.cyan);
70937224 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70947225 // if (CameraPane.Xmin > spot.x)
70957226 // {
....@@ -7107,11 +7238,12 @@
71077238 // {
71087239 // CameraPane.Ymax = spoth;
71097240 // }
7110
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7111
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7241
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7242
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
71127243 spot.translate(0, -32);
7113
- info.g.setColor(Color.green);
7244
+ info.g.setColor(Color.yellow);
71147245 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7246
+ info.g.setColor(Color.green);
71157247 // if (CameraPane.Xmin > spot.x)
71167248 // {
71177249 // CameraPane.Xmin = spot.x;
....@@ -7429,19 +7561,20 @@
74297561 switch (info.pane.RenderCamera().viewCode)
74307562 {
74317563 case 3: // '\001'
7432
- if (modified)
7564
+ if (modified || opposite)
74337565 {
74347566 //LA.matScale(toParent, 1, hScale, vScale);
74357567 LA.matScale(toParent, totalScale, 1, 1);
74367568 } // vScale, 1);
74377569 else
74387570 {
7571
+ // EXCEPTION!
74397572 LA.matScale(toParent, totalScale, totalScale, totalScale);
74407573 } // vScale, 1);
74417574 break;
74427575
74437576 case 2: // '\002'
7444
- if (modified)
7577
+ if (modified || opposite)
74457578 {
74467579 //LA.matScale(toParent, hScale, 1, vScale);
74477580 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7452,7 +7585,7 @@
74527585 break;
74537586
74547587 case 1: // '\003'
7455
- if (modified)
7588
+ if (modified || opposite)
74567589 {
74577590 //LA.matScale(toParent, hScale, vScale, 1);
74587591 LA.matScale(toParent, 1, 1, totalScale);
....@@ -7672,6 +7805,10 @@
76727805 editWindow = null;
76737806 } // ?
76747807 }
7808
+ else
7809
+ {
7810
+ //editWindow.closeUI();
7811
+ }
76757812 }
76767813
76777814 boolean root; // patch for edit windows