Files
sbox-public/engine/Sandbox.Engine/Scene/GameObjectSystems/DebugOverlay/DebugOverlaySystem.DrawTexture.cs
Lorenz Junglas 972aa9210b Move remaining SceneObjects off mainthread (#4745)
* Add CommandList.SetBufferData

* SpriteBatchSceneObject use CommandLists + make thread safe

* Make ScenePanelObject threadsafe

* SceneObjects ExecuteOffTheMainThread by default

* Remove ExecuteOnMainThread = false, assignments since it's now default

* Add Data4 entry to CommandLists allows us to store matrix

* Migrate TextRendering to CommandList

* Migrate Gizmos to CommandList

* Migrate LineRendering to CommandList

* ScenePanel uses CommandList

* Clutter uses commandlist

* Debug SceneObjects use commandlist

* Use CommandList.SetBufferData for sprites and lines

* Fix SceneLineObject using wrong attribtutes to draw
2026-05-04 17:47:12 +00:00

40 lines
966 B
C#

namespace Sandbox;
public partial class DebugOverlaySystem
{
public void Texture( Vector2 pixelPosition, Texture texture, Vector2 size, float duration = 0 )
{
var so = new DebugTextureSceneObject( Scene.SceneWorld );
so.ScreenPos = pixelPosition;
so.ScreenSize = size;
so.Flags.CastShadows = false;
so.RenderLayer = SceneRenderLayer.OverlayWithoutDepth;
Add( duration, so );
}
}
file class DebugTextureSceneObject : SceneCustomObject
{
public Texture Texture;
public Vector2 ScreenPos;
public Vector2 ScreenSize;
Material material;
public DebugTextureSceneObject( SceneWorld sceneWorld ) : base( sceneWorld )
{
material = Material.FromShader( "shaders/Debug/screen_texture.shader" );
}
public override void RenderSceneObject()
{
var rect = new Rect( ScreenPos, ScreenSize );
var attributes = new RenderAttributes();
attributes.Set( "Texture", Texture );
Graphics.DrawQuad( rect, material, Color.White, attributes );
}
}