Random node + optimizations.
.. | .. |
---|
113 | 113 | /*static*/ com.sun.opengl.util.texture.Texture cubemap; // Either custom or rgb |
---|
114 | 114 | /*static*/ com.sun.opengl.util.texture.Texture cubemapcustom; |
---|
115 | 115 | /*static*/ com.sun.opengl.util.texture.Texture cubemaprgb; |
---|
| 116 | + boolean transformMode; |
---|
| 117 | + |
---|
116 | 118 | boolean reverseUP = false; |
---|
117 | 119 | static boolean frozen = false; |
---|
118 | 120 | boolean enablebackspace = false; // patch for back buffer refresh |
---|
.. | .. |
---|
2515 | 2517 | com.sun.opengl.util.texture.TextureIO.newTextureData( |
---|
2516 | 2518 | getClass().getClassLoader().getResourceAsStream(name), |
---|
2517 | 2519 | true, |
---|
2518 | | - com.sun.opengl.util.texture.TextureIO.PNG); |
---|
| 2520 | + GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2519 | 2521 | } catch (java.io.IOException e) |
---|
2520 | 2522 | { |
---|
2521 | 2523 | throw new javax.media.opengl.GLException(e); |
---|
.. | .. |
---|
11082 | 11084 | // |
---|
11083 | 11085 | // newenvy = -1; |
---|
11084 | 11086 | |
---|
11085 | | - if (object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb")) |
---|
| 11087 | + if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb")) |
---|
11086 | 11088 | { |
---|
11087 | 11089 | if (cubemaprgb == null) |
---|
11088 | 11090 | { |
---|
11089 | | - cubemaprgb = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
| 11091 | + cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb" + "/", "jpg", false); |
---|
11090 | 11092 | } |
---|
11091 | 11093 | |
---|
11092 | 11094 | cubemap = cubemaprgb; |
---|
.. | .. |
---|
11097 | 11099 | { |
---|
11098 | 11100 | if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
11099 | 11101 | { |
---|
| 11102 | + if (cubemap != null && cubemap != cubemaprgb) |
---|
| 11103 | + cubemap.dispose(); |
---|
11100 | 11104 | cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
11101 | 11105 | loadedskyboxname = object.skyboxname; |
---|
11102 | 11106 | } |
---|
.. | .. |
---|
16788 | 16792 | gl.glDisable(GL.GL_TEXTURE_GEN_R); |
---|
16789 | 16793 | |
---|
16790 | 16794 | cubemap.disable(); |
---|
16791 | | - ////cubemap.unbind(); |
---|
| 16795 | + //cubemap.dispose(); |
---|
| 16796 | + |
---|
16792 | 16797 | if (CULLFACE) |
---|
16793 | 16798 | { |
---|
16794 | 16799 | gl.glEnable(gl.GL_CULL_FACE); |
---|
.. | .. |
---|
1 | 1 | |
---|
2 | 2 | public class Globals |
---|
3 | 3 | { |
---|
4 | | - public static boolean TOOLTIPS = false; |
---|
| 4 | + public static boolean TOOLTIPS = true; // false; |
---|
5 | 5 | public static boolean ADVANCED = false; |
---|
6 | 6 | public static boolean DEBUG = false; |
---|
7 | 7 | |
---|
.. | .. |
---|
1043 | 1043 | // maxButton.addActionListener(this); |
---|
1044 | 1044 | } |
---|
1045 | 1045 | |
---|
1046 | | -// cButton gcButton; |
---|
1047 | | -// |
---|
| 1046 | + cButton gcButton; |
---|
| 1047 | + |
---|
1048 | 1048 | // oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1049 | 1049 | // gcButton.setToolTipText("Garbage collect"); |
---|
1050 | 1050 | // gcButton.addActionListener(new ActionListener() |
---|
.. | .. |
---|
5325 | 5325 | |
---|
5326 | 5326 | boolean allComposites = true; |
---|
5327 | 5327 | |
---|
| 5328 | + if (group.selection != null) |
---|
5328 | 5329 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
5329 | 5330 | { |
---|
5330 | 5331 | if (!(e.nextElement() instanceof Composite)) |
---|
.. | .. |
---|
21 | 21 | { |
---|
22 | 22 | super(name); |
---|
23 | 23 | |
---|
24 | | - addChild(new cGroup("Leaf")); |
---|
| 24 | + addChild(new cGroup(name + "Leaf")); |
---|
25 | 25 | } |
---|
26 | 26 | |
---|
27 | 27 | Object3D deepCopy() |
---|
.. | .. |
---|
75 | 75 | return new cCheckBox(icon, border); |
---|
76 | 76 | } |
---|
77 | 77 | |
---|
| 78 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 79 | + |
---|
78 | 80 | ImageIcon GetIcon(String name) |
---|
79 | 81 | { |
---|
| 82 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 83 | + if (iconCache != null) |
---|
| 84 | + { |
---|
| 85 | + return iconCache; |
---|
| 86 | + } |
---|
| 87 | + |
---|
80 | 88 | try |
---|
81 | 89 | { |
---|
82 | 90 | BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
.. | .. |
---|
94 | 102 | // } |
---|
95 | 103 | |
---|
96 | 104 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 105 | + |
---|
| 106 | + icons.put(name, icon); |
---|
| 107 | + |
---|
97 | 108 | return icon; |
---|
98 | 109 | } |
---|
99 | 110 | catch (Exception e) |
---|
100 | 111 | { |
---|
| 112 | + //icons.put(name, null); |
---|
101 | 113 | return null; |
---|
102 | 114 | } |
---|
103 | 115 | } |
---|
.. | .. |
---|
433 | 445 | |
---|
434 | 446 | ChangeListener changeListener = new ChangeListener() |
---|
435 | 447 | { |
---|
436 | | - String name; |
---|
| 448 | + //String name; |
---|
437 | 449 | |
---|
438 | 450 | public void stateChanged(ChangeEvent changeEvent) |
---|
439 | 451 | { |
---|
.. | .. |
---|
453 | 465 | // EditSelection(false); |
---|
454 | 466 | // } |
---|
455 | 467 | |
---|
456 | | - if (objectPanel.getSelectedIndex() == 4) |
---|
457 | | - { |
---|
458 | | - name = copy.skyboxname; |
---|
459 | | - |
---|
460 | | - if (name == null) |
---|
461 | | - { |
---|
462 | | - name = ""; |
---|
463 | | - } |
---|
464 | | - |
---|
465 | | - copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
466 | | - copy.skyboxext = "jpg"; |
---|
467 | | - } |
---|
468 | | - else |
---|
469 | | - { |
---|
470 | | - if (name != null) |
---|
471 | | - { |
---|
472 | | - if (name.equals("")) |
---|
473 | | - { |
---|
474 | | - copy.skyboxname = null; |
---|
475 | | - copy.skyboxext = null; |
---|
476 | | - } |
---|
477 | | - else |
---|
478 | | - { |
---|
479 | | - copy.skyboxname = name; |
---|
480 | | - } |
---|
481 | | - } |
---|
482 | | - } |
---|
| 468 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 469 | +// { |
---|
| 470 | +// name = copy.skyboxname; |
---|
| 471 | +// |
---|
| 472 | +// if (name == null) |
---|
| 473 | +// { |
---|
| 474 | +// name = ""; |
---|
| 475 | +// } |
---|
| 476 | +// |
---|
| 477 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 478 | +// copy.skyboxext = "jpg"; |
---|
| 479 | +// } |
---|
| 480 | +// else |
---|
| 481 | +// { |
---|
| 482 | +// if (name != null) |
---|
| 483 | +// { |
---|
| 484 | +// if (name.equals("")) |
---|
| 485 | +// { |
---|
| 486 | +// copy.skyboxname = null; |
---|
| 487 | +// copy.skyboxext = null; |
---|
| 488 | +// } |
---|
| 489 | +// else |
---|
| 490 | +// { |
---|
| 491 | +// copy.skyboxname = name; |
---|
| 492 | +// } |
---|
| 493 | +// } |
---|
| 494 | +// } |
---|
| 495 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
483 | 496 | |
---|
484 | 497 | // refreshContents(false); // To refresh Info tab |
---|
485 | 498 | cameraView.repaint(); |
---|
.. | .. |
---|
1676 | 1689 | scenePanel.add(tabbedPane); |
---|
1677 | 1690 | |
---|
1678 | 1691 | //if (Globals.ADVANCED) |
---|
1679 | | - tabbedPane.add(infoPanel); |
---|
1680 | | - tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
1681 | | - tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1692 | +// tabbedPane.add(infoPanel); |
---|
| 1693 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1694 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
1682 | 1695 | |
---|
1683 | 1696 | /* |
---|
1684 | 1697 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
4781 | 4794 | if (muteSlider) |
---|
4782 | 4795 | return; |
---|
4783 | 4796 | |
---|
| 4797 | + Replace(); |
---|
| 4798 | + |
---|
4784 | 4799 | int version = versionSlider.getInteger(); |
---|
4785 | 4800 | |
---|
4786 | 4801 | if (version != -1 && copy.versionlist[version] != null) |
---|
.. | .. |
---|
5574 | 5574 | if (fullname == null) |
---|
5575 | 5575 | return ""; |
---|
5576 | 5576 | |
---|
| 5577 | + if (fullname.pigment != null) |
---|
| 5578 | + { |
---|
| 5579 | + return fullname.pigment; |
---|
| 5580 | + } |
---|
| 5581 | + |
---|
5577 | 5582 | // System.out.println("Fullname = " + fullname); |
---|
5578 | 5583 | |
---|
5579 | 5584 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5586 | 5591 | |
---|
5587 | 5592 | if (split.length == 0) |
---|
5588 | 5593 | { |
---|
5589 | | - return ""; |
---|
| 5594 | + return fullname.pigment = ""; |
---|
5590 | 5595 | } |
---|
5591 | 5596 | |
---|
5592 | 5597 | if (split.length <= 2) |
---|
.. | .. |
---|
5594 | 5599 | if (fullname.name.endsWith(":")) |
---|
5595 | 5600 | { |
---|
5596 | 5601 | // Windows |
---|
5597 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5602 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5598 | 5603 | } |
---|
5599 | 5604 | |
---|
5600 | | - return split[0]; |
---|
| 5605 | + return fullname.pigment = split[0]; |
---|
5601 | 5606 | } |
---|
5602 | 5607 | |
---|
5603 | 5608 | // Windows |
---|
5604 | 5609 | assert(split.length == 4); |
---|
5605 | 5610 | |
---|
5606 | | - return split[0] + ":" + split[1]; |
---|
| 5611 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5607 | 5612 | } |
---|
5608 | 5613 | |
---|
5609 | 5614 | static String GetBump(cTexture fullname) |
---|
5610 | 5615 | { |
---|
5611 | 5616 | if (fullname == null) |
---|
5612 | 5617 | return ""; |
---|
| 5618 | + |
---|
| 5619 | + if (fullname.bump != null) |
---|
| 5620 | + { |
---|
| 5621 | + return fullname.bump; |
---|
| 5622 | + } |
---|
5613 | 5623 | |
---|
5614 | 5624 | // System.out.println("Fullname = " + fullname); |
---|
5615 | 5625 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5621 | 5631 | |
---|
5622 | 5632 | if (split.length == 0) |
---|
5623 | 5633 | { |
---|
5624 | | - return ""; |
---|
| 5634 | + return fullname.bump = ""; |
---|
5625 | 5635 | } |
---|
5626 | 5636 | |
---|
5627 | 5637 | if (split.length == 1) |
---|
5628 | 5638 | { |
---|
5629 | | - return ""; |
---|
| 5639 | + return fullname.bump = ""; |
---|
5630 | 5640 | } |
---|
5631 | 5641 | |
---|
5632 | 5642 | if (split.length == 2) |
---|
.. | .. |
---|
5634 | 5644 | if (fullname.name.endsWith(":")) |
---|
5635 | 5645 | { |
---|
5636 | 5646 | // Windows |
---|
5637 | | - return ""; |
---|
| 5647 | + return fullname.bump = ""; |
---|
5638 | 5648 | } |
---|
5639 | 5649 | |
---|
5640 | | - return split[1]; |
---|
| 5650 | + return fullname.bump = split[1]; |
---|
5641 | 5651 | } |
---|
5642 | 5652 | |
---|
5643 | 5653 | // Windows |
---|
5644 | 5654 | assert(split.length == 4); |
---|
5645 | 5655 | |
---|
5646 | | - return split[2] + ":" + split[3]; |
---|
| 5656 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5647 | 5657 | } |
---|
5648 | 5658 | |
---|
5649 | 5659 | String GetPigmentTexture() |
---|
.. | .. |
---|
5726 | 5736 | texname = ""; |
---|
5727 | 5737 | |
---|
5728 | 5738 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5739 | + |
---|
| 5740 | + GetTextures().pigment = null; |
---|
| 5741 | + |
---|
5729 | 5742 | Touch(); |
---|
5730 | 5743 | } |
---|
5731 | 5744 | |
---|
.. | .. |
---|
5798 | 5811 | texname = ""; |
---|
5799 | 5812 | |
---|
5800 | 5813 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5814 | + |
---|
| 5815 | + GetTextures().bump = null; |
---|
5801 | 5816 | |
---|
5802 | 5817 | Touch(); |
---|
5803 | 5818 | } |
---|
.. | .. |
---|
7422 | 7437 | // { |
---|
7423 | 7438 | // CameraPane.Ymax = spoth; |
---|
7424 | 7439 | // } |
---|
7425 | | - spot.translate(32, 32); |
---|
| 7440 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7441 | +// { |
---|
| 7442 | +// CameraPane.Xmin = spot.x; |
---|
| 7443 | +// } |
---|
| 7444 | +// if (CameraPane.Xmax < spotw) |
---|
| 7445 | +// { |
---|
| 7446 | +// CameraPane.Xmax = spotw; |
---|
| 7447 | +// } |
---|
| 7448 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7449 | +// { |
---|
| 7450 | +// CameraPane.Ymin = spot.y; |
---|
| 7451 | +// } |
---|
| 7452 | +// if (CameraPane.Ymax < spoth) |
---|
| 7453 | +// { |
---|
| 7454 | +// CameraPane.Ymax = spoth; |
---|
| 7455 | +// } |
---|
| 7456 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7457 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7458 | + spot.translate(32, 0); |
---|
| 7459 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7460 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7461 | + |
---|
| 7462 | + spot.translate(32, 64); |
---|
7426 | 7463 | spotw = spot.x + spot.width; |
---|
7427 | 7464 | spoth = spot.y + spot.height; |
---|
7428 | 7465 | clickInfo.g.setColor(Color.cyan); |
---|
.. | .. |
---|
7443 | 7480 | // { |
---|
7444 | 7481 | // CameraPane.Ymax = spoth; |
---|
7445 | 7482 | // } |
---|
7446 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7447 | | - //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7448 | | - spot.translate(0, -32); |
---|
7449 | | - clickInfo.g.setColor(Color.yellow); |
---|
7450 | | - clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7451 | 7483 | clickInfo.g.setColor(Color.green); |
---|
7452 | | -// if (CameraPane.Xmin > spot.x) |
---|
7453 | | -// { |
---|
7454 | | -// CameraPane.Xmin = spot.x; |
---|
7455 | | -// } |
---|
7456 | | -// if (CameraPane.Xmax < spotw) |
---|
7457 | | -// { |
---|
7458 | | -// CameraPane.Xmax = spotw; |
---|
7459 | | -// } |
---|
7460 | | -// if (CameraPane.Ymin > spot.y) |
---|
7461 | | -// { |
---|
7462 | | -// CameraPane.Ymin = spot.y; |
---|
7463 | | -// } |
---|
7464 | | -// if (CameraPane.Ymax < spoth) |
---|
7465 | | -// { |
---|
7466 | | -// CameraPane.Ymax = spoth; |
---|
7467 | | -// } |
---|
7468 | 7484 | clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
7469 | 7485 | (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7470 | 7486 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
.. | .. |
---|
7523 | 7539 | retval = true; |
---|
7524 | 7540 | } |
---|
7525 | 7541 | spot.translate(0, 32); |
---|
| 7542 | + spot.translate(32, 0); |
---|
| 7543 | + spot.translate(0, 32); |
---|
7526 | 7544 | if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7527 | 7545 | { |
---|
7528 | 7546 | hitSomething = hitScale; |
---|
7529 | 7547 | |
---|
7530 | 7548 | double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7531 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7549 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7532 | 7550 | double sign = 1; |
---|
7533 | 7551 | if (hScale < 0) |
---|
7534 | 7552 | { |
---|
.. | .. |
---|
7540 | 7558 | //hScale = 0.01; |
---|
7541 | 7559 | } |
---|
7542 | 7560 | |
---|
7543 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7561 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7544 | 7562 | sign = 1; |
---|
7545 | 7563 | if (vScale < 0) |
---|
7546 | 7564 | { |
---|
.. | .. |
---|
7755 | 7773 | break; |
---|
7756 | 7774 | |
---|
7757 | 7775 | case hitScale: // scale |
---|
7758 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7776 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7759 | 7777 | double sign = 1; |
---|
7760 | 7778 | if (hScale < 0) |
---|
7761 | 7779 | { |
---|
.. | .. |
---|
7767 | 7785 | //hScale = 0.01; |
---|
7768 | 7786 | } |
---|
7769 | 7787 | |
---|
7770 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7788 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7771 | 7789 | sign = 1; |
---|
7772 | 7790 | if (vScale < 0) |
---|
7773 | 7791 | { |
---|
.. | .. |
---|
356 | 356 | if (support != null && link2master) |
---|
357 | 357 | geo = support; |
---|
358 | 358 | |
---|
359 | | - if (live && Globals.isLIVE() && display.DrawMode() == display.SHADOW) // june 2013 |
---|
| 359 | + if (live && Globals.isLIVE() && (display.DrawMode() == display.SHADOW || !Globals.RENDERSHADOW)) // june 2013 |
---|
360 | 360 | { |
---|
361 | 361 | Step(); |
---|
362 | 362 | } |
---|
.. | .. |
---|
9 | 9 | class RandomEditor extends ObjEditor implements //ItemListener, |
---|
10 | 10 | ChangeListener, ObjectUI, ActionListener |
---|
11 | 11 | { |
---|
12 | | - cGridBag childPanel; |
---|
| 12 | + cGridBag itemPanel; |
---|
| 13 | + private cGridBag dampPanel; |
---|
13 | 14 | RandomEditor(RandomNode inBP, GroupEditor callee) |
---|
14 | 15 | { |
---|
15 | 16 | super(inBP,callee); |
---|
16 | 17 | |
---|
17 | 18 | objEditor = callee.GetEditor(); // new ObjEditor(inBP, this, callee); |
---|
18 | 19 | |
---|
19 | | - switchnode = (RandomNode) inBP; |
---|
| 20 | + randomnode = (RandomNode) inBP; |
---|
20 | 21 | // parent = p; |
---|
21 | 22 | |
---|
22 | 23 | //SetupUI2(callee.objEditor); |
---|
.. | .. |
---|
35 | 36 | |
---|
36 | 37 | objEditor = callee.GetEditor(); // new ObjEditor(inBP, this, callee); |
---|
37 | 38 | |
---|
38 | | - switchnode = (RandomNode) inBP; |
---|
| 39 | + randomnode = (RandomNode) inBP; |
---|
39 | 40 | parent = p; |
---|
40 | 41 | |
---|
41 | 42 | SetupUI2(callee.objEditor); |
---|
.. | .. |
---|
49 | 50 | |
---|
50 | 51 | //objEditor = new ObjEditor(inBP, copy, this, callee); |
---|
51 | 52 | // ?? super.parent = p; |
---|
52 | | - switchnode = (RandomNode) copy; |
---|
| 53 | + randomnode = (RandomNode) copy; |
---|
53 | 54 | parent = p; |
---|
54 | 55 | |
---|
55 | 56 | //objEditor.SetupUI(false); // ? |
---|
.. | .. |
---|
60 | 61 | void SetupUI2(ObjEditor oe) |
---|
61 | 62 | { |
---|
62 | 63 | super.SetupUI2(oe); |
---|
63 | | - childPanel = AddSlider(oe.ctrlPanel, "Item: ", 0, switchnode.Size()-1, switchnode.rnd); |
---|
| 64 | + itemPanel = AddSlider(oe.ctrlPanel, "Item: ", 0, randomnode.Size()-1, randomnode.rndIndex); |
---|
64 | 65 | |
---|
65 | | - childField = (cNumberSlider)childPanel.getComponent(1); |
---|
| 66 | + itemField = (cNumberSlider)itemPanel.getComponent(1); |
---|
66 | 67 | oe.ctrlPanel.Return(); |
---|
| 68 | + |
---|
| 69 | + oe.ctrlPanel.Return(); |
---|
| 70 | + dampPanel = AddSlider(oe.ctrlPanel, "Damp: ", 0, 300, randomnode.damp); |
---|
| 71 | + |
---|
| 72 | + dampField = (cNumberSlider)dampPanel.getComponent(1); |
---|
| 73 | + oe.ctrlPanel.Return(); |
---|
67 | 74 | } |
---|
68 | 75 | |
---|
69 | 76 | void Clear() |
---|
70 | 77 | { |
---|
71 | 78 | objEditor.Clear(); |
---|
72 | 79 | |
---|
73 | | - switchnode = null; |
---|
| 80 | + randomnode = null; |
---|
74 | 81 | } |
---|
75 | 82 | |
---|
76 | 83 | |
---|
77 | 84 | public void stateChanged(ChangeEvent e) |
---|
78 | 85 | { |
---|
79 | 86 | //System.out.println("Biparam :: stateChanged"); |
---|
80 | | - if (e.getSource() == childField) |
---|
| 87 | + if (e.getSource() == itemField || e.getSource() == dampField) |
---|
81 | 88 | { |
---|
82 | 89 | //System.out.println("#U = " + biparam.uDivs); |
---|
83 | 90 | //System.out.println("#V = " + biparam.vDivs); |
---|
.. | .. |
---|
94 | 101 | |
---|
95 | 102 | void Refresh() |
---|
96 | 103 | { |
---|
97 | | - switchnode.rnd = childField.getInteger(); |
---|
| 104 | + randomnode.rndIndex = itemField.getInteger(); |
---|
98 | 105 | |
---|
99 | 106 | refreshContents(); |
---|
100 | 107 | } |
---|
.. | .. |
---|
102 | 109 | /**/ |
---|
103 | 110 | public void applySelf() |
---|
104 | 111 | { |
---|
105 | | - switchnode.rnd = childField.getInteger(); |
---|
| 112 | + randomnode.rndIndex = itemField.getInteger(); |
---|
| 113 | + randomnode.damp = dampField.getInteger(); // biparam.minUDivs, 99); |
---|
106 | 114 | } |
---|
107 | 115 | /**/ |
---|
108 | 116 | |
---|
.. | .. |
---|
111 | 119 | ObjEditor oe = objEditor; |
---|
112 | 120 | |
---|
113 | 121 | //Remove(childField); |
---|
114 | | - oe.ctrlPanel.remove(this.childPanel); |
---|
| 122 | + oe.ctrlPanel.remove(this.itemPanel); |
---|
| 123 | + oe.ctrlPanel.remove(this.dampPanel); |
---|
115 | 124 | |
---|
116 | 125 | super.closeUI(); |
---|
117 | 126 | } |
---|
.. | .. |
---|
126 | 135 | objEditor.refreshContents(); |
---|
127 | 136 | } |
---|
128 | 137 | |
---|
129 | | - RandomNode switchnode; |
---|
130 | | - cNumberSlider childField; |
---|
| 138 | + RandomNode randomnode; |
---|
| 139 | + cNumberSlider itemField; |
---|
| 140 | + cNumberSlider dampField; |
---|
131 | 141 | |
---|
132 | 142 | ObjectUI parent; |
---|
133 | 143 | |
---|
.. | .. |
---|
38 | 38 | return super.size(); |
---|
39 | 39 | } |
---|
40 | 40 | |
---|
41 | | - int rnd = -1; |
---|
| 41 | + int rndIndex = -1; |
---|
42 | 42 | |
---|
43 | 43 | static int globalseed = 0; |
---|
44 | 44 | static int globalseed2 = 0; // mocap frames??? |
---|
.. | .. |
---|
54 | 54 | super.ResetRandom(); |
---|
55 | 55 | } |
---|
56 | 56 | |
---|
| 57 | + int damp; |
---|
| 58 | + transient int countdamp; |
---|
| 59 | + transient int globaloffset; |
---|
| 60 | + |
---|
| 61 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 62 | + { |
---|
| 63 | + if (live && Globals.isLIVE() && (display.DrawMode() == display.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 64 | + currentframe != Globals.framecount) |
---|
| 65 | + { |
---|
| 66 | + currentframe = Globals.framecount; |
---|
| 67 | + |
---|
| 68 | + if (countdamp <= 0) |
---|
| 69 | + { |
---|
| 70 | + countdamp = damp; |
---|
| 71 | + |
---|
| 72 | + globaloffset += 1; |
---|
| 73 | + } |
---|
| 74 | + else |
---|
| 75 | + { |
---|
| 76 | + if (CameraPane.FAST) |
---|
| 77 | + countdamp -= CameraPane.STEP; |
---|
| 78 | + else |
---|
| 79 | + countdamp--; |
---|
| 80 | + } |
---|
| 81 | + } |
---|
| 82 | + |
---|
| 83 | + super.DrawNode(display, root, selected); |
---|
| 84 | + } |
---|
| 85 | + |
---|
57 | 86 | int firstchoice = 0; |
---|
58 | 87 | // int currentpass = 0; |
---|
59 | 88 | |
---|
.. | .. |
---|
66 | 95 | // if (!link2master && rnd != -1) |
---|
67 | 96 | // new Exception().printStackTrace(); |
---|
68 | 97 | |
---|
69 | | - if (!random && rnd != -1) // freeze current value |
---|
70 | | - return super.reserve(rnd); |
---|
| 98 | + if (!random && rndIndex != -1) // freeze current value |
---|
| 99 | + return super.reserve(rndIndex); |
---|
71 | 100 | |
---|
72 | 101 | if (firstchoice == 0) |
---|
73 | 102 | firstchoice = (int)(Math.random()*super.Size()) + 1; |
---|
.. | .. |
---|
91 | 120 | } |
---|
92 | 121 | //int tabarnak = super.Size(); |
---|
93 | 122 | |
---|
94 | | - rnd = gcount%super.Size(); // |
---|
| 123 | + rndIndex = gcount%super.Size(); // |
---|
95 | 124 | |
---|
96 | 125 | //(int)(Math.random()*super.size()); |
---|
97 | 126 | //globalcount++; |
---|
98 | | - gcount += Grafreed.mix3(rnd+12345,firstchoice*12345,gcount); |
---|
| 127 | + gcount += Grafreed.mix3(rndIndex+12345,firstchoice*12345,gcount); |
---|
99 | 128 | |
---|
100 | 129 | gcount &= 0x7fffffff; |
---|
101 | 130 | |
---|
.. | .. |
---|
105 | 134 | globalseed = gcount; |
---|
106 | 135 | |
---|
107 | 136 | if (!random) // aout 2013 link2master) |
---|
108 | | - rnd = whatevercount++; |
---|
| 137 | + rndIndex = whatevercount++; |
---|
109 | 138 | |
---|
110 | | - rnd %= super.Size(); |
---|
| 139 | + if (live) // aout 2019 |
---|
| 140 | + { |
---|
| 141 | + rndIndex += globaloffset; |
---|
| 142 | + } |
---|
| 143 | + |
---|
| 144 | + rndIndex %= super.Size(); |
---|
111 | 145 | |
---|
112 | 146 | //GraphreeD.tracein("RESERVE " + this + " = ", i); |
---|
113 | | - Object3D child = super.get(rnd); |
---|
| 147 | + Object3D child = super.get(rndIndex); |
---|
114 | 148 | //Applet3D.tracein("RESERVE ", child); |
---|
115 | 149 | |
---|
116 | 150 | child.count--; |
---|
.. | .. |
---|
139 | 173 | |
---|
140 | 174 | // globalcount--; |
---|
141 | 175 | |
---|
142 | | - super.get(rnd).count++; |
---|
| 176 | + super.get(rndIndex).count++; |
---|
143 | 177 | //assert (child.count >= 0); |
---|
144 | 178 | |
---|
145 | 179 | if (random) // volatile value |
---|
146 | | - rnd = -1; |
---|
| 180 | + rndIndex = -1; |
---|
147 | 181 | } |
---|
148 | 182 | |
---|
149 | 183 | void createEditWindow(GroupEditor callee, boolean newWindow) |
---|
.. | .. |
---|
11 | 11 | { |
---|
12 | 12 | private cGridBag dampPanel; |
---|
13 | 13 | private cGridBag framePanel; |
---|
| 14 | + |
---|
14 | 15 | SwitchEditor(SwitchNode inBP, GroupEditor callee) |
---|
15 | 16 | { |
---|
16 | 17 | super(inBP,callee); |
---|
.. | .. |
---|
86 | 87 | |
---|
87 | 88 | frameField = (cNumberSlider)framePanel.getComponent(1); |
---|
88 | 89 | oe.ctrlPanel.Return(); |
---|
89 | | - dampPanel = AddSlider(oe.ctrlPanel, "Damp: ", 0, 500, switchnode.speed); |
---|
| 90 | + dampPanel = AddSlider(oe.ctrlPanel, "Damp: ", 0, 300, switchnode.speed); |
---|
90 | 91 | |
---|
91 | 92 | speedField = (cNumberSlider)dampPanel.getComponent(1); |
---|
92 | 93 | oe.ctrlPanel.Return(); |
---|
.. | .. |
---|
41 | 41 | switchobject.count = 1; // hide |
---|
42 | 42 | } |
---|
43 | 43 | |
---|
44 | | - transient boolean restarted; |
---|
| 44 | + //transient boolean restarted; |
---|
45 | 45 | transient int countspeed; |
---|
46 | 46 | |
---|
47 | 47 | transient boolean toggleneutral; |
---|
.. | .. |
---|
59 | 59 | } |
---|
60 | 60 | if (live && Globals.isLIVE() && display.DrawMode() == display.SHADOW) |
---|
61 | 61 | { |
---|
62 | | - if (countspeed == 0) |
---|
| 62 | + if (countspeed <= 0) |
---|
63 | 63 | { |
---|
64 | 64 | countspeed = speed; |
---|
65 | 65 | |
---|
.. | .. |
---|
92 | 92 | |
---|
93 | 93 | } |
---|
94 | 94 | else |
---|
95 | | - countspeed--; |
---|
| 95 | + { |
---|
| 96 | + if (CameraPane.FAST) |
---|
| 97 | + countspeed -= CameraPane.STEP; |
---|
| 98 | + else |
---|
| 99 | + countspeed--; |
---|
| 100 | + } |
---|
96 | 101 | } |
---|
97 | 102 | |
---|
98 | 103 | if (bRep == null) |
---|
.. | .. |
---|
362 | 362 | float diffuse = 0.75f, specular = 0.25f, shininess = 0.75f, shift = 1; |
---|
363 | 363 | float ambient = 0.001f, lightarea = 0.025f, factor = 0.001f, velvet = 0.001f; |
---|
364 | 364 | float sheen = 1f, subsurface = 0.001f, bump = 0.75f, aniso = 0.001f, anisoV = 0.001f; |
---|
365 | | - float cameralight = 0.2f, diffuseness = 0.001f, shadow = 5f, texture = 1f, opacity = 1; |
---|
| 365 | + float cameralight = 0.3f, diffuseness = 0.001f, shadow = 5f, texture = 1f, opacity = 1; |
---|
366 | 366 | float fakedepth = 0.5f, shadowbias = 0.01f; // 0.001f; |
---|
367 | 367 | |
---|
368 | 368 | boolean multiply; |
---|
.. | .. |
---|
32 | 32 | |
---|
33 | 33 | String name; |
---|
34 | 34 | |
---|
| 35 | + transient String pigment; |
---|
| 36 | + transient String bump; |
---|
| 37 | + |
---|
35 | 38 | int pw, ph; |
---|
36 | 39 | byte[] pigmentdata; |
---|
37 | 40 | |
---|