.. | .. |
---|
174 | 174 | { |
---|
175 | 175 | Object3D o = hashtable.get(GetUUID()); |
---|
176 | 176 | |
---|
177 | | - assert(this.bRep == o.bRep); |
---|
| 177 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
178 | 178 | if (this.bRep != null) |
---|
179 | 179 | assert(this.bRep.support == o.transientrep); |
---|
180 | 180 | |
---|
.. | .. |
---|
563 | 563 | toParent = LA.newMatrix(); |
---|
564 | 564 | fromParent = LA.newMatrix(); |
---|
565 | 565 | } |
---|
| 566 | + |
---|
566 | 567 | if (toParentMarked == null) |
---|
567 | 568 | { |
---|
568 | 569 | if (maxcount != 1) |
---|
569 | 570 | { |
---|
570 | 571 | new Exception().printStackTrace(); |
---|
571 | 572 | } |
---|
| 573 | + |
---|
572 | 574 | toParentMarked = LA.newMatrix(); |
---|
573 | 575 | fromParentMarked = LA.newMatrix(); |
---|
574 | 576 | } |
---|
.. | .. |
---|
879 | 881 | |
---|
880 | 882 | if (marked && Globals.isLIVE() && live && |
---|
881 | 883 | //TEMP21aug2018 |
---|
882 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 884 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
883 | 885 | currentframe != Globals.framecount) |
---|
884 | 886 | { |
---|
885 | 887 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
891 | 893 | |
---|
892 | 894 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
893 | 895 | |
---|
894 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 896 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 897 | + (step == 1 && changedir)) |
---|
895 | 898 | { |
---|
896 | 899 | countdown = 1; |
---|
897 | 900 | delay = speedup?8:1; |
---|
.. | .. |
---|
963 | 966 | if (material == null || material.multiply) |
---|
964 | 967 | return true; |
---|
965 | 968 | |
---|
| 969 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
966 | 970 | return material.opacity > 0.99; |
---|
967 | 971 | } |
---|
968 | 972 | |
---|
.. | .. |
---|
2384 | 2388 | } |
---|
2385 | 2389 | */ |
---|
2386 | 2390 | } |
---|
| 2391 | + else |
---|
| 2392 | + { |
---|
| 2393 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2394 | + } |
---|
2387 | 2395 | } |
---|
2388 | 2396 | |
---|
2389 | 2397 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
3501 | 3509 | if (blockloop) |
---|
3502 | 3510 | return; |
---|
3503 | 3511 | |
---|
3504 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3512 | + if (//marked || // does not make sense |
---|
| 3513 | + (bRep != null || material != null)) // borderline... |
---|
3505 | 3514 | live = h; |
---|
3506 | 3515 | |
---|
3507 | 3516 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3522 | 3531 | return; |
---|
3523 | 3532 | |
---|
3524 | 3533 | //if (bRep != null) |
---|
3525 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3534 | + if (//marked || // does not make sense |
---|
| 3535 | + (bRep != null || material != null)) // borderline... |
---|
3526 | 3536 | link2master = h; |
---|
3527 | 3537 | |
---|
3528 | 3538 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3542 | 3552 | if (blockloop) |
---|
3543 | 3553 | return; |
---|
3544 | 3554 | |
---|
3545 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3555 | + if (//marked || // does not make sense |
---|
| 3556 | + (bRep != null || material != null)) // borderline... |
---|
3546 | 3557 | hide = h; |
---|
3547 | 3558 | |
---|
3548 | 3559 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3562 | 3573 | if (blockloop) |
---|
3563 | 3574 | return; |
---|
3564 | 3575 | |
---|
3565 | | - if (bRep != null && material != null) // borderline... |
---|
| 3576 | + if (bRep != null || material != null) // borderline... |
---|
3566 | 3577 | marked = h; |
---|
3567 | 3578 | |
---|
3568 | 3579 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3572 | 3583 | continue; |
---|
3573 | 3584 | blockloop = true; |
---|
3574 | 3585 | 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); |
---|
3575 | 3626 | blockloop = false; |
---|
3576 | 3627 | // release(i); |
---|
3577 | 3628 | } |
---|
.. | .. |
---|
4345 | 4396 | { |
---|
4346 | 4397 | blockloop = true; |
---|
4347 | 4398 | 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(); |
---|
4348 | 4448 | blockloop = false; |
---|
4349 | 4449 | } |
---|
4350 | 4450 | } |
---|
.. | .. |
---|
5572 | 5672 | boolean NeedSupport() |
---|
5573 | 5673 | { |
---|
5574 | 5674 | 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 |
---|
5576 | 5676 | // PROBLEM with CROWD!! |
---|
5577 | 5677 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5578 | 5678 | } |
---|
5579 | 5679 | |
---|
5580 | 5680 | 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 | + } |
---|
5581 | 5692 | |
---|
5582 | 5693 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5583 | 5694 | { |
---|
.. | .. |
---|
5640 | 5751 | support = support; |
---|
5641 | 5752 | |
---|
5642 | 5753 | //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); |
---|
5644 | 5755 | |
---|
5645 | 5756 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5646 | 5757 | { |
---|
.. | .. |
---|
5660 | 5771 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5661 | 5772 | |
---|
5662 | 5773 | 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))) |
---|
5664 | 5776 | { |
---|
5665 | 5777 | Globals.lighttouched = true; |
---|
5666 | 5778 | } // all panes... |
---|
| 5779 | + |
---|
5667 | 5780 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5668 | 5781 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5669 | 5782 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5831 | 5944 | tex = GetTextures(); |
---|
5832 | 5945 | } |
---|
5833 | 5946 | |
---|
5834 | | - boolean failed = false; |
---|
| 5947 | + boolean failedPigment = false; |
---|
| 5948 | + boolean failedBump = false; |
---|
5835 | 5949 | |
---|
5836 | 5950 | try |
---|
5837 | 5951 | { |
---|
5838 | | - display.BindTextures(tex, texres); |
---|
| 5952 | + display.BindPigmentTexture(tex, texres); |
---|
5839 | 5953 | } |
---|
5840 | 5954 | catch (Exception e) |
---|
5841 | 5955 | { |
---|
5842 | 5956 | 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; |
---|
5844 | 5968 | } |
---|
5845 | 5969 | |
---|
5846 | 5970 | if (!compiled) |
---|
.. | .. |
---|
5863 | 5987 | } |
---|
5864 | 5988 | } |
---|
5865 | 5989 | |
---|
5866 | | - if (!failed) |
---|
5867 | | - display.ReleaseTextures(tex); |
---|
| 5990 | + if (!failedBump) |
---|
| 5991 | + display.ReleaseBumpTexture(tex); |
---|
| 5992 | + |
---|
| 5993 | + if (!failedPigment) |
---|
| 5994 | + display.ReleasePigmentTexture(tex); |
---|
5868 | 5995 | |
---|
5869 | 5996 | display.PopMaterial(this, selected); |
---|
5870 | 5997 | } |
---|
.. | .. |
---|
6237 | 6364 | // dec 2012 |
---|
6238 | 6365 | new Exception().printStackTrace(); |
---|
6239 | 6366 | return; |
---|
| 6367 | + } |
---|
| 6368 | + |
---|
| 6369 | + if (dontselect) |
---|
| 6370 | + { |
---|
| 6371 | + //bRep.GenerateNormalsMINE(); |
---|
6240 | 6372 | } |
---|
6241 | 6373 | |
---|
6242 | 6374 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7089 | 7221 | spot.translate(32, 32); |
---|
7090 | 7222 | spotw = spot.x + spot.width; |
---|
7091 | 7223 | spoth = spot.y + spot.height; |
---|
7092 | | - info.g.setColor(Color.blue); |
---|
| 7224 | + info.g.setColor(Color.cyan); |
---|
7093 | 7225 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7094 | 7226 | // if (CameraPane.Xmin > spot.x) |
---|
7095 | 7227 | // { |
---|
.. | .. |
---|
7107 | 7239 | // { |
---|
7108 | 7240 | // CameraPane.Ymax = spoth; |
---|
7109 | 7241 | // } |
---|
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 |
---|
7112 | 7244 | spot.translate(0, -32); |
---|
7113 | | - info.g.setColor(Color.green); |
---|
| 7245 | + info.g.setColor(Color.yellow); |
---|
7114 | 7246 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7247 | + info.g.setColor(Color.green); |
---|
7115 | 7248 | // if (CameraPane.Xmin > spot.x) |
---|
7116 | 7249 | // { |
---|
7117 | 7250 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7429 | 7562 | switch (info.pane.RenderCamera().viewCode) |
---|
7430 | 7563 | { |
---|
7431 | 7564 | case 3: // '\001' |
---|
7432 | | - if (modified) |
---|
| 7565 | + if (modified || opposite) |
---|
7433 | 7566 | { |
---|
7434 | 7567 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7435 | 7568 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7436 | 7569 | } // vScale, 1); |
---|
7437 | 7570 | else |
---|
7438 | 7571 | { |
---|
| 7572 | + // EXCEPTION! |
---|
7439 | 7573 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7440 | 7574 | } // vScale, 1); |
---|
7441 | 7575 | break; |
---|
7442 | 7576 | |
---|
7443 | 7577 | case 2: // '\002' |
---|
7444 | | - if (modified) |
---|
| 7578 | + if (modified || opposite) |
---|
7445 | 7579 | { |
---|
7446 | 7580 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7447 | 7581 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7452 | 7586 | break; |
---|
7453 | 7587 | |
---|
7454 | 7588 | case 1: // '\003' |
---|
7455 | | - if (modified) |
---|
| 7589 | + if (modified || opposite) |
---|
7456 | 7590 | { |
---|
7457 | 7591 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7458 | 7592 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7672 | 7806 | editWindow = null; |
---|
7673 | 7807 | } // ? |
---|
7674 | 7808 | } |
---|
| 7809 | + else |
---|
| 7810 | + { |
---|
| 7811 | + //editWindow.closeUI(); |
---|
| 7812 | + } |
---|
7675 | 7813 | } |
---|
7676 | 7814 | |
---|
7677 | 7815 | boolean root; // patch for edit windows |
---|