Interact with Materials from scripts

This commit is contained in:
Simon Lübeß
2025-02-14 11:54:07 +01:00
parent e5437c6ff6
commit aaed4199d3
24 changed files with 739 additions and 64 deletions
+52
View File
@@ -0,0 +1,52 @@
using GlitchyEngine.Core;
using GlitchyEngine.Math;
namespace GlitchyEngine.Graphics;
/// <summary>
/// Component that renders a sprite.
/// </summary>
public class SpriteRenderer : Component
{
// TODO: Texture2D/Sprite
/// <summary>
/// Gets or sets the tint color.
/// </summary>
public ColorRGBA Color
{
get
{
ScriptGlue.SpriteRenderer_GetColor(_uuid, out ColorRGBA color);
return color;
}
set => ScriptGlue.SpriteRenderer_SetColor(_uuid, value);
}
/// <summary>
/// Gets or sets the UV-transform.
/// </summary>
public UVTransform UVTransform
{
get
{
ScriptGlue.SpriteRenderer_GetUvTransform(_uuid, out UVTransform uvTransform);
return uvTransform;
}
set => ScriptGlue.SpriteRenderer_SetUvTransform(_uuid, value);
}
/// <summary>
/// Gets or sets the Material of this SpriteRenderer.
/// </summary>
public Material Material
{
get
{
ScriptGlue.SpriteRenderer_GetMaterial(_uuid, out UUID materialHandle);
return new Material { _uuid = materialHandle };
}
set => ScriptGlue.SpriteRenderer_SetMaterial(_uuid, value._uuid);
}
}