daily update on 20241002 by nitload youmu, intrinsic function rebuild, syntax style arrange
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -26,7 +26,6 @@
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("BenchMark")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d082071f2d004b4566bd19a1a030cf06b112c3af")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0979123ac08c4f5e39b2f34d0d4ccd2d83b92b4e")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("BenchMark")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("BenchMark")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("BenchMark")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+924fe6eef7b6b9441b297f211c82b4684f23d002")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0979123ac08c4f5e39b2f34d0d4ccd2d83b92b4e")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("BenchMark")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("BenchMark")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/b207f16616b7bd967d647a809cc27e7174063451/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/0979123ac08c4f5e39b2f34d0d4ccd2d83b92b4e/*"}}
|
||||
@@ -1779,7 +1779,6 @@
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("OEM")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1ee4e4a42f2a6b8609a6fce1d36c8da7f4182da6")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0979123ac08c4f5e39b2f34d0d4ccd2d83b92b4e")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("OEM")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("OEM")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
@@ -115,7 +114,6 @@
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
|
||||
@@ -228,7 +228,6 @@
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
|
||||
@@ -8,21 +8,15 @@
|
||||
".NETCoreApp,Version=v6.0": {
|
||||
"StgSharpDebug/1.0.0": {
|
||||
"dependencies": {
|
||||
"BidirectionalDict": "1.2.0",
|
||||
"Microsoft.Windows.CsWin32": "0.3.49-beta"
|
||||
"Microsoft.Windows.CsWin32": "0.3.49-beta",
|
||||
"System.Collections.Concurrent": "4.3.0"
|
||||
},
|
||||
"runtime": {
|
||||
"StgSharpDebug.dll": {}
|
||||
}
|
||||
},
|
||||
"BidirectionalDict/1.2.0": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/BidirectionalDict.dll": {
|
||||
"assemblyVersion": "1.2.0.0",
|
||||
"fileVersion": "1.2.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.NETCore.Platforms/1.1.0": {},
|
||||
"Microsoft.NETCore.Targets/1.1.0": {},
|
||||
"Microsoft.Windows.CsWin32/0.3.49-beta": {
|
||||
"dependencies": {
|
||||
"Microsoft.Windows.SDK.Win32Docs": "0.1.42-alpha",
|
||||
@@ -39,8 +33,117 @@
|
||||
"Microsoft.Windows.SDK.Win32Metadata": "55.0.45-preview"
|
||||
}
|
||||
},
|
||||
"System.Collections/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Collections.Concurrent/4.3.0": {
|
||||
"dependencies": {
|
||||
"System.Collections": "4.3.0",
|
||||
"System.Diagnostics.Debug": "4.3.0",
|
||||
"System.Diagnostics.Tracing": "4.3.0",
|
||||
"System.Globalization": "4.3.0",
|
||||
"System.Reflection": "4.3.0",
|
||||
"System.Resources.ResourceManager": "4.3.0",
|
||||
"System.Runtime": "4.3.0",
|
||||
"System.Runtime.Extensions": "4.3.0",
|
||||
"System.Threading": "4.3.0",
|
||||
"System.Threading.Tasks": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Diagnostics.Debug/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Diagnostics.Tracing/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Globalization/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.IO/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0",
|
||||
"System.Text.Encoding": "4.3.0",
|
||||
"System.Threading.Tasks": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Memory/4.5.5": {},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.0.0": {}
|
||||
"System.Reflection/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.IO": "4.3.0",
|
||||
"System.Reflection.Primitives": "4.3.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Reflection.Primitives/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Resources.ResourceManager/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Globalization": "4.3.0",
|
||||
"System.Reflection": "4.3.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Runtime/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0"
|
||||
}
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.0.0": {},
|
||||
"System.Runtime.Extensions/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Text.Encoding/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Threading/4.3.0": {
|
||||
"dependencies": {
|
||||
"System.Runtime": "4.3.0",
|
||||
"System.Threading.Tasks": "4.3.0"
|
||||
}
|
||||
},
|
||||
"System.Threading.Tasks/4.3.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.NETCore.Targets": "1.1.0",
|
||||
"System.Runtime": "4.3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
@@ -49,12 +152,19 @@
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"BidirectionalDict/1.2.0": {
|
||||
"Microsoft.NETCore.Platforms/1.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-hjLTwpPTQBdseFVTVH1vf7Pbaj5ATKIM3DQN8Hup22ixyC14+r1bE4YFjtZmWfcegvJR74zYtatBTwpOHmIMNQ==",
|
||||
"path": "bidirectionaldict/1.2.0",
|
||||
"hashPath": "bidirectionaldict.1.2.0.nupkg.sha512"
|
||||
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
|
||||
"path": "microsoft.netcore.platforms/1.1.0",
|
||||
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.NETCore.Targets/1.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==",
|
||||
"path": "microsoft.netcore.targets/1.1.0",
|
||||
"hashPath": "microsoft.netcore.targets.1.1.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Windows.CsWin32/0.3.49-beta": {
|
||||
"type": "package",
|
||||
@@ -84,6 +194,48 @@
|
||||
"path": "microsoft.windows.wdk.win32metadata/0.9.9-experimental",
|
||||
"hashPath": "microsoft.windows.wdk.win32metadata.0.9.9-experimental.nupkg.sha512"
|
||||
},
|
||||
"System.Collections/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==",
|
||||
"path": "system.collections/4.3.0",
|
||||
"hashPath": "system.collections.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Concurrent/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==",
|
||||
"path": "system.collections.concurrent/4.3.0",
|
||||
"hashPath": "system.collections.concurrent.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Diagnostics.Debug/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==",
|
||||
"path": "system.diagnostics.debug/4.3.0",
|
||||
"hashPath": "system.diagnostics.debug.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Diagnostics.Tracing/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==",
|
||||
"path": "system.diagnostics.tracing/4.3.0",
|
||||
"hashPath": "system.diagnostics.tracing.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Globalization/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==",
|
||||
"path": "system.globalization/4.3.0",
|
||||
"hashPath": "system.globalization.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.IO/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==",
|
||||
"path": "system.io/4.3.0",
|
||||
"hashPath": "system.io.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Memory/4.5.5": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
@@ -91,12 +243,68 @@
|
||||
"path": "system.memory/4.5.5",
|
||||
"hashPath": "system.memory.4.5.5.nupkg.sha512"
|
||||
},
|
||||
"System.Reflection/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==",
|
||||
"path": "system.reflection/4.3.0",
|
||||
"hashPath": "system.reflection.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reflection.Primitives/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==",
|
||||
"path": "system.reflection.primitives/4.3.0",
|
||||
"hashPath": "system.reflection.primitives.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Resources.ResourceManager/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==",
|
||||
"path": "system.resources.resourcemanager/4.3.0",
|
||||
"hashPath": "system.resources.resourcemanager.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Runtime/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==",
|
||||
"path": "system.runtime/4.3.0",
|
||||
"hashPath": "system.runtime.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
|
||||
"path": "system.runtime.compilerservices.unsafe/6.0.0",
|
||||
"hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Runtime.Extensions/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==",
|
||||
"path": "system.runtime.extensions/4.3.0",
|
||||
"hashPath": "system.runtime.extensions.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Text.Encoding/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==",
|
||||
"path": "system.text.encoding/4.3.0",
|
||||
"hashPath": "system.text.encoding.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Threading/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==",
|
||||
"path": "system.threading/4.3.0",
|
||||
"hashPath": "system.threading.4.3.0.nupkg.sha512"
|
||||
},
|
||||
"System.Threading.Tasks/4.3.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==",
|
||||
"path": "system.threading.tasks/4.3.0",
|
||||
"hashPath": "system.threading.tasks.4.3.0.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,12 +45,23 @@ namespace StgSharp.Controls
|
||||
{
|
||||
|
||||
public bool IsEntity => true;
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
|
||||
public ReadOnlySpan<Vec4> TextureBox
|
||||
{
|
||||
get => throw new NotImplementedException();
|
||||
}
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
public vec2d Position { get; set; }
|
||||
|
||||
public Rectangle BoundingBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vec2 Position
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
|
||||
@@ -53,21 +53,32 @@ namespace StgSharp.Controls
|
||||
buttonList = new List<TriggerButton>();
|
||||
}
|
||||
|
||||
public bool IsEntity { get => false; }
|
||||
public bool IsEntity
|
||||
{
|
||||
get => false;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
public ReadOnlySpan<Vec4> TextureBox
|
||||
{
|
||||
get => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
public Rectangle BoundingBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public TriggerButton CurrentButton
|
||||
{
|
||||
get => current;
|
||||
}
|
||||
|
||||
public vec2d Position { get; set; }
|
||||
public Vec2 Position
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
protected List<TriggerButton> AllButton
|
||||
{
|
||||
@@ -83,8 +94,7 @@ namespace StgSharp.Controls
|
||||
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
foreach (TriggerButton item in buttonList)
|
||||
{
|
||||
foreach( TriggerButton item in buttonList ) {
|
||||
yield return item.Single();
|
||||
}
|
||||
}
|
||||
@@ -92,12 +102,10 @@ namespace StgSharp.Controls
|
||||
public void MoveDown()
|
||||
{
|
||||
TriggerButton button = current;
|
||||
while ((button.Down != null) && button.Down.IsDisabled)
|
||||
{
|
||||
while( ( button.Down != null ) && button.Down.IsDisabled ) {
|
||||
button = button.Right;
|
||||
}
|
||||
if (current == button)
|
||||
{
|
||||
if( current == button ) {
|
||||
return;
|
||||
}
|
||||
current.DeHighlight();
|
||||
@@ -108,12 +116,10 @@ namespace StgSharp.Controls
|
||||
public void MoveLeft()
|
||||
{
|
||||
TriggerButton button = current;
|
||||
while ((button.Left != null) && button.Left.IsDisabled)
|
||||
{
|
||||
while( ( button.Left != null ) && button.Left.IsDisabled ) {
|
||||
button = button.Left;
|
||||
}
|
||||
if (current == button)
|
||||
{
|
||||
if( current == button ) {
|
||||
return;
|
||||
}
|
||||
current.DeHighlight();
|
||||
@@ -124,12 +130,10 @@ namespace StgSharp.Controls
|
||||
public void MoveRight()
|
||||
{
|
||||
TriggerButton button = current;
|
||||
while ((button.Right != null) && button.Right.IsDisabled)
|
||||
{
|
||||
while( ( button.Right != null ) && button.Right.IsDisabled ) {
|
||||
button = button.Right;
|
||||
}
|
||||
if (current == button)
|
||||
{
|
||||
if( current == button ) {
|
||||
return;
|
||||
}
|
||||
current.DeHighlight();
|
||||
@@ -140,12 +144,10 @@ namespace StgSharp.Controls
|
||||
public void MoveUp()
|
||||
{
|
||||
TriggerButton button = current;
|
||||
while ((button.Up != null) && button.Up.IsDisabled)
|
||||
{
|
||||
while( ( button.Up != null ) && button.Up.IsDisabled ) {
|
||||
button = button.Right;
|
||||
}
|
||||
if (current == button)
|
||||
{
|
||||
if( current == button ) {
|
||||
return;
|
||||
}
|
||||
current.DeHighlight();
|
||||
|
||||
@@ -47,18 +47,21 @@ namespace StgSharp.Controls
|
||||
private char[] displayIndex;
|
||||
private char defaultChar;
|
||||
|
||||
Dictionary<char, PlainGeometryMesh> texIndex;
|
||||
private Dictionary<char, PlainGeometryMesh> texIndex;
|
||||
private int length;
|
||||
PlainGeometryMesh _tittleMesh;
|
||||
private PlainGeometryMesh _tittleMesh;
|
||||
|
||||
public CharacterLineIndexImage(
|
||||
int length, char defaultChar, PlainGeometryMesh tittleMesh,
|
||||
int length,
|
||||
char defaultChar,
|
||||
PlainGeometryMesh tittleMesh,
|
||||
IEnumerable<(char, PlainGeometryMesh)> indexEnumeration )
|
||||
{
|
||||
this.length = length;
|
||||
displayIndex = new char[length];
|
||||
_tittleMesh = tittleMesh;
|
||||
texIndex = indexEnumeration.ToDictionary(item => item.Item1, item => item.Item2);
|
||||
texIndex = indexEnumeration.ToDictionary(
|
||||
item => item.Item1, item => item.Item2 );
|
||||
}
|
||||
|
||||
public bool IsEntity
|
||||
@@ -66,23 +69,32 @@ namespace StgSharp.Controls
|
||||
get => true;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
public ReadOnlySpan<Vec4> TextureBox
|
||||
{
|
||||
get => throw new NotSupportedException();
|
||||
}
|
||||
public Rectangle BoundingBox { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public vec2d Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public Rectangle BoundingBox
|
||||
{
|
||||
get => throw new NotImplementedException();
|
||||
set => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Vec2 Position
|
||||
{
|
||||
get => throw new NotImplementedException();
|
||||
set => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Display( string message )
|
||||
{
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
if( string.IsNullOrEmpty( message ) ) {
|
||||
message = string.Empty;
|
||||
}
|
||||
|
||||
string result = ( message.Length >= length ) ?
|
||||
message.Substring(message.Length - displayIndex.Length) :
|
||||
message.PadLeft(length, defaultChar);
|
||||
message.Substring( message.Length - displayIndex.Length ) : message.PadLeft(
|
||||
length, defaultChar );
|
||||
|
||||
displayIndex = result.ToCharArray();
|
||||
}
|
||||
@@ -90,8 +102,7 @@ namespace StgSharp.Controls
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
yield return _tittleMesh;
|
||||
foreach (char item in displayIndex)
|
||||
{
|
||||
foreach( char item in displayIndex ) {
|
||||
yield return texIndex[ item ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,12 +42,27 @@ namespace StgSharp.Controls
|
||||
public interface ControllingItem : IEnumerable<PlainGeometryMesh>
|
||||
{
|
||||
|
||||
public abstract bool IsEntity { get; }
|
||||
public abstract bool IsEntity
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract ReadOnlySpan<vec4d> TextureBox { get; }
|
||||
public abstract Rectangle BoundingBox { get; set; }
|
||||
public abstract vec2d Position { get; set; }
|
||||
public abstract ReadOnlySpan<Vec4> TextureBox
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract Rectangle BoundingBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public abstract Vec2 Position
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
|
||||
@@ -44,20 +44,30 @@ namespace StgSharp.Controls
|
||||
|
||||
private PlainGeometryMesh renderMesh;
|
||||
|
||||
public DecorationBox(Rectangle bound, Image texture, vec2d[] texCoord)
|
||||
public DecorationBox( Rectangle bound, Image texture, Vec2[] texCoord )
|
||||
{
|
||||
renderMesh = new PlainGeometryMesh(BoundingBox, new TextureProvider(texture, texCoord));
|
||||
renderMesh = new PlainGeometryMesh(
|
||||
BoundingBox, new TextureProvider( texture, texCoord ) );
|
||||
}
|
||||
|
||||
public bool IsEntity => true;
|
||||
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
public ReadOnlySpan<Vec4> TextureBox
|
||||
{
|
||||
get => renderMesh.TextureCoord;
|
||||
}
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
|
||||
public vec2d Position { get; set; }
|
||||
public Rectangle BoundingBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vec2 Position
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace StgSharp.Controls
|
||||
|
||||
private TimeFunction _movement;
|
||||
|
||||
private vec2d _currentPosition, _movementVec;
|
||||
private Vec2 _currentPosition, _movementVec;
|
||||
|
||||
public MarkingLabel( PlainGeometryMesh marker, TimeFunction movement )
|
||||
{
|
||||
@@ -57,31 +57,40 @@ namespace StgSharp.Controls
|
||||
}
|
||||
|
||||
public bool IsEntity => true;
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
|
||||
public ReadOnlySpan<Vec4> TextureBox
|
||||
{
|
||||
get => marker.TextureCoord;
|
||||
}
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
public vec2d Position { get; set; }
|
||||
|
||||
public Rectangle BoundingBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vec2 Position
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||
{
|
||||
yield return marker;
|
||||
}
|
||||
|
||||
public void Move(vec2d movement)
|
||||
{
|
||||
if (!_movement.IsComplete)
|
||||
public void Move( Vec2 movement )
|
||||
{
|
||||
if( !_movement.IsComplete ) {
|
||||
Position = _currentPosition + ( _movement.Calculate() * _movementVec );
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveTo(vec2d target)
|
||||
public void MoveTo( Vec2 target )
|
||||
{
|
||||
Move( target - Position );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,11 +40,14 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Controls
|
||||
{
|
||||
|
||||
public delegate void RenderButtonTextureCallback(ButtonStatus status, float beginTime, in TextureProvider texture);
|
||||
public delegate void RenderButtonTextureCallback(
|
||||
ButtonStatus status,
|
||||
float beginTime,
|
||||
in TextureProvider texture );
|
||||
|
||||
public enum ButtonStatus
|
||||
{
|
||||
|
||||
Error = 0b0,
|
||||
Disable = 0b1,
|
||||
Enable = 0b10,
|
||||
@@ -58,6 +61,7 @@ namespace StgSharp.Controls
|
||||
HighlightToEnable = -( Enable | Highlight ),
|
||||
|
||||
HighlightToDisable = -( Highlight | Disable ),
|
||||
|
||||
}
|
||||
|
||||
public class TriggerButton : ControllingItem
|
||||
@@ -102,41 +106,74 @@ namespace StgSharp.Controls
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_renderButton == null)
|
||||
{
|
||||
if( _renderButton == null ) {
|
||||
_renderButton = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_renderButton += value;
|
||||
}
|
||||
}
|
||||
remove
|
||||
{
|
||||
if (_renderButton != null)
|
||||
{
|
||||
if( _renderButton != null ) {
|
||||
_renderButton -= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsHighLighted { get; internal set; }
|
||||
public bool IsHighLighted
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public bool IsDisabled { get; internal set; }
|
||||
public bool IsDisabled
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public bool IsEntity => true;
|
||||
|
||||
public ReadOnlySpan<vec4d> TextureBox
|
||||
public ReadOnlySpan<Vec4> TextureBox
|
||||
{
|
||||
get => MemoryMarshal.Cast<vec2d, vec4d>(_texture.TextureCoordinate);
|
||||
get => MemoryMarshal.Cast<Vec2, Vec4>( _texture.TextureCoordinate );
|
||||
}
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
|
||||
public TriggerButton Left { get; internal set; }
|
||||
public TriggerButton Right { get; internal set; }
|
||||
public TriggerButton Up { get; internal set; }
|
||||
public TriggerButton Down { get; internal set; }
|
||||
public vec2d Position { get; set; }
|
||||
public Rectangle BoundingBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public TriggerButton Left
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public TriggerButton Right
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public TriggerButton Up
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public TriggerButton Down
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public Vec2 Position
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
internal TextureProvider Texture
|
||||
{
|
||||
@@ -144,12 +181,15 @@ namespace StgSharp.Controls
|
||||
set => _texture = value;
|
||||
}
|
||||
|
||||
protected ButtonStatus CurrentStatus { get; set; }
|
||||
protected ButtonStatus CurrentStatus
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public void DeHighlight()
|
||||
{
|
||||
if (CurrentStatus == ButtonStatus.Highlight)
|
||||
{
|
||||
if( CurrentStatus == ButtonStatus.Highlight ) {
|
||||
CurrentStatus = ButtonStatus.HighlightToEnable;
|
||||
}
|
||||
}
|
||||
@@ -162,24 +202,19 @@ namespace StgSharp.Controls
|
||||
ButtonStatus.Highlight => ButtonStatus.HighlightToDisable,
|
||||
_ => CurrentStatus,
|
||||
};
|
||||
if (disableCallback != null)
|
||||
{
|
||||
if( disableCallback != null ) {
|
||||
disableCallback();
|
||||
}
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
if (CurrentStatus == ButtonStatus.Disable)
|
||||
{
|
||||
if( CurrentStatus == ButtonStatus.Disable ) {
|
||||
CurrentStatus = ButtonStatus.DisableToEnable;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (enableCallback != null)
|
||||
{
|
||||
if( enableCallback != null ) {
|
||||
enableCallback();
|
||||
}
|
||||
}
|
||||
@@ -192,24 +227,19 @@ namespace StgSharp.Controls
|
||||
|
||||
public void Highlight()
|
||||
{
|
||||
if (CurrentStatus == ButtonStatus.Enable)
|
||||
{
|
||||
if( CurrentStatus == ButtonStatus.Enable ) {
|
||||
CurrentStatus |= ButtonStatus.EnableToHighlight;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (confirmCallback != null)
|
||||
{
|
||||
if( confirmCallback != null ) {
|
||||
confirmCallback();
|
||||
}
|
||||
}
|
||||
|
||||
internal void Init( ButtonStatus status )
|
||||
{
|
||||
if (CurrentStatus == ButtonStatus.Error)
|
||||
{
|
||||
if( CurrentStatus == ButtonStatus.Error ) {
|
||||
CurrentStatus = status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,31 +40,55 @@ namespace StgSharp
|
||||
{
|
||||
internal static partial class InternalIO
|
||||
{
|
||||
|
||||
#region ssgc api define
|
||||
|
||||
[DllImport(SSC_libName, EntryPoint = "initGL",
|
||||
[DllImport(
|
||||
SSC_libName,
|
||||
EntryPoint = "initGL",
|
||||
CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern void InternalInitGL(int majorVersion, int minorVersion);
|
||||
internal static extern void InternalInitGL(
|
||||
int majorVersion,
|
||||
int minorVersion );
|
||||
|
||||
[DllImport(SSC_libName, EntryPoint = "loadGlfuncDefault",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[DllImport(
|
||||
SSC_libName,
|
||||
EntryPoint = "loadGlfuncDefault",
|
||||
CallingConvention = CallingConvention.Cdecl,
|
||||
CharSet = CharSet.Ansi )]
|
||||
internal static extern IntPtr InternalLoadGlfuncDefault( string name );
|
||||
|
||||
[DllImport(SSC_libName, EntryPoint = "linkShaderProgram",
|
||||
[DllImport(
|
||||
SSC_libName,
|
||||
EntryPoint = "linkShaderProgram",
|
||||
CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern unsafe uint InternalLinkShaderProgram(OpenglContext* context, uint shaderProgram);
|
||||
internal static extern unsafe uint InternalLinkShaderProgram(
|
||||
OpenglContext* context,
|
||||
uint shaderProgram );
|
||||
|
||||
[DllImport(SSC_libName, EntryPoint = "readLog",
|
||||
[DllImport(
|
||||
SSC_libName,
|
||||
EntryPoint = "readLog",
|
||||
CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern unsafe IntPtr InternalReadSSCLog();
|
||||
|
||||
[DllImport(SSC_libName, EntryPoint = "loadImageData",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern unsafe void InternalLoadImage(string fileName, ImageInfo* output, ImageLoader loader);
|
||||
[DllImport(
|
||||
SSC_libName,
|
||||
EntryPoint = "loadImageData",
|
||||
CallingConvention = CallingConvention.Cdecl,
|
||||
CharSet = CharSet.Ansi )]
|
||||
internal static extern unsafe void InternalLoadImage(
|
||||
string fileName,
|
||||
ImageInfo* output,
|
||||
ImageLoader loader );
|
||||
|
||||
[DllImport(SSC_libName, EntryPoint = "unloadImageData",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern unsafe void InternalUnloadImage(ImageInfo* output);
|
||||
[DllImport(
|
||||
SSC_libName,
|
||||
EntryPoint = "unloadImageData",
|
||||
CallingConvention = CallingConvention.Cdecl,
|
||||
CharSet = CharSet.Ansi )]
|
||||
internal static extern unsafe void InternalUnloadImage(
|
||||
ImageInfo* output );
|
||||
|
||||
#endregion ssgc api define
|
||||
}
|
||||
@@ -73,7 +97,12 @@ namespace StgSharp
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
[UnmanagedFunctionPointer( CallingConvention.Cdecl, CharSet = CharSet.Ansi )]
|
||||
public delegate IntPtr ImageLoader(string name, ref int width, ref int height, ref int definedChannel, int desiredChannel);
|
||||
public delegate IntPtr ImageLoader(
|
||||
string name,
|
||||
ref int width,
|
||||
ref int height,
|
||||
ref int definedChannel,
|
||||
int desiredChannel );
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public struct OpenglContext
|
||||
@@ -86,18 +115,21 @@ namespace StgSharp.Graphics
|
||||
|
||||
public override unsafe int GetHashCode()
|
||||
{
|
||||
fixed (OpenglContext* sptr = &this)
|
||||
{
|
||||
fixed( OpenglContext* sptr = &this ) {
|
||||
return sptr->GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator !=(OpenglContext left, OpenglContext right)
|
||||
public static bool operator !=(
|
||||
OpenglContext left,
|
||||
OpenglContext right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
public static bool operator ==(OpenglContext left, OpenglContext right)
|
||||
public static bool operator ==(
|
||||
OpenglContext left,
|
||||
OpenglContext right )
|
||||
{
|
||||
return left.Equals( right );
|
||||
}
|
||||
@@ -2103,7 +2135,7 @@ namespace StgSharp.Graphics
|
||||
internal unsafe delegate*<int, uint, double*, void> glUniform1dv;
|
||||
internal unsafe delegate*<int, float, void> glUniform1f;
|
||||
internal unsafe delegate*<int, float, void> glUniform1fARB;
|
||||
internal unsafe delegate*<int, uint, vec4d*, void> glUniform1fv;
|
||||
internal unsafe delegate*<int, uint, Vec4*, void> glUniform1fv;
|
||||
internal unsafe delegate*<int, uint, float*, void> glUniform1fvARB;
|
||||
internal unsafe delegate*<int, int, void> glUniform1i;
|
||||
internal unsafe delegate*<int, long, void> glUniform1i64ARB;
|
||||
@@ -2638,7 +2670,5 @@ namespace StgSharp.Graphics
|
||||
internal unsafe delegate*<uint, uint, uint, uint, uint, uint, void> glWriteMaskEXT;
|
||||
|
||||
#endregion glapi
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,12 +28,14 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Data.Intrinsic;
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -47,11 +49,13 @@ namespace StgSharp
|
||||
{
|
||||
public enum LogType
|
||||
{
|
||||
|
||||
Error,
|
||||
Warning,
|
||||
Info,
|
||||
InfoError,
|
||||
InfoWarning,
|
||||
|
||||
}
|
||||
|
||||
internal static unsafe partial class InternalIO
|
||||
@@ -71,7 +75,8 @@ namespace StgSharp
|
||||
|
||||
internal static IntPtr SSClibPtr = IntPtr.Zero;
|
||||
|
||||
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1);
|
||||
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(
|
||||
1, 1 );
|
||||
|
||||
static InternalIO()
|
||||
{
|
||||
@@ -82,27 +87,29 @@ namespace StgSharp
|
||||
GLtype.Add( TypeCode.UInt16, GLconst.UNSIGNED_SHORT );
|
||||
GLtype.Add( TypeCode.SByte, GLconst.BYTE );
|
||||
GLtype.Add( TypeCode.Byte, GLconst.UNSIGNED_BYTE );
|
||||
|
||||
fixed( IntrinsicContext* cptr = &_intrinsicContext ) {
|
||||
LoadIntrinsicFunction( cptr );
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalAppendLog( string log )
|
||||
{
|
||||
if (!File.Exists(SS_errorLog))
|
||||
{
|
||||
if( !File.Exists( SS_errorLog ) ) {
|
||||
FileStream stream = File.Create( SS_errorLog );
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorLog))
|
||||
{
|
||||
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
|
||||
logStream.WriteLine( log );
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete( "Not completed", true )]
|
||||
internal static IntPtr InternalLoadProc<T>(IntPtr lib, string name) where T : Delegate
|
||||
{
|
||||
try
|
||||
internal static IntPtr InternalLoadProc<T>( IntPtr lib, string name )
|
||||
where T: Delegate
|
||||
{
|
||||
try {
|
||||
IntPtr procPtr =
|
||||
#if WINDOWS
|
||||
IntPtr.Zero;
|
||||
@@ -113,8 +120,7 @@ namespace StgSharp
|
||||
#endif
|
||||
return procPtr;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
catch( Exception ) {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -122,33 +128,34 @@ namespace StgSharp
|
||||
internal static void InternalWriteLog( string logLine, LogType logType )
|
||||
{
|
||||
logSyncSemaphore.Wait();
|
||||
if (!File.Exists(SS_errorLog))
|
||||
{
|
||||
if( !File.Exists( SS_errorLog ) ) {
|
||||
FileStream stream = File.Create( SS_errorLog );
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorLog))
|
||||
{
|
||||
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
|
||||
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
|
||||
logStream.WriteLine(
|
||||
$"{logType}\t{DateTime.Now.ToString("o")}" );
|
||||
logStream.WriteLine( logLine );
|
||||
}
|
||||
logSyncSemaphore.Release();
|
||||
}
|
||||
|
||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||
internal static void InternalWriteLog(
|
||||
string beforeTime,
|
||||
string logLine,
|
||||
LogType logType )
|
||||
{
|
||||
logSyncSemaphore.Wait();
|
||||
if (!File.Exists(InternalIO.SS_errorLog))
|
||||
{
|
||||
if( !File.Exists( InternalIO.SS_errorLog ) ) {
|
||||
FileStream stream = File.Create( InternalIO.SS_errorLog );
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorLog))
|
||||
{
|
||||
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
|
||||
logStream.WriteLine( beforeTime );
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
logStream.WriteLine(
|
||||
$"{logType}\t@\t{DateTime.Now.ToString("o")}" );
|
||||
logStream.WriteLine( logLine );
|
||||
}
|
||||
logSyncSemaphore.Release( 1 );
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="KeyEnum.cs"
|
||||
// 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 StgSharp.Graphics;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public enum KeyboardKey : int
|
||||
{
|
||||
|
||||
UNKNOWN = -1,
|
||||
None = 0,
|
||||
Space = 32,
|
||||
Apostrophe = 39/*'*/,
|
||||
Comma = 44/*,*/,
|
||||
Minus = 45/*-*/,
|
||||
Period = 46/*.*/,
|
||||
Slash = 47/*/*/,
|
||||
Zero = 48,
|
||||
One = 49,
|
||||
Two = 50,
|
||||
Three = 51,
|
||||
Four = 52,
|
||||
Five = 53,
|
||||
Six = 54,
|
||||
Seven = 55,
|
||||
Eight = 56,
|
||||
Nine = 57,
|
||||
Semicolon = 59/*,*/,
|
||||
Equal = 61/*=*/,
|
||||
A = 65,
|
||||
B = 66,
|
||||
C = 67,
|
||||
D = 68,
|
||||
E = 69,
|
||||
F = 70,
|
||||
G = 71,
|
||||
H = 72,
|
||||
I = 73,
|
||||
J = 74,
|
||||
K = 75,
|
||||
L = 76,
|
||||
M = 77,
|
||||
N = 78,
|
||||
O = 79,
|
||||
P = 80,
|
||||
Q = 81,
|
||||
R = 82,
|
||||
S = 83,
|
||||
T = 84,
|
||||
U = 85,
|
||||
V = 86,
|
||||
W = 87,
|
||||
X = 88,
|
||||
Y = 89,
|
||||
Z = 90,
|
||||
LeftBracket = 91/*[*/,
|
||||
BACKSLASH = 92/*\*/,
|
||||
RightBracket = 93/*]*/,
|
||||
GraveAccent = 96/*`*/,
|
||||
World1 = 161/*non-US#1*/,
|
||||
World2 = 162/*non-US#2*/,
|
||||
Esc = 256,
|
||||
Enter = 257,
|
||||
Tab = 258,
|
||||
Backspace = 259,
|
||||
Insert = 260,
|
||||
Delete = 261,
|
||||
Right = 262,
|
||||
Left = 263,
|
||||
Down = 264,
|
||||
Up = 265,
|
||||
PgUp = 266,
|
||||
PgDown = 267,
|
||||
Home = 268,
|
||||
End = 269,
|
||||
CapsLock = 280,
|
||||
ScrollLock = 281,
|
||||
NumLock = 282,
|
||||
PrintScreen = 283,
|
||||
Pause = 284,
|
||||
F1 = 290,
|
||||
F2 = 291,
|
||||
F3 = 292,
|
||||
F4 = 293,
|
||||
F5 = 294,
|
||||
F6 = 295,
|
||||
F7 = 296,
|
||||
F8 = 297,
|
||||
F9 = 298,
|
||||
F10 = 299,
|
||||
F11 = 300,
|
||||
F12 = 301,
|
||||
F13 = 302,
|
||||
F14 = 303,
|
||||
F15 = 304,
|
||||
F16 = 305,
|
||||
F17 = 306,
|
||||
F18 = 307,
|
||||
F19 = 308,
|
||||
F20 = 309,
|
||||
F21 = 310,
|
||||
F22 = 311,
|
||||
F23 = 312,
|
||||
F24 = 313,
|
||||
F25 = 314,
|
||||
NumPad0 = 320,
|
||||
NumPad1 = 321,
|
||||
NumPad2 = 322,
|
||||
NumPad3 = 323,
|
||||
NumPad4 = 324,
|
||||
NumPad5 = 325,
|
||||
NumPad6 = 326,
|
||||
NumPad7 = 327,
|
||||
NumPad8 = 328,
|
||||
NumPad9 = 329,
|
||||
NumPadDec = 330,
|
||||
NumPadDiv = 331,
|
||||
NumPadMul = 332,
|
||||
NumPadSub = 333,
|
||||
NumPadAdd = 334,
|
||||
NumPadAnter = 335,
|
||||
NumPadEqual = 336,
|
||||
LeftShift = 340,
|
||||
LeftControl = 341,
|
||||
LeftAlt = 342,
|
||||
LeftSuper = 343,
|
||||
RightShift = 344,
|
||||
RightControl = 345,
|
||||
RightAlt = 346,
|
||||
RightSuper = 347,
|
||||
Menu = 348,
|
||||
First = Space,
|
||||
Last = Menu,
|
||||
|
||||
}
|
||||
|
||||
#pragma warning disable CA1707
|
||||
#pragma warning disable CA1712
|
||||
#pragma warning disable CA1008
|
||||
#pragma warning disable CA1027
|
||||
public enum Joystick : int
|
||||
#pragma warning restore CA1027
|
||||
{
|
||||
|
||||
Joystick_1 = GLconst.GLFW_JOYSTICK_1,
|
||||
Joystick_2 = GLconst.GLFW_JOYSTICK_2,
|
||||
Joystick_3 = GLconst.GLFW_JOYSTICK_3,
|
||||
Joystick_4 = GLconst.GLFW_JOYSTICK_4,
|
||||
Joystick_5 = GLconst.GLFW_JOYSTICK_5,
|
||||
Joystick_6 = GLconst.GLFW_JOYSTICK_6,
|
||||
Joystick_7 = GLconst.GLFW_JOYSTICK_7,
|
||||
Joystick_8 = GLconst.GLFW_JOYSTICK_8,
|
||||
Joystick_9 = GLconst.GLFW_JOYSTICK_9,
|
||||
Joystick_10 = GLconst.GLFW_JOYSTICK_10,
|
||||
Joystick_11 = GLconst.GLFW_JOYSTICK_11,
|
||||
Joystick_12 = GLconst.GLFW_JOYSTICK_12,
|
||||
Joystick_13 = GLconst.GLFW_JOYSTICK_13,
|
||||
Joystick_14 = GLconst.GLFW_JOYSTICK_14,
|
||||
Joystick_15 = GLconst.GLFW_JOYSTICK_15,
|
||||
Joystick_16 = GLconst.GLFW_JOYSTICK_16,
|
||||
First = Joystick_1,
|
||||
Last = Joystick_16
|
||||
|
||||
}
|
||||
|
||||
[System.Flags]
|
||||
public enum Mouse : int
|
||||
{
|
||||
|
||||
Button1 = 0,
|
||||
Button2 = 1,
|
||||
Button3 = 2,
|
||||
Button4 = 3,
|
||||
Button5 = 4,
|
||||
Button6 = 5,
|
||||
Button7 = 6,
|
||||
Button8 = 7,
|
||||
First = Button1,
|
||||
Last = Button8,
|
||||
Left = Button1,
|
||||
Right = Button2,
|
||||
Middle = Button3
|
||||
|
||||
}
|
||||
|
||||
#pragma warning restore CA1707
|
||||
#pragma warning restore CA1712
|
||||
#pragma warning restore CA7008
|
||||
|
||||
internal enum InputEquipment
|
||||
{
|
||||
|
||||
Keyboard,
|
||||
Mouse,
|
||||
Joystick
|
||||
|
||||
}
|
||||
|
||||
public enum KeyStatus : int
|
||||
{
|
||||
|
||||
RELEASE = 0,
|
||||
PRESS = 1
|
||||
|
||||
}
|
||||
}
|
||||
@@ -66,5 +66,4 @@ namespace StgSharp
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IClickTrigger.cs"
|
||||
// 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.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Controlling.UsrActivity
|
||||
{
|
||||
public interface IClickTrigger
|
||||
{
|
||||
|
||||
public int TargetKeyOrButtonID
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public KeyStatus TriggeredStatus
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -34,20 +34,26 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Controlling.UsrActivity
|
||||
{
|
||||
public struct JoystickTrigger : ITrigger, IEquatable<JoystickTrigger>
|
||||
public readonly struct JoystickTrigger : IClickTrigger, IEquatable<JoystickTrigger>
|
||||
{
|
||||
|
||||
private KeyStatus _triggeredStat;
|
||||
public Joystick Stick;
|
||||
private readonly Joystick _stick;
|
||||
private readonly KeyStatus _status;
|
||||
|
||||
public JoystickTrigger(Joystick targetKey)
|
||||
public JoystickTrigger( Joystick targetKey, KeyStatus status )
|
||||
{
|
||||
this.Stick = targetKey;
|
||||
this._stick = targetKey;
|
||||
_status = status;
|
||||
}
|
||||
|
||||
public int TargetKeyOrButtonID => (int)Stick;
|
||||
public int TargetKeyOrButtonID => ( int )_stick;
|
||||
|
||||
public KeyStatus TriggeredStatus => _triggeredStat;
|
||||
public Joystick Stick
|
||||
{
|
||||
get => _stick;
|
||||
}
|
||||
|
||||
public KeyStatus TriggeredStatus => _status;
|
||||
|
||||
public override bool Equals( object obj )
|
||||
{
|
||||
@@ -56,22 +62,26 @@ namespace StgSharp.Controlling.UsrActivity
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return ((int)Stick) + (17 * ((int)_triggeredStat));
|
||||
return ( ( int )_stick ) + ( 17 * ( ( int )_status ) );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Key {Stick} triggered when {_triggeredStat}";
|
||||
return $"Key {_stick} triggered when {_status}";
|
||||
}
|
||||
|
||||
public static bool operator !=(JoystickTrigger left, JoystickTrigger right)
|
||||
public static bool operator !=(
|
||||
JoystickTrigger left,
|
||||
JoystickTrigger right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
public static bool operator ==(JoystickTrigger left, JoystickTrigger right)
|
||||
public static bool operator ==(
|
||||
JoystickTrigger left,
|
||||
JoystickTrigger right )
|
||||
{
|
||||
return (left._triggeredStat == right._triggeredStat) && (left.Stick == right.Stick);
|
||||
return ( left._status == right._status ) && ( left._stick == right._stick );
|
||||
}
|
||||
|
||||
bool IEquatable<JoystickTrigger>.Equals( JoystickTrigger other )
|
||||
|
||||
@@ -35,12 +35,11 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Controlling.UsrActivity
|
||||
{
|
||||
|
||||
public struct KeyTrigger : ITrigger, IEquatable<KeyTrigger>
|
||||
public readonly struct KeyTrigger : IClickTrigger, IEquatable<KeyTrigger>
|
||||
{
|
||||
|
||||
private KeyboardKey _targetKey;
|
||||
private KeyStatus _triggerStat;
|
||||
private readonly KeyboardKey _targetKey;
|
||||
private readonly KeyStatus _triggerStat;
|
||||
|
||||
public KeyTrigger( KeyboardKey targetKey, KeyStatus targetStat )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="MouseTrigger.cs"
|
||||
// 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 StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.SymbolStore;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Controlling.UsrActivity
|
||||
{
|
||||
public readonly struct MouseTrigger : IClickTrigger, IEquatable<MouseTrigger>
|
||||
{
|
||||
|
||||
private readonly KeyStatus _status;
|
||||
private readonly Mouse _mouse;
|
||||
|
||||
public MouseTrigger( Mouse mouse, KeyStatus status )
|
||||
{
|
||||
_mouse = mouse;
|
||||
_status = status;
|
||||
}
|
||||
|
||||
public int TargetKeyOrButtonID => ( int )_mouse;
|
||||
|
||||
public KeyStatus TriggeredStatus => _status;
|
||||
|
||||
public bool Equals( MouseTrigger other )
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
public static bool operator !=( MouseTrigger left, MouseTrigger right )
|
||||
{
|
||||
return left._mouse != right._mouse || left._status != right._status;
|
||||
}
|
||||
|
||||
public static bool operator ==( MouseTrigger left, MouseTrigger right )
|
||||
{
|
||||
return left._mouse == right._mouse && left._status == right._status;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="TriggetFactory.cs"
|
||||
// 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 StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Controlling.UsrActivity
|
||||
{
|
||||
public static class TriggetBuilder
|
||||
{
|
||||
|
||||
private const int JoystickMax = ( int )Joystick.Last + 1;
|
||||
private const int JoystickMin = ( int )Joystick.First - 1;
|
||||
private const int KeyboardMax = ( int )KeyboardKey.Last + 1;
|
||||
private const int KeyboardMin = ( int )KeyboardKey.First - 1;
|
||||
private const int MouseMax = ( int )Mouse.Last + 1;
|
||||
private const int MouseMin = ( int )Mouse.First - 1;
|
||||
|
||||
private static KeyTrigger keyboardtemp;
|
||||
private static MouseTrigger mousetemp;
|
||||
|
||||
public static JoystickTrigger BuildJoystickClickTrigger(
|
||||
int keyCode,
|
||||
KeyStatus status )
|
||||
{
|
||||
if( keyCode > MouseMin && keyCode < MouseMax ) {
|
||||
return new JoystickTrigger( ( Joystick )keyCode, status );
|
||||
}
|
||||
throw new InvalidOperationException(
|
||||
"Known key code or key is not on joystick." );
|
||||
}
|
||||
|
||||
public static KeyTrigger BuildKeyboardClickTrigger(
|
||||
int keyCode,
|
||||
KeyStatus status )
|
||||
{
|
||||
if( keyCode > KeyboardMin && keyCode < KeyboardMax ) {
|
||||
return new KeyTrigger( ( KeyboardKey )keyCode, status );
|
||||
}
|
||||
throw new InvalidOperationException(
|
||||
"Known key code or kay is not on keyboard." );
|
||||
}
|
||||
|
||||
public static MouseTrigger BuildMouseClickTrigger(
|
||||
int keyCode,
|
||||
KeyStatus status )
|
||||
{
|
||||
if( keyCode >= MouseMin && keyCode <= MouseMax ) {
|
||||
return new MouseTrigger( ( Mouse )keyCode, status );
|
||||
}
|
||||
throw new InvalidOperationException(
|
||||
"Known key code or key is not on mouse." );
|
||||
}
|
||||
|
||||
public static IClickTrigger BuildTrigger(
|
||||
int keyCode,
|
||||
KeyStatus status )
|
||||
{
|
||||
if( keyCode > KeyboardMin && keyCode < KeyboardMax ) {
|
||||
return new KeyTrigger( ( KeyboardKey )keyCode, status );
|
||||
}
|
||||
if( keyCode > JoystickMin && keyCode < JoystickMax ) {
|
||||
return new JoystickTrigger( ( Joystick )keyCode, status );
|
||||
}
|
||||
if( keyCode >= MouseMin && keyCode <= MouseMax ) {
|
||||
return new MouseTrigger( ( Mouse )keyCode, status );
|
||||
}
|
||||
throw new InvalidOperationException( "Known key code." );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,5 @@ namespace StgSharp
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}//------------------ end of class ---------------------
|
||||
}
|
||||
|
||||
@@ -97,7 +97,5 @@ namespace StgSharp
|
||||
""";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ColumnSet2.cs"
|
||||
// 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 StgSharp.Data.Intrinsic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Data.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Explicit, Size = 12 * sizeof( float ), Pack = 16 )]
|
||||
internal struct ColumnSet2 : IEquatable<ColumnSet2>
|
||||
{
|
||||
|
||||
[FieldOffset( 0 * sizeof( float ) )] internal float m00;
|
||||
[FieldOffset( 4 * sizeof( float ) )] internal float m01;
|
||||
[FieldOffset( 1 * sizeof( float ) )] internal float m10;
|
||||
[FieldOffset( 5 * sizeof( float ) )] internal float m11;
|
||||
[FieldOffset( 2 * sizeof( float ) )] internal float m20;
|
||||
[FieldOffset( 6 * sizeof( float ) )] internal float m21;
|
||||
[FieldOffset( 3 * sizeof( float ) )] internal float m30;
|
||||
[FieldOffset( 7 * sizeof( float ) )] internal float m31;
|
||||
|
||||
[FieldOffset( 0 )] internal Vector4 colum0;
|
||||
[FieldOffset( 4 * sizeof( float ) )] internal Vector4 colum1;
|
||||
|
||||
internal ColumnSet2( Vector4 c0, Vector4 c1 )
|
||||
{
|
||||
colum0 = c0;
|
||||
colum1 = c1;
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public override bool Equals( object? obj )
|
||||
{
|
||||
return ( obj is ColumnSet2 mat ) && Equals( mat );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public bool Equals( ColumnSet2 other )
|
||||
{
|
||||
return colum0.Equals( other.colum0 ) && colum1.Equals(
|
||||
other.colum1 );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator !=( ColumnSet2 left, ColumnSet2 right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator ==( ColumnSet2 left, ColumnSet2 right )
|
||||
{
|
||||
return left.Equals( right );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ColumnSet3.cs"
|
||||
// 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 StgSharp.Data.Intrinsic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Data.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Explicit, Size = 12 * sizeof( float ), Pack = 16 )]
|
||||
internal struct ColumnSet3 : IEquatable<ColumnSet3>, IMat
|
||||
{
|
||||
|
||||
[FieldOffset( 0 * sizeof( float ) )] internal float m00;
|
||||
[FieldOffset( 4 * sizeof( float ) )] internal float m01;
|
||||
[FieldOffset( 8 * sizeof( float ) )] internal float m02;
|
||||
[FieldOffset( 1 * sizeof( float ) )] internal float m10;
|
||||
[FieldOffset( 5 * sizeof( float ) )] internal float m11;
|
||||
[FieldOffset( 9 * sizeof( float ) )] internal float m12;
|
||||
[FieldOffset( 2 * sizeof( float ) )] internal float m20;
|
||||
[FieldOffset( 6 * sizeof( float ) )] internal float m21;
|
||||
[FieldOffset( 10 * sizeof( float ) )] internal float m22;
|
||||
[FieldOffset( 3 * sizeof( float ) )] internal float m30;
|
||||
[FieldOffset( 7 * sizeof( float ) )] internal float m31;
|
||||
[FieldOffset( 11 * sizeof( float ) )] internal float m32;
|
||||
|
||||
[FieldOffset( 0 )] internal Vector4 colum0;
|
||||
[FieldOffset( 4 * sizeof( float ) )] internal Vector4 colum1;
|
||||
[FieldOffset( 8 * sizeof( float ) )] internal Vector4 colum2;
|
||||
|
||||
public override bool Equals( object? obj )
|
||||
{
|
||||
return ( obj is ColumnSet3 mat ) && Equals( mat );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public bool Equals( ColumnSet3 other )
|
||||
{
|
||||
return colum0.Equals( other.colum0 ) && colum1.Equals(
|
||||
other.colum1 ) && colum2.Equals( other.colum2 );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator !=( ColumnSet3 left, ColumnSet3 right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator ==( ColumnSet3 left, ColumnSet3 right )
|
||||
{
|
||||
return left.Equals( right );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ColumnSet4.cs"
|
||||
// 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 StgSharp;
|
||||
using StgSharp.Data.Intrinsic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Data.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Explicit, Size = 16 * sizeof( float ) )]
|
||||
internal struct ColumnSet4 : IEquatable<ColumnSet4>, IMat
|
||||
{
|
||||
|
||||
[FieldOffset( 0 )] internal Vector4 colum0;
|
||||
[FieldOffset( 16 )] internal Vector4 colum1;
|
||||
[FieldOffset( 32 )] internal Vector4 colum2;
|
||||
[FieldOffset( 48 )] internal Vector4 colum3;
|
||||
|
||||
[FieldOffset( 0 )] public float m00;
|
||||
|
||||
[FieldOffset( 16 )] public float m01;
|
||||
|
||||
[FieldOffset( 32 )] public float m02;
|
||||
|
||||
[FieldOffset( 48 )] public float m03;
|
||||
[FieldOffset( 4 )] public float m10;
|
||||
[FieldOffset( 20 )] public float m11;
|
||||
[FieldOffset( 36 )] public float m12;
|
||||
[FieldOffset( 52 )] public float m13;
|
||||
[FieldOffset( 8 )] public float m20;
|
||||
[FieldOffset( 24 )] public float m21;
|
||||
[FieldOffset( 40 )] public float m22;
|
||||
[FieldOffset( 56 )] public float m23;
|
||||
[FieldOffset( 12 )] public float m30;
|
||||
[FieldOffset( 28 )] public float m31;
|
||||
[FieldOffset( 44 )] public float m32;
|
||||
[FieldOffset( 60 )] public float m33;
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
internal ColumnSet4(
|
||||
Vector4 colum0,
|
||||
Vector4 colum1,
|
||||
Vector4 colum2,
|
||||
Vector4 colum3 )
|
||||
{
|
||||
this.colum0 = colum0;
|
||||
this.colum1 = colum1;
|
||||
this.colum2 = colum2;
|
||||
this.colum3 = colum3;
|
||||
}
|
||||
|
||||
public override bool Equals( object? obj )
|
||||
{
|
||||
return ( obj is ColumnSet4 mat ) && Equals( mat );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public bool Equals( ColumnSet4 other )
|
||||
{
|
||||
return colum0.Equals( other.colum0 ) && colum1.Equals(
|
||||
other.colum1 ) && colum2.Equals( other.colum2 ) && colum3.Equals(
|
||||
other.colum3 );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator !=( ColumnSet4 left, ColumnSet4 right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator ==( ColumnSet4 left, ColumnSet4 right )
|
||||
{
|
||||
return left.Equals( right );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IRegisterType.cs"
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Data.Intrinsic
|
||||
{
|
||||
public interface IRegisterType
|
||||
{
|
||||
|
||||
public T Read<T>( int index )
|
||||
where T: struct
|
||||
#if NET8_0_OR_GREATER
|
||||
, INumber
|
||||
#else
|
||||
, IConvertible
|
||||
#endif
|
||||
;
|
||||
|
||||
public void Write<T>( int index, T value )
|
||||
where T: struct
|
||||
#if NET8_0_OR_GREATER
|
||||
, INumber
|
||||
#else
|
||||
, IConvertible
|
||||
#endif
|
||||
;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IntrinsicContext.cs"
|
||||
// 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 StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Data.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct IntrinsicContext
|
||||
{
|
||||
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet3*, void> transpose23;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet4*, void> transpose24;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet2*, void> transpose32;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, void> transpose33;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet4*, void> transpose34;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet2*, void> transpose42;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet3*, void> transpose43;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, void> transpose44;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, float> det_mat_3;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, float> det_mat_4;
|
||||
public delegate* unmanaged[Cdecl]<M128*, M128*, void> normalize_v3;
|
||||
public delegate* unmanaged[Cdecl]<char*, int, int> string_quickHash;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="M128.cs"
|
||||
// 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 StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if NET5_0_OR_GREATER
|
||||
using System.Runtime.Intrinsics;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Data.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Explicit, Pack = 16 )]
|
||||
public unsafe struct M128 : IRegisterType
|
||||
{
|
||||
|
||||
[FieldOffset( 0 )] internal Vector4 vec;
|
||||
|
||||
internal M128( Vector4 v )
|
||||
{
|
||||
vec = v;
|
||||
}
|
||||
|
||||
public override bool Equals( [NotNullWhen( true )] object obj )
|
||||
{
|
||||
if( obj is not M128 other ) {
|
||||
return false;
|
||||
}
|
||||
return this == other;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return vec.GetHashCode();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public T Read<T>( int index )
|
||||
where T: struct
|
||||
#if NET8_0_OR_GREATER
|
||||
, INumber
|
||||
#else
|
||||
, IConvertible
|
||||
#endif
|
||||
|
||||
{
|
||||
fixed( Vector4* p = &vec ) {
|
||||
#pragma warning disable CS8500
|
||||
return *( ( T* )p + index );
|
||||
#pragma warning restore CS8500
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string ToString( int sample )
|
||||
{
|
||||
string str = string.Empty;
|
||||
for( int i = 15; i >= 0; i-- ) {
|
||||
str += $"{Convert.ToString(Read<byte>(i), sample)} ";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public void Write<T>( int index, T value )
|
||||
where T: struct
|
||||
#if NET8_0_OR_GREATER
|
||||
, INumber
|
||||
#else
|
||||
, IConvertible
|
||||
#endif
|
||||
{
|
||||
fixed( Vector4* p = &vec ) {
|
||||
#pragma warning disable CS8500
|
||||
*( ( T* )p + index ) = value;
|
||||
#pragma warning restore CS8500
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator !=( M128 left, M128 right )
|
||||
{
|
||||
return left.vec != right.vec;
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator ==( M128 left, M128 right )
|
||||
{
|
||||
return left.vec == right.vec;
|
||||
}
|
||||
|
||||
#if NET5_0_OR_GREATER
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<byte>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, byte>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<sbyte>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, sbyte>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<short>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, short>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<ushort>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, ushort>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<int>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, int>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<uint>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, uint>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<long>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, long>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<ulong>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, ulong>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<float>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, float>();
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static explicit operator Vector128<double>( M128 m )
|
||||
{
|
||||
return m.vec.AsVector128().As<float, double>();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="M256.cs"
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Data.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct M256 : IRegisterType
|
||||
{
|
||||
|
||||
private M128 v0;
|
||||
private M128 v1;
|
||||
|
||||
T IRegisterType.Read<T>( int index )
|
||||
{
|
||||
fixed( M128* mptr = &v0 ) {
|
||||
return *( ( T* )mptr + index );
|
||||
}
|
||||
}
|
||||
|
||||
void IRegisterType.Write<T>( int index, T value )
|
||||
{
|
||||
fixed( M128* mptr = &v0 ) {
|
||||
*( ( T* )mptr + index ) = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="intrinsicContextProvider.cs"
|
||||
// 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 StgSharp.Data.Intrinsic;
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal static unsafe partial class InternalIO
|
||||
{
|
||||
|
||||
private static readonly IntrinsicContext _intrinsicContext = new IntrinsicContext(
|
||||
);
|
||||
|
||||
internal static IntrinsicContext Intrinsic
|
||||
{
|
||||
get => _intrinsicContext;
|
||||
}
|
||||
|
||||
[DllImport(
|
||||
InternalIO.SSC_libName,
|
||||
CallingConvention = CallingConvention.Cdecl,
|
||||
EntryPoint = "load_intrinsic_function" )]
|
||||
private static extern void LoadIntrinsicFunction(
|
||||
IntrinsicContext* context );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Lable.cs"
|
||||
// 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 StgSharp;
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace StgSharp.Data
|
||||
{
|
||||
public class DataLabel
|
||||
{
|
||||
private readonly string _name;
|
||||
|
||||
public DataLabel( string lableName )
|
||||
{
|
||||
_name = lableName;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
}
|
||||
|
||||
public override unsafe int GetHashCode()
|
||||
{
|
||||
ReadOnlySpan<char> nameSpan = _name.AsSpan();
|
||||
fixed( char* cptr = nameSpan ) {
|
||||
return InternalIO.Intrinsic
|
||||
.string_quickHash( cptr, _name.Length );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class DataLabelBuilder
|
||||
{
|
||||
public static DataLabel AsLabel(this string name)
|
||||
{
|
||||
return new DataLabel(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Data;
|
||||
using StgSharp.Data.Intrinsic;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -46,34 +46,26 @@ namespace StgSharp.Data
|
||||
|
||||
private byte[] currentKey;
|
||||
|
||||
|
||||
private readonly byte[] originKey;
|
||||
private int cycleCount;
|
||||
private SHA512 hash;
|
||||
|
||||
public RandomGenerator() : this(DateTime.UtcNow.ToBinary())
|
||||
{
|
||||
|
||||
}
|
||||
public RandomGenerator() : this( DateTime.UtcNow.ToBinary() ) { }
|
||||
|
||||
public RandomGenerator( object source )
|
||||
{
|
||||
try
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
try {
|
||||
if( source == null ) {
|
||||
throw new ArgumentNullException( nameof( source ) );
|
||||
}
|
||||
XmlSerializer s = new XmlSerializer( source.GetType() );
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
using( StringWriter sw = new StringWriter() ) {
|
||||
s.Serialize( sw, source );
|
||||
string data = sw.ToString();
|
||||
originKey = Encoding.UTF8.GetBytes( data );
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
catch( Exception ) {
|
||||
throw;
|
||||
}
|
||||
hash = SHA512.Create();
|
||||
@@ -111,8 +103,7 @@ namespace StgSharp.Data
|
||||
public byte GenRandomInt8()
|
||||
{
|
||||
cycleCount++;
|
||||
if (cycleCount % 64 == 0)
|
||||
{
|
||||
if( cycleCount % 64 == 0 ) {
|
||||
PrivateRand();
|
||||
}
|
||||
return currentKey[ cycleCount % 64 ];
|
||||
@@ -122,37 +113,28 @@ namespace StgSharp.Data
|
||||
{
|
||||
cycleCount++;
|
||||
|
||||
while (true)
|
||||
{
|
||||
while( true ) {
|
||||
M128 source = PrivateRand();
|
||||
|
||||
uint
|
||||
temp0 = source.Read<uint>( 0 ),
|
||||
temp1 = source.Read<uint>( 2 );
|
||||
|
||||
if (temp0 * temp1 != 0)
|
||||
{
|
||||
if( temp0 * temp1 != 0 ) {
|
||||
float ret = ( ( temp0 % temp1 ) * 1.0f ) / temp1;
|
||||
if (ret < 0.335f)
|
||||
{
|
||||
if( ret < 0.335f ) {
|
||||
ret = ret * ( ( ret * ( -0.7811934f ) ) + 1.4489113f );
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ret = ( ret * ( ( ret * ( -0.1158368f ) ) + 1.0580600f ) ) + 0.0590584f;
|
||||
}
|
||||
if (ret > 1)
|
||||
{
|
||||
if( ret > 1 ) {
|
||||
continue;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
currentKey = originKey;
|
||||
@@ -163,22 +145,25 @@ namespace StgSharp.Data
|
||||
{
|
||||
currentKey = hash.ComputeHash( currentKey );
|
||||
M128 ret;
|
||||
fixed (byte* bptr = currentKey)
|
||||
{
|
||||
switch ((cycleCount % 16) / 4)
|
||||
{
|
||||
fixed( byte* bptr = currentKey ) {
|
||||
switch( ( cycleCount % 16 ) / 4 ) {
|
||||
case 0:
|
||||
ret = *(((M128*)bptr) + 0); break;
|
||||
ret = *( ( ( M128* )bptr ) + 0 );
|
||||
break;
|
||||
case 1:
|
||||
ret = *(((M128*)bptr) + 1); break;
|
||||
ret = *( ( ( M128* )bptr ) + 1 );
|
||||
break;
|
||||
case 2:
|
||||
ret = *(((M128*)bptr) + 2); break;
|
||||
ret = *( ( ( M128* )bptr ) + 2 );
|
||||
break;
|
||||
case 3:
|
||||
ret = *(((M128*)bptr) + 3); break;
|
||||
ret = *( ( ( M128* )bptr ) + 3 );
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
//Console.WriteLine(ret.ToString(16));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -39,12 +39,9 @@ using System.Threading.Tasks;
|
||||
namespace StgSharp.Data
|
||||
{
|
||||
/// <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.
|
||||
/// 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
|
||||
{
|
||||
|
||||
}
|
||||
public partial class Area { }
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Data.Intrinsic;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -38,12 +40,10 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Data
|
||||
{
|
||||
|
||||
[StructLayout( LayoutKind.Explicit, Size = 16 )]
|
||||
public struct SSDSegmentHead
|
||||
{
|
||||
|
||||
|
||||
[FieldOffset( 12 )] internal byte size;
|
||||
|
||||
[FieldOffset( 0 )] internal M128 data;
|
||||
@@ -55,14 +55,12 @@ namespace StgSharp.Data
|
||||
[FieldOffset( 4 )] public int nextID;
|
||||
[FieldOffset( 8 )] public int previousHash;
|
||||
|
||||
|
||||
public int Size
|
||||
{
|
||||
get => ( ( int )size ) + 1;
|
||||
set
|
||||
{
|
||||
if ((value > 256) || (value < 0))
|
||||
{
|
||||
if( ( value > 256 ) || ( value < 0 ) ) {
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
size = ( byte )( value - 1 );
|
||||
@@ -72,11 +70,9 @@ namespace StgSharp.Data
|
||||
public unsafe byte[] GetBytes()
|
||||
{
|
||||
byte[] ret = new byte[16];
|
||||
fixed (Vector4* vptr = &data.vec)
|
||||
{
|
||||
fixed( Vector4* vptr = &data.vec ) {
|
||||
byte* bptr = ( byte* )vptr;
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
for( int i = 0; i < 15; i++ ) {
|
||||
ret[ i ] = *bptr;
|
||||
}
|
||||
}
|
||||
@@ -84,6 +80,4 @@ namespace StgSharp.Data
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Data.Intrinsic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
@@ -44,7 +45,8 @@ namespace StgSharp.Data
|
||||
public unsafe struct SSDSegment : IComparable<int>, IComparable<SSDSegment>
|
||||
{
|
||||
|
||||
[FieldOffset(16)] public fixed byte Data[16 * (StgSharp.ssdSegmentLength - 1)];
|
||||
[FieldOffset( 16 )] public fixed byte Data[
|
||||
16 * ( StgSharp.ssdSegmentLength - 1 ) ];
|
||||
[FieldOffset( 12 )] public int DataHash;
|
||||
[FieldOffset( 8 )] public int PreviousHash;
|
||||
[FieldOffset( 0 * 16 )] public SSDSegmentHead Head;
|
||||
@@ -58,8 +60,7 @@ namespace StgSharp.Data
|
||||
{
|
||||
get
|
||||
{
|
||||
if (index > (16 * (StgSharp.ssdSegmentLength - 1)) - 1)
|
||||
{
|
||||
if( index > ( 16 * ( StgSharp.ssdSegmentLength - 1 ) ) - 1 ) {
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
return Data[ index ];
|
||||
@@ -67,8 +68,7 @@ namespace StgSharp.Data
|
||||
|
||||
set
|
||||
{
|
||||
if (index > (16 * (StgSharp.ssdSegmentLength - 1)) - 1)
|
||||
{
|
||||
if( index > ( 16 * ( StgSharp.ssdSegmentLength - 1 ) ) - 1 ) {
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
Data[ index ] = value;
|
||||
@@ -85,29 +85,25 @@ namespace StgSharp.Data
|
||||
|
||||
public void FillRandomBytes( int begin )
|
||||
{
|
||||
if (begin > 255)
|
||||
{
|
||||
if( begin > 255 ) {
|
||||
return;
|
||||
}
|
||||
for (int i = begin; i < 255; i++)
|
||||
{
|
||||
for( int i = begin; i < 255; i++ ) {
|
||||
Data[ i ] = Scaler.Random<byte>(); //TODO: 使用STGSHARP内部随机数工具处理它
|
||||
}
|
||||
}
|
||||
|
||||
public static SSDSegment FromStream( byte[] stream )
|
||||
{
|
||||
if (stream.Length != 16 * StgSharp.ssdSegmentLength)
|
||||
{
|
||||
if( stream.Length != 16 * StgSharp.ssdSegmentLength ) {
|
||||
throw new ArgumentException();
|
||||
}
|
||||
SSDSegment ret = new SSDSegment();
|
||||
fixed (byte* bptr = stream)
|
||||
{
|
||||
fixed( byte* bptr = stream ) {
|
||||
ret.Head.data = *( M128* )bptr;
|
||||
for (int i = 1; i < StgSharp.ssdSegmentLength; i++)
|
||||
{
|
||||
ret.WriteData<M128>(i - 1, *(M128*)(bptr + (16 * i)));
|
||||
for( int i = 1; i < StgSharp.ssdSegmentLength; i++ ) {
|
||||
ret.WriteData<M128>(
|
||||
i - 1, *( M128* )( bptr + ( 16 * i ) ) );
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -116,14 +112,11 @@ namespace StgSharp.Data
|
||||
public byte[] GetBytes()
|
||||
{
|
||||
byte[] ret = new byte[16 * StgSharp.ssdSegmentLength];
|
||||
fixed (M128* mptr = &Head.data)
|
||||
{
|
||||
fixed (byte* aptr = ret)
|
||||
{
|
||||
fixed( M128* mptr = &Head.data ) {
|
||||
fixed( byte* aptr = ret ) {
|
||||
Vector4* vsptr = ( Vector4* )mptr;
|
||||
Vector4* vtptr = ( Vector4* )aptr;
|
||||
for (int i = 0; i < 18; i++)
|
||||
{
|
||||
for( int i = 0; i < 18; i++ ) {
|
||||
*( vtptr + i ) = *( vsptr + i );
|
||||
}
|
||||
}
|
||||
@@ -135,11 +128,9 @@ namespace StgSharp.Data
|
||||
public int GetDataHash()
|
||||
{
|
||||
Vector4 v = Vector4.One;
|
||||
fixed (M128* mptr = &Head.data)
|
||||
{
|
||||
fixed( M128* mptr = &Head.data ) {
|
||||
Vector4* vptr = ( Vector4* )mptr;
|
||||
for (int i = 0; i < StgSharp.ssdSegmentLength - 1; i += 1)
|
||||
{
|
||||
for( int i = 0; i < StgSharp.ssdSegmentLength - 1; i += 1 ) {
|
||||
v += ( *vptr ) * 31;
|
||||
}
|
||||
}
|
||||
@@ -151,11 +142,9 @@ namespace StgSharp.Data
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int ret = 17;
|
||||
fixed (M128* mptr = &Head.data)
|
||||
{
|
||||
fixed( M128* mptr = &Head.data ) {
|
||||
Vector4* vptr = ( Vector4* )mptr;
|
||||
for (int i = 0; i < StgSharp.ssdSegmentLength; i++)
|
||||
{
|
||||
for( int i = 0; i < StgSharp.ssdSegmentLength; i++ ) {
|
||||
ret = ( ret + ( *vptr ).GetHashCode() ) * 31;
|
||||
}
|
||||
}
|
||||
@@ -164,8 +153,7 @@ namespace StgSharp.Data
|
||||
|
||||
public unsafe T ReadData<T>( int index ) where T: struct
|
||||
{
|
||||
fixed (byte* bptr = Data)
|
||||
{
|
||||
fixed( byte* bptr = Data ) {
|
||||
T* tptr = ( T* )bptr;
|
||||
return *( tptr + index );
|
||||
}
|
||||
@@ -173,8 +161,7 @@ namespace StgSharp.Data
|
||||
|
||||
public unsafe void WriteData<T>( int index, T value ) where T: struct
|
||||
{
|
||||
fixed (byte* bptr = Data)
|
||||
{
|
||||
fixed( byte* bptr = Data ) {
|
||||
T* tptr = ( T* )bptr;
|
||||
*( tptr + index ) = value;
|
||||
}
|
||||
@@ -191,5 +178,4 @@ namespace StgSharp.Data
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,9 +58,11 @@ namespace StgSharp.Data
|
||||
|
||||
public static SSD FromFile( string fileRoute )
|
||||
{
|
||||
return new SSD(new FileStream(fileRoute, FileMode.Open, FileAccess.Read)) { };
|
||||
return new SSD(
|
||||
new FileStream( fileRoute, FileMode.Open, FileAccess.Read ) )
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,17 +51,13 @@ namespace StgSharp.Data
|
||||
|
||||
internal SSDFolder( string name )
|
||||
{
|
||||
if (name == "root")
|
||||
{
|
||||
if( name == "root" ) {
|
||||
throw new ArgumentException(
|
||||
"Name cannot be root," +
|
||||
"it is preserved for root file indexer.");
|
||||
"Name cannot be root," + "it is preserved for root file indexer." );
|
||||
}
|
||||
if (name == "default")
|
||||
{
|
||||
if( name == "default" ) {
|
||||
throw new ArgumentException(
|
||||
"Name cannot be default," +
|
||||
"it is preserved for default file id provider.");
|
||||
"Name cannot be default," + "it is preserved for default file id provider." );
|
||||
}
|
||||
_name = name;
|
||||
folders = new Dictionary<string, SSDFolder>();
|
||||
@@ -74,7 +70,6 @@ namespace StgSharp.Data
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
//TODO 虚拟文件夹的GetBytes好难写
|
||||
public byte[] GetBytes()
|
||||
{
|
||||
|
||||
@@ -52,8 +52,7 @@ namespace StgSharp.Data.FileIO
|
||||
|
||||
public SSDraw( string name, Stream streamSource )
|
||||
{
|
||||
if ((streamSource == null) || (streamSource.Length == 0))
|
||||
{
|
||||
if( ( streamSource == null ) || ( streamSource.Length == 0 ) ) {
|
||||
throw new ArgumentNullException( nameof( streamSource ) );
|
||||
}
|
||||
Name = name;
|
||||
@@ -61,17 +60,20 @@ namespace StgSharp.Data.FileIO
|
||||
streamSource.Read( data.AsSpan() );
|
||||
}
|
||||
|
||||
public SSDrawHead Head { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public SSDrawHead Head
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Explicit, Size = 32 * 16 )]
|
||||
public unsafe struct SSDrawHead
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public unsafe struct SSDrawHead { }
|
||||
}
|
||||
|
||||
@@ -34,13 +34,8 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Data
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A class contains a sets of methods to serialize several types
|
||||
/// </summary>
|
||||
public static partial class Serializer
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public static partial class Serializer { }
|
||||
}
|
||||
|
||||
@@ -36,11 +36,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Data
|
||||
{
|
||||
|
||||
public interface ISSDSerializable
|
||||
{
|
||||
|
||||
public SerializableTypeCode SSDTypeCode { get; }
|
||||
public SerializableTypeCode SSDTypeCode
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public byte[] GetBytes();
|
||||
|
||||
@@ -50,6 +52,7 @@ namespace StgSharp.Data
|
||||
|
||||
public enum SerializableTypeCode
|
||||
{
|
||||
|
||||
Unknown = 0,
|
||||
IndexTable = 1,
|
||||
PixelImage = 2,
|
||||
@@ -59,12 +62,14 @@ namespace StgSharp.Data
|
||||
Text = 6,
|
||||
RawData = 7,
|
||||
VirtualFolder = int.MaxValue,
|
||||
|
||||
}
|
||||
|
||||
public static partial class Serializer
|
||||
{
|
||||
|
||||
public static T Deserialize<T>(byte[] stream) where T : ISSDSerializable
|
||||
public static T Deserialize<T>( byte[] stream )
|
||||
where T: ISSDSerializable
|
||||
{
|
||||
T serializableObject = Activator.CreateInstance<T>();
|
||||
serializableObject.FromBytes( stream );
|
||||
@@ -73,8 +78,7 @@ namespace StgSharp.Data
|
||||
|
||||
public static string GetNameTail( SerializableTypeCode typeCode )
|
||||
{
|
||||
switch (typeCode)
|
||||
{
|
||||
switch( typeCode ) {
|
||||
case SerializableTypeCode.IndexTable:
|
||||
return "_idt";
|
||||
case SerializableTypeCode.PixelImage:
|
||||
@@ -95,6 +99,7 @@ namespace StgSharp.Data
|
||||
throw new ArgumentException( "Unknown file type" );
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] Serialize( ISSDSerializable serializableObject )
|
||||
{
|
||||
return serializableObject.GetBytes();
|
||||
|
||||
@@ -30,8 +30,5 @@
|
||||
//-----------------------------------------------------------------------
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
public abstract class BehaviorArgs
|
||||
{
|
||||
|
||||
}
|
||||
public abstract class BehaviorArgs { }
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -43,9 +42,23 @@ namespace StgSharp.Entities
|
||||
internal LinkedList<Launcher<EntityPartical>> _commonBulletLauncher;
|
||||
public bool _selectalbe;
|
||||
|
||||
public Launcher<EntityPartical> AwardLauncher { get; set; }
|
||||
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
||||
public LinkedList<Launcher<EntityPartical>> CommonBulletLauncher { get; set; }
|
||||
public Launcher<EntityPartical> AwardLauncher
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Launcher<EntityPartical> DieBulletLauncher
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public LinkedList<Launcher<EntityPartical>> CommonBulletLauncher
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public virtual void OnRender()
|
||||
{
|
||||
@@ -55,8 +68,7 @@ namespace StgSharp.Entities
|
||||
public override void OnRenderFrame()
|
||||
{
|
||||
this.OnUpdate();
|
||||
foreach (Launcher<EntityPartical> launcher in CommonBulletLauncher)
|
||||
{
|
||||
foreach( Launcher<EntityPartical> launcher in CommonBulletLauncher ) {
|
||||
launcher.Launch();
|
||||
}
|
||||
this.OnRender();
|
||||
@@ -67,6 +79,5 @@ namespace StgSharp.Entities
|
||||
new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
public class Enemy : IEntity
|
||||
@@ -40,15 +39,28 @@ namespace StgSharp.Entities
|
||||
internal Launcher<EntityPartical> _dieBulletLauncher;
|
||||
public bool _selectalbe;
|
||||
|
||||
public Launcher<EntityPartical> AwardLauncher { get; set; }
|
||||
public Launcher<EntityPartical> CommonBulletLauncher { get; set; }
|
||||
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
||||
public Launcher<EntityPartical> AwardLauncher
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Launcher<EntityPartical> CommonBulletLauncher
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Launcher<EntityPartical> DieBulletLauncher
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override void OnRenderFrame()
|
||||
{
|
||||
CommonBulletLauncher.Launch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,5 @@
|
||||
//-----------------------------------------------------------------------
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
public abstract class EntityPartical : IEntity
|
||||
{
|
||||
|
||||
}
|
||||
public abstract class EntityPartical : IEntity { }
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace StgSharp
|
||||
{
|
||||
|
||||
protected uint _bornTick;
|
||||
internal Func<int, vec3d> _movHandler;
|
||||
internal Func<int, Vec3> _movHandler;
|
||||
internal LinkedList<PlainGeometry> _collisionBox;
|
||||
internal Point _basePoint;
|
||||
internal Point _pos;
|
||||
@@ -51,12 +51,20 @@ namespace StgSharp
|
||||
/// <summary>
|
||||
/// X position of an enenmy entity
|
||||
/// </summary>
|
||||
public float X { get; set; }
|
||||
public float X
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Y position of an enemy entity
|
||||
/// </summary>
|
||||
public float Y { get; set; }
|
||||
public float Y
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public LinkedList<PlainGeometry> CollisionBox
|
||||
{
|
||||
@@ -73,12 +81,20 @@ namespace StgSharp
|
||||
set => _collisionSensor = value;
|
||||
}
|
||||
|
||||
public string TextureGL { get; set; }
|
||||
public string TextureGL
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
|
||||
/// A 2D vector presenting the position of an enemy entity, position can also be visited by
|
||||
/// X, Y
|
||||
/// </summary>
|
||||
public vec2d Location { get; }
|
||||
public Vec2 Location
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract void OnRenderFrame();
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace StgSharp
|
||||
*用于发射其他的实体,主要是子弹 和 掉落物
|
||||
*/
|
||||
|
||||
internal vec2d _center; //发射器的参考位置,运动轨迹的方程应当基于这个参考点构建
|
||||
internal Vec2 _center; //发射器的参考位置,运动轨迹的方程应当基于这个参考点构建
|
||||
|
||||
public EntityPartical Bullet
|
||||
{
|
||||
@@ -52,12 +52,7 @@ namespace StgSharp
|
||||
set => _bulletSample = value;
|
||||
}
|
||||
|
||||
internal virtual void Launch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
internal virtual void Launch() { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,5 @@ namespace StgSharp
|
||||
|
||||
public float Velocity => _velocity;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,9 @@ namespace StgSharp
|
||||
public class UniformEmptyReferenceException : Exception
|
||||
{
|
||||
|
||||
public UniformEmptyReferenceException(string program, string name) :
|
||||
base($"Location -1 returned when trying to find uniform {name} in shader program {program}")
|
||||
{
|
||||
|
||||
}
|
||||
public UniformEmptyReferenceException( string program, string name )
|
||||
: base(
|
||||
$"Location -1 returned when trying to find uniform {name} in shader program {program}" ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace StgSharp
|
||||
|
||||
internal const int ssdSegmentLength = 16;
|
||||
|
||||
static byte[] _currentHash;
|
||||
private static byte[] _currentHash;
|
||||
|
||||
private static bool _inited;
|
||||
private static int _mainThreadID = -1;
|
||||
@@ -53,12 +53,10 @@ namespace StgSharp
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_currentHash == null)
|
||||
{
|
||||
if( _currentHash == null ) {
|
||||
string route = Assembly.GetExecutingAssembly().Location;
|
||||
string time = DateTime.UtcNow.ToString();
|
||||
using (SHA256 sh = SHA256.Create())
|
||||
{
|
||||
using( SHA256 sh = SHA256.Create() ) {
|
||||
byte[] bytes = Encoding.UTF8.GetBytes( route );
|
||||
_currentHash = sh.ComputeHash( bytes );
|
||||
}
|
||||
@@ -70,22 +68,20 @@ namespace StgSharp
|
||||
public static int MainThreadID
|
||||
{
|
||||
get => ( _mainThreadID == -1 ) ?
|
||||
throw new InvalidOperationException("StgSharp environment is not inited. " +
|
||||
"Main thread id is not available") : _mainThreadID;
|
||||
throw new InvalidOperationException(
|
||||
"StgSharp environment is not inited. " + "Main thread id is not available" ) : _mainThreadID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CustomizeInit an instance of OpenGL program,
|
||||
/// This method should be called before any other StgSharp api.
|
||||
/// CustomizeInit an instance of OpenGL program, This method should be called before any
|
||||
/// other StgSharp api.
|
||||
/// </summary>
|
||||
public static void InitGL( int majorVersion, int minorVersion )
|
||||
{
|
||||
if (API == default)
|
||||
{
|
||||
if( API == default ) {
|
||||
API = GraphicAPI.GL;
|
||||
}
|
||||
if (API != GraphicAPI.GL)
|
||||
{
|
||||
if( API != GraphicAPI.GL ) {
|
||||
return;
|
||||
}
|
||||
InternalIO.InternalInitGL( majorVersion, minorVersion );
|
||||
|
||||
@@ -48,12 +48,12 @@ namespace StgSharp
|
||||
{
|
||||
get
|
||||
{
|
||||
if (monitorsArray == null)
|
||||
{
|
||||
if( monitorsArray == null ) {
|
||||
int count = 0;
|
||||
IntPtr* arrayhandle = InternalIO.glfwGetMonitors( &count );
|
||||
monitorsArray = new IntPtr[count];
|
||||
Marshal.Copy((IntPtr)arrayhandle, monitorsArray, 0, count);
|
||||
Marshal.Copy(
|
||||
( IntPtr )arrayhandle, monitorsArray, 0, count );
|
||||
Marshal.FreeHGlobal( ( IntPtr )arrayhandle );
|
||||
}
|
||||
return monitorsArray;
|
||||
@@ -66,6 +66,4 @@ namespace StgSharp
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -60,18 +60,19 @@ namespace StgSharp
|
||||
{
|
||||
internal enum GraphicAPI : byte
|
||||
{
|
||||
|
||||
GL,
|
||||
DX,
|
||||
VK
|
||||
|
||||
}
|
||||
|
||||
public static partial class StgSharp
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Version of current StgSharp platform.
|
||||
/// Main version represent in hundred's digit,
|
||||
/// and sub version represent in ten's digit.
|
||||
/// Version of current StgSharp platform. Main version represent in hundred's digit, and sub
|
||||
/// version represent in ten's digit.
|
||||
/// </summary>
|
||||
public const long version = 430;
|
||||
|
||||
@@ -106,16 +107,17 @@ namespace StgSharp
|
||||
{
|
||||
InternalIO.InternalWriteLog( log, LogType.Warning );
|
||||
}
|
||||
|
||||
public static void LogWarning( Exception notVerySeriesException )
|
||||
{
|
||||
InternalIO.InternalWriteLog(notVerySeriesException.Message, LogType.Warning);
|
||||
InternalIO.InternalWriteLog(
|
||||
notVerySeriesException.Message, LogType.Warning );
|
||||
}
|
||||
|
||||
public static void Mark( bool needConsole )
|
||||
{
|
||||
markCount++;
|
||||
if (needConsole)
|
||||
{
|
||||
if( needConsole ) {
|
||||
Console.WriteLine( markCount );
|
||||
}
|
||||
}
|
||||
@@ -132,25 +134,21 @@ namespace StgSharp
|
||||
bool isConsole,
|
||||
[CallerFilePath] string filePath = "",
|
||||
[CallerMemberName] string callerName = "",
|
||||
[CallerLineNumber] int lineNumber = 0
|
||||
)
|
||||
[CallerLineNumber] int lineNumber = 0 )
|
||||
{
|
||||
Type t = target.GetType();
|
||||
string log = $"Tracked object: {nameof(target)}\t\tType:{t.Name}\n";
|
||||
FieldInfo[] fieldInfo = t.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
FieldInfo[] fieldInfo = t.GetFields(
|
||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance );
|
||||
log += "|\tFieldName\t|\tFieldType\t|\tFieldValue\t|\n";
|
||||
foreach (FieldInfo field in fieldInfo)
|
||||
{
|
||||
foreach( FieldInfo field in fieldInfo ) {
|
||||
log += $"|{field.Name}\t\t|{field.FieldType}\t\t|{field.GetValue(target)}\t\t|\n";
|
||||
}
|
||||
log += $"Tracking at:\n{filePath}\t{callerName}\tline {lineNumber}\n";
|
||||
log += $"Additional information:\n{message}\n";
|
||||
if (isConsole)
|
||||
{
|
||||
if( isConsole ) {
|
||||
Console.WriteLine( log );
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
InternalIO.InternalWriteLog( log, LogType.Info );
|
||||
}
|
||||
}
|
||||
@@ -168,32 +166,28 @@ namespace StgSharp
|
||||
|
||||
internal static TDele ConvertAPI<TDele>( IntPtr funcPtr )
|
||||
{
|
||||
if (funcPtr == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Failed to convert api, the function pointer is zero.");
|
||||
if( funcPtr == IntPtr.Zero ) {
|
||||
throw new Exception(
|
||||
"Failed to convert api, the function pointer is zero." );
|
||||
}
|
||||
try
|
||||
{
|
||||
try {
|
||||
return Marshal.GetDelegateForFunctionPointer<TDele>( funcPtr );
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
catch( Exception ) {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Delegate ConvertAPI( IntPtr funcPtr, Type T )
|
||||
{
|
||||
if (funcPtr == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Failed to convert api, the function pointer is zero.");
|
||||
if( funcPtr == IntPtr.Zero ) {
|
||||
throw new Exception(
|
||||
"Failed to convert api, the function pointer is zero." );
|
||||
}
|
||||
try
|
||||
{
|
||||
try {
|
||||
return Marshal.GetDelegateForFunctionPointer( funcPtr, T );
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
catch( Exception ) {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
public static partial class StgSharp
|
||||
{
|
||||
|
||||
@@ -49,6 +48,5 @@ namespace StgSharp
|
||||
return keyListener.GetOrAdd( ( int )key, KeyStatus.RELEASE );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,7 @@ namespace StgSharp.Geometries
|
||||
private CoordinationBase localCoordination;
|
||||
private Matrix44 coordMat;
|
||||
|
||||
|
||||
public CoordinationBase(
|
||||
CoordinationBase localCoordination)
|
||||
public CoordinationBase( CoordinationBase localCoordination )
|
||||
{
|
||||
this.localCoordination = localCoordination;
|
||||
coordMat = new Matrix44();
|
||||
@@ -59,19 +57,19 @@ namespace StgSharp.Geometries
|
||||
internal set => coordMat.colum3.XYZ = value.Coord;
|
||||
}
|
||||
|
||||
public virtual vec3d LocalX
|
||||
public virtual Vec3 LocalX
|
||||
{
|
||||
get => coordMat.colum0.XYZ;
|
||||
internal set => coordMat.colum0.XYZ = value;
|
||||
}
|
||||
|
||||
public virtual vec3d LocalY
|
||||
public virtual Vec3 LocalY
|
||||
{
|
||||
get => coordMat.colum1.XYZ;
|
||||
internal set => coordMat.colum1.XYZ = value;
|
||||
}
|
||||
|
||||
public virtual vec3d LocalZ
|
||||
public virtual Vec3 LocalZ
|
||||
{
|
||||
get => coordMat.colum2.XYZ;
|
||||
set => coordMat.colum2.XYZ = value;
|
||||
|
||||
@@ -41,23 +41,22 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
private static PlainCoordinate statndardPlainCoordination = new PlainCoordinate(
|
||||
null, new Point(0, 0, 0),
|
||||
new vec3d(1, 0, 0),
|
||||
new vec3d(0, 1, 0)
|
||||
);
|
||||
null, new Point( 0, 0, 0 ), new Vec3( 1, 0, 0 ),
|
||||
new Vec3( 0, 1, 0 ) );
|
||||
|
||||
public PlainCoordinate(
|
||||
CoordinationBase local,
|
||||
Point origin,
|
||||
vec3d xAxis,
|
||||
vec3d yAxis
|
||||
) : base(local)
|
||||
Vec3 xAxis,
|
||||
Vec3 yAxis )
|
||||
: base( local )
|
||||
{
|
||||
CoordMat = Matrix44.Unit;
|
||||
|
||||
CoordMat.colum0 = new vec4d(xAxis, 0);
|
||||
CoordMat.colum1 = new vec4d(yAxis, 0);
|
||||
CoordMat.colum2 = new vec4d(Linear.Normalize(Vec3d.Cross(xAxis, yAxis)), 0);
|
||||
CoordMat.colum0 = new Vec4( xAxis, 0 );
|
||||
CoordMat.colum1 = new Vec4( yAxis, 0 );
|
||||
CoordMat.colum2 = new Vec4(
|
||||
Linear.Normalize( Vec3.Cross( xAxis, yAxis ) ), 0 );
|
||||
|
||||
LocalOrigin = origin;
|
||||
}
|
||||
|
||||
@@ -40,11 +40,12 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
public SpaceCoordinate(
|
||||
CoordinationBase localCoordination, Point origin,
|
||||
vec3d xAxis, vec3d yAxis, vec3d zAxis
|
||||
) : base(localCoordination)
|
||||
{
|
||||
}
|
||||
CoordinationBase localCoordination,
|
||||
Point origin,
|
||||
Vec3 xAxis,
|
||||
Vec3 yAxis,
|
||||
Vec3 zAxis )
|
||||
: base( localCoordination ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,20 +36,19 @@ namespace StgSharp.Geometries
|
||||
public unsafe class ToUpperDimensionException : Exception
|
||||
{
|
||||
|
||||
protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
public ToUpperDimensionException()
|
||||
{
|
||||
}
|
||||
protected ToUpperDimensionException(
|
||||
SerializationInfo info,
|
||||
StreamingContext context )
|
||||
: base( info, context ) { }
|
||||
|
||||
public ToUpperDimensionException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
public ToUpperDimensionException() { }
|
||||
|
||||
public ToUpperDimensionException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
public ToUpperDimensionException( string message ) : base( message ) { }
|
||||
|
||||
public ToUpperDimensionException(
|
||||
string message,
|
||||
Exception innerException )
|
||||
: base( message, innerException ) { }
|
||||
|
||||
}
|
||||
|
||||
@@ -59,20 +58,17 @@ namespace StgSharp.Geometries
|
||||
public class UnusedVertexException : Exception
|
||||
{
|
||||
|
||||
protected UnusedVertexException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
public UnusedVertexException()
|
||||
{
|
||||
}
|
||||
protected UnusedVertexException(
|
||||
SerializationInfo info,
|
||||
StreamingContext context )
|
||||
: base( info, context ) { }
|
||||
|
||||
public UnusedVertexException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
public UnusedVertexException() { }
|
||||
|
||||
public UnusedVertexException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
public UnusedVertexException( string message ) : base( message ) { }
|
||||
|
||||
public UnusedVertexException( string message, Exception innerException )
|
||||
: base( message, innerException ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,9 @@ using System.Text;
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
[UnmanagedFunctionPointer( CallingConvention.Cdecl )]
|
||||
public delegate vec3d GeometryMotionDelegate(TimeSpanProvider timeSource, out float rotation);
|
||||
public delegate Vec3 GeometryMotionDelegate(
|
||||
TimeSpanProvider timeSource,
|
||||
out float rotation );
|
||||
|
||||
public class GeometryMotion
|
||||
{
|
||||
@@ -54,33 +56,27 @@ namespace StgSharp.Geometries
|
||||
public unsafe GeometryMotion(
|
||||
bool isIncreament,
|
||||
TimeSpanProvider timeSource,
|
||||
GeometryMotionDelegate motionDelegate
|
||||
)
|
||||
GeometryMotionDelegate motionDelegate )
|
||||
{
|
||||
isIncrementMode = isIncreament;
|
||||
time = timeSource;
|
||||
if (motionDelegate == null)
|
||||
{
|
||||
handle = (IntPtr)(delegate*<TimeSpanProvider, out float, vec3d>)&defaultMotion;
|
||||
if( motionDelegate == null ) {
|
||||
handle = ( IntPtr )( delegate*<TimeSpanProvider, out float, Vec3> )&defaultMotion;
|
||||
movement = defaultMotion;
|
||||
}
|
||||
else if (motionDelegate.Method.IsStatic)
|
||||
{
|
||||
} else if( motionDelegate.Method.IsStatic ) {
|
||||
sourceIsStatic = true;
|
||||
handle = Marshal.GetFunctionPointerForDelegate( motionDelegate );
|
||||
movement = motionDelegate;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
movement = motionDelegate;
|
||||
}
|
||||
|
||||
//sourceIsStatic = false;
|
||||
}
|
||||
|
||||
public bool IsIncrement
|
||||
{
|
||||
get => isIncrementMode;
|
||||
|
||||
}
|
||||
|
||||
public static GeometryMotion DefaultMotion
|
||||
@@ -88,35 +84,32 @@ namespace StgSharp.Geometries
|
||||
get => new GeometryMotion( true, null, null );
|
||||
}
|
||||
|
||||
public unsafe void RunMotion(ref vec3d coord, ref float rotation)
|
||||
public unsafe void RunMotion( ref Vec3 coord, ref float rotation )
|
||||
{
|
||||
float rot;
|
||||
vec3d vec;
|
||||
if (sourceIsStatic)
|
||||
{
|
||||
vec = ((delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, vec3d>)handle)(time, out rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vec3 vec;
|
||||
if( sourceIsStatic ) {
|
||||
vec = ( ( delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, Vec3> )handle )(
|
||||
time, out rot );
|
||||
} else {
|
||||
vec = movement( time, out rot );
|
||||
}
|
||||
|
||||
if (isIncrementMode)
|
||||
{
|
||||
if( isIncrementMode ) {
|
||||
coord += vec;
|
||||
rotation += rot;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
coord = vec;
|
||||
rotation = rot;
|
||||
}
|
||||
}
|
||||
|
||||
private static vec3d defaultMotion(TimeSpanProvider provider, out float rotation)
|
||||
private static Vec3 defaultMotion(
|
||||
TimeSpanProvider provider,
|
||||
out float rotation )
|
||||
{
|
||||
rotation = 0;
|
||||
return Vec3d.Zero;
|
||||
return Vec3.Zero;
|
||||
}
|
||||
|
||||
}//------------------------------- End of Class -------------------------------
|
||||
|
||||
@@ -49,12 +49,16 @@ namespace StgSharp.Geometries
|
||||
}
|
||||
|
||||
#pragma warning disable CA1819
|
||||
public vec4d[] VertexStream
|
||||
public Vec4[] VertexStream
|
||||
#pragma warning restore CA1819
|
||||
{
|
||||
get;
|
||||
}
|
||||
public CoordinationBase Coordination { get; }
|
||||
|
||||
public CoordinationBase Coordination
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public int VertexCount
|
||||
{
|
||||
|
||||
@@ -36,9 +36,5 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public interface IGeomtryBuffer
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public interface IGeomtryBuffer { }
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace StgSharp.Geometries
|
||||
get { return GlobalBuffer.CoordAndRotationList[ BufferId ].W; }
|
||||
set
|
||||
{
|
||||
vec4d temp = GlobalBuffer.CoordAndRotationList[BufferId];
|
||||
Vec4 temp = GlobalBuffer.CoordAndRotationList[ BufferId ];
|
||||
temp.W = value;
|
||||
GlobalBuffer.CoordAndRotationList[ BufferId ] = temp;
|
||||
}
|
||||
@@ -62,7 +62,8 @@ namespace StgSharp.Geometries
|
||||
|
||||
public GeometryMotion Motion
|
||||
{
|
||||
get; set;
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IInstancingBuffer GlobalBuffer
|
||||
@@ -77,25 +78,25 @@ namespace StgSharp.Geometries
|
||||
internal set;
|
||||
}
|
||||
|
||||
public vec3d CenterPositionGlobal
|
||||
public Vec3 CenterPositionGlobal
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public vec3d Coord
|
||||
public Vec3 Coord
|
||||
{
|
||||
get { return GlobalBuffer.CoordAndRotationList[ BufferId ].XYZ; }
|
||||
set { GlobalBuffer.CoordAndRotationList[BufferId] = new vec4d(value.vec); }
|
||||
set { GlobalBuffer.CoordAndRotationList[ BufferId ] = new Vec4(
|
||||
value.vec ); }
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
(vec3d coord, float rotation) = (Coord, Rotation);
|
||||
(Vec3 coord, float rotation) = (Coord, Rotation);
|
||||
Motion.RunMotion( ref coord, ref rotation );
|
||||
(Coord, Rotation) = (coord, rotation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,19 +39,35 @@ namespace StgSharp.Geometries
|
||||
public interface IInstancingBuffer
|
||||
{
|
||||
|
||||
public Span<vec4d> CoordAndRotationSpan { get; }
|
||||
public Span<Vec4> CoordAndRotationSpan
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public Span<float> ScalingSpan { get; }
|
||||
public Span<float> ScalingSpan
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
internal IGeometry TypicalShape { get; }
|
||||
internal IGeometry TypicalShape
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
internal List<IInstancing> InstanceList { get; }
|
||||
|
||||
internal List<vec4d> CoordAndRotationList { get; }
|
||||
|
||||
internal List<float> ScalingList { get; }
|
||||
internal List<IInstancing> InstanceList
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
internal List<Vec4> CoordAndRotationList
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
internal List<float> ScalingList
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,14 +49,12 @@ namespace StgSharp.Geometries
|
||||
/// <summary>
|
||||
/// The origin of this coordinate.
|
||||
/// </summary>
|
||||
public vec3d origin;
|
||||
public Vec3 origin;
|
||||
|
||||
public PartialPlainCoordinate
|
||||
(
|
||||
vec3d origin,
|
||||
vec3d horiziontial,
|
||||
vec3d vertical
|
||||
)
|
||||
public PartialPlainCoordinate(
|
||||
Vec3 origin,
|
||||
Vec3 horiziontial,
|
||||
Vec3 vertical )
|
||||
{
|
||||
this.origin = origin;
|
||||
axis = new Matrix32();
|
||||
@@ -68,19 +66,17 @@ namespace StgSharp.Geometries
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The horizontial axis of the coordinate.
|
||||
/// Point to the right direction.
|
||||
/// The horizontial axis of the coordinate. Point to the right direction.
|
||||
/// </summary>
|
||||
public vec3d axis_H => axis.colum0;
|
||||
public Vec3 axis_H => axis.colum0;
|
||||
|
||||
/// <summary>
|
||||
/// The vertical axis of the coordinate.
|
||||
/// Point to the top direction.
|
||||
/// The vertical axis of the coordinate. Point to the top direction.
|
||||
/// </summary>
|
||||
public vec3d axis_V => axis.colum1;
|
||||
public Vec3 axis_V => axis.colum1;
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public vec3d GetRealLocate(vec2d raletiveLocation)
|
||||
public Vec3 GetRealLocate( Vec2 raletiveLocation )
|
||||
{
|
||||
return origin + axis.VerticalVecMultiply( raletiveLocation );
|
||||
}
|
||||
|
||||
@@ -34,16 +34,14 @@ using System.Runtime.CompilerServices;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
public static unsafe class GeometryOperation
|
||||
{
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static vec3d DefaultMotion(int tick)
|
||||
public static Vec3 DefaultMotion( int tick )
|
||||
{
|
||||
return default(vec3d);
|
||||
return default( Vec3 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,18 +38,19 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
public interface IPlainEntity
|
||||
{
|
||||
|
||||
public vec2d CenterPosition { get; set; }
|
||||
public Vec2 CenterPosition
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool CollideWith( IPlainEntity entity );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class PlainEntity : IPlainEntity
|
||||
{
|
||||
|
||||
@@ -65,12 +66,11 @@ namespace StgSharp.Geometries
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
vec2d IPlainEntity.CenterPosition
|
||||
Vec2 IPlainEntity.CenterPosition
|
||||
{
|
||||
get => _shape.Coordination.LocalOrigin.Coord.XY;
|
||||
set => throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,8 +45,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
public ParticleOnPlain( PlainInstancingBuffer<ParticleOnPlain> buffer )
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
if( buffer == null ) {
|
||||
throw new ArgumentNullException( paramName: nameof( buffer ) );
|
||||
}
|
||||
GlobalBuffer = buffer;
|
||||
@@ -72,19 +71,18 @@ namespace StgSharp.Geometries
|
||||
set;
|
||||
}
|
||||
|
||||
vec3d IInstancing.CenterPositionGlobal
|
||||
Vec3 IInstancing.CenterPositionGlobal
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
bool IPlainEntity.CollideWith( IPlainEntity entity )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
vec2d IPlainEntity.CenterPosition
|
||||
Vec2 IPlainEntity.CenterPosition
|
||||
{
|
||||
get => GlobalBuffer.CoordAndRotationList[ BufferId ].XY;
|
||||
set => throw new NotImplementedException();
|
||||
|
||||
@@ -42,10 +42,9 @@ namespace StgSharp.Geometries
|
||||
public abstract class PlainGeometry : IGeometry
|
||||
{
|
||||
|
||||
protected vec4d[] vertexMat;
|
||||
protected Vec4[] vertexMat;
|
||||
internal CoordinationBase coordinate;
|
||||
|
||||
|
||||
internal PlainGeometry( CoordinationBase coordination )
|
||||
{
|
||||
coordinate = coordination;
|
||||
@@ -57,18 +56,17 @@ namespace StgSharp.Geometries
|
||||
set => vertexMat[ index ].vec = value.coordVec;
|
||||
}
|
||||
|
||||
|
||||
public int VertexCount => this.vertexMat.Length;
|
||||
|
||||
public abstract ReadOnlySpan<int> VertexIndices { get; }
|
||||
public abstract ReadOnlySpan<int> VertexIndices
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
#pragma warning disable CA1819
|
||||
public vec4d[] VertexStream => vertexMat;
|
||||
public Vec4[] VertexStream => vertexMat;
|
||||
|
||||
public CoordinationBase Coordination => this.coordinate;
|
||||
#pragma warning restore CA1819
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -44,26 +44,24 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class PlainInstancingBuffer<T> :
|
||||
IDisposable, IEnumerable<T>, IInstancingBuffer
|
||||
where T :
|
||||
IInstancing
|
||||
public class PlainInstancingBuffer<T> : IDisposable, IEnumerable<T>, IInstancingBuffer
|
||||
where T: IInstancing
|
||||
{
|
||||
|
||||
private bool disposedValue;
|
||||
|
||||
private CoordinatePlain globalCorrdinnate;
|
||||
private List<vec4d> coordList;
|
||||
private List<Vec4> coordList;
|
||||
private List<IInstancing> instanceList;
|
||||
private List<float> scalingList;
|
||||
private Mutex mutex;
|
||||
|
||||
public PlainInstancingBuffer()
|
||||
{
|
||||
coordList = new List<vec4d>(capacity: 100);
|
||||
coordList = new List<Vec4>( capacity: 100 );
|
||||
instanceList = new List<IInstancing>( capacity: 100 );
|
||||
scalingList = new List<float>( capacity: 100 );
|
||||
coordArray = Array.Empty<vec4d>();
|
||||
coordArray = Array.Empty<Vec4>();
|
||||
scaleArray = Array.Empty<float>();
|
||||
mutex = new Mutex();
|
||||
}
|
||||
@@ -73,7 +71,7 @@ namespace StgSharp.Geometries
|
||||
get => instanceList;
|
||||
}
|
||||
|
||||
public List<vec4d> CoordAndRotationList
|
||||
public List<Vec4> CoordAndRotationList
|
||||
{
|
||||
get => coordList;
|
||||
}
|
||||
@@ -83,25 +81,25 @@ namespace StgSharp.Geometries
|
||||
get => scalingList;
|
||||
}
|
||||
|
||||
public Span<vec4d> CoordAndRotationSpan
|
||||
public Span<Vec4> CoordAndRotationSpan
|
||||
{
|
||||
get
|
||||
{
|
||||
if (coordArray.Length != coordList.Capacity)
|
||||
{
|
||||
FieldInfo fieldInfo = typeof(List<vec4d>).
|
||||
GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (fieldInfo == null)
|
||||
{
|
||||
if( coordArray.Length != coordList.Capacity ) {
|
||||
FieldInfo fieldInfo = typeof( List<Vec4> ).
|
||||
GetField(
|
||||
"_items",
|
||||
BindingFlags.NonPublic | BindingFlags.Instance );
|
||||
if( fieldInfo == null ) {
|
||||
#pragma warning disable CA1065
|
||||
#pragma warning disable CA2201
|
||||
throw new NullReferenceException();
|
||||
#pragma warning restore CA2201
|
||||
#pragma warning restore CA1065
|
||||
}
|
||||
coordArray = (vec4d[])fieldInfo.GetValue(coordList);
|
||||
coordArray = ( Vec4[] )fieldInfo.GetValue( coordList );
|
||||
}
|
||||
return new Span<vec4d>(coordArray, 0, coordList.Count);
|
||||
return new Span<Vec4>( coordArray, 0, coordList.Count );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,12 +107,12 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
get
|
||||
{
|
||||
if (scaleArray.Length != coordList.Capacity)
|
||||
{
|
||||
if( scaleArray.Length != coordList.Capacity ) {
|
||||
FieldInfo fieldInfo = typeof( List<float> ).
|
||||
GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (fieldInfo == null)
|
||||
{
|
||||
GetField(
|
||||
"_items",
|
||||
BindingFlags.NonPublic | BindingFlags.Instance );
|
||||
if( fieldInfo == null ) {
|
||||
#pragma warning disable CA1065
|
||||
#pragma warning disable CA2201
|
||||
throw new NullReferenceException();
|
||||
@@ -131,7 +129,7 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
mutex.WaitOne();
|
||||
int ret = instanceList.Count;
|
||||
coordList.Add(new vec4d());
|
||||
coordList.Add( new Vec4() );
|
||||
scalingList.Add( 0 );
|
||||
mutex.ReleaseMutex();
|
||||
return ret;
|
||||
@@ -150,8 +148,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
foreach (IInstancing item in instanceList)
|
||||
{
|
||||
foreach( IInstancing item in instanceList ) {
|
||||
yield return ( T )item;
|
||||
}
|
||||
}
|
||||
@@ -159,8 +156,7 @@ namespace StgSharp.Geometries
|
||||
public void Remove( T instance )
|
||||
{
|
||||
mutex.WaitOne();
|
||||
if (instance.GlobalBuffer != this)
|
||||
{
|
||||
if( instance.GlobalBuffer != this ) {
|
||||
throw new ArgumentException(
|
||||
message: "instance does not belong to current Particle Buffer",
|
||||
paramName: nameof( instance ) );
|
||||
@@ -171,7 +167,8 @@ namespace StgSharp.Geometries
|
||||
temp.BufferId = instance.BufferId;
|
||||
|
||||
coordList[ instance.BufferId ] = coordList[ coordList.Count - 1 ];
|
||||
scalingList[instance.BufferId] = scalingList[scalingList.Count - 1];
|
||||
scalingList[ instance.BufferId ] = scalingList[
|
||||
scalingList.Count - 1 ];
|
||||
|
||||
instanceList.RemoveAt( instanceList.Count - 1 );
|
||||
coordList.RemoveAt( coordList.Count - 1 );
|
||||
@@ -181,18 +178,15 @@ namespace StgSharp.Geometries
|
||||
|
||||
public void UpdateAllParticles()
|
||||
{
|
||||
foreach (IInstancing particle in instanceList)
|
||||
{
|
||||
foreach( IInstancing particle in instanceList ) {
|
||||
particle.Move();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Dispose( bool disposing )
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if( !disposedValue ) {
|
||||
if( disposing ) {
|
||||
mutex.Dispose();
|
||||
}
|
||||
|
||||
@@ -205,21 +199,19 @@ namespace StgSharp.Geometries
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
foreach (IInstancing item in instanceList)
|
||||
{
|
||||
foreach( IInstancing item in instanceList ) {
|
||||
yield return ( T )item;
|
||||
}
|
||||
}
|
||||
|
||||
IGeometry IInstancingBuffer.TypicalShape => throw new NotImplementedException();
|
||||
IGeometry IInstancingBuffer.TypicalShape => throw new NotImplementedException(
|
||||
);
|
||||
|
||||
#region field of mem opt
|
||||
|
||||
vec4d[] coordArray;
|
||||
float[] scaleArray;
|
||||
private Vec4[] coordArray;
|
||||
private float[] scaleArray;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,50 +38,48 @@ namespace StgSharp.Geometries
|
||||
public class Parallelogram : Polygon4
|
||||
{
|
||||
|
||||
internal readonly Func<int, vec3d> movCenterOperation =
|
||||
new Func<int, vec3d>(GeometryOperation.DefaultMotion);
|
||||
internal readonly Func<int, Vec3> movCenterOperation =
|
||||
new Func<int, Vec3>( GeometryOperation.DefaultMotion );
|
||||
|
||||
internal Point center;
|
||||
|
||||
public Parallelogram(
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y
|
||||
) : base(
|
||||
v0x, v0y, v1x, v1y,
|
||||
v2x, v2y, v3x, v3y
|
||||
)
|
||||
float v0x,
|
||||
float v0y,
|
||||
float v1x,
|
||||
float v1y,
|
||||
float v2x,
|
||||
float v2y,
|
||||
float v3x,
|
||||
float v3y )
|
||||
: base( v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y )
|
||||
{
|
||||
#if DEBUG
|
||||
if (
|
||||
this[0].Coord + this[2].Coord !=
|
||||
this[1].Coord + this[3].Coord
|
||||
)
|
||||
{
|
||||
InternalIO.InternalWriteLog("Init of geometry item failed, because four vertices cannot form a rectangle.", LogType.Warning);
|
||||
if( this[ 0 ].Coord + this[ 2 ].Coord != this[ 1 ].Coord + this[ 3 ].Coord ) {
|
||||
InternalIO.InternalWriteLog(
|
||||
"Init of geometry item failed, because four vertices cannot form a rectangle.",
|
||||
LogType.Warning );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public Parallelogram(
|
||||
PlainCoordinate coordination,
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y
|
||||
) : base(coordination,
|
||||
v0x, v0y, v1x, v1y,
|
||||
v2x, v2y, v3x, v3y
|
||||
)
|
||||
float v0x,
|
||||
float v0y,
|
||||
float v1x,
|
||||
float v1y,
|
||||
float v2x,
|
||||
float v2y,
|
||||
float v3x,
|
||||
float v3y )
|
||||
: base( coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y )
|
||||
{
|
||||
#if DEBUG
|
||||
if (
|
||||
this[0].Coord + this[2].Coord !=
|
||||
this[1].Coord + this[3].Coord
|
||||
)
|
||||
{
|
||||
InternalIO.InternalWriteLog("Init of geometry item failed, because four vertices cannot form a rectangle.", LogType.Warning);
|
||||
if( this[ 0 ].Coord + this[ 2 ].Coord != this[ 1 ].Coord + this[ 3 ].Coord ) {
|
||||
InternalIO.InternalWriteLog(
|
||||
"Init of geometry item failed, because four vertices cannot form a rectangle.",
|
||||
LogType.Warning );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -38,21 +38,21 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
internal readonly float d = -1;
|
||||
internal vec3d origin;
|
||||
internal Vec3 origin;
|
||||
|
||||
internal vec3d plainParameter;
|
||||
internal vec3d vec1;
|
||||
internal vec3d vec2;
|
||||
internal Vec3 plainParameter;
|
||||
internal Vec3 vec1;
|
||||
internal Vec3 vec2;
|
||||
|
||||
internal Plain( Vector4 origin, Vector4 p1, Vector4 p2 )
|
||||
{
|
||||
this.origin = new vec3d(origin);
|
||||
this.origin = new Vec3( origin );
|
||||
|
||||
vec1 = new vec3d(p1 - origin);
|
||||
vec2 = new vec3d(p2 - origin);
|
||||
vec1 = new Vec3( p1 - origin );
|
||||
vec2 = new Vec3( p2 - origin );
|
||||
}
|
||||
|
||||
public Plain(vec3d o, vec3d v1, vec3d v2)
|
||||
public Plain( Vec3 o, Vec3 v1, Vec3 v2 )
|
||||
{
|
||||
this.origin = o;
|
||||
this.vec1 = v1 - ( v2 * ( v1.Y / v2.Y ) ); //计算平面在xz平面上的方向投影
|
||||
@@ -60,6 +60,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
//|origin|-k1*|vec1|-k2*|vec2|计算plainParameter.Z;
|
||||
plainParameter.Z = origin.Z - ( vec1.Z * ( origin.X / vec1.X ) ) - ( vec2.Z * ( origin.Y / vec2.Y ) );
|
||||
|
||||
//根据plainParameter.Z和对应的方向矢量计算plainParameter.X和plainParameter.Y
|
||||
plainParameter.X = vec1.X * ( vec1.Z / plainParameter.Z );
|
||||
plainParameter.Y = vec2.Y * ( vec2.Z / plainParameter.Z );
|
||||
@@ -71,9 +72,9 @@ namespace StgSharp.Geometries
|
||||
|
||||
public Plain( Point p1, Point p2, Point p3 )
|
||||
{
|
||||
vec3d origin = p1.Coord;
|
||||
vec3d v1 = p2.Coord - origin;
|
||||
vec3d v2 = p3.Coord - origin;
|
||||
Vec3 origin = p1.Coord;
|
||||
Vec3 v1 = p2.Coord - origin;
|
||||
Vec3 v2 = p3.Coord - origin;
|
||||
|
||||
|
||||
vec1 = v1 - ( v2 * ( v1.Y / v2.Y ) ); //计算平面在xz平面上的方向投影
|
||||
@@ -81,6 +82,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
//|origin|-k1*|vec1|-k2*|vec2|计算plainParameter.Z;
|
||||
plainParameter.Z = origin.Z - ( vec1.Z * ( origin.X / vec1.X ) ) - ( vec2.Z * ( origin.Y / vec2.Y ) );
|
||||
|
||||
//根据plainParameter.Z和对应的方向矢量计算plainParameter.X和plainParameter.Y
|
||||
plainParameter.X = vec1.X * ( vec1.Z / plainParameter.Z );
|
||||
plainParameter.Y = vec2.Y * ( vec2.Z / plainParameter.Z );
|
||||
|
||||
@@ -41,16 +41,16 @@ namespace StgSharp.Geometries
|
||||
|
||||
protected static int[] Indices = [0, 1, 2, 0, 2, 3];
|
||||
|
||||
internal Polygon4() : base(PlainCoordinate.StandardPlainCoordination)
|
||||
internal Polygon4()
|
||||
: base( PlainCoordinate.StandardPlainCoordination )
|
||||
{
|
||||
vertexMat = new vec4d[4];
|
||||
vertexMat = new Vec4[4];
|
||||
}
|
||||
|
||||
internal Polygon4(vec4d[] rawCoord) :
|
||||
base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
if (rawCoord.Length != 4)
|
||||
internal Polygon4( Vec4[] rawCoord )
|
||||
: base( PlainCoordinate.StandardPlainCoordination )
|
||||
{
|
||||
if( rawCoord.Length != 4 ) {
|
||||
throw new ArgumentOutOfRangeException( nameof( rawCoord ) );
|
||||
}
|
||||
vertexMat = rawCoord;
|
||||
@@ -60,40 +60,42 @@ namespace StgSharp.Geometries
|
||||
Point topLeft,
|
||||
Point topRight,
|
||||
Point bottomRight,
|
||||
Point bottomLeft
|
||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
||||
Point bottomLeft )
|
||||
: base( PlainCoordinate.StandardPlainCoordination )
|
||||
{
|
||||
this[ 0 ] = topLeft;
|
||||
this[ 1 ] = topRight;
|
||||
this[ 2 ] = bottomRight;
|
||||
this[ 3 ] = bottomLeft;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Polygon4(CoordinationBase coordinate,
|
||||
public Polygon4(
|
||||
CoordinationBase coordinate,
|
||||
PlainCoordinate coordination,
|
||||
Point topLeft,
|
||||
Point topRight,
|
||||
Point bottomRight,
|
||||
Point bottomLeft
|
||||
) : base(coordinate)
|
||||
Point bottomLeft )
|
||||
: base( coordinate )
|
||||
{
|
||||
this[ 0 ] = topLeft;
|
||||
this[ 1 ] = topRight;
|
||||
this[ 2 ] = bottomRight;
|
||||
this[ 3 ] = bottomLeft;
|
||||
|
||||
}
|
||||
|
||||
public Polygon4(
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y
|
||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
||||
float v0x,
|
||||
float v0y,
|
||||
float v1x,
|
||||
float v1y,
|
||||
float v2x,
|
||||
float v2y,
|
||||
float v3x,
|
||||
float v3y )
|
||||
: base( PlainCoordinate.StandardPlainCoordination )
|
||||
{
|
||||
vertexMat = new vec4d[4];
|
||||
vertexMat = new Vec4[4];
|
||||
|
||||
this[ 0 ] = new Point( v0x, v0y, 0 );
|
||||
this[ 1 ] = new Point( v1x, v1y, 0 );
|
||||
@@ -103,13 +105,17 @@ namespace StgSharp.Geometries
|
||||
|
||||
public Polygon4(
|
||||
PlainCoordinate coordination,
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y
|
||||
) : base(coordination)
|
||||
float v0x,
|
||||
float v0y,
|
||||
float v1x,
|
||||
float v1y,
|
||||
float v2x,
|
||||
float v2y,
|
||||
float v3x,
|
||||
float v3y )
|
||||
: base( coordination )
|
||||
{
|
||||
vertexMat = new vec4d[4];
|
||||
vertexMat = new Vec4[4];
|
||||
|
||||
this[ 0 ] = new Point( v0x, v0y, 0 );
|
||||
this[ 1 ] = new Point( v1x, v1y, 0 );
|
||||
|
||||
@@ -41,20 +41,26 @@ namespace StgSharp.Geometries
|
||||
|
||||
internal static int[] Indices = [0, 1, 2, 0, 2, 3, 0, 3, 4];
|
||||
|
||||
public unsafe Polygon5() : base(PlainCoordinate.StandardPlainCoordination)
|
||||
public unsafe Polygon5()
|
||||
: base( PlainCoordinate.StandardPlainCoordination )
|
||||
{
|
||||
vertexMat = new vec4d[5];
|
||||
vertexMat = new Vec4[5];
|
||||
}
|
||||
|
||||
public Polygon5(
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y,
|
||||
float v4x, float v4y
|
||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
||||
float v0x,
|
||||
float v0y,
|
||||
float v1x,
|
||||
float v1y,
|
||||
float v2x,
|
||||
float v2y,
|
||||
float v3x,
|
||||
float v3y,
|
||||
float v4x,
|
||||
float v4y )
|
||||
: base( PlainCoordinate.StandardPlainCoordination )
|
||||
{
|
||||
vertexMat = new vec4d[5];
|
||||
vertexMat = new Vec4[5];
|
||||
this[ 0 ] = new Point( v0x, v0y, 0 );
|
||||
this[ 1 ] = new Point( v1x, v1y, 0 );
|
||||
this[ 2 ] = new Point( v2x, v2y, 0 );
|
||||
@@ -64,14 +70,19 @@ namespace StgSharp.Geometries
|
||||
|
||||
public Polygon5(
|
||||
PlainCoordinate coordination,
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y,
|
||||
float v4x, float v4y
|
||||
) : base(coordination)
|
||||
float v0x,
|
||||
float v0y,
|
||||
float v1x,
|
||||
float v1y,
|
||||
float v2x,
|
||||
float v2y,
|
||||
float v3x,
|
||||
float v3y,
|
||||
float v4x,
|
||||
float v4y )
|
||||
: base( coordination )
|
||||
{
|
||||
vertexMat = new vec4d[5];
|
||||
vertexMat = new Vec4[5];
|
||||
this[ 0 ] = new Point( v0x, v0y, 0 );
|
||||
this[ 1 ] = new Point( v1x, v1y, 0 );
|
||||
this[ 2 ] = new Point( v2x, v2y, 0 );
|
||||
|
||||
@@ -41,23 +41,24 @@ namespace StgSharp.Geometries
|
||||
|
||||
internal static int[] Indices = [0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5];
|
||||
|
||||
public Polygon6() : base(PlainCoordinate.StandardPlainCoordination)
|
||||
public Polygon6()
|
||||
: base( PlainCoordinate.StandardPlainCoordination )
|
||||
{
|
||||
vertexMat = new vec4d[6];
|
||||
vertexMat = new Vec4[6];
|
||||
}
|
||||
|
||||
public Polygon6(
|
||||
PlainCoordinate coordination,
|
||||
vec2d vert0,
|
||||
vec2d vert1,
|
||||
vec2d vert2,
|
||||
vec2d vert3,
|
||||
vec2d vert4,
|
||||
vec2d vert5,
|
||||
vec2d vert6
|
||||
) : base(coordination)
|
||||
Vec2 vert0,
|
||||
Vec2 vert1,
|
||||
Vec2 vert2,
|
||||
Vec2 vert3,
|
||||
Vec2 vert4,
|
||||
Vec2 vert5,
|
||||
Vec2 vert6 )
|
||||
: base( coordination )
|
||||
{
|
||||
vertexMat = new vec4d[6];
|
||||
vertexMat = new Vec4[6];
|
||||
vertexMat[ 0 ].vec = vert0.vec;
|
||||
vertexMat[ 1 ].vec = vert1.vec;
|
||||
vertexMat[ 2 ].vec = vert2.vec;
|
||||
|
||||
@@ -38,46 +38,41 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
public Rectangle(
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y
|
||||
) : base(
|
||||
v0x, v0y,
|
||||
v1x, v1y,
|
||||
v2x, v2y,
|
||||
v3x, v3y
|
||||
)
|
||||
float v0x,
|
||||
float v0y,
|
||||
float v1x,
|
||||
float v1y,
|
||||
float v2x,
|
||||
float v2y,
|
||||
float v3x,
|
||||
float v3y )
|
||||
: base( v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y )
|
||||
{
|
||||
#if DEBUG
|
||||
vec2d side0 = (this[0].Coord - this[1].Coord).XY;
|
||||
vec2d side1 = (this[2].Coord - this[1].Coord).XY;
|
||||
if (side0.Cross(side1) == 0)
|
||||
{
|
||||
Vec2 side0 = ( this[ 0 ].Coord - this[ 1 ].Coord ).XY;
|
||||
Vec2 side1 = ( this[ 2 ].Coord - this[ 1 ].Coord ).XY;
|
||||
if( side0.Cross( side1 ) == 0 ) {
|
||||
throw new ArgumentException();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public Rectangle(
|
||||
PlainCoordinate coordination,
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y
|
||||
) : base(coordination,
|
||||
v0x, v0y,
|
||||
v1x, v1y,
|
||||
v2x, v2y,
|
||||
v3x, v3y
|
||||
)
|
||||
float v0x,
|
||||
float v0y,
|
||||
float v1x,
|
||||
float v1y,
|
||||
float v2x,
|
||||
float v2y,
|
||||
float v3x,
|
||||
float v3y )
|
||||
: base( coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y )
|
||||
{
|
||||
#if DEBUG
|
||||
vec2d side0 = (this[0].Coord - this[1].Coord).XY;
|
||||
vec2d side1 = (this[2].Coord - this[1].Coord).XY;
|
||||
if (side0.Cross(side1) == 0)
|
||||
{
|
||||
Vec2 side0 = ( this[ 0 ].Coord - this[ 1 ].Coord ).XY;
|
||||
Vec2 side1 = ( this[ 2 ].Coord - this[ 1 ].Coord ).XY;
|
||||
if( side0.Cross( side1 ) == 0 ) {
|
||||
throw new ArgumentException();
|
||||
}
|
||||
#endif
|
||||
@@ -88,9 +83,9 @@ namespace StgSharp.Geometries
|
||||
/// </summary>
|
||||
/// <param name="tick"> CurrentBlueprint time tick </param>
|
||||
/// <returns></returns>
|
||||
public virtual vec3d MovCenter(uint tick)
|
||||
public virtual Vec3 MovCenter( uint tick )
|
||||
{
|
||||
return default(vec3d);
|
||||
return default( Vec3 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user