Normand Briere
2019-08-22 0c7b833be7d86598a6813cd1c6db0ca9e1b17966
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());
....@@ -377,14 +383,6 @@
377383 client = inClient;
378384 copy = client;
379385
380
- if (copy.versionlist == null)
381
- {
382
- copy.versionlist = new Object3D[100];
383
- copy.versionindex = -1;
384
-
385
-// Save(true);
386
- }
387
-
388386 SetupUI2(callee.GetEditor());
389387 }
390388
....@@ -1878,9 +1876,9 @@
18781876
18791877 if (Globals.ADVANCED)
18801878 {
1881
- tabbedPane.add(infoPanel);
1882
- tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1883
- tabbedPane.setToolTipTextAt(4, "Information");
1879
+ objectPanel.add(infoPanel);
1880
+ objectPanel.setIconAt(5, GetIcon("icons/info.png"));
1881
+ objectPanel.setToolTipTextAt(4, "Information");
18841882 }
18851883
18861884 /*
....@@ -2364,7 +2362,7 @@
23642362 {
23652363 public void mouseClicked(MouseEvent e)
23662364 {
2367
- borderfadeField.setFloat(0.5);
2365
+ borderfadeField.setFloat(0.4);
23682366 opacityField.setFloat(0.75);
23692367
23702368 materialtouched = true;
....@@ -2430,6 +2428,48 @@
24302428 }
24312429 });
24322430 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);
24332473
24342474 cGridBag panel = new cGridBag().setVertical(true);
24352475
....@@ -2676,6 +2716,12 @@
26762716 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
26772717 colorSection.add(backlit);
26782718
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
+
26792725 //panel.add(new JSeparator());
26802726
26812727 //panel.add(globalSection);
....@@ -3727,6 +3773,7 @@
37273773 shadowField.setFloat(mat.shadow);
37283774 textureField.setFloat(mat.texture);
37293775 opacityField.setFloat(mat.opacity);
3776
+ parallaxField.setFloat(mat.parallax + 0.125f);
37303777 fakedepthField.setFloat(mat.fakedepth);
37313778 shadowbiasField.setFloat(mat.shadowbias);
37323779 bumpField.setInteger(1); // dec 2013
....@@ -4420,7 +4467,11 @@
44204467 System.err.println("Save");
44214468 Replace();
44224469
4423
- //cRadio tab = GetCurrentTab();
4470
+ if (copy.versionlist == null)
4471
+ {
4472
+ copy.versionlist = new Object3D[100];
4473
+ copy.versionindex = -1;
4474
+ }
44244475
44254476 Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
44264477
....@@ -4594,7 +4645,7 @@
45944645
45954646 //cRadio tab = GetCurrentTab();
45964647
4597
- if (copy.versionlist == null)
4648
+ if (copy.versionindex == -2)
45984649 {
45994650 saveVersionButton.setEnabled(false);
46004651 restoreButton.setEnabled(false);
....@@ -4951,6 +5002,7 @@
49515002 current.shadow = (float) shadowField.getFloat();
49525003 current.texture = (float) textureField.getFloat();
49535004 current.opacity = (float) opacityField.getFloat();
5005
+ current.parallax = (float) parallaxField.getFloat() - 0.125f;
49545006 current.fakedepth = (float) fakedepthField.getFloat();
49555007 current.shadowbias = (float) shadowbiasField.getFloat();
49565008
....@@ -5005,6 +5057,8 @@
50055057 textureField.SetToolTipValue((mat.texture));
50065058 if (!Equal(opacityField.getFloat(), mat.opacity))
50075059 opacityField.SetToolTipValue((mat.opacity));
5060
+ //if (!Equal(parallaxField.getFloat(), mat.parallax))
5061
+ parallaxField.SetToolTipValue((mat.parallax));
50085062 if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
50095063 fakedepthField.SetToolTipValue((mat.fakedepth));
50105064 if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
....@@ -6261,6 +6315,8 @@
62616315 cNumberSlider textureField;
62626316 JLabel opacityLabel;
62636317 cNumberSlider opacityField;
6318
+ JLabel parallaxLabel;
6319
+ cNumberSlider parallaxField;
62646320 JLabel fakedepthLabel;
62656321 cNumberSlider fakedepthField;
62666322 JLabel shadowbiasLabel;