mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-20 14:28:17 -04:00
* IManagedCamera.GetSetMainCamera with SceneCamera.IsRecordingCamera flag * Explicitly set RT for recording layers, fixes red border not drawing and issues with scene panels * Keep recording when switching to play mode Fix viewport size when switching to play mode while recoding, so we can keep going https://files.facepunch.com/lolleko/2026/February/05_12-54-WelldocumentedSkua.mp4 * Make sure we can record in the menu too
53 lines
994 B
C#
53 lines
994 B
C#
namespace Sandbox;
|
|
|
|
public static class MenuScene
|
|
{
|
|
public static Scene Scene;
|
|
|
|
public static void Startup( string sceneName )
|
|
{
|
|
Log.Info( $"Loading startup scene: {sceneName}" );
|
|
|
|
Scene = new Scene();
|
|
|
|
using ( Scene.Push() )
|
|
{
|
|
Scene.LoadFromFile( sceneName );
|
|
LoadingScreen.IsVisible = false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tick the scene. This only happens when the menu is visible
|
|
/// </summary>
|
|
public static void Tick()
|
|
{
|
|
if ( Scene is null ) return;
|
|
if ( !Game.IsMainMenuVisible ) return;
|
|
|
|
using ( Scene.Push() )
|
|
{
|
|
Scene.GameTick( RealTime.Delta );
|
|
}
|
|
}
|
|
|
|
internal static void Render( SwapChainHandle_t swapChain )
|
|
{
|
|
if ( Scene is null ) return;
|
|
if ( !Game.IsMainMenuVisible ) return;
|
|
if ( Scene.IsLoading )
|
|
{
|
|
Scene.RenderEnvmaps();
|
|
return;
|
|
}
|
|
|
|
Scene.Camera?.SceneCamera.EnableEngineOverlays = true;
|
|
SceneCamera.RecordingCamera = Scene.Camera?.SceneCamera;
|
|
|
|
using ( Scene.Push() )
|
|
{
|
|
Scene.Render( swapChain, default );
|
|
}
|
|
}
|
|
}
|