Normand Briere
2019-08-22 6a823ffbfcda4c843f46e02e83c869d5bc323e25
ObjEditor.java
....@@ -134,8 +134,14 @@
134134
135135 try
136136 {
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
+
139145 // if (image.getWidth() > 48 && image.getHeight() > 48)
140146 // {
141147 // BufferedImage resized = new BufferedImage(48, 48, image.getType());
....@@ -460,8 +466,11 @@
460466 importOBJItem.addActionListener(this);
461467 import3DSItem = menu.add(new MenuItem("3DS file..."));
462468 import3DSItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
463471 importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
464472 importVRMLX3DItem.addActionListener(this);
473
+ }
465474 menu.add("-");
466475 importGFDItem = menu.add(new MenuItem("Grafreed file..."));
467476 importGFDItem.addActionListener(this);
....@@ -1786,14 +1795,14 @@
17861795 cGridBag creditsPanel = new cGridBag().setVertical(true);
17871796 creditsPanel.setName("Credits");
17881797
1789
- cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1798
+ cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
17901799 creditsPanel.add(ogaLabel);
17911800
1792
- cButton opengameartButton;
1793
- creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1794
- opengameartButton.setToolTipText("https://opengameart.org");
1801
+ cButton creditButton;
1802
+ creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1803
+ creditButton.setToolTipText("https://opengameart.org");
17951804
1796
- opengameartButton.addMouseListener(new MouseAdapter()
1805
+ creditButton.addMouseListener(new MouseAdapter()
17971806 {
17981807 public void mouseClicked(MouseEvent e)
17991808 {
....@@ -1808,7 +1817,64 @@
18081817 }
18091818 });
18101819
1811
- for (int i=10; --i>=0;)
1820
+ ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
1821
+ creditsPanel.add(ogaLabel);
1822
+
1823
+ creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF));
1824
+ creditButton.setToolTipText("https://3delicious.net");
1825
+
1826
+ creditButton.addMouseListener(new MouseAdapter()
1827
+ {
1828
+ public void mouseClicked(MouseEvent e)
1829
+ {
1830
+ try
1831
+ {
1832
+ Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net"));
1833
+ } catch (Exception e1)
1834
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1835
+ {
1836
+ e1.printStackTrace();
1837
+ }
1838
+ }
1839
+ });
1840
+
1841
+ creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF));
1842
+ creditButton.setToolTipText("https://archive3d.net");
1843
+
1844
+ creditButton.addMouseListener(new MouseAdapter()
1845
+ {
1846
+ public void mouseClicked(MouseEvent e)
1847
+ {
1848
+ try
1849
+ {
1850
+ Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net"));
1851
+ } catch (Exception e1)
1852
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1853
+ {
1854
+ e1.printStackTrace();
1855
+ }
1856
+ }
1857
+ });
1858
+
1859
+ creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF));
1860
+ creditButton.setToolTipText("https://turbosquid.com");
1861
+
1862
+ creditButton.addMouseListener(new MouseAdapter()
1863
+ {
1864
+ public void mouseClicked(MouseEvent e)
1865
+ {
1866
+ try
1867
+ {
1868
+ Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free"));
1869
+ } catch (Exception e1)
1870
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1871
+ {
1872
+ e1.printStackTrace();
1873
+ }
1874
+ }
1875
+ });
1876
+
1877
+ for (int i=6; --i>=0;)
18121878 {
18131879 creditsPanel.add(new cGridBag());
18141880 }
....@@ -2371,6 +2437,48 @@
23712437 });
23722438 presetpanel.add(shadowShader);
23732439
2440
+ cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF);
2441
+ para0.setToolTipText("No parallax");
2442
+ para0.addMouseListener(new MouseAdapter()
2443
+ {
2444
+ public void mouseClicked(MouseEvent e)
2445
+ {
2446
+ parallaxField.setFloat(0.25);
2447
+
2448
+ materialtouched = true;
2449
+ applySelf();
2450
+ }
2451
+ });
2452
+ presetpanel.add(para0);
2453
+
2454
+ cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF);
2455
+ para1.setToolTipText("With parallax");
2456
+ para1.addMouseListener(new MouseAdapter()
2457
+ {
2458
+ public void mouseClicked(MouseEvent e)
2459
+ {
2460
+ parallaxField.setFloat(0.255);
2461
+
2462
+ materialtouched = true;
2463
+ applySelf();
2464
+ }
2465
+ });
2466
+ presetpanel.add(para1);
2467
+
2468
+ cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF);
2469
+ para2.setToolTipText("Reset parallax");
2470
+ para2.addMouseListener(new MouseAdapter()
2471
+ {
2472
+ public void mouseClicked(MouseEvent e)
2473
+ {
2474
+ parallaxField.setFloat(0.265);
2475
+
2476
+ materialtouched = true;
2477
+ applySelf();
2478
+ }
2479
+ });
2480
+ presetpanel.add(para2);
2481
+
23742482 cGridBag panel = new cGridBag().setVertical(true);
23752483
23762484 presetpanel.preferredWidth = 1;
....@@ -2616,6 +2724,12 @@
26162724 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
26172725 colorSection.add(backlit);
26182726
2727
+ cGridBag parallax = new cGridBag();
2728
+ parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints);
2729
+ parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2730
+ parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.5, -0.25)); // , aConstraints);
2731
+ colorSection.add(parallax);
2732
+
26192733 //panel.add(new JSeparator());
26202734
26212735 //panel.add(globalSection);
....@@ -3667,6 +3781,7 @@
36673781 shadowField.setFloat(mat.shadow);
36683782 textureField.setFloat(mat.texture);
36693783 opacityField.setFloat(mat.opacity);
3784
+ parallaxField.setFloat(mat.parallax + 0.25f);
36703785 fakedepthField.setFloat(mat.fakedepth);
36713786 shadowbiasField.setFloat(mat.shadowbias);
36723787 bumpField.setInteger(1); // dec 2013
....@@ -4891,6 +5006,7 @@
48915006 current.shadow = (float) shadowField.getFloat();
48925007 current.texture = (float) textureField.getFloat();
48935008 current.opacity = (float) opacityField.getFloat();
5009
+ current.parallax = (float) parallaxField.getFloat() - 0.25f;
48945010 current.fakedepth = (float) fakedepthField.getFloat();
48955011 current.shadowbias = (float) shadowbiasField.getFloat();
48965012
....@@ -4945,6 +5061,8 @@
49455061 textureField.SetToolTipValue((mat.texture));
49465062 if (!Equal(opacityField.getFloat(), mat.opacity))
49475063 opacityField.SetToolTipValue((mat.opacity));
5064
+ //if (!Equal(parallaxField.getFloat(), mat.parallax))
5065
+ parallaxField.SetToolTipValue((mat.parallax));
49485066 if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
49495067 fakedepthField.SetToolTipValue((mat.fakedepth));
49505068 if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
....@@ -6201,6 +6319,8 @@
62016319 cNumberSlider textureField;
62026320 JLabel opacityLabel;
62036321 cNumberSlider opacityField;
6322
+ JLabel parallaxLabel;
6323
+ cNumberSlider parallaxField;
62046324 JLabel fakedepthLabel;
62056325 cNumberSlider fakedepthField;
62066326 JLabel shadowbiasLabel;