.. | .. |
---|
134 | 134 | |
---|
135 | 135 | try |
---|
136 | 136 | { |
---|
137 | | - BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
138 | | - |
---|
| 137 | + BufferedImage image; |
---|
| 138 | + |
---|
| 139 | + if (name.endsWith("jpg")) |
---|
| 140 | + // Much faster! |
---|
| 141 | + image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage(); |
---|
| 142 | + else |
---|
| 143 | + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 144 | + |
---|
139 | 145 | // if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
140 | 146 | // { |
---|
141 | 147 | // BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
.. | .. |
---|
377 | 383 | client = inClient; |
---|
378 | 384 | copy = client; |
---|
379 | 385 | |
---|
380 | | - if (copy.versionlist == null) |
---|
381 | | - { |
---|
382 | | - copy.versionlist = new Object3D[100]; |
---|
383 | | - copy.versionindex = -1; |
---|
384 | | - |
---|
385 | | -// Save(true); |
---|
386 | | - } |
---|
387 | | - |
---|
388 | 386 | SetupUI2(callee.GetEditor()); |
---|
389 | 387 | } |
---|
390 | 388 | |
---|
.. | .. |
---|
460 | 458 | importOBJItem.addActionListener(this); |
---|
461 | 459 | import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
462 | 460 | import3DSItem.addActionListener(this); |
---|
| 461 | + if (Globals.ADVANCED) |
---|
| 462 | + { |
---|
463 | 463 | importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
464 | 464 | importVRMLX3DItem.addActionListener(this); |
---|
| 465 | + } |
---|
465 | 466 | menu.add("-"); |
---|
466 | 467 | importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
467 | 468 | importGFDItem.addActionListener(this); |
---|
.. | .. |
---|
1766 | 1767 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1767 | 1768 | |
---|
1768 | 1769 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1769 | | - scenePanel.preferredWidth = 6; |
---|
| 1770 | + scenePanel.preferredWidth = 5; |
---|
1770 | 1771 | |
---|
1771 | 1772 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1772 | 1773 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1786 | 1787 | cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
1787 | 1788 | creditsPanel.setName("Credits"); |
---|
1788 | 1789 | |
---|
1789 | | - cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
| 1790 | + cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
1790 | 1791 | creditsPanel.add(ogaLabel); |
---|
1791 | 1792 | |
---|
1792 | | - cButton opengameartButton; |
---|
1793 | | - creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
1794 | | - opengameartButton.setToolTipText("https://opengameart.org"); |
---|
| 1793 | + cButton creditButton; |
---|
| 1794 | + creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
| 1795 | + creditButton.setToolTipText("https://opengameart.org"); |
---|
1795 | 1796 | |
---|
1796 | | - opengameartButton.addMouseListener(new MouseAdapter() |
---|
| 1797 | + creditButton.addMouseListener(new MouseAdapter() |
---|
1797 | 1798 | { |
---|
1798 | 1799 | public void mouseClicked(MouseEvent e) |
---|
1799 | 1800 | { |
---|
.. | .. |
---|
1808 | 1809 | } |
---|
1809 | 1810 | }); |
---|
1810 | 1811 | |
---|
1811 | | - for (int i=10; --i>=0;) |
---|
| 1812 | + ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF); |
---|
| 1813 | + creditsPanel.add(ogaLabel); |
---|
| 1814 | + |
---|
| 1815 | + creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF)); |
---|
| 1816 | + creditButton.setToolTipText("https://3delicious.net"); |
---|
| 1817 | + |
---|
| 1818 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1819 | + { |
---|
| 1820 | + public void mouseClicked(MouseEvent e) |
---|
| 1821 | + { |
---|
| 1822 | + try |
---|
| 1823 | + { |
---|
| 1824 | + Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net")); |
---|
| 1825 | + } catch (Exception e1) |
---|
| 1826 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1827 | + { |
---|
| 1828 | + e1.printStackTrace(); |
---|
| 1829 | + } |
---|
| 1830 | + } |
---|
| 1831 | + }); |
---|
| 1832 | + |
---|
| 1833 | + creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF)); |
---|
| 1834 | + creditButton.setToolTipText("https://archive3d.net"); |
---|
| 1835 | + |
---|
| 1836 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1837 | + { |
---|
| 1838 | + public void mouseClicked(MouseEvent e) |
---|
| 1839 | + { |
---|
| 1840 | + try |
---|
| 1841 | + { |
---|
| 1842 | + Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net")); |
---|
| 1843 | + } catch (Exception e1) |
---|
| 1844 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1845 | + { |
---|
| 1846 | + e1.printStackTrace(); |
---|
| 1847 | + } |
---|
| 1848 | + } |
---|
| 1849 | + }); |
---|
| 1850 | + |
---|
| 1851 | + creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF)); |
---|
| 1852 | + creditButton.setToolTipText("https://turbosquid.com"); |
---|
| 1853 | + |
---|
| 1854 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1855 | + { |
---|
| 1856 | + public void mouseClicked(MouseEvent e) |
---|
| 1857 | + { |
---|
| 1858 | + try |
---|
| 1859 | + { |
---|
| 1860 | + Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free")); |
---|
| 1861 | + } catch (Exception e1) |
---|
| 1862 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1863 | + { |
---|
| 1864 | + e1.printStackTrace(); |
---|
| 1865 | + } |
---|
| 1866 | + } |
---|
| 1867 | + }); |
---|
| 1868 | + |
---|
| 1869 | + for (int i=6; --i>=0;) |
---|
1812 | 1870 | { |
---|
1813 | 1871 | creditsPanel.add(new cGridBag()); |
---|
1814 | 1872 | } |
---|
.. | .. |
---|
1818 | 1876 | |
---|
1819 | 1877 | if (Globals.ADVANCED) |
---|
1820 | 1878 | { |
---|
1821 | | - tabbedPane.add(infoPanel); |
---|
1822 | | - tabbedPane.setIconAt(4, GetIcon("icons/info.png")); |
---|
1823 | | - tabbedPane.setToolTipTextAt(4, "Information"); |
---|
| 1879 | + objectPanel.add(infoPanel); |
---|
| 1880 | + objectPanel.setIconAt(5, GetIcon("icons/info.png")); |
---|
| 1881 | + objectPanel.setToolTipTextAt(4, "Information"); |
---|
1824 | 1882 | } |
---|
1825 | 1883 | |
---|
1826 | 1884 | /* |
---|
.. | .. |
---|
2304 | 2362 | { |
---|
2305 | 2363 | public void mouseClicked(MouseEvent e) |
---|
2306 | 2364 | { |
---|
2307 | | - borderfadeField.setFloat(0.5); |
---|
| 2365 | + borderfadeField.setFloat(0.4); |
---|
2308 | 2366 | opacityField.setFloat(0.75); |
---|
2309 | 2367 | |
---|
2310 | 2368 | materialtouched = true; |
---|
.. | .. |
---|
2370 | 2428 | } |
---|
2371 | 2429 | }); |
---|
2372 | 2430 | presetpanel.add(shadowShader); |
---|
| 2431 | + |
---|
| 2432 | + cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF); |
---|
| 2433 | + para0.setToolTipText("No parallax"); |
---|
| 2434 | + para0.addMouseListener(new MouseAdapter() |
---|
| 2435 | + { |
---|
| 2436 | + public void mouseClicked(MouseEvent e) |
---|
| 2437 | + { |
---|
| 2438 | + parallaxField.setFloat(0.125); |
---|
| 2439 | + |
---|
| 2440 | + materialtouched = true; |
---|
| 2441 | + applySelf(); |
---|
| 2442 | + } |
---|
| 2443 | + }); |
---|
| 2444 | + presetpanel.add(para0); |
---|
| 2445 | + |
---|
| 2446 | + cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF); |
---|
| 2447 | + para1.setToolTipText("With parallax"); |
---|
| 2448 | + para1.addMouseListener(new MouseAdapter() |
---|
| 2449 | + { |
---|
| 2450 | + public void mouseClicked(MouseEvent e) |
---|
| 2451 | + { |
---|
| 2452 | + parallaxField.setFloat(0.13); |
---|
| 2453 | + |
---|
| 2454 | + materialtouched = true; |
---|
| 2455 | + applySelf(); |
---|
| 2456 | + } |
---|
| 2457 | + }); |
---|
| 2458 | + presetpanel.add(para1); |
---|
| 2459 | + |
---|
| 2460 | + cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF); |
---|
| 2461 | + para2.setToolTipText("Reset parallax"); |
---|
| 2462 | + para2.addMouseListener(new MouseAdapter() |
---|
| 2463 | + { |
---|
| 2464 | + public void mouseClicked(MouseEvent e) |
---|
| 2465 | + { |
---|
| 2466 | + parallaxField.setFloat(0.14); |
---|
| 2467 | + |
---|
| 2468 | + materialtouched = true; |
---|
| 2469 | + applySelf(); |
---|
| 2470 | + } |
---|
| 2471 | + }); |
---|
| 2472 | + presetpanel.add(para2); |
---|
2373 | 2473 | |
---|
2374 | 2474 | cGridBag panel = new cGridBag().setVertical(true); |
---|
2375 | 2475 | |
---|
.. | .. |
---|
2616 | 2716 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
2617 | 2717 | colorSection.add(backlit); |
---|
2618 | 2718 | |
---|
| 2719 | + cGridBag parallax = new cGridBag(); |
---|
| 2720 | + parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints); |
---|
| 2721 | + parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2722 | + parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints); |
---|
| 2723 | + colorSection.add(parallax); |
---|
| 2724 | + |
---|
2619 | 2725 | //panel.add(new JSeparator()); |
---|
2620 | 2726 | |
---|
2621 | 2727 | //panel.add(globalSection); |
---|
.. | .. |
---|
3667 | 3773 | shadowField.setFloat(mat.shadow); |
---|
3668 | 3774 | textureField.setFloat(mat.texture); |
---|
3669 | 3775 | opacityField.setFloat(mat.opacity); |
---|
| 3776 | + parallaxField.setFloat(mat.parallax + 0.125f); |
---|
3670 | 3777 | fakedepthField.setFloat(mat.fakedepth); |
---|
3671 | 3778 | shadowbiasField.setFloat(mat.shadowbias); |
---|
3672 | 3779 | bumpField.setInteger(1); // dec 2013 |
---|
.. | .. |
---|
4360 | 4467 | System.err.println("Save"); |
---|
4361 | 4468 | Replace(); |
---|
4362 | 4469 | |
---|
4363 | | - //cRadio tab = GetCurrentTab(); |
---|
| 4470 | + if (copy.versionlist == null) |
---|
| 4471 | + { |
---|
| 4472 | + copy.versionlist = new Object3D[100]; |
---|
| 4473 | + copy.versionindex = -1; |
---|
| 4474 | + } |
---|
4364 | 4475 | |
---|
4365 | 4476 | Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
4366 | 4477 | |
---|
.. | .. |
---|
4534 | 4645 | |
---|
4535 | 4646 | //cRadio tab = GetCurrentTab(); |
---|
4536 | 4647 | |
---|
4537 | | - if (copy.versionlist == null) |
---|
| 4648 | + if (copy.versionindex == -2) |
---|
4538 | 4649 | { |
---|
4539 | 4650 | saveVersionButton.setEnabled(false); |
---|
4540 | 4651 | restoreButton.setEnabled(false); |
---|
.. | .. |
---|
4891 | 5002 | current.shadow = (float) shadowField.getFloat(); |
---|
4892 | 5003 | current.texture = (float) textureField.getFloat(); |
---|
4893 | 5004 | current.opacity = (float) opacityField.getFloat(); |
---|
| 5005 | + current.parallax = (float) parallaxField.getFloat() - 0.125f; |
---|
4894 | 5006 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
4895 | 5007 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
4896 | 5008 | |
---|
.. | .. |
---|
4945 | 5057 | textureField.SetToolTipValue((mat.texture)); |
---|
4946 | 5058 | if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
4947 | 5059 | opacityField.SetToolTipValue((mat.opacity)); |
---|
| 5060 | + //if (!Equal(parallaxField.getFloat(), mat.parallax)) |
---|
| 5061 | + parallaxField.SetToolTipValue((mat.parallax)); |
---|
4948 | 5062 | if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
4949 | 5063 | fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
4950 | 5064 | if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
.. | .. |
---|
6201 | 6315 | cNumberSlider textureField; |
---|
6202 | 6316 | JLabel opacityLabel; |
---|
6203 | 6317 | cNumberSlider opacityField; |
---|
| 6318 | + JLabel parallaxLabel; |
---|
| 6319 | + cNumberSlider parallaxField; |
---|
6204 | 6320 | JLabel fakedepthLabel; |
---|
6205 | 6321 | cNumberSlider fakedepthField; |
---|
6206 | 6322 | JLabel shadowbiasLabel; |
---|