26 lines
527 B
C#
26 lines
527 B
C#
using System;
|
|
using System.Numerics;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Auspex.Vfx.Internal;
|
|
|
|
internal sealed class PinnedAlignedMatrix : IDisposable
|
|
{
|
|
private IntPtr rawptr;
|
|
|
|
private IntPtr aligned;
|
|
|
|
public unsafe Matrix4x4* Get => (Matrix4x4*)aligned;
|
|
|
|
public unsafe PinnedAlignedMatrix()
|
|
{
|
|
rawptr = Marshal.AllocHGlobal(sizeof(Matrix4x4) + 8);
|
|
aligned = new IntPtr(16 * (((long)(nint)rawptr + 15L) / 16));
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Marshal.FreeHGlobal(rawptr);
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
}
|