33import com .jme3 .asset .AssetEventListener ;
44import com .jme3 .asset .AssetKey ;
55import com .jme3 .asset .TextureKey ;
6+ import com .jme3 .math .Vector3f ;
67import com .jme3 .system .AppSettings ;
78import com .ss .editor .Editor ;
89import com .ss .editor .EditorContext ;
@@ -39,6 +40,9 @@ public final class EditorConfig implements AssetEventListener {
3940 public static final String PREF_GRAPHIC_ANISOTROPY = GRAPHICS_ALIAS + "." + "anisotropy" ;
4041 public static final String PREF_GRAPHIC_FXAA = GRAPHICS_ALIAS + "." + "fxaa" ;
4142 public static final String PREF_GRAPHIC_FULLSCREEN = GRAPHICS_ALIAS + "." + "fullscreen" ;
43+ public static final String PREF_GRAPHIC_GAMA_CORRECTION = GRAPHICS_ALIAS + "." + "gammaCorrection" ;
44+ public static final String PREF_GRAPHIC_TONEMAP_FILTER = GRAPHICS_ALIAS + "." + "toneMapFilter" ;
45+ public static final String PREF_GRAPHIC_TONEMAP_FILTER_WHITE_POINT = GRAPHICS_ALIAS + "." + "toneMapFilterWhitePoint" ;
4246
4347 public static final String PREF_CURRENT_ASSET = ASSET_ALIAS + "." + "currentAsset" ;
4448 public static final String PREF_LAST_OPENED_ASSETS = ASSET_ALIAS + "." + "lastOpenedAssets" ;
@@ -68,6 +72,11 @@ public static EditorConfig getInstance() {
6872 */
6973 private volatile ScreenSize screenSize ;
7074
75+ /**
76+ * Точка белого на фильтре экспозиции.
77+ */
78+ private volatile Vector3f toneMapFilterWhitePoint ;
79+
7180 /**
7281 * Уровень анизатропной фильтрации.
7382 */
@@ -83,6 +92,16 @@ public static EditorConfig getInstance() {
8392 */
8493 private volatile boolean fullscreen ;
8594
95+ /**
96+ * Включен ли режим гамма коррекции.
97+ */
98+ private volatile boolean gammaCorrection ;
99+
100+ /**
101+ * Включен ли фильтр экспозиции.
102+ */
103+ private volatile boolean toneMapFilter ;
104+
86105 /**
87106 * Текущий выбранный Asset.
88107 */
@@ -200,6 +219,48 @@ public boolean isFullscreen() {
200219 return fullscreen ;
201220 }
202221
222+ /**
223+ * @return включен ли режим гамма коррекции.
224+ */
225+ public boolean isGammaCorrection () {
226+ return gammaCorrection ;
227+ }
228+
229+ /**
230+ * @param gammaCorrection включен ли режим гамма коррекции.
231+ */
232+ public void setGammaCorrection (final boolean gammaCorrection ) {
233+ this .gammaCorrection = gammaCorrection ;
234+ }
235+
236+ /**
237+ * @return включен ли фильтр экспозиции.
238+ */
239+ public boolean isToneMapFilter () {
240+ return toneMapFilter ;
241+ }
242+
243+ /**
244+ * @param toneMapFilter включен ли фильтр экспозиции.
245+ */
246+ public void setToneMapFilter (final boolean toneMapFilter ) {
247+ this .toneMapFilter = toneMapFilter ;
248+ }
249+
250+ /**
251+ * @return точка белого на фильтре экспозиции.
252+ */
253+ public Vector3f getToneMapFilterWhitePoint () {
254+ return toneMapFilterWhitePoint ;
255+ }
256+
257+ /**
258+ * @param toneMapFilterWhitePoint точка белого на фильтре экспозиции.
259+ */
260+ public void setToneMapFilterWhitePoint (final Vector3f toneMapFilterWhitePoint ) {
261+ this .toneMapFilterWhitePoint = toneMapFilterWhitePoint ;
262+ }
263+
203264 /**
204265 * @return настройки движка.
205266 */
@@ -233,6 +294,8 @@ private void init() {
233294 this .anisotropy = prefs .getInt (PREF_GRAPHIC_ANISOTROPY , 0 );
234295 this .fxaa = prefs .getBoolean (PREF_GRAPHIC_FXAA , false );
235296 this .fullscreen = prefs .getBoolean (PREF_GRAPHIC_FULLSCREEN , false );
297+ this .gammaCorrection = prefs .getBoolean (PREF_GRAPHIC_GAMA_CORRECTION , false );
298+ this .toneMapFilter = prefs .getBoolean (PREF_GRAPHIC_TONEMAP_FILTER , false );
236299
237300 final String currentAssetURI = prefs .get (PREF_CURRENT_ASSET , null );
238301
@@ -244,6 +307,23 @@ private void init() {
244307 }
245308 }
246309
310+ this .toneMapFilterWhitePoint = new Vector3f (11 , 11 , 11 );
311+
312+ final String whitePoint = prefs .get (PREF_GRAPHIC_TONEMAP_FILTER_WHITE_POINT , null );
313+ final String [] coords = whitePoint == null ? null : whitePoint .split ("," , 3 );
314+
315+ if (coords != null && coords .length > 2 ) {
316+ try {
317+
318+ toneMapFilterWhitePoint .setX (Float .parseFloat (coords [0 ]));
319+ toneMapFilterWhitePoint .setY (Float .parseFloat (coords [1 ]));
320+ toneMapFilterWhitePoint .setZ (Float .parseFloat (coords [2 ]));
321+
322+ } catch (NumberFormatException e ) {
323+ LOGGER .error (e );
324+ }
325+ }
326+
247327 final List <String > deserializeLastOpened = EditorUtil .deserialize (prefs .getByteArray (PREF_LAST_OPENED_ASSETS , null ));
248328
249329 if (deserializeLastOpened != null ) {
@@ -262,6 +342,12 @@ public void save() {
262342 prefs .putInt (PREF_GRAPHIC_ANISOTROPY , getAnisotropy ());
263343 prefs .putBoolean (PREF_GRAPHIC_FXAA , isFXAA ());
264344 prefs .putBoolean (PREF_GRAPHIC_FULLSCREEN , isFullscreen ());
345+ prefs .putBoolean (PREF_GRAPHIC_GAMA_CORRECTION , isGammaCorrection ());
346+ prefs .putBoolean (PREF_GRAPHIC_TONEMAP_FILTER , isToneMapFilter ());
347+
348+ final Vector3f whitePoint = getToneMapFilterWhitePoint ();
349+
350+ prefs .put (PREF_GRAPHIC_TONEMAP_FILTER_WHITE_POINT , whitePoint .getX () + "," + whitePoint .getY () + "," + whitePoint .getZ ());
265351
266352 if (currentAsset != null ) {
267353 prefs .put (PREF_CURRENT_ASSET , currentAsset .toUri ().toString ());
0 commit comments