using System.Runtime.InteropServices; using LyraApi.Ecs; namespace LyraApi.Math; [StructLayout(LayoutKind.Sequential)] struct Vec3(float x, float y, float z) : IComponent { /// /// The X component. /// public float X { get; set; } = x; /// /// The Y component /// public float Y { get; set; } = y; /// /// The Z component /// public float Z { get; set; } = z; public static string HostName => "Vec3"; public static ulong HostSize => (ulong)Marshal.SizeOf(); public static ulong HostAlignment => (ulong)MarshalUtils.AlignmentOf(); public static ulong TypeId => 4124409524; public static object? TakeFromBytes(byte[] bytes) { byte[] taken = bytes.Take((int)HostSize).ToArray(); return MarshalUtils.FromBytes(taken); } }