mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-20 14:28:17 -04:00
- TextRenderer.TextSceneObject — world text component - DebugTextureSceneObject — debug overlay textures - DebugTextSceneObject — debug overlay text - DebugSphereSceneObject — debug overlay spheres - SceneMapLoader.TextSceneObject — map world text entities - LPVDebugGridObject — light probe debug grid - ClutterBatchSceneObject — clutter instanced rendering These ones are not as simple: - ScenePanelObject - so much UI shit wasn't thread safe before, but should nwo be ... - GizmoInlineSceneObject - SpriteBatchSceneObject - lots of non concurrent dictionaries around here (needs a commandlist approach)
41 lines
1011 B
C#
41 lines
1011 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 )
|
|
{
|
|
managedNative.ExecuteOnMainThread = false;
|
|
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 );
|
|
}
|
|
}
|