daily update on 20230724 by nitload youmu, bigM128map added
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal static unsafe partial class internalIO
|
||||
{
|
||||
[DllImport("StgSharpGraphic.dll",EntryPoint = "VecAddVec",
|
||||
CallingConvention =CallingConvention.Cdecl)]
|
||||
internal static extern M128 VecAddVec(M128 vec1, M128 vec2);
|
||||
|
||||
[DllImport("StgSharpGraphic.dll",EntryPoint = "VecSubVec")]
|
||||
internal static extern M128 VecSubVec(M128 vec1, M128 vec2);
|
||||
|
||||
[DllImport("StgSharpGraphic.dll",EntryPoint = "VecMulVec")]
|
||||
internal static extern float VecMulVec(M128 vec1, M128 vec2);
|
||||
|
||||
[DllImport("StgSharpGraphic.dll", EntryPoint = "InitBigM128Map")]
|
||||
internal static unsafe extern long internalInitBigM128Map(int floatCount);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using StgSharp;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Logic;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public class M128Map
|
||||
{
|
||||
public readonly long mapID;
|
||||
|
||||
internal readonly StgSharp.LinkedListNode<long> _unusedM128Header;
|
||||
|
||||
internal StgSharp.LinkedList<long> m128Map =
|
||||
new StgSharp.LinkedList<long>();
|
||||
|
||||
public bool isFull
|
||||
{
|
||||
get
|
||||
{
|
||||
return _unusedM128Header == m128Map._hook;
|
||||
}
|
||||
}
|
||||
|
||||
public M128Map()
|
||||
{
|
||||
long M128Ptr = internalIO.internalInitBigM128Map(4*30*30);
|
||||
m128Map.Add(0);
|
||||
|
||||
_unusedM128Header = m128Map._hook._next;
|
||||
|
||||
for (int i = 1; i < 80*80/4; i++)
|
||||
{
|
||||
m128Map.Add(M128Ptr);
|
||||
M128Ptr += 4;
|
||||
}
|
||||
|
||||
mapID = Calc.RandomSeed();
|
||||
}
|
||||
|
||||
internal long RegistManagedM128Ptr()
|
||||
{
|
||||
LinkedListNode<long> m128 = _unusedM128Header._next;
|
||||
LinkedListNode<long> m128Previous = _unusedM128Header._previous;
|
||||
|
||||
m128._next._previous = _unusedM128Header.Next;
|
||||
m128Previous._next = m128;
|
||||
m128._previous = m128Previous;
|
||||
_unusedM128Header._next = m128._next;
|
||||
m128._next = _unusedM128Header;
|
||||
_unusedM128Header._previous = m128;
|
||||
|
||||
return m128._value;
|
||||
|
||||
}
|
||||
|
||||
internal void RecycleManagedM128Ptr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
||||
internal struct M128
|
||||
{
|
||||
[FieldOffset(0)] internal float single_0;
|
||||
[FieldOffset(4)] internal float single_1;
|
||||
[FieldOffset(8)] internal float single_2;
|
||||
[FieldOffset(12)] internal float single_3;
|
||||
|
||||
[FieldOffset(0)] internal int int32_0;
|
||||
[FieldOffset(4)] internal int int32_1;
|
||||
[FieldOffset(8)] internal int int32_2;
|
||||
[FieldOffset(12)] internal int int32_3;
|
||||
|
||||
[FieldOffset(0)] internal long int64_0;
|
||||
[FieldOffset(8)] internal long int64_1;
|
||||
|
||||
[FieldOffset(0)] internal long double_0;
|
||||
[FieldOffset(8)] internal long double_1;
|
||||
|
||||
internal M128(float s0, float s1, float s2, float s3)
|
||||
{
|
||||
single_0 = s0;
|
||||
single_1 = s1;
|
||||
single_2 = s2;
|
||||
single_3 = s3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user