SHA256
Add Disable Tile Culling Option
This commit is contained in:
1 parent
7c6210d2c4
commit
d1ba5d5c18
7 files changed
+86
-2
No files matched your search
@@ -940,6 +940,14 @@ internal class RenderManager : MonoBehaviour
|
|||||||
// Cancelled or failed during the countdown: do not start the encoder
|
// Cancelled or failed during the countdown: do not start the encoder
|
||||||
if (stage != RenderStage.OnScene) yield break;
|
if (stage != RenderStage.OnScene) yield break;
|
||||||
|
|
||||||
|
if (Configuration.AdvancedConfig.DisableTileCulling && scrLevelMaker.instance)
|
||||||
|
{
|
||||||
|
foreach (var floor in scrLevelMaker.instance.listFloors)
|
||||||
|
{
|
||||||
|
if (floor) floor.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
frameCount = 0; framesSent = 0;
|
frameCount = 0; framesSent = 0;
|
||||||
_renderStopwatch.Restart();
|
_renderStopwatch.Restart();
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,12 @@ public class AdvancedConfig
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool FixCustomFrameRate { get; set; } = true;
|
public bool FixCustomFrameRate { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When true, prevents floor tiles from being disabled when outside the camera frustum (scrFloor.OnBecameInvisible),
|
||||||
|
/// eliminating the 1-frame update lag/glitch when tiles enter the screen. Default true.
|
||||||
|
/// </summary>
|
||||||
|
public bool DisableTileCulling { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>File extension of the default output file name, without the dot (e.g. "mkv", "mp4"); selects the container.</summary>
|
/// <summary>File extension of the default output file name, without the dot (e.g. "mkv", "mp4"); selects the container.</summary>
|
||||||
public string FileExtension { get; set; } = "mkv";
|
public string FileExtension { get; set; } = "mkv";
|
||||||
|
|
||||||
@@ -136,6 +142,7 @@ public class AdvancedConfig
|
|||||||
NonTile = source.NonTile;
|
NonTile = source.NonTile;
|
||||||
HighResBloomCorrection = source.HighResBloomCorrection;
|
HighResBloomCorrection = source.HighResBloomCorrection;
|
||||||
FixCustomFrameRate = source.FixCustomFrameRate;
|
FixCustomFrameRate = source.FixCustomFrameRate;
|
||||||
|
DisableTileCulling = source.DisableTileCulling;
|
||||||
FileExtension = source.FileExtension;
|
FileExtension = source.FileExtension;
|
||||||
firePlanetColor = source.firePlanetColor;
|
firePlanetColor = source.firePlanetColor;
|
||||||
icePlanetColor = source.icePlanetColor;
|
icePlanetColor = source.icePlanetColor;
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"ui.render_config.non_tile": "Non-Tile Mode",
|
"ui.render_config.non_tile": "Non-Tile Mode",
|
||||||
"ui.render_config.high_res_bloom_correction": "High-Resolution Bloom Correction",
|
"ui.render_config.high_res_bloom_correction": "High-Resolution Bloom Correction",
|
||||||
"ui.render_config.fix_custom_frame_rate": "Fix Custom FPS Render Timing",
|
"ui.render_config.fix_custom_frame_rate": "Fix Custom FPS Render Timing",
|
||||||
|
"ui.render_config.disable_tile_culling": "Disable Tile Culling",
|
||||||
"ui.render_config.random_seed": "Random Seed (Optional)",
|
"ui.render_config.random_seed": "Random Seed (Optional)",
|
||||||
"ui.render_config.validation_title": "Invalid Settings",
|
"ui.render_config.validation_title": "Invalid Settings",
|
||||||
"ui.render_config.validation_error": "Please check your input values:\n- Width and Height must be integers > 0\n- Render FPS and Video FPS must be > 0\n- Delay After End must be >= 0",
|
"ui.render_config.validation_error": "Please check your input values:\n- Width and Height must be integers > 0\n- Render FPS and Video FPS must be > 0\n- Delay After End must be >= 0",
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"ui.render_config.non_tile": "논타일 모드",
|
"ui.render_config.non_tile": "논타일 모드",
|
||||||
"ui.render_config.high_res_bloom_correction": "고해상도 블룸 보정",
|
"ui.render_config.high_res_bloom_correction": "고해상도 블룸 보정",
|
||||||
"ui.render_config.fix_custom_frame_rate": "커스텀 FPS 렌더 타이밍 보정",
|
"ui.render_config.fix_custom_frame_rate": "커스텀 FPS 렌더 타이밍 보정",
|
||||||
|
"ui.render_config.disable_tile_culling": "타일 컬링 비활성화",
|
||||||
"ui.render_config.random_seed": "랜덤 시드 (선택 사항)",
|
"ui.render_config.random_seed": "랜덤 시드 (선택 사항)",
|
||||||
"ui.render_config.validation_title": "설정 오류",
|
"ui.render_config.validation_title": "설정 오류",
|
||||||
"ui.render_config.validation_error": "입력값을 확인해 주세요:\n- 너비와 높이는 0보다 큰 정수여야 합니다.\n- 렌더 FPS와 영상 FPS는 0보다 커야 합니다.\n- 종료 후 대기 시간은 0 이상이어야 합니다.",
|
"ui.render_config.validation_error": "입력값을 확인해 주세요:\n- 너비와 높이는 0보다 큰 정수여야 합니다.\n- 렌더 FPS와 영상 FPS는 0보다 커야 합니다.\n- 종료 후 대기 시간은 0 이상이어야 합니다.",
|
||||||
|
|||||||
@@ -30,8 +30,19 @@ public static class scnGamePatch
|
|||||||
[HarmonyPatch("Play")]
|
[HarmonyPatch("Play")]
|
||||||
public static void ProcessFloors()
|
public static void ProcessFloors()
|
||||||
{
|
{
|
||||||
var nonTile = RenderManager.Instance.stage >= RenderStage.Load &&
|
if (RenderManager.Instance &&
|
||||||
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
RenderManager.Instance.stage >= RenderStage.Load &&
|
||||||
|
RenderManager.Instance.Configuration?.AdvancedConfig?.DisableTileCulling == true)
|
||||||
|
{
|
||||||
|
foreach (var floor in scrLevelMaker.instance.listFloors)
|
||||||
|
{
|
||||||
|
if (floor) floor.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var nonTile = RenderManager.Instance &&
|
||||||
|
RenderManager.Instance.stage >= RenderStage.Load &&
|
||||||
|
RenderManager.Instance.Configuration?.AdvancedConfig?.NonTile == true;
|
||||||
|
|
||||||
if (!nonTile) return;
|
if (!nonTile) return;
|
||||||
foreach (var floor in scrLevelMaker.instance.listFloors)
|
foreach (var floor in scrLevelMaker.instance.listFloors)
|
||||||
|
|||||||
@@ -33,4 +33,41 @@ public class scrFloorPatch
|
|||||||
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
||||||
return !nonTile;
|
return !nonTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Postfix of <c>scrFloor.Start</c>.
|
||||||
|
/// The game sets <c>enabled = isVisible</c> in Start(), which disables all off-screen tiles right at spawn.
|
||||||
|
/// When <c>DisableTileCulling</c> is enabled, force every floor to remain enabled.
|
||||||
|
/// </summary>
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch("Start")]
|
||||||
|
public static void ForceEnableOnStart(scrFloor __instance)
|
||||||
|
{
|
||||||
|
if (RenderManager.Instance &&
|
||||||
|
RenderManager.Instance.stage >= RenderStage.Load &&
|
||||||
|
RenderManager.Instance.Configuration.AdvancedConfig.DisableTileCulling)
|
||||||
|
{
|
||||||
|
__instance.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prefix of <c>scrFloor.OnBecameInvisible</c>.
|
||||||
|
/// Skips disabling the floor component (<c>enabled = false</c>) while rendering with
|
||||||
|
/// <c>AdvancedConfig.DisableTileCulling</c> enabled, preventing the 1-frame update lag/glitch
|
||||||
|
/// when tiles enter the camera view.
|
||||||
|
/// </summary>
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch("OnBecameInvisible")]
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
public static bool PreventTileCulling(scrFloor __instance)
|
||||||
|
{
|
||||||
|
if (RenderManager.Instance &&
|
||||||
|
RenderManager.Instance.stage >= RenderStage.Load &&
|
||||||
|
RenderManager.Instance.Configuration.AdvancedConfig.DisableTileCulling)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -141,6 +141,7 @@ internal static class RenderConfigWindow
|
|||||||
private static O5Toggle? _nonTileToggle;
|
private static O5Toggle? _nonTileToggle;
|
||||||
private static O5Toggle? _highResBloomCorrectionToggle;
|
private static O5Toggle? _highResBloomCorrectionToggle;
|
||||||
private static O5Toggle? _fixCustomFrameRateToggle;
|
private static O5Toggle? _fixCustomFrameRateToggle;
|
||||||
|
private static O5Toggle? _disableTileCullingToggle;
|
||||||
|
|
||||||
// Planet color overrides: the toggle enables the override, the picker holds the color. A disabled toggle stores
|
// Planet color overrides: the toggle enables the override, the picker holds the color. A disabled toggle stores
|
||||||
// null in AdvancedConfig (no override is applied by PersistencePatch) and blocks the picker.
|
// null in AdvancedConfig (no override is applied by PersistencePatch) and blocks the picker.
|
||||||
@@ -807,6 +808,22 @@ internal static class RenderConfigWindow
|
|||||||
},
|
},
|
||||||
generateLabel: false
|
generateLabel: false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Disable Tile Culling (AdvancedConfig.DisableTileCulling): prevents tiles from being disabled outside the frustum
|
||||||
|
_disableTileCullingToggle = CreateToggleField(
|
||||||
|
ctx, CreateFieldSlot(advRight),
|
||||||
|
labelKey: "",
|
||||||
|
defaultValue: true,
|
||||||
|
value: config.AdvancedConfig.DisableTileCulling,
|
||||||
|
toggleTextKey: "ui.render_config.disable_tile_culling",
|
||||||
|
id: "toggle_disable_tile_culling",
|
||||||
|
onChanged: val =>
|
||||||
|
{
|
||||||
|
config.AdvancedConfig.DisableTileCulling = val;
|
||||||
|
MarkConfigModified();
|
||||||
|
},
|
||||||
|
generateLabel: false
|
||||||
|
);
|
||||||
|
|
||||||
// 7-1. Planet Color Settings (Optional).
|
// 7-1. Planet Color Settings (Optional).
|
||||||
// For each planet: the toggle turns the override on/off (off stores null and blocks/collapses the picker);
|
// For each planet: the toggle turns the override on/off (off stores null and blocks/collapses the picker);
|
||||||
@@ -1018,6 +1035,7 @@ internal static class RenderConfigWindow
|
|||||||
_nonTileToggle?.Set(config.AdvancedConfig.NonTile, false);
|
_nonTileToggle?.Set(config.AdvancedConfig.NonTile, false);
|
||||||
_highResBloomCorrectionToggle?.Set(config.AdvancedConfig.HighResBloomCorrection, false);
|
_highResBloomCorrectionToggle?.Set(config.AdvancedConfig.HighResBloomCorrection, false);
|
||||||
_fixCustomFrameRateToggle?.Set(config.AdvancedConfig.FixCustomFrameRate, false);
|
_fixCustomFrameRateToggle?.Set(config.AdvancedConfig.FixCustomFrameRate, false);
|
||||||
|
_disableTileCullingToggle?.Set(config.AdvancedConfig.DisableTileCulling, false);
|
||||||
|
|
||||||
// Planet colors: toggle on when an override is stored; the picker shows the stored color or the default and is
|
// Planet colors: toggle on when an override is stored; the picker shows the stored color or the default and is
|
||||||
// blocked without an override
|
// blocked without an override
|
||||||
@@ -1201,6 +1219,7 @@ internal static class RenderConfigWindow
|
|||||||
if (_nonTileToggle != null) target.AdvancedConfig.NonTile = _nonTileToggle.Value;
|
if (_nonTileToggle != null) target.AdvancedConfig.NonTile = _nonTileToggle.Value;
|
||||||
if (_highResBloomCorrectionToggle != null) target.AdvancedConfig.HighResBloomCorrection = _highResBloomCorrectionToggle.Value;
|
if (_highResBloomCorrectionToggle != null) target.AdvancedConfig.HighResBloomCorrection = _highResBloomCorrectionToggle.Value;
|
||||||
if (_fixCustomFrameRateToggle != null) target.AdvancedConfig.FixCustomFrameRate = _fixCustomFrameRateToggle.Value;
|
if (_fixCustomFrameRateToggle != null) target.AdvancedConfig.FixCustomFrameRate = _fixCustomFrameRateToggle.Value;
|
||||||
|
if (_disableTileCullingToggle != null) target.AdvancedConfig.DisableTileCulling = _disableTileCullingToggle.Value;
|
||||||
|
|
||||||
// Planet Colors
|
// Planet Colors
|
||||||
target.AdvancedConfig.firePlanetColor = (_firePlanetToggle?.Value == true && _firePlanetPicker != null)
|
target.AdvancedConfig.firePlanetColor = (_firePlanetToggle?.Value == true && _firePlanetPicker != null)
|
||||||
|
|||||||
Reference in new issue
Block a user