Normand Briere
2019-08-22 6a145f6c81dfcbe0653eda27d042efb48daa7512
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());
....@@ -1789,7 +1795,7 @@
17891795 cGridBag creditsPanel = new cGridBag().setVertical(true);
17901796 creditsPanel.setName("Credits");
17911797
1792
- cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1798
+ cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
17931799 creditsPanel.add(ogaLabel);
17941800
17951801 cButton creditButton;
....@@ -1811,7 +1817,7 @@
18111817 }
18121818 });
18131819
1814
- ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
1820
+ ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
18151821 creditsPanel.add(ogaLabel);
18161822
18171823 creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF));
....@@ -2364,7 +2370,7 @@
23642370 {
23652371 public void mouseClicked(MouseEvent e)
23662372 {
2367
- borderfadeField.setFloat(0.5);
2373
+ borderfadeField.setFloat(0.4);
23682374 opacityField.setFloat(0.75);
23692375
23702376 materialtouched = true;
....@@ -2430,6 +2436,48 @@
24302436 }
24312437 });
24322438 presetpanel.add(shadowShader);
2439
+
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.125);
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.13);
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.14);
2475
+
2476
+ materialtouched = true;
2477
+ applySelf();
2478
+ }
2479
+ });
2480
+ presetpanel.add(para2);
24332481
24342482 cGridBag panel = new cGridBag().setVertical(true);
24352483
....@@ -2676,6 +2724,12 @@
26762724 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
26772725 colorSection.add(backlit);
26782726
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.25, -0.125)); // , aConstraints);
2731
+ colorSection.add(parallax);
2732
+
26792733 //panel.add(new JSeparator());
26802734
26812735 //panel.add(globalSection);
....@@ -3727,6 +3781,7 @@
37273781 shadowField.setFloat(mat.shadow);
37283782 textureField.setFloat(mat.texture);
37293783 opacityField.setFloat(mat.opacity);
3784
+ parallaxField.setFloat(mat.parallax + 0.125f);
37303785 fakedepthField.setFloat(mat.fakedepth);
37313786 shadowbiasField.setFloat(mat.shadowbias);
37323787 bumpField.setInteger(1); // dec 2013
....@@ -4951,6 +5006,7 @@
49515006 current.shadow = (float) shadowField.getFloat();
49525007 current.texture = (float) textureField.getFloat();
49535008 current.opacity = (float) opacityField.getFloat();
5009
+ current.parallax = (float) parallaxField.getFloat() - 0.125f;
49545010 current.fakedepth = (float) fakedepthField.getFloat();
49555011 current.shadowbias = (float) shadowbiasField.getFloat();
49565012
....@@ -5005,6 +5061,8 @@
50055061 textureField.SetToolTipValue((mat.texture));
50065062 if (!Equal(opacityField.getFloat(), mat.opacity))
50075063 opacityField.SetToolTipValue((mat.opacity));
5064
+ //if (!Equal(parallaxField.getFloat(), mat.parallax))
5065
+ parallaxField.SetToolTipValue((mat.parallax));
50085066 if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
50095067 fakedepthField.SetToolTipValue((mat.fakedepth));
50105068 if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
....@@ -6261,6 +6319,8 @@
62616319 cNumberSlider textureField;
62626320 JLabel opacityLabel;
62636321 cNumberSlider opacityField;
6322
+ JLabel parallaxLabel;
6323
+ cNumberSlider parallaxField;
62646324 JLabel fakedepthLabel;
62656325 cNumberSlider fakedepthField;
62666326 JLabel shadowbiasLabel;