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
+39
View File
@@ -0,0 +1,39 @@
using System.Runtime.InteropServices;
using GlitchyEngine.Math;
namespace GlitchyEngine.Graphics;
/// <summary>
/// Stores transformations that can be applied to UV-Coordinates.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct UVTransform
{
/// <summary>
/// The offset that will be added to the UV-Coordinate.
/// </summary>
public float2 Offset;
/// <summary>
/// The scaling that will be applied to the UV-Coordinate.
/// </summary>
public float2 Scale;
/// <summary>
/// Creates a new instance of <see cref="UVTransform"/> with the given scale and offset.
/// </summary>
/// <param name="offset"><inheritdoc cref="Offset"/></param>
/// <param name="scale"><inheritdoc cref="Scale"/></param>
public UVTransform(float2 offset, float2 scale)
{
Offset = offset;
Scale = scale;
}
/// <summary>
/// Transforms the given uv-coordinate.
/// </summary>
public float2 Transform(float2 uvCoordinate)
{
return Offset + uvCoordinate * Scale;
}
}