Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
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 }
....@@ -879,7 +881,7 @@
879881
880882 if (marked && Globals.isLIVE() && live &&
881883 //TEMP21aug2018
882
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
884
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
883885 currentframe != Globals.framecount)
884886 {
885887 currentframe = Globals.framecount;
....@@ -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;
....@@ -963,6 +966,7 @@
963966 if (material == null || material.multiply)
964967 return true;
965968
969
+ // Transparent objects are dynamic because we have to sort the triangles.
966970 return material.opacity > 0.99;
967971 }
968972
....@@ -2384,6 +2388,10 @@
23842388 }
23852389 */
23862390 }
2391
+ else
2392
+ {
2393
+ //((ObjEditor)editWindow).SetupUI2(null);
2394
+ }
23872395 }
23882396
23892397 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -3501,7 +3509,8 @@
35013509 if (blockloop)
35023510 return;
35033511
3504
- if (marked || (bRep != null && material != null)) // borderline...
3512
+ if (//marked || // does not make sense
3513
+ (bRep != null || material != null)) // borderline...
35053514 live = h;
35063515
35073516 for (int i = 0; i < Size(); i++)
....@@ -3522,7 +3531,8 @@
35223531 return;
35233532
35243533 //if (bRep != null)
3525
- if (marked || (bRep != null && material != null)) // borderline...
3534
+ if (//marked || // does not make sense
3535
+ (bRep != null || material != null)) // borderline...
35263536 link2master = h;
35273537
35283538 for (int i = 0; i < Size(); i++)
....@@ -3542,7 +3552,8 @@
35423552 if (blockloop)
35433553 return;
35443554
3545
- if (marked || (bRep != null && material != null)) // borderline...
3555
+ if (//marked || // does not make sense
3556
+ (bRep != null || material != null)) // borderline...
35463557 hide = h;
35473558
35483559 for (int i = 0; i < Size(); i++)
....@@ -3562,7 +3573,7 @@
35623573 if (blockloop)
35633574 return;
35643575
3565
- if (bRep != null && material != null) // borderline...
3576
+ if (bRep != null || material != null) // borderline...
35663577 marked = h;
35673578
35683579 for (int i = 0; i < Size(); i++)
....@@ -3572,6 +3583,46 @@
35723583 continue;
35733584 blockloop = true;
35743585 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);
35753626 blockloop = false;
35763627 // release(i);
35773628 }
....@@ -4345,6 +4396,55 @@
43454396 {
43464397 blockloop = true;
43474398 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();
43484448 blockloop = false;
43494449 }
43504450 }
....@@ -5572,12 +5672,23 @@
55725672 boolean NeedSupport()
55735673 {
55745674 return
5575
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5675
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
55765676 // PROBLEM with CROWD!!
55775677 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
55785678 }
55795679
55805680 static boolean DEBUG_SELECTION = false;
5681
+
5682
+ boolean IsLive()
5683
+ {
5684
+ if (live)
5685
+ return true;
5686
+
5687
+ if (parent == null)
5688
+ return false;
5689
+
5690
+ return parent.IsLive();
5691
+ }
55815692
55825693 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
55835694 {
....@@ -5640,7 +5751,7 @@
56405751 support = support;
56415752
56425753 //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);
5754
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
56445755
56455756 if (!usecalllists && bRep != null && bRep.displaylist > 0)
56465757 {
....@@ -5660,10 +5771,12 @@
56605771 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56615772
56625773 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5663
- (touched || (bRep != null && bRep.displaylist <= 0)))
5774
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5775
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0)))
56645776 {
56655777 Globals.lighttouched = true;
56665778 } // all panes...
5779
+
56675780 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56685781 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56695782 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5831,16 +5944,27 @@
58315944 tex = GetTextures();
58325945 }
58335946
5834
- boolean failed = false;
5947
+ boolean failedPigment = false;
5948
+ boolean failedBump = false;
58355949
58365950 try
58375951 {
5838
- display.BindTextures(tex, texres);
5952
+ display.BindPigmentTexture(tex, texres);
58395953 }
58405954 catch (Exception e)
58415955 {
58425956 System.err.println("FAILED: " + this);
5843
- 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;
58445968 }
58455969
58465970 if (!compiled)
....@@ -5863,8 +5987,11 @@
58635987 }
58645988 }
58655989
5866
- if (!failed)
5867
- display.ReleaseTextures(tex);
5990
+ if (!failedBump)
5991
+ display.ReleaseBumpTexture(tex);
5992
+
5993
+ if (!failedPigment)
5994
+ display.ReleasePigmentTexture(tex);
58685995
58695996 display.PopMaterial(this, selected);
58705997 }
....@@ -6237,6 +6364,11 @@
62376364 // dec 2012
62386365 new Exception().printStackTrace();
62396366 return;
6367
+ }
6368
+
6369
+ if (dontselect)
6370
+ {
6371
+ //bRep.GenerateNormalsMINE();
62406372 }
62416373
62426374 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7089,7 +7221,7 @@
70897221 spot.translate(32, 32);
70907222 spotw = spot.x + spot.width;
70917223 spoth = spot.y + spot.height;
7092
- info.g.setColor(Color.blue);
7224
+ info.g.setColor(Color.cyan);
70937225 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70947226 // if (CameraPane.Xmin > spot.x)
70957227 // {
....@@ -7107,11 +7239,12 @@
71077239 // {
71087240 // CameraPane.Ymax = spoth;
71097241 // }
7110
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7111
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7242
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7243
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
71127244 spot.translate(0, -32);
7113
- info.g.setColor(Color.green);
7245
+ info.g.setColor(Color.yellow);
71147246 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7247
+ info.g.setColor(Color.green);
71157248 // if (CameraPane.Xmin > spot.x)
71167249 // {
71177250 // CameraPane.Xmin = spot.x;
....@@ -7429,19 +7562,20 @@
74297562 switch (info.pane.RenderCamera().viewCode)
74307563 {
74317564 case 3: // '\001'
7432
- if (modified)
7565
+ if (modified || opposite)
74337566 {
74347567 //LA.matScale(toParent, 1, hScale, vScale);
74357568 LA.matScale(toParent, totalScale, 1, 1);
74367569 } // vScale, 1);
74377570 else
74387571 {
7572
+ // EXCEPTION!
74397573 LA.matScale(toParent, totalScale, totalScale, totalScale);
74407574 } // vScale, 1);
74417575 break;
74427576
74437577 case 2: // '\002'
7444
- if (modified)
7578
+ if (modified || opposite)
74457579 {
74467580 //LA.matScale(toParent, hScale, 1, vScale);
74477581 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7452,7 +7586,7 @@
74527586 break;
74537587
74547588 case 1: // '\003'
7455
- if (modified)
7589
+ if (modified || opposite)
74567590 {
74577591 //LA.matScale(toParent, hScale, vScale, 1);
74587592 LA.matScale(toParent, 1, 1, totalScale);
....@@ -7672,6 +7806,10 @@
76727806 editWindow = null;
76737807 } // ?
76747808 }
7809
+ else
7810
+ {
7811
+ //editWindow.closeUI();
7812
+ }
76757813 }
76767814
76777815 boolean root; // patch for edit windows