From eff03e0e1ab57ca47d3c3e5dd39d724e4c3caaa1 Mon Sep 17 00:00:00 2001 From: Jan Racek Date: Sat, 28 Mar 2026 13:31:41 +0100 Subject: [PATCH] Back color configurable, added fps counter checkbox --- Editor/Core/SplashControlPanel.cs | 7 +++++++ Editor/Core/SplashSettings.cs | 13 +++++++++++++ Editor/PSXSceneExporterEditor.cs | 10 +++++++--- Runtime/PSXSceneExporter.cs | 17 +++++------------ 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Editor/Core/SplashControlPanel.cs b/Editor/Core/SplashControlPanel.cs index 73a97d3..2b920a6 100644 --- a/Editor/Core/SplashControlPanel.cs +++ b/Editor/Core/SplashControlPanel.cs @@ -594,6 +594,10 @@ namespace SplashEdit.EditorCode new GUIContent("Memory Overlay", "Show heap/RAM usage bar at top-right during gameplay"), SplashSettings.MemoryOverlay); + SplashSettings.FpsOverlay = EditorGUILayout.Toggle( + new GUIContent("FPS Overlay", "Show an FPS counter at top-left during gameplay"), + SplashSettings.FpsOverlay); + // Serial port (only for Real Hardware) if (SplashSettings.Target == BuildTarget.RealHardware) { @@ -1187,6 +1191,9 @@ namespace SplashEdit.EditorCode if (SplashSettings.MemoryOverlay) buildArg += " MEMOVERLAY=1"; + + if (SplashSettings.FpsOverlay) + buildArg += " FPSOVERLAY=1"; int jobCount = Math.Max(1, SystemInfo.processorCount - 1); string cleanPrefix = SplashSettings.CleanBuild ? "make clean && " : ""; diff --git a/Editor/Core/SplashSettings.cs b/Editor/Core/SplashSettings.cs index 14928a7..53779f8 100644 --- a/Editor/Core/SplashSettings.cs +++ b/Editor/Core/SplashSettings.cs @@ -136,6 +136,19 @@ namespace SplashEdit.EditorCode set => EditorPrefs.SetBool(Prefix + "MemoryOverlay", value); } + + // --- FPS Overlay --- + /// + /// When enabled, compiles the runtime with an FPS counter + /// and text overlay at the top-left corner of the screen. + /// Passes FPSOVERLAY=1 to the native Makefile. + /// + public static bool FpsOverlay + { + get => EditorPrefs.GetBool(Prefix + "FpsOverlay", false); + set => EditorPrefs.SetBool(Prefix + "FpsOverlay", value); + } + // --- Export settings --- public static float DefaultGTEScaling { diff --git a/Editor/PSXSceneExporterEditor.cs b/Editor/PSXSceneExporterEditor.cs index 39974f1..86d8aaa 100644 --- a/Editor/PSXSceneExporterEditor.cs +++ b/Editor/PSXSceneExporterEditor.cs @@ -103,16 +103,19 @@ namespace SplashEdit.EditorCode private void DrawFogSection(PSXSceneExporter exporter) { - showFog = EditorGUILayout.Foldout(showFog, "Fog", true, PSXEditorStyles.FoldoutHeader); + showFog = EditorGUILayout.Foldout(showFog, "Fog & Background", true, PSXEditorStyles.FoldoutHeader); if (!showFog) return; EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(fogEnabledProp, new GUIContent("Enabled")); + EditorGUILayout.PropertyField(fogColorProp, new GUIContent("Background Color", + "Background clear color. Also used as the fog blend target when fog is enabled.")); + + EditorGUILayout.PropertyField(fogEnabledProp, new GUIContent("Distance Fog")); if (fogEnabledProp.boolValue) { - EditorGUILayout.PropertyField(fogColorProp, new GUIContent("Color")); + EditorGUI.indentLevel++; EditorGUILayout.PropertyField(fogDensityProp, new GUIContent("Density")); float gteScale = exporter.GTEScaling; @@ -125,6 +128,7 @@ namespace SplashEdit.EditorCode $"GTE range: {fogNearUnity:F1} - {fogFarUnity:F1} units | " + $"{8000f / (density * 3f):F0} - {8000f / density:F0} SZ", PSXEditorStyles.RichLabel); + EditorGUI.indentLevel--; } EditorGUI.indentLevel--; diff --git a/Runtime/PSXSceneExporter.cs b/Runtime/PSXSceneExporter.cs index 6151e0b..52e573f 100644 --- a/Runtime/PSXSceneExporter.cs +++ b/Runtime/PSXSceneExporter.cs @@ -30,11 +30,11 @@ namespace SplashEdit.RuntimeCode public float GTEScaling = 100.0f; public LuaFile SceneLuaFile; - [Header("Fog Configuration")] - [Tooltip("Enable distance fog. Fog color is also used as the GPU clear color.")] - public bool FogEnabled = false; - [Tooltip("Fog color (RGB). Also used as the sky/clear color.")] + [Header("Fog & Background")] + [Tooltip("Background clear color. Also used as the fog blend target when fog is enabled.")] public Color FogColor = new Color(0.5f, 0.5f, 0.6f); + [Tooltip("Enable distance fog that blends geometry toward the background color.")] + public bool FogEnabled = false; [Tooltip("Fog density (1 = light haze, 10 = pea soup).")] [Range(1, 10)] public int FogDensity = 5; @@ -82,8 +82,7 @@ namespace SplashEdit.RuntimeCode } } - // Phase 3+4: World collision and nav regions - private PSXCollisionExporter _collisionExporter; + // Phase 4: Nav regions private PSXNavRegionBuilder _navRegionBuilder; // Phase 5: Room/portal system (interior scenes) @@ -186,12 +185,6 @@ namespace SplashEdit.RuntimeCode _bvh = new BVH(_exporters.ToList()); _bvh.Build(); - // Phase 3: Build world collision soup - _collisionExporter = new PSXCollisionExporter(); - _collisionExporter.Build(_exporters, GTEScaling); - if (_collisionExporter.MeshCount == 0) - Debug.LogWarning("No collision meshes! Set CollisionType=Static on your floor/wall objects."); - // Phase 4+5: Room volumes are needed by BOTH the nav region builder // (for spatial room assignment) and the room builder (for triangle assignment). // Collect them early so both systems use the same room indices.