- Added an AppSetting param for gamma correction, defaulted to true.
- Added a filed in the Setting dialog to toggle gamma correction on and off
This commit is contained in:
parent
0967f39b83
commit
a23038430c
@ -143,6 +143,7 @@ public final class AppSettings extends HashMap<String, Object> {
|
||||
defaults.put("SettingsDialogImage", "/com/jme3/app/Monkey.png");
|
||||
defaults.put("MinHeight", 0);
|
||||
defaults.put("MinWidth", 0);
|
||||
defaults.put("GammaCorrection", true);
|
||||
// defaults.put("Icons", null);
|
||||
}
|
||||
|
||||
@ -746,6 +747,17 @@ public final class AppSettings extends HashMap<String, Object> {
|
||||
putString("SettingsDialogImage", path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables Gamma Correction
|
||||
* This requires that the GPU supports GL_ARB_framebuffer_sRGB and will
|
||||
* disabled otherwise.
|
||||
* @param gammaCorrection
|
||||
* (Default : true)
|
||||
*/
|
||||
public void setGammaCorrection(boolean gammaCorrection) {
|
||||
putBoolean("GammaCorrection", gammaCorrection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the framerate.
|
||||
* @see #setFrameRate(int)
|
||||
@ -914,4 +926,8 @@ public final class AppSettings extends HashMap<String, Object> {
|
||||
public String getSettingsDialogImage() {
|
||||
return getString("SettingsDialogImage");
|
||||
}
|
||||
|
||||
public boolean getGammaCorrection() {
|
||||
return getBoolean("GammaCorrection");
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ public final class SettingsDialog extends JFrame {
|
||||
|
||||
// UI components
|
||||
private JCheckBox vsyncBox = null;
|
||||
private JCheckBox gammaBox = null;
|
||||
private JCheckBox fullscreenBox = null;
|
||||
private JComboBox displayResCombo = null;
|
||||
private JComboBox colorDepthCombo = null;
|
||||
@ -356,6 +357,9 @@ public final class SettingsDialog extends JFrame {
|
||||
vsyncBox = new JCheckBox(resourceBundle.getString("checkbox.vsync"));
|
||||
vsyncBox.setSelected(source.isVSync());
|
||||
|
||||
gammaBox = new JCheckBox(resourceBundle.getString("checkbox.gamma"));
|
||||
gammaBox.setSelected(source.getGammaCorrection());
|
||||
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.weightx = 0.5;
|
||||
gbc.gridx = 0;
|
||||
@ -365,12 +369,19 @@ public final class SettingsDialog extends JFrame {
|
||||
mainPanel.add(fullscreenBox, gbc);
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.weightx = 0.5;
|
||||
gbc.insets = new Insets(4, 16, 0, 4);
|
||||
// gbc.insets = new Insets(4, 16, 0, 4);
|
||||
gbc.gridx = 2;
|
||||
gbc.gridwidth = 2;
|
||||
// gbc.gridwidth = 2;
|
||||
gbc.gridy = 1;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
mainPanel.add(vsyncBox, gbc);
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.weightx = 0.5;
|
||||
gbc.gridx = 3;
|
||||
gbc.gridy = 1;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
mainPanel.add(vsyncBox, gbc);
|
||||
mainPanel.add(gammaBox, gbc);
|
||||
|
||||
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.insets = new Insets(4, 4, 4, 4);
|
||||
@ -517,6 +528,7 @@ public final class SettingsDialog extends JFrame {
|
||||
String display = (String) displayResCombo.getSelectedItem();
|
||||
boolean fullscreen = fullscreenBox.isSelected();
|
||||
boolean vsync = vsyncBox.isSelected();
|
||||
boolean gamma = gammaBox.isSelected();
|
||||
|
||||
int width = Integer.parseInt(display.substring(0, display.indexOf(" x ")));
|
||||
display = display.substring(display.indexOf(" x ") + 3);
|
||||
@ -576,6 +588,7 @@ public final class SettingsDialog extends JFrame {
|
||||
source.setFrequency(freq);
|
||||
source.setFullscreen(fullscreen);
|
||||
source.setVSync(vsync);
|
||||
source.setGammaCorrection(gamma);
|
||||
//source.setRenderer(renderer);
|
||||
source.setSamples(multisample);
|
||||
|
||||
|
@ -5,6 +5,7 @@ button.cancel=Cancel
|
||||
|
||||
checkbox.fullscreen=Fullscreen?
|
||||
checkbox.vsync=Vsync?
|
||||
checkbox.gamma=Gamma correction
|
||||
|
||||
label.resolutions=Screen Resolution
|
||||
label.colordepth=Color Depth
|
||||
|
Loading…
x
Reference in New Issue
Block a user