Back color configurable, added fps counter checkbox

This commit is contained in:
2026-03-28 13:31:41 +01:00
parent 5e862f8c0b
commit eff03e0e1a
4 changed files with 32 additions and 15 deletions

View File

@@ -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 && " : "";

View File

@@ -136,6 +136,19 @@ namespace SplashEdit.EditorCode
set => EditorPrefs.SetBool(Prefix + "MemoryOverlay", value);
}
// --- FPS Overlay ---
/// <summary>
/// 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.
/// </summary>
public static bool FpsOverlay
{
get => EditorPrefs.GetBool(Prefix + "FpsOverlay", false);
set => EditorPrefs.SetBool(Prefix + "FpsOverlay", value);
}
// --- Export settings ---
public static float DefaultGTEScaling
{

View File

@@ -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
$"<color=#aaaaaa>GTE range: {fogNearUnity:F1} - {fogFarUnity:F1} units | " +
$"{8000f / (density * 3f):F0} - {8000f / density:F0} SZ</color>",
PSXEditorStyles.RichLabel);
EditorGUI.indentLevel--;
}
EditorGUI.indentLevel--;

View File

@@ -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.