mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-08-01 16:28:36 -04:00
* 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
40 lines
966 B
C#
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 );
|
|
}
|
|
}
|