Start of DebugRenderer

This commit is contained in:
Simon Lübeß
2021-09-11 12:58:25 +02:00
parent cb51880925
commit 5c95668a1d
2 changed files with 44 additions and 0 deletions
@@ -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<TransformComponent>())
{
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);
}
}
}
}
}
+2
View File
@@ -491,6 +491,8 @@ namespace Sandbox
Renderer.Submit(_quadGeometryBinding, _logoMaterial, .Translation(0, 0, -1) * .Scaling(2f));
DebugRenderer.Render(_world);
Renderer.EndScene();
basicEffect.ReleaseRef();