From 6a145f6c81dfcbe0653eda27d042efb48daa7512 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 21 Aug 2019 21:05:56 -0400
Subject: [PATCH] Minor tuning

---
 ObjEditor.java |   70 ++++++++++++++++++++++++++++++++--
 1 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/ObjEditor.java b/ObjEditor.java
index 93c90ad..728fabc 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -134,8 +134,14 @@
         
         try
         {
-            BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
-
+            BufferedImage image;
+            
+            if (name.endsWith("jpg"))
+                // Much faster!
+                image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage();
+            else
+                image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
+  
 //            if (image.getWidth() > 48 && image.getHeight() > 48)
 //            {
 //                BufferedImage resized = new BufferedImage(48, 48, image.getType());
@@ -1789,7 +1795,7 @@
         cGridBag creditsPanel = new cGridBag().setVertical(true);
         creditsPanel.setName("Credits");
         
-        cLabel ogaLabel = new cLabel("   Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
+        cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
 	creditsPanel.add(ogaLabel);
         
         cButton creditButton;
@@ -1811,7 +1817,7 @@
             }
         });
         
-        ogaLabel = new cLabel("   Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
+        ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
 	creditsPanel.add(ogaLabel);
         
 	creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF));
@@ -2364,7 +2370,7 @@
         {
             public void mouseClicked(MouseEvent e)
             {
-                borderfadeField.setFloat(0.5);
+                borderfadeField.setFloat(0.4);
                 opacityField.setFloat(0.75);
 
                 materialtouched = true;
@@ -2430,6 +2436,48 @@
             }
         });
         presetpanel.add(shadowShader);
+        
+        cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF);
+        para0.setToolTipText("No parallax");
+        para0.addMouseListener(new MouseAdapter()
+        {
+            public void mouseClicked(MouseEvent e)
+            {
+                parallaxField.setFloat(0.125);
+
+                materialtouched = true;
+                applySelf();
+            }
+        });
+        presetpanel.add(para0);
+        
+        cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF);
+        para1.setToolTipText("With parallax");
+        para1.addMouseListener(new MouseAdapter()
+        {
+            public void mouseClicked(MouseEvent e)
+            {
+                parallaxField.setFloat(0.13);
+
+                materialtouched = true;
+                applySelf();
+            }
+        });
+        presetpanel.add(para1);
+        
+        cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF);
+        para2.setToolTipText("Reset parallax");
+        para2.addMouseListener(new MouseAdapter()
+        {
+            public void mouseClicked(MouseEvent e)
+            {
+                parallaxField.setFloat(0.14);
+
+                materialtouched = true;
+                applySelf();
+            }
+        });
+        presetpanel.add(para2);
         
         cGridBag panel = new cGridBag().setVertical(true);
         
@@ -2676,6 +2724,12 @@
                 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
         colorSection.add(backlit);
 
+        cGridBag parallax = new cGridBag();
+                parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints);
+                parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING);
+                parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints);
+        colorSection.add(parallax);
+        
         //panel.add(new JSeparator());
         
         //panel.add(globalSection);
@@ -3727,6 +3781,7 @@
         shadowField.setFloat(mat.shadow);
         textureField.setFloat(mat.texture);
         opacityField.setFloat(mat.opacity);
+        parallaxField.setFloat(mat.parallax + 0.125f);
         fakedepthField.setFloat(mat.fakedepth);
         shadowbiasField.setFloat(mat.shadowbias);
         bumpField.setInteger(1); // dec 2013
@@ -4951,6 +5006,7 @@
             current.shadow = (float) shadowField.getFloat();
             current.texture = (float) textureField.getFloat();
             current.opacity = (float) opacityField.getFloat();
+            current.parallax = (float) parallaxField.getFloat() - 0.125f;
             current.fakedepth = (float) fakedepthField.getFloat();
             current.shadowbias = (float) shadowbiasField.getFloat();
 
@@ -5005,6 +5061,8 @@
                         textureField.SetToolTipValue((mat.texture));
                     if (!Equal(opacityField.getFloat(), mat.opacity))
                         opacityField.SetToolTipValue((mat.opacity));
+                    //if (!Equal(parallaxField.getFloat(), mat.parallax))
+                        parallaxField.SetToolTipValue((mat.parallax));
                     if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
                         fakedepthField.SetToolTipValue((mat.fakedepth));
                     if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
@@ -6261,6 +6319,8 @@
     cNumberSlider textureField;
     JLabel opacityLabel;
     cNumberSlider opacityField;
+    JLabel parallaxLabel;
+    cNumberSlider parallaxField;
     JLabel fakedepthLabel;
     cNumberSlider fakedepthField;
     JLabel shadowbiasLabel;

--
Gitblit v1.6.2