using System.Runtime.InteropServices;
using GlitchyEngine.Math;
namespace GlitchyEngine.Graphics;
///
/// Stores transformations that can be applied to UV-Coordinates.
///
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct UVTransform
{
///
/// The offset that will be added to the UV-Coordinate.
///
public float2 Offset;
///
/// The scaling that will be applied to the UV-Coordinate.
///
public float2 Scale;
///
/// Creates a new instance of with the given scale and offset.
///
///
///
public UVTransform(float2 offset, float2 scale)
{
Offset = offset;
Scale = scale;
}
///
/// Transforms the given uv-coordinate.
///
public float2 Transform(float2 uvCoordinate)
{
return Offset + uvCoordinate * Scale;
}
}