Files
sbox-public/engine/Sandbox.Menu/MenuScene.cs
Lorenz Junglas 39aeaaeefc Editor viewport screen recording (#3999)
* 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
2026-02-10 11:55:18 +01:00

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 );
}
}
}