mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Start of DebugRenderer
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -491,6 +491,8 @@ namespace Sandbox
|
|||||||
|
|
||||||
Renderer.Submit(_quadGeometryBinding, _logoMaterial, .Translation(0, 0, -1) * .Scaling(2f));
|
Renderer.Submit(_quadGeometryBinding, _logoMaterial, .Translation(0, 0, -1) * .Scaling(2f));
|
||||||
|
|
||||||
|
DebugRenderer.Render(_world);
|
||||||
|
|
||||||
Renderer.EndScene();
|
Renderer.EndScene();
|
||||||
|
|
||||||
basicEffect.ReleaseRef();
|
basicEffect.ReleaseRef();
|
||||||
|
|||||||
Reference in New Issue
Block a user