diff --git a/GlitchyEngine/src/Renderer/DebugRenderer.bf b/GlitchyEngine/src/Renderer/DebugRenderer.bf new file mode 100644 index 0000000..52472ca --- /dev/null +++ b/GlitchyEngine/src/Renderer/DebugRenderer.bf @@ -0,0 +1,42 @@ +using GlitchyEngine.Math; +using GlitchyEngine.World; + +namespace GlitchyEngine.Renderer +{ + /// Provides functionality for debugging + public static class DebugRenderer + { + private static GeometryBinding CoordinateCross; + + public static void Init(GraphicsContext context) + { + CreateCoordinateCross(context); + } + + private static void CreateCoordinateCross(GraphicsContext context) + { + CoordinateCross = new GeometryBinding(context); + //CoordinateCross.PrimitiveTopology + } + + public static void Deinit() + { + CoordinateCross.ReleaseRef(); + } + + public static bool DrawEntityTransforms = true; + + public static void Render(EcsWorld world) + { + if(DrawEntityTransforms) + { + for(var (entity, transform) in world.Enumerate()) + { + Renderer.DrawLine(.Zero, Vector3(1f, 0, 0), .Red, transform.WorldTransform); + Renderer.DrawLine(.Zero, Vector3(0, 1f, 0), .Lime, transform.WorldTransform); + Renderer.DrawLine(.Zero, Vector3(0, 0, 1f), .Blue, transform.WorldTransform); + } + } + } + } +} diff --git a/Sandbox/src/SandboxApp.bf b/Sandbox/src/SandboxApp.bf index ceb032a..8e204bb 100644 --- a/Sandbox/src/SandboxApp.bf +++ b/Sandbox/src/SandboxApp.bf @@ -491,6 +491,8 @@ namespace Sandbox Renderer.Submit(_quadGeometryBinding, _logoMaterial, .Translation(0, 0, -1) * .Scaling(2f)); + DebugRenderer.Render(_world); + Renderer.EndScene(); basicEffect.ReleaseRef();