11package com .ss .editor .config ;
22
3+ import static com .ss .editor .util .OpenGLVersion .GL_32 ;
34import static com .ss .rlib .util .ObjectUtils .notNull ;
45import static com .ss .rlib .util .Utils .get ;
56import com .jme3 .asset .AssetEventListener ;
1213import com .ss .editor .annotation .FromAnyThread ;
1314import com .ss .editor .ui .css .CssColorTheme ;
1415import com .ss .editor .util .EditorUtil ;
16+ import com .ss .editor .util .OpenGLVersion ;
1517import com .ss .rlib .logging .Logger ;
1618import com .ss .rlib .logging .LoggerManager ;
1719import org .jetbrains .annotations .NotNull ;
@@ -51,6 +53,7 @@ public final class EditorConfig implements AssetEventListener {
5153 private static final String PREF_SCREEN_HEIGHT = SCREEN_ALIAS + "." + "screenHeight" ;
5254 private static final String PREF_SCREEN_MAXIMIZED = SCREEN_ALIAS + "." + "screenMaximized" ;
5355
56+ private static final String PREF_GRAPHIC_OPEN_GL = GRAPHICS_ALIAS + "." + "openGL" ;
5457 private static final String PREF_GRAPHIC_ANISOTROPY = GRAPHICS_ALIAS + "." + "anisotropy" ;
5558 private static final String PREF_GRAPHIC_FRAME_RATE = GRAPHICS_ALIAS + "." + "frameRate" ;
5659 private static final String PREF_GRAPHIC_CAMERA_ANGLE = GRAPHICS_ALIAS + "." + "cameraAngle" ;
@@ -69,7 +72,7 @@ public final class EditorConfig implements AssetEventListener {
6972 private static final String PREF_AUTO_TANGENT_GENERATING = ASSET_EDITING + "." + "autoTangentGenerating" ;
7073 private static final String PREF_DEFAULT_USE_FLIPPED_TEXTURE = ASSET_EDITING + "." + "defaultUseFlippedTexture" ;
7174 private static final String PREF_CAMERA_LAMP_ENABLED = ASSET_EDITING + "." + "defaultCameraLampEnabled" ;
72- private static final String PREF_ANALYTICS_QUESTION = ASSET_OTHER + "." + "analyticsQuestion" + Config .VERSION ;
75+ private static final String PREF_ANALYTICS_QUESTION = ASSET_OTHER + "." + "analyticsQuestion" + Config .STRING_VERSION ;
7376
7477 private static final String PREF_GLOBAL_LEFT_TOOL_WIDTH = ASSET_OTHER + "." + "globalLeftToolWidth" ;
7578 private static final String PREF_GLOBAL_LEFT_TOOL_COLLAPSED = ASSET_OTHER + "." + "globalLeftToolCollapsed" ;
@@ -116,6 +119,12 @@ public static EditorConfig getInstance() {
116119 @ Nullable
117120 private volatile Path currentAsset ;
118121
122+ /**
123+ * The current open GL version.
124+ */
125+ @ Nullable
126+ private volatile OpenGLVersion openGLVersion ;
127+
119128 /**
120129 * The path to the folder with additional classpath.
121130 */
@@ -730,6 +739,21 @@ public void setTheme(@NotNull final CssColorTheme theme) {
730739 this .theme = theme .ordinal ();
731740 }
732741
742+ /**
743+ * @return the current open GL version.
744+ */
745+ @ NotNull
746+ public OpenGLVersion getOpenGLVersion () {
747+ return notNull (openGLVersion );
748+ }
749+
750+ /**
751+ * @param openGLVersion the current open GL version.
752+ */
753+ public void setOpenGLVersion (@ NotNull final OpenGLVersion openGLVersion ) {
754+ this .openGLVersion = openGLVersion ;
755+ }
756+
733757 /**
734758 * Gets settings.
735759 *
@@ -794,6 +818,7 @@ private void init() {
794818 this .defaultEditorCameraEnabled = prefs .getBoolean (PREF_CAMERA_LAMP_ENABLED , true );
795819 this .analyticsQuestion = prefs .getBoolean (PREF_ANALYTICS_QUESTION , false );
796820 this .theme = prefs .getInt (PREF_THEME , CssColorTheme .DARK .ordinal ());
821+ this .openGLVersion = OpenGLVersion .valueOf (prefs .getInt (PREF_GRAPHIC_OPEN_GL , GL_32 .ordinal ()));
797822
798823 final String currentAssetURI = prefs .get (PREF_CURRENT_ASSET , null );
799824
@@ -867,6 +892,7 @@ public synchronized void save() {
867892 prefs .putBoolean (PREF_CAMERA_LAMP_ENABLED , isDefaultEditorCameraEnabled ());
868893 prefs .putBoolean (PREF_ANALYTICS_QUESTION , isAnalyticsQuestion ());
869894 prefs .putInt (PREF_THEME , getTheme ().ordinal ());
895+ prefs .putInt (PREF_GRAPHIC_OPEN_GL , getOpenGLVersion ().ordinal ());
870896
871897 final Vector3f whitePoint = getToneMapFilterWhitePoint ();
872898
0 commit comments