54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using StgSharp.Controlling;
|
|
using StgSharp.Math;
|
|
using System.Data.Common;
|
|
using System.Numerics;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace StgSharp.Math
|
|
{
|
|
[StructLayout(LayoutKind.Explicit)]
|
|
public unsafe struct M128
|
|
{
|
|
[FieldOffset(0)] internal fixed float Single[4];
|
|
[FieldOffset(0)] internal fixed double Double[2];
|
|
|
|
[FieldOffset(0)] internal fixed sbyte Int8[16];
|
|
[FieldOffset(0)] internal fixed short Int16[8];
|
|
[FieldOffset(0)] internal fixed int Int32[4];
|
|
[FieldOffset(0)] internal fixed long Int64[2];
|
|
|
|
[FieldOffset(0)] internal fixed byte UInt8[16];
|
|
[FieldOffset(0)] internal fixed ushort UInt16[8];
|
|
[FieldOffset(0)] internal fixed uint UInt32[4];
|
|
[FieldOffset(0)] internal fixed ulong UInt64[2];
|
|
|
|
[FieldOffset(0)] internal IntPtr IntPtr0;
|
|
[FieldOffset(1)] internal IntPtr IntPtr1;
|
|
|
|
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
|
public struct Vec4d
|
|
{
|
|
[FieldOffset(0)] internal Vector4 vec;
|
|
[FieldOffset(0)] internal M128 reg;
|
|
|
|
[FieldOffset(0)] public float X;
|
|
[FieldOffset(4)] public float Y;
|
|
[FieldOffset(8)] public float Z;
|
|
[FieldOffset(12)] public float W;
|
|
|
|
public Vec4d(
|
|
float x, float y, float z, float w)
|
|
{
|
|
X = x; Y = y; Z = z; W = w;
|
|
}
|
|
|
|
public static implicit operator M128(Vec4d vec)
|
|
{
|
|
return vec.reg;
|
|
}
|
|
}
|
|
}
|