Added DebugNameComponent

This commit is contained in:
Simon Lübeß
2021-09-14 23:54:50 +02:00
parent ab17598972
commit 908167c83e
3 changed files with 35 additions and 0 deletions
+6
View File
@@ -71,6 +71,11 @@ namespace GlitchyEngine.Content
{
Entity entity = world.NewEntity();
#if DEBUG
var nameComponent = world.AssignComponent<DebugNameComponent>(entity);
nameComponent.SetName(StringView(node.Name));
#endif
if(parentEntity.HasValue)
{
var childParent = world.AssignComponent<ParentComponent>(entity);
@@ -101,6 +106,7 @@ namespace GlitchyEngine.Content
childTransform.Scale = .(1, 1, 1);
}
// Invert the Z-Axis of the root Node to convert the coordinate system from right-handed to left-handed
if(parentEntity == null)
childTransform.Scale *= .(1, 1, -1);
@@ -0,0 +1,28 @@
using System;
namespace GlitchyEngine.World
{
struct DebugNameComponent : IDisposableComponent
{
private String _debugName;
public String DebugName
{
get => _debugName;
set mut => SetName(value);
}
public void SetName(StringView name) mut
{
delete _debugName;
_debugName = new String(name);
}
public static void DisposeComponent(void* component)
{
Self* self = (Self*)component;
DeleteAndNullify!(self._debugName);
}
}
}