arrange of proj structure
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="BattleField"
|
// file="BattleField"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -29,7 +29,7 @@ using StgSharp.Geometries;
|
|||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
|
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="ButtonGroup"
|
// file="ButtonGroup"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="CharacterIndexImage"
|
// file="CharacterIndexImage"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="ControllingIntem"
|
// file="ControllingIntem"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="DecorationBox.cs"
|
// file="DecorationBox.cs"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MarkingLable"
|
// file="MarkingLable"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -29,7 +29,7 @@ using StgSharp.Controls;
|
|||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using StgSharp.Timing;
|
using StgSharp.Timing;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="TriggerButton"
|
// file="TriggerButton"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -29,7 +29,7 @@ using StgSharp.Controls;
|
|||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="Counter"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload Space
|
|
||||||
// Copyright (c) Nitload Space. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using System;
|
|
||||||
using System.Numerics;
|
|
||||||
|
|
||||||
namespace StgSharp
|
|
||||||
{
|
|
||||||
public class Counter<T> where T: unmanaged, INumber<T>
|
|
||||||
{
|
|
||||||
|
|
||||||
internal dynamic _value;
|
|
||||||
internal readonly T _defaultDecrement;
|
|
||||||
|
|
||||||
internal readonly T _defaultIncrement;
|
|
||||||
internal readonly T _defaultValue;
|
|
||||||
|
|
||||||
public Counter(T defaultValue, T defaultIncrement, T defaultDecrement)
|
|
||||||
{
|
|
||||||
_value = defaultValue;
|
|
||||||
_defaultValue = defaultValue;
|
|
||||||
_defaultIncrement = defaultIncrement;
|
|
||||||
_defaultDecrement = defaultDecrement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T DecrementSpan => _defaultDecrement;
|
|
||||||
|
|
||||||
public T IncrementSpan => _defaultIncrement;
|
|
||||||
|
|
||||||
public T CurrentSpan => _value - _defaultValue;
|
|
||||||
|
|
||||||
public T Value
|
|
||||||
{
|
|
||||||
get => _value;
|
|
||||||
set => _value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Add(T value)
|
|
||||||
{
|
|
||||||
_value += value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void QuickAdd()
|
|
||||||
{
|
|
||||||
_value += _defaultIncrement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void QuickSub()
|
|
||||||
{
|
|
||||||
_value -= _defaultDecrement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
_value = _defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Sub(T value)
|
|
||||||
{
|
|
||||||
_value -= value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Value.ToString() ?? string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Counter<T> operator --(Counter<T> counter)
|
|
||||||
{
|
|
||||||
counter?.QuickSub();
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Counter<T> operator ++(Counter<T> counter)
|
|
||||||
{
|
|
||||||
counter?.QuickAdd();
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator T(Counter<T> counter)
|
|
||||||
{
|
|
||||||
return counter switch
|
|
||||||
{
|
|
||||||
null => T.Zero,
|
|
||||||
_ => counter.Value
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="root"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.Internal;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp
|
|
||||||
{
|
|
||||||
public static unsafe partial class World { }//------------------ end of class ---------------------
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="Area"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.Internal.FileIO;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An independent storage area, used as the only folder type in root folder. Contains several
|
|
||||||
/// <see cref="SSD" /> files reference as virtual disc. Data is actually stored in <see
|
|
||||||
/// cref="SSD" />s in certain RAID mode.
|
|
||||||
/// </summary>
|
|
||||||
public partial class Area { }
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="DataHead"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.HighPerformance;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
|
||||||
public struct SSDSegmentHead
|
|
||||||
{
|
|
||||||
|
|
||||||
[FieldOffset(12)] internal byte size;
|
|
||||||
|
|
||||||
[FieldOffset(0)] internal M128 data;
|
|
||||||
[FieldOffset(13)] public byte selfDefine_1;
|
|
||||||
[FieldOffset(14)] public byte selfDefine_2;
|
|
||||||
[FieldOffset(15)] public byte selfDefine_3;
|
|
||||||
|
|
||||||
[FieldOffset(0)] public int globalID;
|
|
||||||
[FieldOffset(4)] public int nextID;
|
|
||||||
[FieldOffset(8)] public int previousHash;
|
|
||||||
|
|
||||||
public int Size
|
|
||||||
{
|
|
||||||
get => ((int)size) + 1;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if ((value > 256) || (value < 0)) {
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
}
|
|
||||||
size = (byte)(value - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe byte[] GetBytes()
|
|
||||||
{
|
|
||||||
byte[] ret = new byte[16];
|
|
||||||
fixed (M128* vptr = &data)
|
|
||||||
{
|
|
||||||
byte* bptr = (byte*)vptr;
|
|
||||||
for (int i = 0; i < 15; i++) {
|
|
||||||
ret[i] = *bptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="DataSegment"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.HighPerformance;
|
|
||||||
using StgSharp.HighPerformance;
|
|
||||||
using StgSharp.Internal.Intrinsic;
|
|
||||||
|
|
||||||
using StgSharp.Mathematics;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = World.ssdSegmentLength * 16)]
|
|
||||||
public unsafe struct SSDSegment : IComparable<int>, IComparable<SSDSegment>
|
|
||||||
{
|
|
||||||
|
|
||||||
[FieldOffset(16)] public fixed byte Data[16 * (World.ssdSegmentLength - 1)];
|
|
||||||
[FieldOffset(12)] public int DataHash;
|
|
||||||
[FieldOffset(8)] public int PreviousHash;
|
|
||||||
[FieldOffset(0 * 16)] public SSDSegmentHead Head;
|
|
||||||
|
|
||||||
public SSDSegment(int previousHash)
|
|
||||||
{
|
|
||||||
this.PreviousHash = previousHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte this[int index]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (index > (16 * (World.ssdSegmentLength - 1)) - 1) {
|
|
||||||
throw new IndexOutOfRangeException();
|
|
||||||
}
|
|
||||||
return Data[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (index > (16 * (World.ssdSegmentLength - 1)) - 1) {
|
|
||||||
throw new IndexOutOfRangeException();
|
|
||||||
}
|
|
||||||
Data[index] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ID
|
|
||||||
{
|
|
||||||
get { return Head.globalID; }
|
|
||||||
set { Head.globalID = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public short Size => Head.size;
|
|
||||||
|
|
||||||
public void FillRandomBytes(int begin)
|
|
||||||
{
|
|
||||||
if (begin > 255) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = begin; i < 255; i++) {
|
|
||||||
Data[i] = Scalar.Random<byte>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SSDSegment FromStream(byte[] stream)
|
|
||||||
{
|
|
||||||
if (stream.Length != 16 * World.ssdSegmentLength) {
|
|
||||||
throw new ArgumentException();
|
|
||||||
}
|
|
||||||
SSDSegment ret = new SSDSegment();
|
|
||||||
fixed (byte* bptr = stream)
|
|
||||||
{
|
|
||||||
ret.Head.data = *(M128*)bptr;
|
|
||||||
for (int i = 1; i < World.ssdSegmentLength; i++) {
|
|
||||||
ret.WriteData<M128>(i - 1, *(M128*)(bptr + (16 * i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] GetBytes()
|
|
||||||
{
|
|
||||||
byte[] ret = new byte[16 * World.ssdSegmentLength];
|
|
||||||
fixed (M128* mptr = &Head.data)
|
|
||||||
{
|
|
||||||
fixed (byte* aptr = ret)
|
|
||||||
{
|
|
||||||
Vector4* vsptr = (Vector4*)mptr;
|
|
||||||
Vector4* vtptr = (Vector4*)aptr;
|
|
||||||
for (int i = 0; i < 18; i++) {
|
|
||||||
*(vtptr + i) = *(vsptr + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetDataHash()
|
|
||||||
{
|
|
||||||
Vector4 v = Vector4.One;
|
|
||||||
fixed (M128* mptr = &Head.data)
|
|
||||||
{
|
|
||||||
Vector4* vptr = (Vector4*)mptr;
|
|
||||||
for (int i = 0; i < World.ssdSegmentLength - 1; i += 1) {
|
|
||||||
v += (*vptr) * 31;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
M128 m = new M128(v);
|
|
||||||
DataHash = m.Vec.GetHashCode();
|
|
||||||
return DataHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
int ret = 17;
|
|
||||||
fixed (M128* mptr = &Head.data)
|
|
||||||
{
|
|
||||||
Vector4* vptr = (Vector4*)mptr;
|
|
||||||
for (int i = 0; i < World.ssdSegmentLength; i++) {
|
|
||||||
ret = (ret + (*vptr).GetHashCode()) * 31;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe T ReadData<T>(int index) where T: unmanaged
|
|
||||||
{
|
|
||||||
fixed (byte* bptr = Data)
|
|
||||||
{
|
|
||||||
T* tptr = (T*)bptr;
|
|
||||||
return *(tptr + index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe void WriteData<T>(int index, T value) where T: unmanaged
|
|
||||||
{
|
|
||||||
fixed (byte* bptr = Data)
|
|
||||||
{
|
|
||||||
T* tptr = (T*)bptr;
|
|
||||||
*(tptr + index) = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int IComparable<int>.CompareTo(int other)
|
|
||||||
{
|
|
||||||
return ID.CompareTo(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
int IComparable<SSDSegment>.CompareTo(SSDSegment other)
|
|
||||||
{
|
|
||||||
return ID.CompareTo(other.ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="SSD"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.Internal.FileIO;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
public partial class SSD
|
|
||||||
{
|
|
||||||
|
|
||||||
private Dictionary<string, SSDraw> fileList;
|
|
||||||
|
|
||||||
private FileStream file;
|
|
||||||
private SSDrawHead head;
|
|
||||||
|
|
||||||
public SSD()
|
|
||||||
{
|
|
||||||
fileList = new Dictionary<string, SSDraw>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public SSD(FileStream fileStream)
|
|
||||||
{
|
|
||||||
fileList = new Dictionary<string, SSDraw>();
|
|
||||||
file = fileStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SSD FromFile(string fileRoute)
|
|
||||||
{
|
|
||||||
return new SSD(new FileStream(fileRoute, FileMode.Open, FileAccess.Read))
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="SSDVirtualFolder"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.Internal.FileIO;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
public class SSDFolder : ISSDSerializable
|
|
||||||
{
|
|
||||||
|
|
||||||
internal Dictionary<string, SSDFolder> folders;
|
|
||||||
internal int _folderID;
|
|
||||||
internal string _name;
|
|
||||||
|
|
||||||
internal SSDFolder()
|
|
||||||
{
|
|
||||||
folders = new Dictionary<string, SSDFolder>();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal SSDFolder(string name)
|
|
||||||
{
|
|
||||||
if (name == "root") {
|
|
||||||
throw new ArgumentException(
|
|
||||||
"Name cannot be root," + "it is preserved for root file indexer.");
|
|
||||||
}
|
|
||||||
if (name == "default") {
|
|
||||||
throw new ArgumentException(
|
|
||||||
"Name cannot be default," + "it is preserved for default file id provider.");
|
|
||||||
}
|
|
||||||
_name = name;
|
|
||||||
folders = new Dictionary<string, SSDFolder>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.VirtualFolder;
|
|
||||||
|
|
||||||
public void FromBytes(byte[] stream)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO TOUGH TO Get Bytes from virtual folders
|
|
||||||
public byte[] GetBytes()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="Define"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A class contains a sets of methods to serialize several types
|
|
||||||
/// </summary>
|
|
||||||
public static partial class Serializer { }
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="ISSDSerializable"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
public interface ISSDSerializable
|
|
||||||
{
|
|
||||||
|
|
||||||
public SerializableTypeCode SSDTypeCode { get; }
|
|
||||||
|
|
||||||
public byte[] GetBytes();
|
|
||||||
|
|
||||||
internal void FromBytes(byte[] stream);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum SerializableTypeCode
|
|
||||||
{
|
|
||||||
|
|
||||||
Unknown = 0,
|
|
||||||
IndexTable = 1,
|
|
||||||
PixelImage = 2,
|
|
||||||
VectorImage = 3,
|
|
||||||
Audio = 4,
|
|
||||||
Shader = 5,
|
|
||||||
Text = 6,
|
|
||||||
RawData = 7,
|
|
||||||
VirtualFolder = int.MaxValue,
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static partial class Serializer
|
|
||||||
{
|
|
||||||
|
|
||||||
public static T Deserialize<T>(byte[] stream) where T: ISSDSerializable
|
|
||||||
{
|
|
||||||
T serializableObject = Activator.CreateInstance<T>();
|
|
||||||
serializableObject.FromBytes(stream);
|
|
||||||
return serializableObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetNameTail(SerializableTypeCode typeCode)
|
|
||||||
{
|
|
||||||
switch (typeCode)
|
|
||||||
{
|
|
||||||
case SerializableTypeCode.IndexTable:
|
|
||||||
return "_idt";
|
|
||||||
case SerializableTypeCode.PixelImage:
|
|
||||||
return "_pim";
|
|
||||||
case SerializableTypeCode.VectorImage:
|
|
||||||
return "_vim";
|
|
||||||
case SerializableTypeCode.Audio:
|
|
||||||
return "_wav";
|
|
||||||
case SerializableTypeCode.Shader:
|
|
||||||
return "_gls";
|
|
||||||
case SerializableTypeCode.Text:
|
|
||||||
return "_txt";
|
|
||||||
case SerializableTypeCode.RawData:
|
|
||||||
return "_raw";
|
|
||||||
case SerializableTypeCode.VirtualFolder:
|
|
||||||
return "_fod";
|
|
||||||
default:
|
|
||||||
throw new ArgumentException("Unknown file type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] Serialize(ISSDSerializable serializableObject)
|
|
||||||
{
|
|
||||||
return serializableObject.GetBytes();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="CoordinationBase"
|
// file="CoordinationBase"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="PlainCoordinate"
|
// file="PlainCoordinate"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="SpaceCoordinate"
|
// file="SpaceCoordinate"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="GeometryOperation"
|
// file="GeometryOperation"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using StgSharp.Timing;
|
using StgSharp.Timing;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="IGeometry"
|
// file="IGeometry"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="IInstancing"
|
// file="IInstancing"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="IInstancingBuffer"
|
// file="IInstancingBuffer"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="GeometryOperation"
|
// file="GeometryOperation"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="IPlainEntity"
|
// file="IPlainEntity"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="ParticleOnPlain"
|
// file="ParticleOnPlain"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="PlainGeometry"
|
// file="PlainGeometry"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="PlainInstancingBuffer"
|
// file="PlainInstancingBuffer"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using StgSharp.Mathematics.Numeric;
|
using StgSharp.Mathematics.Numeric;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Parallelogram"
|
// file="Parallelogram"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Plain"
|
// file="Plain"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Polygon4"
|
// file="Polygon4"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
@@ -51,7 +51,9 @@ namespace StgSharp.Geometries
|
|||||||
vertexMat = new Vec4[4];
|
vertexMat = new Vec4[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Polygon4(Vec4[] rawCoord)
|
internal Polygon4(
|
||||||
|
Vec4[] rawCoord
|
||||||
|
)
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
if (rawCoord.Length != 4) {
|
if (rawCoord.Length != 4) {
|
||||||
@@ -60,7 +62,12 @@ namespace StgSharp.Geometries
|
|||||||
vertexMat = rawCoord;
|
vertexMat = rawCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Polygon4(Point topLeft, Point topRight, Point bottomRight, Point bottomLeft)
|
public Polygon4(
|
||||||
|
Point topLeft,
|
||||||
|
Point topRight,
|
||||||
|
Point bottomRight,
|
||||||
|
Point bottomLeft
|
||||||
|
)
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
this[0] = topLeft;
|
this[0] = topLeft;
|
||||||
@@ -75,7 +82,8 @@ namespace StgSharp.Geometries
|
|||||||
Point topLeft,
|
Point topLeft,
|
||||||
Point topRight,
|
Point topRight,
|
||||||
Point bottomRight,
|
Point bottomRight,
|
||||||
Point bottomLeft)
|
Point bottomLeft
|
||||||
|
)
|
||||||
: base(coordinate)
|
: base(coordinate)
|
||||||
{
|
{
|
||||||
this[0] = topLeft;
|
this[0] = topLeft;
|
||||||
@@ -84,7 +92,16 @@ namespace StgSharp.Geometries
|
|||||||
this[3] = bottomLeft;
|
this[3] = bottomLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Polygon4(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y)
|
public Polygon4(
|
||||||
|
float v0x,
|
||||||
|
float v0y,
|
||||||
|
float v1x,
|
||||||
|
float v1y,
|
||||||
|
float v2x,
|
||||||
|
float v2y,
|
||||||
|
float v3x,
|
||||||
|
float v3y
|
||||||
|
)
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[4];
|
vertexMat = new Vec4[4];
|
||||||
@@ -104,7 +121,8 @@ namespace StgSharp.Geometries
|
|||||||
float v2x,
|
float v2x,
|
||||||
float v2y,
|
float v2y,
|
||||||
float v3x,
|
float v3x,
|
||||||
float v3y)
|
float v3y
|
||||||
|
)
|
||||||
: base(coordination)
|
: base(coordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[4];
|
vertexMat = new Vec4[4];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Polygon5"
|
// file="Polygon5"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Polygon6"
|
// file="Polygon6"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Rectangle"
|
// file="Rectangle"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Triangle"
|
// file="Triangle"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Point"
|
// file="Point"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,8 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -43,19 +42,27 @@ namespace StgSharp.Geometries
|
|||||||
[FieldOffset(0)] private Vec3 coord;
|
[FieldOffset(0)] private Vec3 coord;
|
||||||
[FieldOffset(0)] internal Vector4 coordVec;
|
[FieldOffset(0)] internal Vector4 coordVec;
|
||||||
|
|
||||||
internal Point(Vec4 vector)
|
internal Point(
|
||||||
|
Vec4 vector
|
||||||
|
)
|
||||||
{
|
{
|
||||||
coordVec = vector.vec;
|
coordVec = vector.vec;
|
||||||
coordVec.W = 1;
|
coordVec.W = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point(Vec3 coord)
|
public Point(
|
||||||
|
Vec3 coord
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Coord = coord;
|
Coord = coord;
|
||||||
coordVec.W = 1;
|
coordVec.W = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point(float x, float y, float z)
|
public Point(
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float z
|
||||||
|
)
|
||||||
{
|
{
|
||||||
coordVec = new Vector4(x, y, z, 1);
|
coordVec = new Vector4(x, y, z, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="TriangulatedSurface"
|
// file="TriangulatedSurface"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.HighPerformance;
|
using StgSharp.HighPerformance;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
global using StgSharp.Internal;
|
global using StgSharp.Internal;
|
||||||
global using StgSharp.Internal.Intrinsic;
|
|
||||||
global
|
global
|
||||||
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
@@ -34,65 +33,5 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
[assembly: InternalsVisibleTo("StgSharp.Mathematics")]
|
[assembly: InternalsVisibleTo("StgSharp.Mathematics")]
|
||||||
[assembly: InternalsVisibleTo("StgSharp.RegularAnalysis")]
|
[assembly: InternalsVisibleTo("StgSharp.RegularAnalysis")]
|
||||||
|
[assembly: InternalsVisibleTo("StgSharp.Graphics")]
|
||||||
[assembly: InternalsVisibleTo("StgSharpDebug")]
|
[assembly: InternalsVisibleTo("StgSharpDebug")]
|
||||||
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Design",
|
|
||||||
"CA1008:枚举应具有零值",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "type",
|
|
||||||
Target = "~T:StgSharp.Graphics.OpenGL.ShaderStatus")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Naming",
|
|
||||||
"CA1715:标识符应具有正确的前缀",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "member",
|
|
||||||
Target = "~M:StgSharp.Graphics.OpenGL.ShaderProgram.GetUniform``2(System.String)~StgSharp.Graphics.OpenGL.Uniform{``0,``1}")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Naming",
|
|
||||||
"CA1715:标识符应具有正确的前缀",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "member",
|
|
||||||
Target = "~M:StgSharp.Graphics.OpenGL.ShaderProgram.GetUniform``3(System.String)~StgSharp.Graphics.OpenGL.Uniform{``0,``1,``2}")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Naming",
|
|
||||||
"CA1715:标识符应具有正确的前缀",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "member",
|
|
||||||
Target = "~M:StgSharp.Graphics.OpenGL.ShaderProgram.GetUniform``4(System.String)~StgSharp.Graphics.OpenGL.Uniform{``0,``1,``2,``3}")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Naming",
|
|
||||||
"CA1715:标识符应具有正确的前缀",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "type",
|
|
||||||
Target = "~T:StgSharp.Graphics.OpenGL.Uniform`4")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Design",
|
|
||||||
"CA1043:将整型或字符串参数用于索引器",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "member",
|
|
||||||
Target = "~P:StgSharp.MVVM.ViewBase.IViewResponder`1.Item(StgSharp.Controlling.UsrActivity.ITrigger)")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Design",
|
|
||||||
"CA1043:将整型或字符串参数用于索引器",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "member",
|
|
||||||
Target = "~P:StgSharp.MVVM.ViewBase.ViewResponder`1.Item(StgSharp.Controlling.UsrActivity.ITrigger)")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Performance",
|
|
||||||
"CA1864:首选 \"IDictionary.TryAdd(TKey, TValue)\" 方法",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "member",
|
|
||||||
Target = "~P:StgSharp.MVVM.ViewBase.ViewRender`1.Item(System.String)")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Design",
|
|
||||||
"CA1033:接口方法应可由子类型调用",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "member",
|
|
||||||
Target = "~P:StgSharp.Collections.IBidirectionalDictionary`2.System#Collections#Generic#IDictionary<TFirst,TSecond>#Keys")]
|
|
||||||
[assembly: SuppressMessage(
|
|
||||||
"Design",
|
|
||||||
"CA1033:接口方法应可由子类型调用",
|
|
||||||
Justification = "<挂起>",
|
|
||||||
Scope = "member",
|
|
||||||
Target = "~P:StgSharp.Collections.IBidirectionalDictionary`2.System#Collections#Generic#IDictionary<TFirst,TSecond>#Values")]
|
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="IGraphicAPIs"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StgSharp.Graphics
|
|
||||||
{
|
|
||||||
public interface IGraphicAPIs
|
|
||||||
{
|
|
||||||
|
|
||||||
public IntPtr GraphicApiPackageHandle { get; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="DefaultLog"
|
// file="DefaultLog"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,10 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Graphics.OpenGL;
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -47,7 +44,9 @@ namespace StgSharp.Internal
|
|||||||
|
|
||||||
internal static SemaphoreSlim logSyncSemaphore = new(1, 1);
|
internal static SemaphoreSlim logSyncSemaphore = new(1, 1);
|
||||||
|
|
||||||
internal static void InternalAppendLog(string log)
|
internal static void InternalAppendLog(
|
||||||
|
string log
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (!File.Exists(Native.LogPath))
|
if (!File.Exists(Native.LogPath))
|
||||||
{
|
{
|
||||||
@@ -60,7 +59,10 @@ namespace StgSharp.Internal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
internal static void InternalWriteLog(
|
||||||
|
string logLine,
|
||||||
|
LogType logType
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (logType < _currentLogLevel) {
|
if (logType < _currentLogLevel) {
|
||||||
return;
|
return;
|
||||||
@@ -87,7 +89,11 @@ namespace StgSharp.Internal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
internal static void InternalWriteLog(
|
||||||
|
string beforeTime,
|
||||||
|
string logLine,
|
||||||
|
LogType logType
|
||||||
|
)
|
||||||
{
|
{
|
||||||
logSyncSemaphore.Wait();
|
logSyncSemaphore.Wait();
|
||||||
if (!File.Exists(Native.LogPath))
|
if (!File.Exists(Native.LogPath))
|
||||||
@@ -104,7 +110,9 @@ namespace StgSharp.Internal
|
|||||||
_ = logSyncSemaphore.Release(1);
|
_ = logSyncSemaphore.Release(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void SetLogLevel(LogType logLevel)
|
internal static void SetLogLevel(
|
||||||
|
LogType logLevel
|
||||||
|
)
|
||||||
{
|
{
|
||||||
_currentLogLevel = logLevel;
|
_currentLogLevel = logLevel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="InternalResource"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
internal static class BuiltInShader
|
|
||||||
{
|
|
||||||
|
|
||||||
#region ControllingItemRender
|
|
||||||
|
|
||||||
internal const string ControlItemRenderVertexShader = """
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
""";
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region CollisionTexture
|
|
||||||
|
|
||||||
internal static ReadOnlySpan<byte> CollisionTextureVertexShader => """
|
|
||||||
#version 430 core
|
|
||||||
layout(location = 0) in vec2 localCollisionCoord;
|
|
||||||
layout(location = 1) in vec2 spaceCoord;
|
|
||||||
layout(location = 2) in float rotation;
|
|
||||||
layout(location = 3) in float scaling;
|
|
||||||
|
|
||||||
uniform vec2 target;
|
|
||||||
uniform mat2 projection;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
mat2 scaling = mat2(
|
|
||||||
scaling,0,
|
|
||||||
0,scaling );
|
|
||||||
|
|
||||||
mat2 rotation = mat2(
|
|
||||||
cos(rotation),-sin(rotation),
|
|
||||||
sin(rotation),cos(rotation) );
|
|
||||||
|
|
||||||
vec2 realCoord = (rotation * scaling * localCollisionCoord) + spaceCoord - target;
|
|
||||||
realCoord = projection * realCoord;
|
|
||||||
float dist = distance(realCoord, vec2(0,0));
|
|
||||||
float angle = atan(realCoord.y, realCoord.x);
|
|
||||||
gl_Position = vec4(angle, realCoord.y, dist, 1);
|
|
||||||
}
|
|
||||||
"""u8;
|
|
||||||
|
|
||||||
internal static ReadOnlySpan<byte> CollisionTextureFragmentShader => """
|
|
||||||
#version 430 core
|
|
||||||
out vec4 Color;
|
|
||||||
|
|
||||||
uniform float range;
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
float dist = gl_FragCoord.z;
|
|
||||||
if(dist > range)
|
|
||||||
{
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
dist /= range;
|
|
||||||
gl_FragDepth = min(dist, gl_FragDepth);
|
|
||||||
Color = vec4(dist,0,0,1);
|
|
||||||
}
|
|
||||||
"""u8;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,944 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="StructDefine"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.Graphics;
|
|
||||||
using StgSharp.Graphics.OpenGL;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
/**/
|
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
|
||||||
{
|
|
||||||
// rename types in style of GLFW
|
|
||||||
|
|
||||||
using GLFWbool = Boolean;
|
|
||||||
|
|
||||||
// strucs defined in GLFW3.h
|
|
||||||
|
|
||||||
#region GLFW3 struct
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct glfwContext
|
|
||||||
{
|
|
||||||
|
|
||||||
private delegate*<byte*> extensionSupported;
|
|
||||||
private delegate*<delegate*<void>, void> getProcAddress;
|
|
||||||
|
|
||||||
/*
|
|
||||||
void (* makeCurrent) (glfwWindow*);
|
|
||||||
void (* swapBuffers) (glfwWindow*);
|
|
||||||
void (* swapInterval) (int);
|
|
||||||
int (* extensionSupported) (const byte*);
|
|
||||||
delegate*<void>(*getProcAddress)(const byte*);
|
|
||||||
void (* destroy) (glfwWindow*);
|
|
||||||
*/
|
|
||||||
|
|
||||||
private delegate*<glfwWindow*> makeCurrent;
|
|
||||||
private delegate*<glfwWindow*> swapBuffer;
|
|
||||||
private delegate*<int> swapInterval;
|
|
||||||
private GLFWbool forward, debug, noerror;
|
|
||||||
|
|
||||||
private int client;
|
|
||||||
private int major, minor, revision;
|
|
||||||
private int profile;
|
|
||||||
private int release;
|
|
||||||
private int robustness;
|
|
||||||
private int source;
|
|
||||||
private IntPtr destroy;
|
|
||||||
|
|
||||||
// PFNGLGETINTEGERVPROC GetIntegerv;
|
|
||||||
private IntPtr GetIntegerv;
|
|
||||||
|
|
||||||
// PFNGLGETSTRINGPROC GetString;
|
|
||||||
private IntPtr GetString;
|
|
||||||
|
|
||||||
// PFNGLGETSTRINGIPROC GetStringi;
|
|
||||||
private IntPtr GetStringi;
|
|
||||||
|
|
||||||
internal struct egl
|
|
||||||
{
|
|
||||||
|
|
||||||
private void* client;
|
|
||||||
|
|
||||||
/*
|
|
||||||
EGLConfig config;
|
|
||||||
EGLContext handle;
|
|
||||||
EGLSurface surface;
|
|
||||||
*/
|
|
||||||
private void* config;
|
|
||||||
private void* handle;
|
|
||||||
private void* surface;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal struct osmesa
|
|
||||||
{
|
|
||||||
|
|
||||||
private void* buffer;
|
|
||||||
|
|
||||||
// OSMesaContext handle;
|
|
||||||
private void* handle;
|
|
||||||
private int height;
|
|
||||||
|
|
||||||
private int width;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is defined in platform.h
|
|
||||||
// GLFW_PLATFORM_CONTEXT_STATE
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct glfwVideomode
|
|
||||||
{
|
|
||||||
/*! The refresh rate, in Hz, of the video mode.
|
|
||||||
*/
|
|
||||||
|
|
||||||
private int refreshRate;
|
|
||||||
/*! The bit depth of the blue channel of the video mode.
|
|
||||||
*/
|
|
||||||
public int blueBits;
|
|
||||||
/*! The bit depth of the green channel of the video mode.
|
|
||||||
*/
|
|
||||||
public int greenBits;
|
|
||||||
/*! The height, in screen coordinates, of the video mode.
|
|
||||||
*/
|
|
||||||
public int height;
|
|
||||||
/*! The bit depth of the red channel of the video mode.
|
|
||||||
*/
|
|
||||||
public int redBits;
|
|
||||||
|
|
||||||
/*! The width, in screen coordinates, of the video mode.
|
|
||||||
*/
|
|
||||||
public int width;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct glfwGammaramp
|
|
||||||
{
|
|
||||||
/*! An array of value describing the response of the blue channel.
|
|
||||||
*/
|
|
||||||
|
|
||||||
private ushort* blue;
|
|
||||||
/*! An array of value describing the response of the green channel.
|
|
||||||
*/
|
|
||||||
private ushort* green;
|
|
||||||
|
|
||||||
/*! An array of value describing the response of the red channel.
|
|
||||||
*/
|
|
||||||
private ushort* red;
|
|
||||||
/*! The number of elements in each array.
|
|
||||||
*/
|
|
||||||
private uint size;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWimage
|
|
||||||
{
|
|
||||||
/*! The pixel _data of this image, arranged left-to-right, top-to-bottom.
|
|
||||||
*/
|
|
||||||
|
|
||||||
private byte* pixels;
|
|
||||||
|
|
||||||
/*! The height, in pixels, of this image.
|
|
||||||
*/
|
|
||||||
private int height;
|
|
||||||
/*! The width, in pixels, of this image.
|
|
||||||
*/
|
|
||||||
private int width;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWgamepadstate
|
|
||||||
{
|
|
||||||
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
|
|
||||||
* or `GLFW_RELEASE`.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public fixed byte buttons[15];
|
|
||||||
|
|
||||||
/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
|
|
||||||
* to 1.0 inclusive.
|
|
||||||
*/
|
|
||||||
public fixed float axes[6];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWallocator
|
|
||||||
{
|
|
||||||
|
|
||||||
private void* user;
|
|
||||||
|
|
||||||
// GLFWallocatefun allocate;
|
|
||||||
private IntPtr allocate;
|
|
||||||
|
|
||||||
// GLFWdeallocatefun deallocate;
|
|
||||||
private IntPtr deallocate;
|
|
||||||
|
|
||||||
// GLFWreallocatefun reallocate;
|
|
||||||
private IntPtr reallocate;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct glfwMonitor
|
|
||||||
{
|
|
||||||
|
|
||||||
private glfwVideomode* modes;
|
|
||||||
|
|
||||||
private glfwWindow* window;
|
|
||||||
|
|
||||||
private fixed byte name[128];
|
|
||||||
private glfwGammaramp currentRamp;
|
|
||||||
|
|
||||||
private glfwGammaramp originalRamp;
|
|
||||||
private glfwVideomode currentMode;
|
|
||||||
private int modeCount;
|
|
||||||
|
|
||||||
private int width, height;
|
|
||||||
private IntPtr userPointer;
|
|
||||||
|
|
||||||
public glfwMonitor() { }
|
|
||||||
|
|
||||||
public unsafe string Name
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
fixed (byte* cptr = name) {
|
|
||||||
return Marshal.PtrToStringAnsi((IntPtr)cptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal unsafe struct glfwWindow
|
|
||||||
{
|
|
||||||
|
|
||||||
private glfwWindow* next;
|
|
||||||
private void* userPointer;
|
|
||||||
private bool rawMouseMotion;
|
|
||||||
private Callbacks callbacks;
|
|
||||||
|
|
||||||
// Virtual cursor position when cursor is disabled
|
|
||||||
private double virtualCursorPosX, virtualCursorPosY;
|
|
||||||
private int autoIconify;
|
|
||||||
private int cursorMode;
|
|
||||||
private int decorated;
|
|
||||||
private int doublebuffer;
|
|
||||||
private int floating;
|
|
||||||
private int focusOnShow;
|
|
||||||
private int lockKeyMods;
|
|
||||||
private int maxwidth, maxheight;
|
|
||||||
|
|
||||||
private int minwidth, minheight;
|
|
||||||
private int mousePassthrough;
|
|
||||||
private int numer, denom;
|
|
||||||
|
|
||||||
// Window settings and state
|
|
||||||
private int resizable;
|
|
||||||
private int shouldClose;
|
|
||||||
|
|
||||||
private int stickyKeys;
|
|
||||||
private int stickyMouseButtons;
|
|
||||||
private IntPtr cursor; // _GLFWcursor* cursor;
|
|
||||||
// glfwVideomode videoMode; // 根据GLFWvidmode的定义转换
|
|
||||||
private IntPtr monitor; // _GLFWmonitor* monitor;
|
|
||||||
public fixed byte keys[FrameworkConstant.KEY_LAST + 1];
|
|
||||||
public fixed byte mouseButtons[FrameworkConstant.MOUSE_BUTTON_LAST + 1];
|
|
||||||
|
|
||||||
// _GLFWcontext viewPortDisplay; // 根据_GLFWcontext的定义转换
|
|
||||||
|
|
||||||
// Callbacks are represented as IntPtr since we don't need the actual function pointers in C#
|
|
||||||
internal struct Callbacks
|
|
||||||
{
|
|
||||||
|
|
||||||
internal IntPtr character;
|
|
||||||
internal IntPtr charmods;
|
|
||||||
internal IntPtr close;
|
|
||||||
internal IntPtr cursorEnter;
|
|
||||||
internal IntPtr cursorPos;
|
|
||||||
internal IntPtr drop;
|
|
||||||
internal IntPtr fbsize;
|
|
||||||
internal IntPtr focus;
|
|
||||||
internal IntPtr iconify;
|
|
||||||
internal IntPtr key;
|
|
||||||
internal IntPtr maximize;
|
|
||||||
internal IntPtr mouseButton;
|
|
||||||
internal IntPtr pos;
|
|
||||||
internal IntPtr refresh;
|
|
||||||
internal IntPtr scale;
|
|
||||||
internal IntPtr scroll;
|
|
||||||
internal IntPtr size;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// GLFW_PLATFORM_WINDOW_STATE platformWindowState;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct GLFWwindowCallback { }
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct GLFWcursor
|
|
||||||
{
|
|
||||||
|
|
||||||
// GLFWcursor* next;
|
|
||||||
private IntPtr next;
|
|
||||||
|
|
||||||
// This is defined in platform.h
|
|
||||||
// not completed in tranformation
|
|
||||||
// GLFW_PLATFORM_CURSOR_STATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWerror
|
|
||||||
{
|
|
||||||
//GLFWerror* next;
|
|
||||||
IntPtr next;
|
|
||||||
int code;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)glConst.GLFW_MESSAGE_SIZE)]
|
|
||||||
byte[] description = new byte[glConst.GLFW_MESSAGE_SIZE];
|
|
||||||
|
|
||||||
public GLFWerror()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWinitconfig
|
|
||||||
{
|
|
||||||
|
|
||||||
private GLFWbool hatButtons;
|
|
||||||
|
|
||||||
private int angleType;
|
|
||||||
private int platformID;
|
|
||||||
|
|
||||||
// PFN_vkGetInstanceProcAddr vulkanLoader;
|
|
||||||
private IntPtr vulkanLoader;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWwndconfig
|
|
||||||
{
|
|
||||||
|
|
||||||
private byte* title;
|
|
||||||
|
|
||||||
private GLFWbool autoIconify;
|
|
||||||
private GLFWbool centerCursor;
|
|
||||||
private GLFWbool decorated;
|
|
||||||
private GLFWbool floating;
|
|
||||||
private GLFWbool focused;
|
|
||||||
private GLFWbool focusOnShow;
|
|
||||||
private GLFWbool maximized;
|
|
||||||
private GLFWbool mousePassthrough;
|
|
||||||
private GLFWbool resizable;
|
|
||||||
private GLFWbool scaleToMonitor;
|
|
||||||
private GLFWbool visible;
|
|
||||||
private int height;
|
|
||||||
private int width;
|
|
||||||
|
|
||||||
private int xpos;
|
|
||||||
private int ypos;
|
|
||||||
|
|
||||||
internal Ns ns = new Ns();
|
|
||||||
|
|
||||||
internal Win32 win32 = new Win32();
|
|
||||||
|
|
||||||
internal Wl wl = new Wl();
|
|
||||||
|
|
||||||
internal X11 x11 = new X11();
|
|
||||||
|
|
||||||
public GLFWwndconfig() { }
|
|
||||||
|
|
||||||
internal struct Ns
|
|
||||||
{
|
|
||||||
|
|
||||||
private GLFWbool retina = false;
|
|
||||||
public fixed byte frameName[256];
|
|
||||||
|
|
||||||
public Ns() { }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal struct X11
|
|
||||||
{
|
|
||||||
|
|
||||||
public fixed byte className[256];
|
|
||||||
public fixed byte instanceName[256];
|
|
||||||
|
|
||||||
public X11() { }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal struct Win32
|
|
||||||
{
|
|
||||||
|
|
||||||
private GLFWbool keymenu;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal struct Wl
|
|
||||||
{
|
|
||||||
|
|
||||||
public fixed byte appId[256];
|
|
||||||
|
|
||||||
public Wl() { }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWctxconfig
|
|
||||||
{
|
|
||||||
|
|
||||||
private GLFWbool debug;
|
|
||||||
private GLFWbool forward;
|
|
||||||
private GLFWbool noerror;
|
|
||||||
|
|
||||||
private int client;
|
|
||||||
private int major;
|
|
||||||
private int minor;
|
|
||||||
private int profile;
|
|
||||||
private int release;
|
|
||||||
private int robustness;
|
|
||||||
private int source;
|
|
||||||
|
|
||||||
// glfwWindow* share;
|
|
||||||
private IntPtr share;
|
|
||||||
|
|
||||||
internal Nsgl nsgl = new Nsgl();
|
|
||||||
|
|
||||||
public GLFWctxconfig() { }
|
|
||||||
|
|
||||||
internal struct Nsgl
|
|
||||||
{
|
|
||||||
|
|
||||||
private GLFWbool offline;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWfbconfig
|
|
||||||
{
|
|
||||||
|
|
||||||
private GLFWbool doublebuffer;
|
|
||||||
private GLFWbool sRGB;
|
|
||||||
private GLFWbool stereo;
|
|
||||||
private GLFWbool transparent;
|
|
||||||
|
|
||||||
private int accumAlphaBits;
|
|
||||||
private int accumBlueBits;
|
|
||||||
private int accumGreenBits;
|
|
||||||
private int accumRedBits;
|
|
||||||
private int alphaBits;
|
|
||||||
private int auxBuffers;
|
|
||||||
private int blueBits;
|
|
||||||
private int depthBits;
|
|
||||||
private int greenBits;
|
|
||||||
|
|
||||||
private int redBits;
|
|
||||||
private int samples;
|
|
||||||
private int stencilBits;
|
|
||||||
private uintptr_t handle;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal unsafe struct GLFWlibrary
|
|
||||||
{
|
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = FrameworkConstant.JOYSTICK_LAST + 1)]
|
|
||||||
private GLFWjoystick[] joysticks = new GLFWjoystick[FrameworkConstant.JOYSTICK_LAST + 1];
|
|
||||||
|
|
||||||
private GLFWallocator allocator;
|
|
||||||
|
|
||||||
private GLFWbool initialized;
|
|
||||||
|
|
||||||
private GLFWbool joysticksInitialized;
|
|
||||||
private GLFWls contextSlot;
|
|
||||||
|
|
||||||
private GLFWls errorSlot;
|
|
||||||
private GLFWmutex errorLock;
|
|
||||||
|
|
||||||
private GLFWplatform platform;
|
|
||||||
|
|
||||||
private int mappingCount;
|
|
||||||
|
|
||||||
private int monitorCount;
|
|
||||||
|
|
||||||
// GLFWcursor* cursorListHead;
|
|
||||||
private IntPtr cursorListHead;
|
|
||||||
|
|
||||||
// GLFWerror* errorListHead;
|
|
||||||
private IntPtr errorListHead;
|
|
||||||
|
|
||||||
// GLFWmapping* mappings;
|
|
||||||
private IntPtr mappings;
|
|
||||||
|
|
||||||
// GLFWmonitor** monitors;
|
|
||||||
private IntPtr monitors;
|
|
||||||
|
|
||||||
// glfwWindow* windowListHead;
|
|
||||||
private IntPtr windowListHead;
|
|
||||||
|
|
||||||
internal Callbacks callbacks = new Callbacks();
|
|
||||||
|
|
||||||
internal Egl egl = new Egl();
|
|
||||||
|
|
||||||
internal Hints hints = new Hints();
|
|
||||||
|
|
||||||
internal Osmesa osmesa = new Osmesa();
|
|
||||||
|
|
||||||
public GLFWlibrary() { }
|
|
||||||
|
|
||||||
internal unsafe struct Hints
|
|
||||||
{
|
|
||||||
|
|
||||||
private GLFWctxconfig context;
|
|
||||||
private GLFWfbconfig framebuffer;
|
|
||||||
|
|
||||||
private GLFWinitconfig init;
|
|
||||||
private GLFWwndconfig window;
|
|
||||||
private int refreshRate;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal unsafe struct timer
|
|
||||||
{
|
|
||||||
|
|
||||||
private ulong offset;
|
|
||||||
|
|
||||||
// This is defined in platform.h
|
|
||||||
|
|
||||||
// not transformed function defination
|
|
||||||
// GLFW_PLATFORM_LIBRARY_TIMER_STATE
|
|
||||||
}
|
|
||||||
|
|
||||||
internal unsafe struct Egl
|
|
||||||
{
|
|
||||||
|
|
||||||
internal void* display;
|
|
||||||
|
|
||||||
internal void* handle;
|
|
||||||
|
|
||||||
internal bool ANGLE_platform_angle;
|
|
||||||
internal bool ANGLE_platform_angle_d3d;
|
|
||||||
internal bool ANGLE_platform_angle_metal;
|
|
||||||
internal bool ANGLE_platform_angle_opengl;
|
|
||||||
internal bool ANGLE_platform_angle_vulkan;
|
|
||||||
internal bool EXT_client_extensions;
|
|
||||||
internal bool EXT_platform_base;
|
|
||||||
internal bool EXT_platform_wayland;
|
|
||||||
internal bool EXT_platform_x11;
|
|
||||||
internal bool EXT_present_opaque;
|
|
||||||
internal bool KHR_colorSpace;
|
|
||||||
internal bool KHR_context_flush_control;
|
|
||||||
|
|
||||||
internal bool KHR_create_context;
|
|
||||||
internal bool KHR_create_context_no_error;
|
|
||||||
internal bool KHR_get_all_proc_addresses;
|
|
||||||
internal bool prefix;
|
|
||||||
internal int major, minor;
|
|
||||||
|
|
||||||
internal int platform;
|
|
||||||
internal IntPtr BindAPI;
|
|
||||||
internal IntPtr CreateContext;
|
|
||||||
internal IntPtr CreatePlatformWindowSurfaceEXT;
|
|
||||||
internal IntPtr CreateWindowSurface;
|
|
||||||
internal IntPtr DestroyContext;
|
|
||||||
internal IntPtr DestroySurface;
|
|
||||||
|
|
||||||
internal IntPtr GetConfigAttrib;
|
|
||||||
internal IntPtr GetConfigs;
|
|
||||||
internal IntPtr GetDisplay;
|
|
||||||
internal IntPtr GetError;
|
|
||||||
|
|
||||||
internal IntPtr GetPlatformDisplayEXT;
|
|
||||||
internal IntPtr GetProcAddress;
|
|
||||||
internal IntPtr Initialize;
|
|
||||||
internal IntPtr MakeCurrent;
|
|
||||||
internal IntPtr QueryString;
|
|
||||||
internal IntPtr SwapBuffers;
|
|
||||||
internal IntPtr SwapInterval;
|
|
||||||
internal IntPtr Terminate;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal unsafe struct Osmesa
|
|
||||||
{
|
|
||||||
|
|
||||||
private void* handle;
|
|
||||||
|
|
||||||
private IntPtr CreateContextAttribs;
|
|
||||||
|
|
||||||
private IntPtr CreateContextExt;
|
|
||||||
private IntPtr DestroyContext;
|
|
||||||
private IntPtr GetColorBuffer;
|
|
||||||
private IntPtr GetDepthBuffer;
|
|
||||||
private IntPtr GetProcAddress;
|
|
||||||
private IntPtr MakeCurrent;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal unsafe struct vk
|
|
||||||
{
|
|
||||||
|
|
||||||
private void* handle;
|
|
||||||
|
|
||||||
private GLFWbool available;
|
|
||||||
private GLFWbool EXT_metal_surface;
|
|
||||||
private GLFWbool KHR_surface;
|
|
||||||
private GLFWbool KHR_wayland_surface;
|
|
||||||
private GLFWbool KHR_win32_surface;
|
|
||||||
private GLFWbool KHR_xcb_surface;
|
|
||||||
private GLFWbool KHR_xlib_surface;
|
|
||||||
private GLFWbool MVK_macos_surface;
|
|
||||||
private IntPtr GetInstanceProcAddr;
|
|
||||||
private fixed ulong extensions[2];
|
|
||||||
|
|
||||||
public vk() { }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal unsafe struct Callbacks
|
|
||||||
{
|
|
||||||
|
|
||||||
private IntPtr joystick;
|
|
||||||
|
|
||||||
private IntPtr monitor;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWmapelement
|
|
||||||
{
|
|
||||||
|
|
||||||
private byte index;
|
|
||||||
|
|
||||||
private byte type;
|
|
||||||
|
|
||||||
private sbyte axisOffset;
|
|
||||||
private sbyte axisScale;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWmapping
|
|
||||||
{
|
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
|
||||||
private GLFWmapelement[] axes = new GLFWmapelement[6];
|
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
|
|
||||||
private GLFWmapelement[] buttons = new GLFWmapelement[15];
|
|
||||||
private fixed byte guid[33];
|
|
||||||
|
|
||||||
private fixed byte name[128];
|
|
||||||
|
|
||||||
public GLFWmapping() { }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWjoystick
|
|
||||||
{
|
|
||||||
|
|
||||||
private float* axes;
|
|
||||||
private byte* buttons;
|
|
||||||
private byte* hats;
|
|
||||||
private void* userPointer;
|
|
||||||
private fixed byte guid[33];
|
|
||||||
private fixed byte name[128];
|
|
||||||
|
|
||||||
private GLFWbool allocated;
|
|
||||||
private GLFWbool connected;
|
|
||||||
private int axisCount;
|
|
||||||
private int buttonCount;
|
|
||||||
private int hatCount;
|
|
||||||
|
|
||||||
// GLFWmapping* mapping;
|
|
||||||
private IntPtr mapping;
|
|
||||||
|
|
||||||
// This is defined in platform.h
|
|
||||||
// not completed in transforming
|
|
||||||
// GLFW_PLATFORM_JOYSTICK_STATE;
|
|
||||||
|
|
||||||
public GLFWjoystick() { }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWls
|
|
||||||
{
|
|
||||||
|
|
||||||
// This is defined in platform.h
|
|
||||||
|
|
||||||
// GLFW_PLATFORM_TLS_STATE
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWplatform
|
|
||||||
{
|
|
||||||
|
|
||||||
private int platformID;
|
|
||||||
|
|
||||||
// init
|
|
||||||
// GLFWbool(*init)(void);
|
|
||||||
private IntPtr init;
|
|
||||||
|
|
||||||
// void (* terminate) (void);
|
|
||||||
private IntPtr terminate;
|
|
||||||
internal IntPtr createCursor;
|
|
||||||
internal IntPtr createStandardCursor;
|
|
||||||
|
|
||||||
// window
|
|
||||||
internal IntPtr createWindow;
|
|
||||||
internal IntPtr destroyCursor;
|
|
||||||
|
|
||||||
internal IntPtr destroyWindow;
|
|
||||||
internal IntPtr focusWindow;
|
|
||||||
internal IntPtr framebufferTransparent;
|
|
||||||
|
|
||||||
// monitor
|
|
||||||
internal IntPtr freeMonitor;
|
|
||||||
internal IntPtr getClipboardString;
|
|
||||||
|
|
||||||
internal IntPtr getEGLNativeDisplay;
|
|
||||||
internal IntPtr getEGLNativeWindow;
|
|
||||||
|
|
||||||
// EGL
|
|
||||||
// EGLenum(*getEGLPlatform)(EGLint**);
|
|
||||||
// EGLNativeDisplayType(*getEGLNativeDisplay)(void);
|
|
||||||
// EGLNativeWindowType(*getEGLNativeWindow)(glfwWindow*);
|
|
||||||
internal IntPtr getEGLPlatform;
|
|
||||||
internal IntPtr getFramebufferSize;
|
|
||||||
internal IntPtr getGammaRamp;
|
|
||||||
internal IntPtr getKeyScancode;
|
|
||||||
internal IntPtr getMappingName;
|
|
||||||
internal IntPtr getMonitorContentScale;
|
|
||||||
|
|
||||||
internal IntPtr getMonitorPos;
|
|
||||||
internal IntPtr getMonitorWorkarea;
|
|
||||||
|
|
||||||
// vulkan
|
|
||||||
// void (* getRequiredInstanceExtensions) (byte**);
|
|
||||||
// GLFWbool(*getPhysicalDevicePresentationSupport)(VkInstance, VkPhysicalDevice, uint32_t);
|
|
||||||
// VkResult(*createWindowSurface)(VkInstance, glfwWindow*,const VkAllocationCallbacks*, VkSurfaceKHR*);
|
|
||||||
internal IntPtr getRequiredInstanceExtensions;
|
|
||||||
internal IntPtr getScancodeName;
|
|
||||||
internal IntPtr getVideoMode;
|
|
||||||
internal IntPtr getVideoModes;
|
|
||||||
internal IntPtr getWindowContentScale;
|
|
||||||
internal IntPtr getWindowFrameSize;
|
|
||||||
internal IntPtr getWindowOpacity;
|
|
||||||
internal IntPtr getWindowPos;
|
|
||||||
internal IntPtr getWindowSize;
|
|
||||||
internal IntPtr GLFWwindow;
|
|
||||||
internal IntPtr hideWindow;
|
|
||||||
internal IntPtr iconifyWindow;
|
|
||||||
internal IntPtr initJoysticks;
|
|
||||||
internal IntPtr maximizeWindow;
|
|
||||||
internal IntPtr pollEvents;
|
|
||||||
internal IntPtr pollJoystick;
|
|
||||||
internal IntPtr postEmptyEvent;
|
|
||||||
internal IntPtr rawMouseMotionSupported;
|
|
||||||
internal IntPtr requestWindowAttention;
|
|
||||||
internal IntPtr restoreWindow;
|
|
||||||
internal IntPtr setClipboardString;
|
|
||||||
internal IntPtr setCursor;
|
|
||||||
internal IntPtr setCursorMode;
|
|
||||||
|
|
||||||
#region input
|
|
||||||
|
|
||||||
/* void (* getCursorPos) (glfwWindow*, double*, double*);
|
|
||||||
void (* setCursorPos) (glfwWindow*, double, double);
|
|
||||||
void (* setCursorMode) (glfwWindow*, int);
|
|
||||||
void (* setRawMouseMotion) (glfwWindow*, GLFWbool);
|
|
||||||
GLFWbool(*rawMouseMotionSupported)(void);
|
|
||||||
GLFWbool(*createCursor)(GLFWcursor*,const GLFWimage*,int,int);
|
|
||||||
GLFWbool(*createStandardCursor)(GLFWcursor*, int);
|
|
||||||
void (* destroyCursor) (GLFWcursor*);
|
|
||||||
void (* setCursor) (glfwWindow*, GLFWcursor*);
|
|
||||||
const byte* (*getScancodeName)(int);
|
|
||||||
int (* getKeyScancode) (int);
|
|
||||||
void (* setClipboardString) (const byte*);
|
|
||||||
const byte* (*getClipboardString)(void);
|
|
||||||
GLFWbool(*initJoysticks)(void);
|
|
||||||
void (* terminateJoysticks) (void);
|
|
||||||
GLFWbool(*pollJoystick)(GLFWjoystick*, int);
|
|
||||||
const byte* (*getMappingName)(void);
|
|
||||||
void (* updateGamepadGUID) (byte*);
|
|
||||||
// monitor
|
|
||||||
void (* freeMonitor) (GLFWmonitor*);
|
|
||||||
void (* getMonitorPos) (GLFWmonitor*, int*, int*);
|
|
||||||
void (* getMonitorContentScale) (GLFWmonitor*, float*, float*);
|
|
||||||
void (* getMonitorWorkarea) (GLFWmonitor*, int*, int*, int*, int*);
|
|
||||||
glfwVideomode* (* getVideoModes) (GLFWmonitor*, int*);
|
|
||||||
void (* getVideoMode) (GLFWmonitor*, glfwVideomode*);
|
|
||||||
GLFWbool(*getGammaRamp)(GLFWmonitor*, glfwGammaramp*);
|
|
||||||
void (* setGammaRamp) (GLFWmonitor*,const glfwGammaramp*);
|
|
||||||
// window
|
|
||||||
GLFWbool(*createWindow)(glfwWindow*,const GLFWwndconfig*,const GLFWctxconfig*,const GLFWfbconfig*);
|
|
||||||
void (* destroyWindow) (glfwWindow*);
|
|
||||||
void (* setWindowTitle) (glfwWindow*,const byte*);
|
|
||||||
void (* setWindowIcon) (glfwWindow*, int,const GLFWimage*);
|
|
||||||
void (* getWindowPos) (glfwWindow*, int*, int*);
|
|
||||||
void (* setWindowPos) (glfwWindow*, int, int);
|
|
||||||
void (* getWindowSize) (glfwWindow*, int*, int*);
|
|
||||||
void (* setWindowSize) (glfwWindow*, int, int);
|
|
||||||
void (* setWindowSizeLimits) (glfwWindow*, int, int, int, int);
|
|
||||||
void (* setWindowAspectRatio) (glfwWindow*, int, int);
|
|
||||||
void (* getFramebufferSize) (glfwWindow*, int*, int*);
|
|
||||||
void (* getWindowFrameSize) (glfwWindow*, int*, int*, int*, int*);
|
|
||||||
void (* getWindowContentScale) (glfwWindow*, float*, float*);
|
|
||||||
void (* iconifyWindow) (glfwWindow*);
|
|
||||||
void (* restoreWindow) (glfwWindow*);
|
|
||||||
void (* maximizeWindow) (glfwWindow*);
|
|
||||||
void (* showWindow) (glfwWindow*);
|
|
||||||
void (* hideWindow) (glfwWindow*);
|
|
||||||
void (* requestWindowAttention) (glfwWindow*);
|
|
||||||
void (* focusWindow) (glfwWindow*);
|
|
||||||
void (* setWindowMonitor) (glfwWindow*, GLFWmonitor*, int, int, int, int, int);
|
|
||||||
GLFWbool(*windowFocused)(glfwWindow*);
|
|
||||||
GLFWbool(*windowIconified)(glfwWindow*);
|
|
||||||
GLFWbool(*windowVisible)(glfwWindow*);
|
|
||||||
GLFWbool(*windowMaximized)(glfwWindow*);
|
|
||||||
GLFWbool(*windowHovered)(glfwWindow*);
|
|
||||||
GLFWbool(*framebufferTransparent)(glfwWindow*);
|
|
||||||
float (* getWindowOpacity) (glfwWindow*);
|
|
||||||
void (* setWindowResizable) (glfwWindow*, GLFWbool);
|
|
||||||
void (* setWindowDecorated) (glfwWindow*, GLFWbool);
|
|
||||||
void (* setWindowFloating) (glfwWindow*, GLFWbool);
|
|
||||||
void (* setWindowOpacity) (glfwWindow*, float);
|
|
||||||
void (* setWindowMousePassthrough) (glfwWindow*, GLFWbool);
|
|
||||||
void (* pollEvents) (void);
|
|
||||||
void (* waitEvents) (void);
|
|
||||||
void (* waitEventsTimeout) (double);
|
|
||||||
void (* postEmptyEvent) (void);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
internal IntPtr setCursorPos;
|
|
||||||
internal IntPtr setGammaRamp;
|
|
||||||
internal IntPtr setRawMouseMotion;
|
|
||||||
internal IntPtr setWindowAspectRatio;
|
|
||||||
internal IntPtr setWindowDecorated;
|
|
||||||
internal IntPtr setWindowFloating;
|
|
||||||
internal IntPtr setWindowIcon;
|
|
||||||
internal IntPtr setWindowMonitor;
|
|
||||||
internal IntPtr setWindowMousePassthrough;
|
|
||||||
internal IntPtr setWindowOpacity;
|
|
||||||
internal IntPtr setWindowPos;
|
|
||||||
internal IntPtr setWindowResizable;
|
|
||||||
internal IntPtr setWindowSize;
|
|
||||||
internal IntPtr setWindowSizeLimits;
|
|
||||||
internal IntPtr setWindowTitle;
|
|
||||||
internal IntPtr showWindow;
|
|
||||||
internal IntPtr terminateJoysticks;
|
|
||||||
internal IntPtr updateGamepadGUID;
|
|
||||||
|
|
||||||
internal IntPtr VkPhysicalDevice;
|
|
||||||
internal IntPtr waitEvents;
|
|
||||||
internal IntPtr waitEventsTimeout;
|
|
||||||
internal IntPtr windowFocused;
|
|
||||||
internal IntPtr windowHovered;
|
|
||||||
internal IntPtr windowIconified;
|
|
||||||
internal IntPtr windowMaximized;
|
|
||||||
internal IntPtr windowVisible;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public unsafe struct GLFWmutex
|
|
||||||
{
|
|
||||||
|
|
||||||
// This is defined in platform.h
|
|
||||||
// GLFW_PLATFORM_MUTEX_STATE
|
|
||||||
}
|
|
||||||
|
|
||||||
// public unsafe struct VkAllocationCallbacks { }
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal unsafe struct VkExtensionProperties
|
|
||||||
{
|
|
||||||
|
|
||||||
private fixed byte extensionName[256];
|
|
||||||
private uint specVersion;
|
|
||||||
|
|
||||||
public VkExtensionProperties() { }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal unsafe struct GLFWerror
|
|
||||||
{
|
|
||||||
IntPtr next;
|
|
||||||
int code;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
|
|
||||||
byte[] description = new byte[1024];
|
|
||||||
|
|
||||||
public GLFWerror()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
|
||||||
public struct uintptr_t
|
|
||||||
{
|
|
||||||
|
|
||||||
[FieldOffset(0)]
|
|
||||||
private long part1;
|
|
||||||
|
|
||||||
[FieldOffset(8)]
|
|
||||||
private long part2;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion GLFW3 struct
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**/
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="OpenGLControllingItemRender"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.Graphics.OpenGL;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp.MVVM
|
|
||||||
{
|
|
||||||
public class OpenGLControllingItemRender : glRender
|
|
||||||
{
|
|
||||||
|
|
||||||
public override bool IsContextSharable => true;
|
|
||||||
|
|
||||||
protected override void CustomizeDeinit()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CustomizeInit()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,7 @@ using StgSharp.Controlling.UsrActivity;
|
|||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Graphics.OpenGL;
|
using StgSharp.Graphics.OpenGL;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using StgSharp.MVVM;
|
using StgSharp.MVVM;
|
||||||
using StgSharp.MVVM.ViewModel;
|
using StgSharp.MVVM.ViewModel;
|
||||||
using StgSharp.Threading;
|
using StgSharp.Threading;
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="ElementType"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
#pragma warning disable CA1028
|
|
||||||
namespace StgSharp.Mathematics.Numeric
|
|
||||||
{
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 4)]
|
|
||||||
public struct MatrixElementType
|
|
||||||
{
|
|
||||||
|
|
||||||
public static readonly MatrixElementType F32 = new(0x03000004);
|
|
||||||
public static readonly MatrixElementType F64 = new(0x03000008);
|
|
||||||
public static readonly MatrixElementType I08 = new(0x0100001);
|
|
||||||
public static readonly MatrixElementType I16 = new(0x0100002);
|
|
||||||
public static readonly MatrixElementType I32 = new(0x0100004);
|
|
||||||
public static readonly MatrixElementType I64 = new(0x0100008);
|
|
||||||
public static readonly MatrixElementType U08 = new(0x0200001);
|
|
||||||
public static readonly MatrixElementType U16 = new(0x0200002);
|
|
||||||
public static readonly MatrixElementType U32 = new(0x0200004);
|
|
||||||
public static readonly MatrixElementType U64 = new(0x0200008);
|
|
||||||
|
|
||||||
[FieldOffset(0)] internal readonly int Mask;
|
|
||||||
[FieldOffset(3)] public readonly MatrixElementTypeGroup Group;
|
|
||||||
|
|
||||||
[FieldOffset(0)] public readonly ushort Size;
|
|
||||||
|
|
||||||
private MatrixElementType(
|
|
||||||
int mask
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Unsafe.SkipInit(out this);
|
|
||||||
Unsafe.SkipInit(out Size);
|
|
||||||
Unsafe.SkipInit(out Group);
|
|
||||||
this.Mask = mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum MatrixElementTypeGroup : byte
|
|
||||||
{
|
|
||||||
|
|
||||||
None = 0,
|
|
||||||
Singed = 1,
|
|
||||||
Unsigned = 2,
|
|
||||||
Float = 3,
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#pragma warning restore CA1028
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ using StgSharp.Graphics.OpenGL;
|
|||||||
using StgSharp.Internal;
|
using StgSharp.Internal;
|
||||||
|
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using StgSharp.MVVM;
|
using StgSharp.MVVM;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -115,6 +115,10 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Graphics\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|||||||
+20
-8
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="ColumnSet2"
|
// file="ColumnSet2"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp;
|
using StgSharp;
|
||||||
using StgSharp.Internal.Intrinsic;
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
@@ -34,7 +33,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace StgSharp.Internal.Intrinsic
|
namespace StgSharp.Mathematics.Internal
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 12 * sizeof(float), Pack = 16)]
|
[StructLayout(LayoutKind.Explicit, Size = 12 * sizeof(float), Pack = 16)]
|
||||||
internal struct ColumnSet2 : IEquatable<ColumnSet2>
|
internal struct ColumnSet2 : IEquatable<ColumnSet2>
|
||||||
@@ -52,7 +51,10 @@ namespace StgSharp.Internal.Intrinsic
|
|||||||
[FieldOffset(0)] internal Vector4 colum0;
|
[FieldOffset(0)] internal Vector4 colum0;
|
||||||
[FieldOffset(4 * sizeof(float))] internal Vector4 colum1;
|
[FieldOffset(4 * sizeof(float))] internal Vector4 colum1;
|
||||||
|
|
||||||
internal ColumnSet2(Vector4 c0, Vector4 c1)
|
internal ColumnSet2(
|
||||||
|
Vector4 c0,
|
||||||
|
Vector4 c1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
colum0 = c0;
|
colum0 = c0;
|
||||||
@@ -60,25 +62,35 @@ namespace StgSharp.Internal.Intrinsic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public override bool Equals(object? obj)
|
public override bool Equals(
|
||||||
|
object? obj
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return (obj is ColumnSet2 mat) && Equals(mat);
|
return (obj is ColumnSet2 mat) && Equals(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool Equals(ColumnSet2 other)
|
public bool Equals(
|
||||||
|
ColumnSet2 other
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return colum0.Equals(other.colum0) && colum1.Equals(other.colum1);
|
return colum0.Equals(other.colum0) && colum1.Equals(other.colum1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static bool operator !=(ColumnSet2 left, ColumnSet2 right)
|
public static bool operator !=(
|
||||||
|
ColumnSet2 left,
|
||||||
|
ColumnSet2 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return !(left == right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static bool operator ==(ColumnSet2 left, ColumnSet2 right)
|
public static bool operator ==(
|
||||||
|
ColumnSet2 left,
|
||||||
|
ColumnSet2 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return left.Equals(right);
|
return left.Equals(right);
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="ColumnSet3"
|
// file="ColumnSet3"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Internal.Intrinsic;
|
using StgSharp.Mathematics.Internal;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@@ -33,7 +33,7 @@ using System.Numerics;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Internal.Intrinsic
|
namespace StgSharp.Mathematics.Internal
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 12 * sizeof(float), Pack = 16)]
|
[StructLayout(LayoutKind.Explicit, Size = 12 * sizeof(float), Pack = 16)]
|
||||||
internal struct ColumnSet3 : IEquatable<ColumnSet3>
|
internal struct ColumnSet3 : IEquatable<ColumnSet3>
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="ColumnSet4"
|
// file="ColumnSet4"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,14 +26,14 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp;
|
using StgSharp;
|
||||||
using StgSharp.Internal.Intrinsic;
|
using StgSharp.Mathematics.Internal;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Internal.Intrinsic
|
namespace StgSharp.Mathematics.Internal
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 16 * sizeof(float))]
|
[StructLayout(LayoutKind.Explicit, Size = 16 * sizeof(float))]
|
||||||
internal struct ColumnSet4 : IEquatable<ColumnSet4>
|
internal struct ColumnSet4 : IEquatable<ColumnSet4>
|
||||||
+64
-20
@@ -1,9 +1,9 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="IntrinsicContext"
|
// file="IntrinsicContext"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload Space
|
// AuthorGroup: Nitload
|
||||||
// Copyright (c) Nitload Space. All rights reserved.
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -25,34 +25,78 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.HighPerformance;
|
|
||||||
using System;
|
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.InteropServices.Marshalling;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal.Intrinsic
|
namespace StgSharp.Mathematics.Internal
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[InlineArray(10)]
|
||||||
internal unsafe struct MatrixIntrinsic
|
internal unsafe struct MatrixIntrinsic
|
||||||
{
|
{
|
||||||
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, long, void> buffer_add; //f32_buffer_add
|
private nint handle; //f32_panel_mul
|
||||||
public delegate* unmanaged[Cdecl]<void*, ScalarPacket*, long, void> buffer_fill; //f32_buffer_fill
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, ScalarPacket*, long, void> buffer_scalar_mul; //f32_buffer_s_m
|
public readonly nint this[
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, long, void> buffer_sub; //f32_kernel_sub
|
MatrixIntrinsicHandle handle
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void> buffer_transpose; //f32_kernel_transpose
|
]
|
||||||
public delegate* unmanaged[Cdecl]<MatrixPanel*, MatrixKernel*, int, int, int, int, void> build_panel; //f32_build_panel
|
{
|
||||||
public delegate* unmanaged[Cdecl]<MatrixPanel*, void> clear_panel; //f32_clear_panel
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, void*, void> kernel_fma; //f32_panel_fma
|
get => this[(int)handle];
|
||||||
public delegate* unmanaged[Cdecl]<MatrixKernel*, MatrixKernel*, MatrixKernel*, M128*, void> kernel_tile_fma; //f32_panel_fma
|
}
|
||||||
public delegate* unmanaged[Cdecl]<void*, ulong, ulong, ulong, void> pivot; //f32_panel_mul
|
|
||||||
public delegate* unmanaged[Cdecl]<void*, void*, int, int, int, int, void> store_panel; //f32_store_panel
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[InlineArray(4)]
|
internal enum MatrixIntrinsicHandle : int
|
||||||
|
{
|
||||||
|
|
||||||
|
BufferAdd = 0,
|
||||||
|
BufferFill = 1,
|
||||||
|
BufferScalarMul = 2,
|
||||||
|
BufferSub = 3,
|
||||||
|
BufferTranspose = 4,
|
||||||
|
ClearPanel = 5,
|
||||||
|
KerFma = 6,
|
||||||
|
TileFma = 7,
|
||||||
|
Pivot = 8,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Explicit, Size = 4)]
|
||||||
|
public struct MatrixElementType
|
||||||
|
{
|
||||||
|
|
||||||
|
public const int IntrinsicCount = 0xa;
|
||||||
|
|
||||||
|
public static readonly MatrixElementType F32 = new(0x00010004);
|
||||||
|
public static readonly MatrixElementType F64 = new(0x00020008);
|
||||||
|
public static readonly MatrixElementType I08 = new(0x00030001);
|
||||||
|
public static readonly MatrixElementType I16 = new(0x00040002);
|
||||||
|
public static readonly MatrixElementType I32 = new(0x00050004);
|
||||||
|
public static readonly MatrixElementType I64 = new(0x00060008);
|
||||||
|
public static readonly MatrixElementType U08 = new(0x00070001);
|
||||||
|
public static readonly MatrixElementType U16 = new(0x00080002);
|
||||||
|
public static readonly MatrixElementType U32 = new(0x00090004);
|
||||||
|
public static readonly MatrixElementType U64 = new(0x000a0008);
|
||||||
|
|
||||||
|
[FieldOffset(0)] internal readonly int Mask;
|
||||||
|
[FieldOffset(2)] public readonly ushort IntrinsicNode;
|
||||||
|
|
||||||
|
[FieldOffset(0)] public readonly ushort Size;
|
||||||
|
|
||||||
|
private MatrixElementType(
|
||||||
|
int mask
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Unsafe.SkipInit(out this);
|
||||||
|
Unsafe.SkipInit(out Size);
|
||||||
|
Unsafe.SkipInit(out IntrinsicNode);
|
||||||
|
this.Mask = mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[InlineArray(MatrixElementType.IntrinsicCount)]
|
||||||
internal unsafe struct MatrixIntrinsicArray
|
internal unsafe struct MatrixIntrinsicArray
|
||||||
{
|
{
|
||||||
|
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="SIMDID"
|
// file="SIMDID"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StgSharp.Internal.Intrinsic
|
namespace StgSharp.Mathematics.Internal
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
internal unsafe struct SIMDID
|
internal unsafe struct SIMDID
|
||||||
+20
-23
@@ -1,41 +1,38 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="intrinsicContextProvider.cs"
|
// file="intrinsicContextProvider"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload Space
|
// AuthorGroup: Nitload
|
||||||
// Copyright (c) Nitload Space. All rights reserved.
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// obtaining a copy of this software and associated documentation
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
// files (the “Software”), to deal in the Software without restriction,
|
// in the Software without restriction, including without limitation the rights
|
||||||
// including without limitation the rights to use, copy, modify, merge,
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
// and to permit persons to whom the Software is furnished to do so,
|
// furnished to do so, subject to the following conditions:
|
||||||
// subject to the following conditions:
|
|
||||||
//
|
//
|
||||||
// The above copyright notice and
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
// this permission notice shall be included in all copies
|
// copies or substantial portions of the Software.
|
||||||
// or substantial portions of the Software.
|
|
||||||
//
|
//
|
||||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
// SOFTWARE.
|
||||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Internal.Intrinsic;
|
using StgSharp.Mathematics.Internal;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Internal
|
namespace StgSharp.Mathematics.Internal
|
||||||
{
|
{
|
||||||
internal static unsafe partial class NativeIntrinsic
|
internal static unsafe partial class NativeIntrinsic
|
||||||
{
|
{
|
||||||
+2
-1
@@ -26,6 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.HighPerformance;
|
using StgSharp.HighPerformance;
|
||||||
|
using StgSharp.Mathematics.Internal;
|
||||||
using StgSharp.Mathematics.Numeric;
|
using StgSharp.Mathematics.Numeric;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@@ -34,7 +35,7 @@ using System.Numerics;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Size = (16 * sizeof(float)), Pack = 16)]
|
[StructLayout(LayoutKind.Explicit, Size = (16 * sizeof(float)), Pack = 16)]
|
||||||
public unsafe struct Matrix44 : IEquatable<Matrix44>
|
public unsafe struct Matrix44 : IEquatable<Matrix44>
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Vec2"
|
// file="Vec2"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -32,7 +32,7 @@ using System.Numerics;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A two dimension vector defined by two elements. Vec2 in World are default used as colum
|
/// A two dimension vector defined by two elements. Vec2 in World are default used as colum
|
||||||
+74
-22
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Vec3"
|
// file="Vec3"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -34,7 +34,7 @@ using System.Numerics;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
[CollectionBuilder(typeof(Vec3), nameof(FromSpan))]
|
[CollectionBuilder(typeof(Vec3), nameof(FromSpan))]
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
||||||
@@ -50,14 +50,18 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
[FieldOffset(4)] public float Y;
|
[FieldOffset(4)] public float Y;
|
||||||
[FieldOffset(8)] public float Z;
|
[FieldOffset(8)] public float Z;
|
||||||
|
|
||||||
internal Vec3(M128 vector)
|
internal Vec3(
|
||||||
|
M128 vector
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
reg = vector;
|
reg = vector;
|
||||||
reg.Member<uint>(3) = 0;
|
reg.Member<uint>(3) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Vec3(Vector3 vector)
|
internal Vec3(
|
||||||
|
Vector3 vector
|
||||||
|
)
|
||||||
{
|
{
|
||||||
v = vector;
|
v = vector;
|
||||||
}
|
}
|
||||||
@@ -67,14 +71,21 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3(Vec2 xy, float z)
|
public Vec3(
|
||||||
|
Vec2 xy,
|
||||||
|
float z
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
reg = xy.reg;
|
reg = xy.reg;
|
||||||
Z = z;
|
Z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3(float x, float y, float z)
|
public Vec3(
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float z
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
v = new Vector3(x, y, z);
|
v = new Vector3(x, y, z);
|
||||||
@@ -107,28 +118,39 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
public static Vec3 UnitZ => new(0, 0, 1);
|
public static Vec3 UnitZ => new(0, 0, 1);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec3 Cross(Vec3 left, Vec3 right)
|
public static Vec3 Cross(
|
||||||
|
Vec3 left,
|
||||||
|
Vec3 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return Linear.Cross(left, right);
|
return Linear.Cross(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public readonly float Dot(Vec3 right)
|
public readonly float Dot(
|
||||||
|
Vec3 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return Vector3.Dot(v, right.v);
|
return Vector3.Dot(v, right.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly bool Equals(Vec3 other)
|
public readonly bool Equals(
|
||||||
|
Vec3 other
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return reg == other.reg;
|
return reg == other.reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override readonly bool Equals(object obj)
|
public override readonly bool Equals(
|
||||||
|
object obj
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return obj is not null && obj is Vec3 vec && this == vec;
|
return obj is not null && obj is Vec3 vec && this == vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vec3 FromSpan(ReadOnlySpan<float> span)
|
public static Vec3 FromSpan(
|
||||||
|
ReadOnlySpan<float> span
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Vec3 v = new();
|
Vec3 v = new();
|
||||||
span.CopyTo(MemoryMarshal.CreateSpan(ref v.X, 3));
|
span.CopyTo(MemoryMarshal.CreateSpan(ref v.X, 3));
|
||||||
@@ -158,7 +180,10 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsParallel(Vec3 left, Vec3 right)
|
public static bool IsParallel(
|
||||||
|
Vec3 left,
|
||||||
|
Vec3 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return Cross(left, right) == Zero;
|
return Cross(left, right) == Zero;
|
||||||
}
|
}
|
||||||
@@ -168,61 +193,88 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
return $"[{X},{Y},{Z}]";
|
return $"[{X},{Y},{Z}]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly string ToString(string sample)
|
public readonly string ToString(
|
||||||
|
string sample
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return $"[{X.ToString(sample)},{Y.ToString(sample)},{Z.ToString(sample)}]";
|
return $"[{X.ToString(sample)},{Y.ToString(sample)},{Z.ToString(sample)}]";
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec3 operator -(Vec3 vec)
|
public static Vec3 operator -(
|
||||||
|
Vec3 vec
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return new Vec3(-vec.v);
|
return new Vec3(-vec.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec3 operator -(Vec3 left, Vec3 right)
|
public static Vec3 operator -(
|
||||||
|
Vec3 left,
|
||||||
|
Vec3 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return new Vec3(left.v - right.v);
|
return new Vec3(left.v - right.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static bool operator !=(Vec3 left, Vec3 right)
|
public static bool operator !=(
|
||||||
|
Vec3 left,
|
||||||
|
Vec3 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return left.v != right.v;
|
return left.v != right.v;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec3 operator *(Vec3 vec, float value)
|
public static Vec3 operator *(
|
||||||
|
Vec3 vec,
|
||||||
|
float value
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return new Vec3(vec.v * value);
|
return new Vec3(vec.v * value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static float operator *(Vec3 left, Vec3 right)
|
public static float operator *(
|
||||||
|
Vec3 left,
|
||||||
|
Vec3 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return Vector3.Dot(left.v, right.v);
|
return Vector3.Dot(left.v, right.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec3 operator /(Vec3 vec, float value)
|
public static Vec3 operator /(
|
||||||
|
Vec3 vec,
|
||||||
|
float value
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return new Vec3(vec.v / value);
|
return new Vec3(vec.v / value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec3 operator +(Vec3 left, Vec3 right)
|
public static Vec3 operator +(
|
||||||
|
Vec3 left,
|
||||||
|
Vec3 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return new Vec3(left.v + right.v);
|
return new Vec3(left.v + right.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static bool operator ==(Vec3 left, Vec3 right)
|
public static bool operator ==(
|
||||||
|
Vec3 left,
|
||||||
|
Vec3 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return left.v == right.v;
|
return left.v == right.v;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static unsafe implicit operator Vec3((float, float, float) tuple)
|
public static unsafe implicit operator Vec3(
|
||||||
|
(float, float, float) tuple
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return Unsafe.As<(float,float,float), Vec3>(ref tuple);
|
return Unsafe.As<(float,float,float), Vec3>(ref tuple);
|
||||||
}
|
}
|
||||||
+56
-17
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Vec4"
|
// file="Vec4"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.HighPerformance;
|
using StgSharp.HighPerformance;
|
||||||
using StgSharp.Internal.Intrinsic;
|
using StgSharp.Mathematics.Internal;
|
||||||
using StgSharp.Mathematics.Numeric;
|
using StgSharp.Mathematics.Numeric;
|
||||||
using System;
|
using System;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
@@ -34,7 +34,7 @@ using System.Numerics;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
[CollectionBuilder(builderType:typeof(Vec4), methodName: nameof(Vec4.FromSpan))]
|
[CollectionBuilder(builderType:typeof(Vec4), methodName: nameof(Vec4.FromSpan))]
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
||||||
@@ -52,7 +52,9 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
[FieldOffset(4)] public float Y;
|
[FieldOffset(4)] public float Y;
|
||||||
[FieldOffset(8)] public float Z;
|
[FieldOffset(8)] public float Z;
|
||||||
|
|
||||||
internal Vec4(Vector4 v)
|
internal Vec4(
|
||||||
|
Vector4 v
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out X);
|
Unsafe.SkipInit(out X);
|
||||||
Unsafe.SkipInit(out Y);
|
Unsafe.SkipInit(out Y);
|
||||||
@@ -63,7 +65,9 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
vec = v;
|
vec = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Vec4(M128 v)
|
internal Vec4(
|
||||||
|
M128 v
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out X);
|
Unsafe.SkipInit(out X);
|
||||||
Unsafe.SkipInit(out Y);
|
Unsafe.SkipInit(out Y);
|
||||||
@@ -74,7 +78,10 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
reg = v;
|
reg = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec4(Vec3 v3, float w)
|
public Vec4(
|
||||||
|
Vec3 v3,
|
||||||
|
float w
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out X);
|
Unsafe.SkipInit(out X);
|
||||||
Unsafe.SkipInit(out Y);
|
Unsafe.SkipInit(out Y);
|
||||||
@@ -84,7 +91,12 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
W = w;
|
W = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec4(float x, float y, float z, float w)
|
public Vec4(
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float z,
|
||||||
|
float w
|
||||||
|
)
|
||||||
{
|
{
|
||||||
vec = new Vector4(x, y, z, w);
|
vec = new Vector4(x, y, z, w);
|
||||||
}
|
}
|
||||||
@@ -123,7 +135,10 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec4 Add(Vec4 left, Vec4 right)
|
public static Vec4 Add(
|
||||||
|
Vec4 left,
|
||||||
|
Vec4 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return left + right;
|
return left + right;
|
||||||
}
|
}
|
||||||
@@ -133,12 +148,16 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
return MemoryMarshal.CreateReadOnlySpan(ref reg.Member<float>(0), 4);
|
return MemoryMarshal.CreateReadOnlySpan(ref reg.Member<float>(0), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(
|
||||||
|
object obj
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return obj is Vec4 v && v == this;
|
return obj is Vec4 v && v == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vec4 FromSpan(ReadOnlySpan<float> span)
|
public static Vec4 FromSpan(
|
||||||
|
ReadOnlySpan<float> span
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (span.Length < 4) {
|
if (span.Length < 4) {
|
||||||
throw new ArgumentException("Span length must be at least 4.", nameof(span));
|
throw new ArgumentException("Span length must be at least 4.", nameof(span));
|
||||||
@@ -161,7 +180,10 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec4 Subtract(Vec4 left, Vec4 right)
|
public static Vec4 Subtract(
|
||||||
|
Vec4 left,
|
||||||
|
Vec4 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return left - right;
|
return left - right;
|
||||||
}
|
}
|
||||||
@@ -172,18 +194,27 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec4 operator -(Vec4 left, Vec4 right)
|
public static Vec4 operator -(
|
||||||
|
Vec4 left,
|
||||||
|
Vec4 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return new Vec4(left.vec - right.vec);
|
return new Vec4(left.vec - right.vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator !=(Vec4 left, Vec4 right)
|
public static bool operator !=(
|
||||||
|
Vec4 left,
|
||||||
|
Vec4 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return !(left == right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec4 operator *(Matrix44 mat, Vec4 vec)
|
public static Vec4 operator *(
|
||||||
|
Matrix44 mat,
|
||||||
|
Vec4 vec
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Matrix44 transpose = mat.Transpose;
|
Matrix44 transpose = mat.Transpose;
|
||||||
return new Vec4(Vector4.Dot(transpose.mat.colum0, vec.vec),
|
return new Vec4(Vector4.Dot(transpose.mat.colum0, vec.vec),
|
||||||
@@ -193,17 +224,25 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec4 operator +(Vec4 left, Vec4 right)
|
public static Vec4 operator +(
|
||||||
|
Vec4 left,
|
||||||
|
Vec4 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return new Vec4(left.vec + right.vec);
|
return new Vec4(left.vec + right.vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator ==(Vec4 left, Vec4 right)
|
public static bool operator ==(
|
||||||
|
Vec4 left,
|
||||||
|
Vec4 right
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return left.vec == right.vec;
|
return left.vec == right.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IEquatable<Vec4>.Equals(Vec4 other)
|
bool IEquatable<Vec4>.Equals(
|
||||||
|
Vec4 other
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return vec == other.vec;
|
return vec == other.vec;
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Vector.Cross"
|
// file="Vector.Cross"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
public static unsafe partial class Linear
|
public static unsafe partial class Linear
|
||||||
{
|
{
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Vector.GetAngle"
|
// file="Vector.GetAngle"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
public static unsafe partial class Linear
|
public static unsafe partial class Linear
|
||||||
{
|
{
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Vector.GetLength"
|
// file="Vector.GetLength"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
public static unsafe partial class Linear
|
public static unsafe partial class Linear
|
||||||
{
|
{
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Vector.Normalize"
|
// file="Vector.Normalize"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,10 +25,10 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
public static partial class Linear
|
public static partial class Linear
|
||||||
{
|
{
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Vector.Orthogonalize"
|
// file="Vector.Orthogonalize"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
@@ -25,10 +25,10 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics.Graphic;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Graphic
|
namespace StgSharp.Mathematics.Graphics
|
||||||
{
|
{
|
||||||
public static partial class Linear
|
public static partial class Linear
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Left = (nint)left.Buffer;
|
package->Left = (nint)left.Buffer;
|
||||||
package->Right = (nint)right.Buffer;
|
package->Right = (nint)right.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
@@ -112,7 +112,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
package->ElementSize = sizeof(float);
|
package->ElementSize = sizeof(float);
|
||||||
package->PrimCount = ans.KernelColumnLength;
|
package->PrimCount = ans.KernelColumnLength;
|
||||||
@@ -178,7 +178,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Left = (nint)left.Buffer;
|
package->Left = (nint)left.Buffer;
|
||||||
package->Right = (nint)right.Buffer;
|
package->Right = (nint)right.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
@@ -231,7 +231,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Right = (nint)left.Buffer;
|
package->Right = (nint)left.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
package->ElementSize = sizeof(float);
|
package->ElementSize = sizeof(float);
|
||||||
@@ -287,7 +287,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Left = (nint)left.Buffer;
|
package->Left = (nint)left.Buffer;
|
||||||
package->Right = (nint)right.Buffer;
|
package->Right = (nint)right.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Left = (nint)left.Buffer;
|
package->Left = (nint)left.Buffer;
|
||||||
package->Right = (nint)right.Buffer;
|
package->Right = (nint)right.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
@@ -108,7 +108,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
package->ElementSize = sizeof(double);
|
package->ElementSize = sizeof(double);
|
||||||
package->PrimCount = ans.KernelColumnLength;
|
package->PrimCount = ans.KernelColumnLength;
|
||||||
@@ -167,7 +167,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Left = (nint)left.Buffer;
|
package->Left = (nint)left.Buffer;
|
||||||
package->Right = (nint)right.Buffer;
|
package->Right = (nint)right.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
@@ -220,7 +220,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Right = (nint)left.Buffer;
|
package->Right = (nint)left.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
package->ElementSize = sizeof(double);
|
package->ElementSize = sizeof(double);
|
||||||
@@ -276,7 +276,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
MatrixParallel.ReturnParallelResources(ref pool);
|
MatrixParallel.ReturnParallelResources(ref pool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask();
|
MatrixParallelTask* package = MatrixParallelFactory.CreateBaseTask();
|
||||||
package->Left = (nint)left.Buffer;
|
package->Left = (nint)left.Buffer;
|
||||||
package->Right = (nint)right.Buffer;
|
package->Right = (nint)right.Buffer;
|
||||||
package->Answer = (nint)ans.Buffer;
|
package->Answer = (nint)ans.Buffer;
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// file="MatrixParallelTaskPackage"
|
|
||||||
// Project: StgSharp
|
|
||||||
// AuthorGroup: Nitload
|
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
//
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
using StgSharp.HighPerformance;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Numeric
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* #define PANEL_OP 1
|
|
||||||
* #define BUFFER_OP 2
|
|
||||||
* #define KERNEL_OP 3
|
|
||||||
*
|
|
||||||
* #define RIGHT_ANS_PARAM 1
|
|
||||||
* #define LEFT_RIGHT_ANS_PARAM 2
|
|
||||||
* #define RIGHT_ANS_SCALAR_PARAM 3
|
|
||||||
* #define LEFT_RIGHT_ANS_SCALAR_PARAM 4
|
|
||||||
* #define ANS_SCALAR_PARAM 5
|
|
||||||
*
|
|
||||||
* typedef struct matrix_op_mode {
|
|
||||||
* int16_t operation_style; // PANEL_OP, BUFFER_OP, KERNEL_OP
|
|
||||||
* int16_t parameter_style; // RIGHT_ANS_PARAM, LEFT_RIGHT_ANS_PARAM, e.g.
|
|
||||||
* }
|
|
||||||
* matrix_op_mode;
|
|
||||||
*/
|
|
||||||
|
|
||||||
public enum MatrixIndexStyle : int
|
|
||||||
{
|
|
||||||
|
|
||||||
NONE = 0,
|
|
||||||
BUFFER_INDEX = 1,
|
|
||||||
SEQ_FMA = -1,
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 128)]
|
|
||||||
public unsafe struct MatrixParallelTaskPackage
|
|
||||||
{
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static unsafe void Copy(
|
|
||||||
MatrixParallelTaskPackage* source,
|
|
||||||
MatrixParallelTaskPackage* target
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTaskPackage),
|
|
||||||
sizeof(MatrixParallelTaskPackage));
|
|
||||||
}
|
|
||||||
|
|
||||||
#region source
|
|
||||||
|
|
||||||
// Group 1: Left/Right matrix kernel base address
|
|
||||||
[FieldOffset(0)] public IntPtr Left; // 8
|
|
||||||
[FieldOffset(8)] public IntPtr Right; // 8
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ans
|
|
||||||
|
|
||||||
// Group 2: Result kernel base address + reserved
|
|
||||||
[FieldOffset(16)] public IntPtr Answer; // 8
|
|
||||||
[FieldOffset(24)] public int ElementSize;
|
|
||||||
[FieldOffset(28)] public int ReservedPtr0; // 4 (extension/reserved)
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region left enum
|
|
||||||
|
|
||||||
[FieldOffset(32)]public int LeftPrimOffset; // 4
|
|
||||||
[FieldOffset(36)]public int LeftPrimStride; // 4
|
|
||||||
[FieldOffset(40)]public int LeftSecOffset; // 4
|
|
||||||
[FieldOffset(44)]public int LeftSecStride; // 4
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region right enum
|
|
||||||
|
|
||||||
[FieldOffset(48)]public int RightPrimOffset; // 4
|
|
||||||
[FieldOffset(52)]public int RightPrimStride; // 4
|
|
||||||
[FieldOffset(56)]public int RightSecOffset; // 4
|
|
||||||
[FieldOffset(60)]public int RightSecStride; // 4
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ans enum
|
|
||||||
|
|
||||||
[FieldOffset(64)]public int AnsPrimOffset; // 4
|
|
||||||
[FieldOffset(68)]public int AnsPrimStride; // 4
|
|
||||||
[FieldOffset(72)]public int AnsSecOffset; // 4
|
|
||||||
[FieldOffset(76)] public int AnsSecStride; // 4
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region scalar/compute
|
|
||||||
|
|
||||||
[FieldOffset(80)]public ScalarPacket* Scalar; // 8
|
|
||||||
[FieldOffset(88)]public IntPtr ComputeHandle; // 8
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region global profile
|
|
||||||
|
|
||||||
[FieldOffset(96)]public int PrimCount; // 4
|
|
||||||
[FieldOffset(100)]public int SecCount; // 4
|
|
||||||
[FieldOffset(104)]public MatrixIndexStyle ComputeMode; // 4
|
|
||||||
[FieldOffset(108)]private int ReservedInt0; // 4
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region count offset
|
|
||||||
|
|
||||||
[FieldOffset(112)]public int PrimTileOffset; // 4
|
|
||||||
[FieldOffset(116)]public int SecTileOffset; // 4
|
|
||||||
[FieldOffset(120)] public int PrimColumnCountInTile; // 4
|
|
||||||
[FieldOffset(124)] public int SecColumnCountInTile; // 4
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-2
@@ -47,7 +47,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
||||||
internal static unsafe MatrixParallelWrap ScheduleTask(
|
internal static unsafe MatrixParallelWrap ScheduleTask(
|
||||||
MatrixParallelTaskPackage* package
|
MatrixParallelTask* package
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
switch (package->ComputeMode.OperationStyle)
|
switch (package->ComputeMode.OperationStyle)
|
||||||
@@ -60,7 +60,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static unsafe MatrixParallelWrap ScheduleBufferTask(
|
private static unsafe MatrixParallelWrap ScheduleBufferTask(
|
||||||
MatrixParallelTaskPackage* package
|
MatrixParallelTask* package
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int primCount = package->PrimCount;
|
int primCount = package->PrimCount;
|
||||||
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
using StgSharp.Collections;
|
using StgSharp.Collections;
|
||||||
using StgSharp.HighPerformance.Memory;
|
using StgSharp.HighPerformance.Memory;
|
||||||
using StgSharp.Internal;
|
using StgSharp.Internal;
|
||||||
using StgSharp.Internal.Intrinsic;
|
using StgSharp.Mathematics.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
+3
-3
@@ -40,16 +40,16 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static ConcurrentStack<MatrixParallelQueue> _recycle = [];
|
private static ConcurrentStack<MatrixParallelQueue> _recycle = [];
|
||||||
private MatrixParallelTaskPackage* _package;
|
private MatrixParallelTask* _package;
|
||||||
private ulong _cursor;
|
private ulong _cursor;
|
||||||
private ulong _maxCount;
|
private ulong _maxCount;
|
||||||
|
|
||||||
private MatrixParallelQueue() { }
|
private MatrixParallelQueue() { }
|
||||||
|
|
||||||
public MatrixParallelTaskPackage* Package => _package;
|
public MatrixParallelTask* Package => _package;
|
||||||
|
|
||||||
public static MatrixParallelQueue Rent(
|
public static MatrixParallelQueue Rent(
|
||||||
MatrixParallelTaskPackage* pack
|
MatrixParallelTask* pack
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!_recycle.TryPop(out MatrixParallelQueue? queue)) {
|
if (!_recycle.TryPop(out MatrixParallelQueue? queue)) {
|
||||||
+25
-29
@@ -1,6 +1,6 @@
|
|||||||
//-----------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// file="SSDraw"
|
// -----------------------------------------------------------------------
|
||||||
|
// file="MatrixParallelTask"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
@@ -25,44 +25,40 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Graphics.ShaderEdit;
|
using StgSharp.HighPerformance;
|
||||||
|
using StgSharp.Mathematics.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
namespace StgSharp.Internal.FileIO
|
namespace StgSharp.Mathematics.Numeric
|
||||||
{
|
{
|
||||||
public class SSDraw
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
|
internal unsafe struct MatrixParallelTask
|
||||||
{
|
{
|
||||||
|
|
||||||
private byte[] data;
|
[FieldOffset(0)]public MatrixKernel* Mat1; // 8
|
||||||
|
[FieldOffset(8)] public MatrixKernel* Mat2; // 8
|
||||||
|
[FieldOffset(16)] public MatrixKernel* Mat3; // 16
|
||||||
|
[FieldOffset(32)] public int Common_i;
|
||||||
|
[FieldOffset(36)] public int Common_j;
|
||||||
|
[FieldOffset(40)] public int Common_k;
|
||||||
|
[FieldOffset(44)] public int i;
|
||||||
|
[FieldOffset(48)] public int j;
|
||||||
|
[FieldOffset(52)] public int k;
|
||||||
|
[FieldOffset(56)] public MatrixElementType ElementType; // 56
|
||||||
|
[FieldOffset(24)] public nint Span; // 24
|
||||||
|
|
||||||
public SSDraw(string name, Stream streamSource)
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static void Copy(
|
||||||
|
MatrixParallelTask* source,
|
||||||
|
MatrixParallelTask* target
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if ((streamSource == null) || (streamSource.Length == 0)) {
|
Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTask),
|
||||||
throw new ArgumentNullException(nameof(streamSource));
|
sizeof(MatrixParallelTask));
|
||||||
}
|
|
||||||
Name = name;
|
|
||||||
data = new byte[streamSource.Length];
|
|
||||||
streamSource.Read(data.AsSpan());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SSDrawHead Head { get; set; }
|
|
||||||
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 32 * 16)]
|
|
||||||
public unsafe struct SSDrawHead { }
|
|
||||||
}
|
}
|
||||||
+35
-7
@@ -1,11 +1,38 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// file="MatrixParallelThread.Fma"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload
|
||||||
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
using StgSharp.HighPerformance;
|
||||||
|
using StgSharp.Internal;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using StgSharp.HighPerformance;
|
|
||||||
using StgSharp.Internal;
|
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Numeric
|
namespace StgSharp.Mathematics.Numeric
|
||||||
{
|
{
|
||||||
@@ -13,10 +40,10 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
{
|
{
|
||||||
|
|
||||||
internal static unsafe void ComputeFmaPanelF32(
|
internal static unsafe void ComputeFmaPanelF32(
|
||||||
MatrixParallelTaskPackage* p
|
MatrixParallelTask* p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int f32 = (int)MatrixElementType.F32;
|
int f32 = MatrixElementType.F32.IntrinsicNode;
|
||||||
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
|
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
|
||||||
MatrixKernel* rightBuffer = (MatrixKernel*)p->Right;
|
MatrixKernel* rightBuffer = (MatrixKernel*)p->Right;
|
||||||
MatrixKernel* ansBuffer = (MatrixKernel*)p->Answer;
|
MatrixKernel* ansBuffer = (MatrixKernel*)p->Answer;
|
||||||
@@ -43,10 +70,10 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe void ComputeFmaPanelF64(
|
internal static unsafe void ComputeFmaPanelF64(
|
||||||
MatrixParallelTaskPackage* p
|
MatrixParallelTask* p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int f64 = (int)MatrixElementType.F64;
|
int f64 = MatrixElementType.F64.IntrinsicNode;
|
||||||
|
|
||||||
// int size = 1;
|
// int size = 1;
|
||||||
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
|
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
|
||||||
@@ -73,5 +100,6 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
enumeration);
|
enumeration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -37,7 +37,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
private const int KernelStealCount = 64;
|
private const int KernelStealCount = 64;
|
||||||
|
|
||||||
internal unsafe void BufferCompute(
|
internal unsafe void BufferCompute(
|
||||||
MatrixParallelTaskPackage* p
|
MatrixParallelTask* p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// while () { }
|
// while () { }
|
||||||
@@ -55,7 +55,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal unsafe void SpecialBufferCompute(
|
internal unsafe void SpecialBufferCompute(
|
||||||
MatrixParallelTaskPackage* p
|
MatrixParallelTask* p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
switch ((MatrixElementType)p->ElementSize)
|
switch ((MatrixElementType)p->ElementSize)
|
||||||
+2
-2
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Internal;
|
using StgSharp.Internal;
|
||||||
using StgSharp.Internal.Intrinsic;
|
using StgSharp.Mathematics.Internal;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
MatrixParallelQueue taskQueue = BindedWrap.TaskQueue;
|
MatrixParallelQueue taskQueue = BindedWrap.TaskQueue;
|
||||||
MatrixParallelTaskPackage* p = taskQueue.Package;
|
MatrixParallelTask* p = taskQueue.Package;
|
||||||
if (0 > (int)p ->ComputeHandle) {
|
if (0 > (int)p ->ComputeHandle) {
|
||||||
SpecialBufferCompute(p);
|
SpecialBufferCompute(p);
|
||||||
}
|
}
|
||||||
+10
-10
@@ -55,13 +55,13 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
|
|
||||||
private static SlabAllocator<ScalarPacket> _scalarAllocator ;
|
private static SlabAllocator<ScalarPacket> _scalarAllocator ;
|
||||||
|
|
||||||
private static SlabAllocator<MatrixParallelTaskPackage> _wrapAllocator;
|
private static SlabAllocator<MatrixParallelTask> _wrapAllocator;
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static MatrixParallelTaskPackage* CreateBaseTask()
|
public static MatrixParallelTask* CreateBaseTask()
|
||||||
{
|
{
|
||||||
MatrixParallelTaskPackage* p = (MatrixParallelTaskPackage*)_wrapAllocator.Allocate();
|
MatrixParallelTask* p = (MatrixParallelTask*)_wrapAllocator.Allocate();
|
||||||
Span<byte> s = new Span<byte>((byte*)p, sizeof(MatrixParallelTaskPackage));
|
Span<byte> s = new Span<byte>((byte*)p, sizeof(MatrixParallelTask));
|
||||||
s.Fill(0);
|
s.Fill(0);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@@ -74,12 +74,12 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static unsafe MatrixParallelTaskPackage* FromExistPackage(
|
public static unsafe MatrixParallelTask* FromExistPackage(
|
||||||
MatrixParallelTaskPackage* exist
|
MatrixParallelTask* exist
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MatrixParallelTaskPackage* ptr = (MatrixParallelTaskPackage*)_wrapAllocator.Allocate();
|
MatrixParallelTask* ptr = (MatrixParallelTask*)_wrapAllocator.Allocate();
|
||||||
MatrixParallelTaskPackage.Copy(exist, ptr);
|
MatrixParallelTask.Copy(exist, ptr);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Release(
|
public static void Release(
|
||||||
MatrixParallelTaskPackage* source
|
MatrixParallelTask* source
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (source->Scalar != null) {
|
if (source->Scalar != null) {
|
||||||
@@ -110,7 +110,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
{
|
{
|
||||||
_intermediateResult = new hlsfAllocator(64 * 16 * 16);
|
_intermediateResult = new hlsfAllocator(64 * 16 * 16);
|
||||||
_scalarAllocator = SlabAllocator<ScalarPacket>.Create(64 * 1024, SlabBufferLayout.Chunked);
|
_scalarAllocator = SlabAllocator<ScalarPacket>.Create(64 * 1024, SlabBufferLayout.Chunked);
|
||||||
_wrapAllocator = SlabAllocator<MatrixParallelTaskPackage>.
|
_wrapAllocator = SlabAllocator<MatrixParallelTask>.
|
||||||
Create(128 * 1024, SlabBufferLayout.Chunked);
|
Create(128 * 1024, SlabBufferLayout.Chunked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user