Added MeshRendererComponent

updated SandoxApp to utilize it
This commit is contained in:
Simon Lübeß
2021-09-02 12:34:28 +02:00
parent c270fdcb03
commit e42b587d88
2 changed files with 70 additions and 18 deletions
@@ -0,0 +1,32 @@
using GlitchyEngine.Renderer;
using System;
namespace GlitchyEngine.World
{
/// A component that allows to render a mesh.
public struct MeshRendererComponent : IDisposableComponent
{
private Material _material;
public Material Material
{
[Inline]
get => _material;
set mut
{
if(_material == value)
return;
_material?.ReleaseRef();
_material = value;
_material?.AddRef();
}
}
public static void DisposeComponent(void* component)
{
Self* meshRenderComponent = (Self*)component;
meshRenderComponent._material?.ReleaseRef();
}
}
}