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": {
|
"sources": {
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("BenchMark")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("BenchMark")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("BenchMark")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("BenchMark")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("BenchMark")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("BenchMark")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("BenchMark")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("BenchMark")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("BenchMark")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("BenchMark")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[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": {
|
"sources": {
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("OEM")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("OEM")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("OEM")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("OEM")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("OEM")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
],
|
],
|
||||||
"sources": {
|
"sources": {
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
@@ -115,7 +114,6 @@
|
|||||||
],
|
],
|
||||||
"sources": {
|
"sources": {
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|||||||
@@ -228,7 +228,6 @@
|
|||||||
],
|
],
|
||||||
"sources": {
|
"sources": {
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|||||||
@@ -8,21 +8,15 @@
|
|||||||
".NETCoreApp,Version=v6.0": {
|
".NETCoreApp,Version=v6.0": {
|
||||||
"StgSharpDebug/1.0.0": {
|
"StgSharpDebug/1.0.0": {
|
||||||
"dependencies": {
|
"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": {
|
"runtime": {
|
||||||
"StgSharpDebug.dll": {}
|
"StgSharpDebug.dll": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"BidirectionalDict/1.2.0": {
|
"Microsoft.NETCore.Platforms/1.1.0": {},
|
||||||
"runtime": {
|
"Microsoft.NETCore.Targets/1.1.0": {},
|
||||||
"lib/netcoreapp3.1/BidirectionalDict.dll": {
|
|
||||||
"assemblyVersion": "1.2.0.0",
|
|
||||||
"fileVersion": "1.2.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Microsoft.Windows.CsWin32/0.3.49-beta": {
|
"Microsoft.Windows.CsWin32/0.3.49-beta": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.Windows.SDK.Win32Docs": "0.1.42-alpha",
|
"Microsoft.Windows.SDK.Win32Docs": "0.1.42-alpha",
|
||||||
@@ -39,8 +33,117 @@
|
|||||||
"Microsoft.Windows.SDK.Win32Metadata": "55.0.45-preview"
|
"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.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": {
|
"libraries": {
|
||||||
@@ -49,12 +152,19 @@
|
|||||||
"serviceable": false,
|
"serviceable": false,
|
||||||
"sha512": ""
|
"sha512": ""
|
||||||
},
|
},
|
||||||
"BidirectionalDict/1.2.0": {
|
"Microsoft.NETCore.Platforms/1.1.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-hjLTwpPTQBdseFVTVH1vf7Pbaj5ATKIM3DQN8Hup22ixyC14+r1bE4YFjtZmWfcegvJR74zYtatBTwpOHmIMNQ==",
|
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
|
||||||
"path": "bidirectionaldict/1.2.0",
|
"path": "microsoft.netcore.platforms/1.1.0",
|
||||||
"hashPath": "bidirectionaldict.1.2.0.nupkg.sha512"
|
"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": {
|
"Microsoft.Windows.CsWin32/0.3.49-beta": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -84,6 +194,48 @@
|
|||||||
"path": "microsoft.windows.wdk.win32metadata/0.9.9-experimental",
|
"path": "microsoft.windows.wdk.win32metadata/0.9.9-experimental",
|
||||||
"hashPath": "microsoft.windows.wdk.win32metadata.0.9.9-experimental.nupkg.sha512"
|
"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": {
|
"System.Memory/4.5.5": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
@@ -91,12 +243,68 @@
|
|||||||
"path": "system.memory/4.5.5",
|
"path": "system.memory/4.5.5",
|
||||||
"hashPath": "system.memory.4.5.5.nupkg.sha512"
|
"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": {
|
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
|
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
|
||||||
"path": "system.runtime.compilerservices.unsafe/6.0.0",
|
"path": "system.runtime.compilerservices.unsafe/6.0.0",
|
||||||
"hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512"
|
"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 bool IsEntity => true;
|
||||||
public ReadOnlySpan<vec4d> TextureBox
|
|
||||||
|
public ReadOnlySpan<Vec4> TextureBox
|
||||||
{
|
{
|
||||||
get => throw new NotImplementedException();
|
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()
|
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,38 +53,48 @@ namespace StgSharp.Controls
|
|||||||
buttonList = new List<TriggerButton>();
|
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();
|
get => throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle BoundingBox { get; set; }
|
public Rectangle BoundingBox
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public TriggerButton CurrentButton
|
public TriggerButton CurrentButton
|
||||||
{
|
{
|
||||||
get => current;
|
get => current;
|
||||||
}
|
}
|
||||||
|
|
||||||
public vec2d Position { get; set; }
|
public Vec2 Position
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
protected List<TriggerButton> AllButton
|
protected List<TriggerButton> AllButton
|
||||||
{
|
{
|
||||||
get => buttonList;
|
get => buttonList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddButton(TriggerButton button)
|
public void AddButton( TriggerButton button )
|
||||||
{
|
{
|
||||||
buttonList.Add(button);
|
buttonList.Add( button );
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void Confirm();
|
public abstract void Confirm();
|
||||||
|
|
||||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||||
{
|
{
|
||||||
foreach (TriggerButton item in buttonList)
|
foreach( TriggerButton item in buttonList ) {
|
||||||
{
|
|
||||||
yield return item.Single();
|
yield return item.Single();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,12 +102,10 @@ namespace StgSharp.Controls
|
|||||||
public void MoveDown()
|
public void MoveDown()
|
||||||
{
|
{
|
||||||
TriggerButton button = current;
|
TriggerButton button = current;
|
||||||
while ((button.Down != null) && button.Down.IsDisabled)
|
while( ( button.Down != null ) && button.Down.IsDisabled ) {
|
||||||
{
|
|
||||||
button = button.Right;
|
button = button.Right;
|
||||||
}
|
}
|
||||||
if (current == button)
|
if( current == button ) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
current.DeHighlight();
|
current.DeHighlight();
|
||||||
@@ -108,12 +116,10 @@ namespace StgSharp.Controls
|
|||||||
public void MoveLeft()
|
public void MoveLeft()
|
||||||
{
|
{
|
||||||
TriggerButton button = current;
|
TriggerButton button = current;
|
||||||
while ((button.Left != null) && button.Left.IsDisabled)
|
while( ( button.Left != null ) && button.Left.IsDisabled ) {
|
||||||
{
|
|
||||||
button = button.Left;
|
button = button.Left;
|
||||||
}
|
}
|
||||||
if (current == button)
|
if( current == button ) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
current.DeHighlight();
|
current.DeHighlight();
|
||||||
@@ -124,12 +130,10 @@ namespace StgSharp.Controls
|
|||||||
public void MoveRight()
|
public void MoveRight()
|
||||||
{
|
{
|
||||||
TriggerButton button = current;
|
TriggerButton button = current;
|
||||||
while ((button.Right != null) && button.Right.IsDisabled)
|
while( ( button.Right != null ) && button.Right.IsDisabled ) {
|
||||||
{
|
|
||||||
button = button.Right;
|
button = button.Right;
|
||||||
}
|
}
|
||||||
if (current == button)
|
if( current == button ) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
current.DeHighlight();
|
current.DeHighlight();
|
||||||
@@ -140,12 +144,10 @@ namespace StgSharp.Controls
|
|||||||
public void MoveUp()
|
public void MoveUp()
|
||||||
{
|
{
|
||||||
TriggerButton button = current;
|
TriggerButton button = current;
|
||||||
while ((button.Up != null) && button.Up.IsDisabled)
|
while( ( button.Up != null ) && button.Up.IsDisabled ) {
|
||||||
{
|
|
||||||
button = button.Right;
|
button = button.Right;
|
||||||
}
|
}
|
||||||
if (current == button)
|
if( current == button ) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
current.DeHighlight();
|
current.DeHighlight();
|
||||||
|
|||||||
@@ -47,18 +47,21 @@ namespace StgSharp.Controls
|
|||||||
private char[] displayIndex;
|
private char[] displayIndex;
|
||||||
private char defaultChar;
|
private char defaultChar;
|
||||||
|
|
||||||
Dictionary<char, PlainGeometryMesh> texIndex;
|
private Dictionary<char, PlainGeometryMesh> texIndex;
|
||||||
private int length;
|
private int length;
|
||||||
PlainGeometryMesh _tittleMesh;
|
private PlainGeometryMesh _tittleMesh;
|
||||||
|
|
||||||
public CharacterLineIndexImage(
|
public CharacterLineIndexImage(
|
||||||
int length, char defaultChar, PlainGeometryMesh tittleMesh,
|
int length,
|
||||||
IEnumerable<(char, PlainGeometryMesh)> indexEnumeration)
|
char defaultChar,
|
||||||
|
PlainGeometryMesh tittleMesh,
|
||||||
|
IEnumerable<(char, PlainGeometryMesh)> indexEnumeration )
|
||||||
{
|
{
|
||||||
this.length = length;
|
this.length = length;
|
||||||
displayIndex = new char[length];
|
displayIndex = new char[length];
|
||||||
_tittleMesh = tittleMesh;
|
_tittleMesh = tittleMesh;
|
||||||
texIndex = indexEnumeration.ToDictionary(item => item.Item1, item => item.Item2);
|
texIndex = indexEnumeration.ToDictionary(
|
||||||
|
item => item.Item1, item => item.Item2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEntity
|
public bool IsEntity
|
||||||
@@ -66,23 +69,32 @@ namespace StgSharp.Controls
|
|||||||
get => true;
|
get => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReadOnlySpan<vec4d> TextureBox
|
public ReadOnlySpan<Vec4> TextureBox
|
||||||
{
|
{
|
||||||
get => throw new NotSupportedException();
|
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 void Display(string message)
|
public Rectangle BoundingBox
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(message))
|
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 ) ) {
|
||||||
message = string.Empty;
|
message = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
string result = (message.Length >= length) ?
|
string result = ( message.Length >= length ) ?
|
||||||
message.Substring(message.Length - displayIndex.Length) :
|
message.Substring( message.Length - displayIndex.Length ) : message.PadLeft(
|
||||||
message.PadLeft(length, defaultChar);
|
length, defaultChar );
|
||||||
|
|
||||||
displayIndex = result.ToCharArray();
|
displayIndex = result.ToCharArray();
|
||||||
}
|
}
|
||||||
@@ -90,9 +102,8 @@ namespace StgSharp.Controls
|
|||||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||||
{
|
{
|
||||||
yield return _tittleMesh;
|
yield return _tittleMesh;
|
||||||
foreach (char item in displayIndex)
|
foreach( char item in displayIndex ) {
|
||||||
{
|
yield return texIndex[ item ];
|
||||||
yield return texIndex[item];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,12 +42,27 @@ namespace StgSharp.Controls
|
|||||||
public interface ControllingItem : IEnumerable<PlainGeometryMesh>
|
public interface ControllingItem : IEnumerable<PlainGeometryMesh>
|
||||||
{
|
{
|
||||||
|
|
||||||
public abstract bool IsEntity { get; }
|
public abstract bool IsEntity
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract ReadOnlySpan<vec4d> TextureBox { get; }
|
public abstract ReadOnlySpan<Vec4> TextureBox
|
||||||
public abstract Rectangle BoundingBox { get; set; }
|
{
|
||||||
public abstract vec2d Position { get; set; }
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Rectangle BoundingBox
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Vec2 Position
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,20 +44,30 @@ namespace StgSharp.Controls
|
|||||||
|
|
||||||
private PlainGeometryMesh renderMesh;
|
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 bool IsEntity => true;
|
||||||
|
|
||||||
public ReadOnlySpan<vec4d> TextureBox
|
public ReadOnlySpan<Vec4> TextureBox
|
||||||
{
|
{
|
||||||
get => renderMesh.TextureCoord;
|
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()
|
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,40 +48,49 @@ namespace StgSharp.Controls
|
|||||||
|
|
||||||
private TimeFunction _movement;
|
private TimeFunction _movement;
|
||||||
|
|
||||||
private vec2d _currentPosition, _movementVec;
|
private Vec2 _currentPosition, _movementVec;
|
||||||
|
|
||||||
public MarkingLabel(PlainGeometryMesh marker, TimeFunction movement)
|
public MarkingLabel( PlainGeometryMesh marker, TimeFunction movement )
|
||||||
{
|
{
|
||||||
this.marker = marker;
|
this.marker = marker;
|
||||||
_movement = movement;
|
_movement = movement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEntity => true;
|
public bool IsEntity => true;
|
||||||
public ReadOnlySpan<vec4d> TextureBox
|
|
||||||
|
public ReadOnlySpan<Vec4> TextureBox
|
||||||
{
|
{
|
||||||
get => marker.TextureCoord;
|
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()
|
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||||
{
|
{
|
||||||
yield return marker;
|
yield return marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Move(vec2d movement)
|
public void Move( Vec2 movement )
|
||||||
{
|
{
|
||||||
if (!_movement.IsComplete)
|
if( !_movement.IsComplete ) {
|
||||||
{
|
Position = _currentPosition + ( _movement.Calculate() * _movementVec );
|
||||||
Position = _currentPosition + (_movement.Calculate() * _movementVec);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveTo(vec2d target)
|
public void MoveTo( Vec2 target )
|
||||||
{
|
{
|
||||||
Move(target - Position);
|
Move( target - Position );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,11 +40,14 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Controls
|
namespace StgSharp.Controls
|
||||||
{
|
{
|
||||||
|
public delegate void RenderButtonTextureCallback(
|
||||||
public delegate void RenderButtonTextureCallback(ButtonStatus status, float beginTime, in TextureProvider texture);
|
ButtonStatus status,
|
||||||
|
float beginTime,
|
||||||
|
in TextureProvider texture );
|
||||||
|
|
||||||
public enum ButtonStatus
|
public enum ButtonStatus
|
||||||
{
|
{
|
||||||
|
|
||||||
Error = 0b0,
|
Error = 0b0,
|
||||||
Disable = 0b1,
|
Disable = 0b1,
|
||||||
Enable = 0b10,
|
Enable = 0b10,
|
||||||
@@ -52,12 +55,13 @@ namespace StgSharp.Controls
|
|||||||
Confirm = 0b1000,
|
Confirm = 0b1000,
|
||||||
|
|
||||||
DisableToEnable = Disable | Enable,
|
DisableToEnable = Disable | Enable,
|
||||||
EnableToDisable = -(Enable | DisableToEnable),
|
EnableToDisable = -( Enable | DisableToEnable ),
|
||||||
|
|
||||||
EnableToHighlight = Enable | Highlight,
|
EnableToHighlight = Enable | Highlight,
|
||||||
HighlightToEnable = -(Enable | Highlight),
|
HighlightToEnable = -( Enable | Highlight ),
|
||||||
|
|
||||||
|
HighlightToDisable = -( Highlight | Disable ),
|
||||||
|
|
||||||
HighlightToDisable = -(Highlight | Disable),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TriggerButton : ControllingItem
|
public class TriggerButton : ControllingItem
|
||||||
@@ -66,14 +70,14 @@ namespace StgSharp.Controls
|
|||||||
private Action? confirmCallback;
|
private Action? confirmCallback;
|
||||||
private Action? disableCallback;
|
private Action? disableCallback;
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
private Action? enableCallback;
|
private Action? enableCallback;
|
||||||
private float _statusBeginTime;
|
private float _statusBeginTime;
|
||||||
|
|
||||||
private RenderButtonTextureCallback _renderButton;
|
private RenderButtonTextureCallback _renderButton;
|
||||||
private TextureProvider _texture;
|
private TextureProvider _texture;
|
||||||
|
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
||||||
public TriggerButton()
|
public TriggerButton()
|
||||||
{
|
{
|
||||||
@@ -102,41 +106,74 @@ namespace StgSharp.Controls
|
|||||||
{
|
{
|
||||||
add
|
add
|
||||||
{
|
{
|
||||||
if (_renderButton == null)
|
if( _renderButton == null ) {
|
||||||
{
|
|
||||||
_renderButton = value;
|
_renderButton = value;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
_renderButton += value;
|
_renderButton += value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
remove
|
remove
|
||||||
{
|
{
|
||||||
if (_renderButton != null)
|
if( _renderButton != null ) {
|
||||||
{
|
|
||||||
_renderButton -= value;
|
_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 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 Rectangle BoundingBox
|
||||||
public TriggerButton Right { get; internal set; }
|
{
|
||||||
public TriggerButton Up { get; internal set; }
|
get;
|
||||||
public TriggerButton Down { get; internal set; }
|
set;
|
||||||
public vec2d Position { 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
|
internal TextureProvider Texture
|
||||||
{
|
{
|
||||||
@@ -144,12 +181,15 @@ namespace StgSharp.Controls
|
|||||||
set => _texture = value;
|
set => _texture = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ButtonStatus CurrentStatus { get; set; }
|
protected ButtonStatus CurrentStatus
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public void DeHighlight()
|
public void DeHighlight()
|
||||||
{
|
{
|
||||||
if (CurrentStatus == ButtonStatus.Highlight)
|
if( CurrentStatus == ButtonStatus.Highlight ) {
|
||||||
{
|
|
||||||
CurrentStatus = ButtonStatus.HighlightToEnable;
|
CurrentStatus = ButtonStatus.HighlightToEnable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,54 +202,44 @@ namespace StgSharp.Controls
|
|||||||
ButtonStatus.Highlight => ButtonStatus.HighlightToDisable,
|
ButtonStatus.Highlight => ButtonStatus.HighlightToDisable,
|
||||||
_ => CurrentStatus,
|
_ => CurrentStatus,
|
||||||
};
|
};
|
||||||
if (disableCallback != null)
|
if( disableCallback != null ) {
|
||||||
{
|
|
||||||
disableCallback();
|
disableCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Enable()
|
public void Enable()
|
||||||
{
|
{
|
||||||
if (CurrentStatus == ButtonStatus.Disable)
|
if( CurrentStatus == ButtonStatus.Disable ) {
|
||||||
{
|
|
||||||
CurrentStatus = ButtonStatus.DisableToEnable;
|
CurrentStatus = ButtonStatus.DisableToEnable;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (enableCallback != null)
|
if( enableCallback != null ) {
|
||||||
{
|
|
||||||
enableCallback();
|
enableCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
public IEnumerator<PlainGeometryMesh> GetEnumerator()
|
||||||
{
|
{
|
||||||
_renderButton(CurrentStatus, _statusBeginTime, in _texture);
|
_renderButton( CurrentStatus, _statusBeginTime, in _texture );
|
||||||
yield return new PlainGeometryMesh(this.BoundingBox, _texture);
|
yield return new PlainGeometryMesh( this.BoundingBox, _texture );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Highlight()
|
public void Highlight()
|
||||||
{
|
{
|
||||||
if (CurrentStatus == ButtonStatus.Enable)
|
if( CurrentStatus == ButtonStatus.Enable ) {
|
||||||
{
|
|
||||||
CurrentStatus |= ButtonStatus.EnableToHighlight;
|
CurrentStatus |= ButtonStatus.EnableToHighlight;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (confirmCallback != null)
|
if( confirmCallback != null ) {
|
||||||
{
|
|
||||||
confirmCallback();
|
confirmCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Init(ButtonStatus status)
|
internal void Init( ButtonStatus status )
|
||||||
{
|
{
|
||||||
if (CurrentStatus == ButtonStatus.Error)
|
if( CurrentStatus == ButtonStatus.Error ) {
|
||||||
{
|
|
||||||
CurrentStatus = status;
|
CurrentStatus = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,31 +40,55 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
internal static partial class InternalIO
|
internal static partial class InternalIO
|
||||||
{
|
{
|
||||||
|
|
||||||
#region ssgc api define
|
#region ssgc api define
|
||||||
|
|
||||||
[DllImport(SSC_libName, EntryPoint = "initGL",
|
[DllImport(
|
||||||
CallingConvention = CallingConvention.Cdecl)]
|
SSC_libName,
|
||||||
internal static extern void InternalInitGL(int majorVersion, int minorVersion);
|
EntryPoint = "initGL",
|
||||||
|
CallingConvention = CallingConvention.Cdecl )]
|
||||||
|
internal static extern void InternalInitGL(
|
||||||
|
int majorVersion,
|
||||||
|
int minorVersion );
|
||||||
|
|
||||||
[DllImport(SSC_libName, EntryPoint = "loadGlfuncDefault",
|
[DllImport(
|
||||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
SSC_libName,
|
||||||
internal static extern IntPtr InternalLoadGlfuncDefault(string name);
|
EntryPoint = "loadGlfuncDefault",
|
||||||
|
CallingConvention = CallingConvention.Cdecl,
|
||||||
|
CharSet = CharSet.Ansi )]
|
||||||
|
internal static extern IntPtr InternalLoadGlfuncDefault( string name );
|
||||||
|
|
||||||
[DllImport(SSC_libName, EntryPoint = "linkShaderProgram",
|
[DllImport(
|
||||||
CallingConvention = CallingConvention.Cdecl)]
|
SSC_libName,
|
||||||
internal static extern unsafe uint InternalLinkShaderProgram(OpenglContext* context, uint shaderProgram);
|
EntryPoint = "linkShaderProgram",
|
||||||
|
CallingConvention = CallingConvention.Cdecl )]
|
||||||
|
internal static extern unsafe uint InternalLinkShaderProgram(
|
||||||
|
OpenglContext* context,
|
||||||
|
uint shaderProgram );
|
||||||
|
|
||||||
[DllImport(SSC_libName, EntryPoint = "readLog",
|
[DllImport(
|
||||||
CallingConvention = CallingConvention.Cdecl)]
|
SSC_libName,
|
||||||
|
EntryPoint = "readLog",
|
||||||
|
CallingConvention = CallingConvention.Cdecl )]
|
||||||
internal static extern unsafe IntPtr InternalReadSSCLog();
|
internal static extern unsafe IntPtr InternalReadSSCLog();
|
||||||
|
|
||||||
[DllImport(SSC_libName, EntryPoint = "loadImageData",
|
[DllImport(
|
||||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
SSC_libName,
|
||||||
internal static extern unsafe void InternalLoadImage(string fileName, ImageInfo* output, ImageLoader loader);
|
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",
|
[DllImport(
|
||||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
SSC_libName,
|
||||||
internal static extern unsafe void InternalUnloadImage(ImageInfo* output);
|
EntryPoint = "unloadImageData",
|
||||||
|
CallingConvention = CallingConvention.Cdecl,
|
||||||
|
CharSet = CharSet.Ansi )]
|
||||||
|
internal static extern unsafe void InternalUnloadImage(
|
||||||
|
ImageInfo* output );
|
||||||
|
|
||||||
#endregion ssgc api define
|
#endregion ssgc api define
|
||||||
}
|
}
|
||||||
@@ -72,34 +96,42 @@ namespace StgSharp
|
|||||||
|
|
||||||
namespace StgSharp.Graphics
|
namespace StgSharp.Graphics
|
||||||
{
|
{
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
[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)]
|
[StructLayout( LayoutKind.Sequential )]
|
||||||
public struct OpenglContext
|
public struct OpenglContext
|
||||||
{
|
{
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals( object obj )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override unsafe int GetHashCode()
|
public override unsafe int GetHashCode()
|
||||||
{
|
{
|
||||||
fixed (OpenglContext* sptr = &this)
|
fixed( OpenglContext* sptr = &this ) {
|
||||||
{
|
|
||||||
return sptr->GetHashCode();
|
return sptr->GetHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator !=(OpenglContext left, OpenglContext right)
|
public static bool operator !=(
|
||||||
|
OpenglContext left,
|
||||||
|
OpenglContext right )
|
||||||
{
|
{
|
||||||
return !(left == right);
|
return !( left == right );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator ==(OpenglContext left, OpenglContext right)
|
public static bool operator ==(
|
||||||
|
OpenglContext left,
|
||||||
|
OpenglContext right )
|
||||||
{
|
{
|
||||||
return left.Equals(right);
|
return left.Equals( right );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region glapi
|
#region glapi
|
||||||
@@ -244,7 +276,7 @@ namespace StgSharp.Graphics
|
|||||||
internal unsafe delegate*<uint, IntPtr, UIntPtr, uint, ulong, bool, void> glBufferPageCommitmentMemNV;
|
internal unsafe delegate*<uint, IntPtr, UIntPtr, uint, ulong, bool, void> glBufferPageCommitmentMemNV;
|
||||||
internal unsafe delegate*<uint, uint, int, void> glBufferParameteriAPPLE;
|
internal unsafe delegate*<uint, uint, int, void> glBufferParameteriAPPLE;
|
||||||
internal unsafe delegate*<uint, UIntPtr, void*, uint, void> glBufferStorage;
|
internal unsafe delegate*<uint, UIntPtr, void*, uint, void> glBufferStorage;
|
||||||
[Obsolete("Param type uncertain", true)] internal unsafe delegate*<uint, IntPtr, UIntPtr, int, uint, void> glBufferStorageExternalEXT;
|
[Obsolete( "Param type uncertain", true )] internal unsafe delegate*<uint, IntPtr, UIntPtr, int, uint, void> glBufferStorageExternalEXT;
|
||||||
internal unsafe delegate*<uint, UIntPtr, uint, ulong, void> glBufferStorageMemEXT;
|
internal unsafe delegate*<uint, UIntPtr, uint, ulong, void> glBufferStorageMemEXT;
|
||||||
internal unsafe delegate*<uint, IntPtr, UIntPtr, void*, void> glBufferSubData;
|
internal unsafe delegate*<uint, IntPtr, UIntPtr, void*, void> glBufferSubData;
|
||||||
internal unsafe delegate*<uint, IntPtr, UIntPtr, void*, void> glBufferSubDataARB;
|
internal unsafe delegate*<uint, IntPtr, UIntPtr, void*, void> glBufferSubDataARB;
|
||||||
@@ -1425,7 +1457,7 @@ namespace StgSharp.Graphics
|
|||||||
internal unsafe delegate*<uint, IntPtr, UIntPtr, uint, ulong, bool, void> glNamedBufferPageCommitmentMemNV;
|
internal unsafe delegate*<uint, IntPtr, UIntPtr, uint, ulong, bool, void> glNamedBufferPageCommitmentMemNV;
|
||||||
internal unsafe delegate*<uint, UIntPtr, void*, uint, void> glNamedBufferStorage;
|
internal unsafe delegate*<uint, UIntPtr, void*, uint, void> glNamedBufferStorage;
|
||||||
internal unsafe delegate*<uint, UIntPtr, void*, uint, void> glNamedBufferStorageEXT;
|
internal unsafe delegate*<uint, UIntPtr, void*, uint, void> glNamedBufferStorageEXT;
|
||||||
[Obsolete("Param type uncertain", true)] internal unsafe delegate*<uint, IntPtr, UIntPtr, int, uint, void> glNamedBufferStorageExternalEXT;
|
[Obsolete( "Param type uncertain", true )] internal unsafe delegate*<uint, IntPtr, UIntPtr, int, uint, void> glNamedBufferStorageExternalEXT;
|
||||||
internal unsafe delegate*<uint, UIntPtr, uint, ulong, void> glNamedBufferStorageMemEXT;
|
internal unsafe delegate*<uint, UIntPtr, uint, ulong, void> glNamedBufferStorageMemEXT;
|
||||||
internal unsafe delegate*<uint, IntPtr, UIntPtr, void*, void> glNamedBufferSubData;
|
internal unsafe delegate*<uint, IntPtr, UIntPtr, void*, void> glNamedBufferSubData;
|
||||||
internal unsafe delegate*<uint, IntPtr, UIntPtr, void*, void> glNamedBufferSubDataEXT;
|
internal unsafe delegate*<uint, IntPtr, UIntPtr, void*, void> glNamedBufferSubDataEXT;
|
||||||
@@ -2103,7 +2135,7 @@ namespace StgSharp.Graphics
|
|||||||
internal unsafe delegate*<int, uint, double*, void> glUniform1dv;
|
internal unsafe delegate*<int, uint, double*, void> glUniform1dv;
|
||||||
internal unsafe delegate*<int, float, void> glUniform1f;
|
internal unsafe delegate*<int, float, void> glUniform1f;
|
||||||
internal unsafe delegate*<int, float, void> glUniform1fARB;
|
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, uint, float*, void> glUniform1fvARB;
|
||||||
internal unsafe delegate*<int, int, void> glUniform1i;
|
internal unsafe delegate*<int, int, void> glUniform1i;
|
||||||
internal unsafe delegate*<int, long, void> glUniform1i64ARB;
|
internal unsafe delegate*<int, long, void> glUniform1i64ARB;
|
||||||
@@ -2637,8 +2669,6 @@ namespace StgSharp.Graphics
|
|||||||
internal unsafe delegate*<uint, uint, int*, void> glWindowRectanglesEXT;
|
internal unsafe delegate*<uint, uint, int*, void> glWindowRectanglesEXT;
|
||||||
internal unsafe delegate*<uint, uint, uint, uint, uint, uint, void> glWriteMaskEXT;
|
internal unsafe delegate*<uint, uint, uint, uint, uint, uint, void> glWriteMaskEXT;
|
||||||
|
|
||||||
#endregion glapi
|
#endregion glapi
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,12 +28,14 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
using StgSharp.Data.Intrinsic;
|
||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Graphics.OpenGL;
|
using StgSharp.Graphics.OpenGL;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -47,11 +49,13 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
public enum LogType
|
public enum LogType
|
||||||
{
|
{
|
||||||
|
|
||||||
Error,
|
Error,
|
||||||
Warning,
|
Warning,
|
||||||
Info,
|
Info,
|
||||||
InfoError,
|
InfoError,
|
||||||
InfoWarning,
|
InfoWarning,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe partial class InternalIO
|
internal static unsafe partial class InternalIO
|
||||||
@@ -67,42 +71,45 @@ namespace StgSharp
|
|||||||
new Dictionary<TypeCode, uint>();
|
new Dictionary<TypeCode, uint>();
|
||||||
|
|
||||||
internal static readonly GCHandle ssc_logHandle =
|
internal static readonly GCHandle ssc_logHandle =
|
||||||
GCHandle.Alloc(new byte[512], GCHandleType.Pinned);
|
GCHandle.Alloc( new byte[512], GCHandleType.Pinned );
|
||||||
|
|
||||||
internal static IntPtr SSClibPtr = IntPtr.Zero;
|
internal static IntPtr SSClibPtr = IntPtr.Zero;
|
||||||
|
|
||||||
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1);
|
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(
|
||||||
|
1, 1 );
|
||||||
|
|
||||||
static InternalIO()
|
static InternalIO()
|
||||||
{
|
{
|
||||||
GLtype.Add(TypeCode.Single, GLconst.FLOAT);
|
GLtype.Add( TypeCode.Single, GLconst.FLOAT );
|
||||||
GLtype.Add(TypeCode.Int32, GLconst.INT);
|
GLtype.Add( TypeCode.Int32, GLconst.INT );
|
||||||
GLtype.Add(TypeCode.UInt32, GLconst.UNSIGNED_INT);
|
GLtype.Add( TypeCode.UInt32, GLconst.UNSIGNED_INT );
|
||||||
GLtype.Add(TypeCode.Int16, GLconst.SHORT);
|
GLtype.Add( TypeCode.Int16, GLconst.SHORT );
|
||||||
GLtype.Add(TypeCode.UInt16, GLconst.UNSIGNED_SHORT);
|
GLtype.Add( TypeCode.UInt16, GLconst.UNSIGNED_SHORT );
|
||||||
GLtype.Add(TypeCode.SByte, GLconst.BYTE);
|
GLtype.Add( TypeCode.SByte, GLconst.BYTE );
|
||||||
GLtype.Add(TypeCode.Byte, GLconst.UNSIGNED_BYTE);
|
GLtype.Add( TypeCode.Byte, GLconst.UNSIGNED_BYTE );
|
||||||
|
|
||||||
|
fixed( IntrinsicContext* cptr = &_intrinsicContext ) {
|
||||||
|
LoadIntrinsicFunction( cptr );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InternalAppendLog(string log)
|
internal static void InternalAppendLog( string log )
|
||||||
{
|
{
|
||||||
if (!File.Exists(SS_errorLog))
|
if( !File.Exists( SS_errorLog ) ) {
|
||||||
{
|
FileStream stream = File.Create( SS_errorLog );
|
||||||
FileStream stream = File.Create(SS_errorLog);
|
|
||||||
stream.Close();
|
stream.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
using (StreamWriter logStream = File.AppendText(SS_errorLog))
|
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
|
||||||
{
|
logStream.WriteLine( log );
|
||||||
logStream.WriteLine(log);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Not completed", true)]
|
[Obsolete( "Not completed", true )]
|
||||||
internal static IntPtr InternalLoadProc<T>(IntPtr lib, string name) where T : Delegate
|
internal static IntPtr InternalLoadProc<T>( IntPtr lib, string name )
|
||||||
|
where T: Delegate
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
IntPtr procPtr =
|
IntPtr procPtr =
|
||||||
#if WINDOWS
|
#if WINDOWS
|
||||||
IntPtr.Zero;
|
IntPtr.Zero;
|
||||||
@@ -110,48 +117,48 @@ namespace StgSharp
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
IntPtr.Zero;
|
IntPtr.Zero;
|
||||||
#endif
|
#endif
|
||||||
return procPtr;
|
return procPtr;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch( Exception ) {
|
||||||
{
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
internal static void InternalWriteLog( string logLine, LogType logType )
|
||||||
{
|
{
|
||||||
logSyncSemaphore.Wait();
|
logSyncSemaphore.Wait();
|
||||||
if (!File.Exists(SS_errorLog))
|
if( !File.Exists( SS_errorLog ) ) {
|
||||||
{
|
FileStream stream = File.Create( SS_errorLog );
|
||||||
FileStream stream = File.Create(SS_errorLog);
|
|
||||||
stream.Close();
|
stream.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
using (StreamWriter logStream = File.AppendText(SS_errorLog))
|
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
|
||||||
{
|
logStream.WriteLine(
|
||||||
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
|
$"{logType}\t{DateTime.Now.ToString("o")}" );
|
||||||
logStream.WriteLine(logLine);
|
logStream.WriteLine( logLine );
|
||||||
}
|
}
|
||||||
logSyncSemaphore.Release();
|
logSyncSemaphore.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
internal static void InternalWriteLog(
|
||||||
|
string beforeTime,
|
||||||
|
string logLine,
|
||||||
|
LogType logType )
|
||||||
{
|
{
|
||||||
logSyncSemaphore.Wait();
|
logSyncSemaphore.Wait();
|
||||||
if (!File.Exists(InternalIO.SS_errorLog))
|
if( !File.Exists( InternalIO.SS_errorLog ) ) {
|
||||||
{
|
FileStream stream = File.Create( InternalIO.SS_errorLog );
|
||||||
FileStream stream = File.Create(InternalIO.SS_errorLog);
|
|
||||||
stream.Close();
|
stream.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
using (StreamWriter logStream = File.AppendText(SS_errorLog))
|
using( StreamWriter logStream = File.AppendText( SS_errorLog ) ) {
|
||||||
{
|
logStream.WriteLine( beforeTime );
|
||||||
logStream.WriteLine(beforeTime);
|
logStream.WriteLine(
|
||||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
$"{logType}\t@\t{DateTime.Now.ToString("o")}" );
|
||||||
logStream.WriteLine(logLine);
|
logStream.WriteLine( logLine );
|
||||||
}
|
}
|
||||||
logSyncSemaphore.Release(1);
|
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
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage( AttributeTargets.Method )]
|
||||||
public class KeyEventAttribute : Attribute
|
public class KeyEventAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -44,27 +44,26 @@ namespace StgSharp
|
|||||||
internal int _keyStat;
|
internal int _keyStat;
|
||||||
internal int _keyTarget;
|
internal int _keyTarget;
|
||||||
|
|
||||||
public KeyEventAttribute(KeyboardKey key, KeyStatus status)
|
public KeyEventAttribute( KeyboardKey key, KeyStatus status )
|
||||||
{
|
{
|
||||||
_equipment = (int)InputEquipment.Keyboard;
|
_equipment = ( int )InputEquipment.Keyboard;
|
||||||
_keyTarget = (int)key;
|
_keyTarget = ( int )key;
|
||||||
_keyStat = (int)status;
|
_keyStat = ( int )status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyEventAttribute(Joystick joystick, KeyStatus status)
|
public KeyEventAttribute( Joystick joystick, KeyStatus status )
|
||||||
{
|
{
|
||||||
_equipment = (int)InputEquipment.Keyboard;
|
_equipment = ( int )InputEquipment.Keyboard;
|
||||||
_keyTarget = (int)joystick;
|
_keyTarget = ( int )joystick;
|
||||||
_keyStat = (int)status;
|
_keyStat = ( int )status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyEventAttribute(Mouse mouse, KeyStatus status)
|
public KeyEventAttribute( Mouse mouse, KeyStatus status )
|
||||||
{
|
{
|
||||||
_equipment = (int)InputEquipment.Keyboard;
|
_equipment = ( int )InputEquipment.Keyboard;
|
||||||
_keyTarget = (int)mouse;
|
_keyTarget = ( int )mouse;
|
||||||
_keyStat = (int)status;
|
_keyStat = ( int )status;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,47 +34,57 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Controlling.UsrActivity
|
namespace StgSharp.Controlling.UsrActivity
|
||||||
{
|
{
|
||||||
public struct JoystickTrigger : ITrigger, IEquatable<JoystickTrigger>
|
public readonly struct JoystickTrigger : IClickTrigger, IEquatable<JoystickTrigger>
|
||||||
{
|
{
|
||||||
|
|
||||||
private KeyStatus _triggeredStat;
|
private readonly Joystick _stick;
|
||||||
public 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
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
{
|
||||||
return base.Equals(obj);
|
get => _stick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeyStatus TriggeredStatus => _status;
|
||||||
|
|
||||||
|
public override bool Equals( object obj )
|
||||||
|
{
|
||||||
|
return base.Equals( obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
return ((int)Stick) + (17 * ((int)_triggeredStat));
|
return ( ( int )_stick ) + ( 17 * ( ( int )_status ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
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);
|
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)
|
bool IEquatable<JoystickTrigger>.Equals( JoystickTrigger other )
|
||||||
{
|
{
|
||||||
return other == this;
|
return other == this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,31 +35,30 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Controlling.UsrActivity
|
namespace StgSharp.Controlling.UsrActivity
|
||||||
{
|
{
|
||||||
|
public readonly struct KeyTrigger : IClickTrigger, IEquatable<KeyTrigger>
|
||||||
public struct KeyTrigger : ITrigger, IEquatable<KeyTrigger>
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private KeyboardKey _targetKey;
|
private readonly KeyboardKey _targetKey;
|
||||||
private KeyStatus _triggerStat;
|
private readonly KeyStatus _triggerStat;
|
||||||
|
|
||||||
public KeyTrigger(KeyboardKey targetKey, KeyStatus targetStat)
|
public KeyTrigger( KeyboardKey targetKey, KeyStatus targetStat )
|
||||||
{
|
{
|
||||||
this._targetKey = targetKey;
|
this._targetKey = targetKey;
|
||||||
this._triggerStat = targetStat;
|
this._triggerStat = targetStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int TargetKeyOrButtonID => (int)_targetKey;
|
public int TargetKeyOrButtonID => ( int )_targetKey;
|
||||||
|
|
||||||
public KeyStatus TriggeredStatus => _triggerStat;
|
public KeyStatus TriggeredStatus => _triggerStat;
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals( object obj )
|
||||||
{
|
{
|
||||||
return base.Equals(obj);
|
return base.Equals( obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
return ((int)_targetKey) + (17 * ((int)_triggerStat));
|
return ( ( int )_targetKey ) + ( 17 * ( ( int )_triggerStat ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
@@ -67,17 +66,17 @@ namespace StgSharp.Controlling.UsrActivity
|
|||||||
return $"Key {_targetKey} triggered when {_triggerStat}";
|
return $"Key {_targetKey} triggered when {_triggerStat}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator !=(KeyTrigger left, KeyTrigger right)
|
public static bool operator !=( KeyTrigger left, KeyTrigger right )
|
||||||
{
|
{
|
||||||
return !(left == right);
|
return !( left == right );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator ==(KeyTrigger left, KeyTrigger right)
|
public static bool operator ==( KeyTrigger left, KeyTrigger right )
|
||||||
{
|
{
|
||||||
return (left._triggerStat == right._triggerStat) && (left._targetKey == right._targetKey);
|
return ( left._triggerStat == right._triggerStat ) && ( left._targetKey == right._targetKey );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IEquatable<KeyTrigger>.Equals(KeyTrigger other)
|
bool IEquatable<KeyTrigger>.Equals( KeyTrigger other )
|
||||||
{
|
{
|
||||||
return other == this;
|
return other == this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}//------------------ end of class ---------------------
|
}//------------------ end of class ---------------------
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,8 +96,6 @@ namespace StgSharp
|
|||||||
}
|
}
|
||||||
""";
|
""";
|
||||||
|
|
||||||
#endregion
|
#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;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -46,38 +46,30 @@ namespace StgSharp.Data
|
|||||||
|
|
||||||
private byte[] currentKey;
|
private byte[] currentKey;
|
||||||
|
|
||||||
|
|
||||||
private readonly byte[] originKey;
|
private readonly byte[] originKey;
|
||||||
private int cycleCount;
|
private int cycleCount;
|
||||||
private SHA512 hash;
|
private SHA512 hash;
|
||||||
|
|
||||||
public RandomGenerator() : this(DateTime.UtcNow.ToBinary())
|
public RandomGenerator() : this( DateTime.UtcNow.ToBinary() ) { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
public RandomGenerator( object source )
|
||||||
|
|
||||||
public RandomGenerator(object source)
|
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
if( source == null ) {
|
||||||
if (source == null)
|
throw new ArgumentNullException( nameof( source ) );
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(source));
|
|
||||||
}
|
}
|
||||||
XmlSerializer s = new XmlSerializer(source.GetType());
|
XmlSerializer s = new XmlSerializer( source.GetType() );
|
||||||
using (StringWriter sw = new StringWriter())
|
using( StringWriter sw = new StringWriter() ) {
|
||||||
{
|
s.Serialize( sw, source );
|
||||||
s.Serialize(sw, source);
|
|
||||||
string data = sw.ToString();
|
string data = sw.ToString();
|
||||||
originKey = Encoding.UTF8.GetBytes(data);
|
originKey = Encoding.UTF8.GetBytes( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch( Exception ) {
|
||||||
{
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
hash = SHA512.Create();
|
hash = SHA512.Create();
|
||||||
originKey = hash.ComputeHash(originKey);
|
originKey = hash.ComputeHash( originKey );
|
||||||
currentKey = originKey;
|
currentKey = originKey;
|
||||||
cycleCount = 0;
|
cycleCount = 0;
|
||||||
}
|
}
|
||||||
@@ -105,54 +97,44 @@ namespace StgSharp.Data
|
|||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
return source.Read<int>(cycleCount % 4);
|
return source.Read<int>( cycleCount % 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte GenRandomInt8()
|
public byte GenRandomInt8()
|
||||||
{
|
{
|
||||||
cycleCount++;
|
cycleCount++;
|
||||||
if (cycleCount % 64 == 0)
|
if( cycleCount % 64 == 0 ) {
|
||||||
{
|
|
||||||
PrivateRand();
|
PrivateRand();
|
||||||
}
|
}
|
||||||
return currentKey[cycleCount % 64];
|
return currentKey[ cycleCount % 64 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GenRandomSingle()
|
public float GenRandomSingle()
|
||||||
{
|
{
|
||||||
cycleCount++;
|
cycleCount++;
|
||||||
|
|
||||||
while (true)
|
while( true ) {
|
||||||
{
|
|
||||||
M128 source = PrivateRand();
|
M128 source = PrivateRand();
|
||||||
|
|
||||||
uint
|
uint
|
||||||
temp0 = source.Read<uint>(0),
|
temp0 = source.Read<uint>( 0 ),
|
||||||
temp1 = source.Read<uint>(2);
|
temp1 = source.Read<uint>( 2 );
|
||||||
|
|
||||||
if (temp0 * temp1 != 0)
|
if( temp0 * temp1 != 0 ) {
|
||||||
{
|
float ret = ( ( temp0 % temp1 ) * 1.0f ) / temp1;
|
||||||
float ret = ((temp0 % temp1) * 1.0f) / temp1;
|
if( ret < 0.335f ) {
|
||||||
if (ret < 0.335f)
|
ret = ret * ( ( ret * ( -0.7811934f ) ) + 1.4489113f );
|
||||||
{
|
} else {
|
||||||
ret = ret * ((ret * (-0.7811934f)) + 1.4489113f);
|
ret = ( ret * ( ( ret * ( -0.1158368f ) ) + 1.0580600f ) ) + 0.0590584f;
|
||||||
}
|
}
|
||||||
else
|
if( ret > 1 ) {
|
||||||
{
|
|
||||||
ret = (ret * ((ret * (-0.1158368f)) + 1.0580600f)) + 0.0590584f;
|
|
||||||
}
|
|
||||||
if (ret > 1)
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
currentKey = originKey;
|
currentKey = originKey;
|
||||||
@@ -161,24 +143,27 @@ namespace StgSharp.Data
|
|||||||
|
|
||||||
private unsafe M128 PrivateRand()
|
private unsafe M128 PrivateRand()
|
||||||
{
|
{
|
||||||
currentKey = hash.ComputeHash(currentKey);
|
currentKey = hash.ComputeHash( currentKey );
|
||||||
M128 ret;
|
M128 ret;
|
||||||
fixed (byte* bptr = currentKey)
|
fixed( byte* bptr = currentKey ) {
|
||||||
{
|
switch( ( cycleCount % 16 ) / 4 ) {
|
||||||
switch ((cycleCount % 16) / 4)
|
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
ret = *(((M128*)bptr) + 0); break;
|
ret = *( ( ( M128* )bptr ) + 0 );
|
||||||
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ret = *(((M128*)bptr) + 1); break;
|
ret = *( ( ( M128* )bptr ) + 1 );
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ret = *(((M128*)bptr) + 2); break;
|
ret = *( ( ( M128* )bptr ) + 2 );
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ret = *(((M128*)bptr) + 3); break;
|
ret = *( ( ( M128* )bptr ) + 3 );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Console.WriteLine(ret.ToString(16));
|
//Console.WriteLine(ret.ToString(16));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,12 +39,9 @@ using System.Threading.Tasks;
|
|||||||
namespace StgSharp.Data
|
namespace StgSharp.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An independent storage area, used as the only folder type in root folder.
|
/// An independent storage area, used as the only folder type in root folder. Contains several
|
||||||
/// Contains several <see cref="SSD"/> files reference as virtual disc.
|
/// <see cref="SSD" /> files reference as virtual disc. Data is actually stored in <see
|
||||||
/// Data is actually stored in <see cref="SSD"/>s in certain RAID mode.
|
/// cref="SSD" />s in certain RAID mode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Area
|
public partial class Area { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
using StgSharp.Data.Intrinsic;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -38,52 +40,44 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Data
|
namespace StgSharp.Data
|
||||||
{
|
{
|
||||||
|
[StructLayout( LayoutKind.Explicit, Size = 16 )]
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
|
||||||
public struct SSDSegmentHead
|
public struct SSDSegmentHead
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[FieldOffset( 12 )] internal byte size;
|
||||||
|
|
||||||
[FieldOffset(12)] internal byte size;
|
[FieldOffset( 0 )] internal M128 data;
|
||||||
|
[FieldOffset( 13 )] public byte selfDefine_1;
|
||||||
[FieldOffset(0)] internal M128 data;
|
[FieldOffset( 14 )] public byte selfDefine_2;
|
||||||
[FieldOffset(13)] public byte selfDefine_1;
|
[FieldOffset( 15 )] public byte selfDefine_3;
|
||||||
[FieldOffset(14)] public byte selfDefine_2;
|
|
||||||
[FieldOffset(15)] public byte selfDefine_3;
|
|
||||||
|
|
||||||
[FieldOffset(0)] public int globalID;
|
|
||||||
[FieldOffset(4)] public int nextID;
|
|
||||||
[FieldOffset(8)] public int previousHash;
|
|
||||||
|
|
||||||
|
[FieldOffset( 0 )] public int globalID;
|
||||||
|
[FieldOffset( 4 )] public int nextID;
|
||||||
|
[FieldOffset( 8 )] public int previousHash;
|
||||||
|
|
||||||
public int Size
|
public int Size
|
||||||
{
|
{
|
||||||
get => ((int)size) + 1;
|
get => ( ( int )size ) + 1;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if ((value > 256) || (value < 0))
|
if( ( value > 256 ) || ( value < 0 ) ) {
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
size = (byte)(value - 1);
|
size = ( byte )( value - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe byte[] GetBytes()
|
public unsafe byte[] GetBytes()
|
||||||
{
|
{
|
||||||
byte[] ret = new byte[16];
|
byte[] ret = new byte[16];
|
||||||
fixed (Vector4* vptr = &data.vec)
|
fixed( Vector4* vptr = &data.vec ) {
|
||||||
{
|
byte* bptr = ( byte* )vptr;
|
||||||
byte* bptr = (byte*)vptr;
|
for( int i = 0; i < 15; i++ ) {
|
||||||
for (int i = 0; i < 15; i++)
|
ret[ i ] = *bptr;
|
||||||
{
|
|
||||||
ret[i] = *bptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
using StgSharp.Data.Intrinsic;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@@ -40,38 +41,37 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp.Data
|
namespace StgSharp.Data
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit, Size = StgSharp.ssdSegmentLength * 16)]
|
[StructLayout( LayoutKind.Explicit, Size = StgSharp.ssdSegmentLength * 16 )]
|
||||||
public unsafe struct SSDSegment : IComparable<int>, IComparable<SSDSegment>
|
public unsafe struct SSDSegment : IComparable<int>, IComparable<SSDSegment>
|
||||||
{
|
{
|
||||||
|
|
||||||
[FieldOffset(16)] public fixed byte Data[16 * (StgSharp.ssdSegmentLength - 1)];
|
[FieldOffset( 16 )] public fixed byte Data[
|
||||||
[FieldOffset(12)] public int DataHash;
|
16 * ( StgSharp.ssdSegmentLength - 1 ) ];
|
||||||
[FieldOffset(8)] public int PreviousHash;
|
[FieldOffset( 12 )] public int DataHash;
|
||||||
[FieldOffset(0 * 16)] public SSDSegmentHead Head;
|
[FieldOffset( 8 )] public int PreviousHash;
|
||||||
|
[FieldOffset( 0 * 16 )] public SSDSegmentHead Head;
|
||||||
|
|
||||||
public SSDSegment(int previousHash)
|
public SSDSegment( int previousHash )
|
||||||
{
|
{
|
||||||
this.PreviousHash = previousHash;
|
this.PreviousHash = previousHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte this[int index]
|
public byte this[ int index ]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (index > (16 * (StgSharp.ssdSegmentLength - 1)) - 1)
|
if( index > ( 16 * ( StgSharp.ssdSegmentLength - 1 ) ) - 1 ) {
|
||||||
{
|
|
||||||
throw new IndexOutOfRangeException();
|
throw new IndexOutOfRangeException();
|
||||||
}
|
}
|
||||||
return Data[index];
|
return Data[ index ];
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (index > (16 * (StgSharp.ssdSegmentLength - 1)) - 1)
|
if( index > ( 16 * ( StgSharp.ssdSegmentLength - 1 ) ) - 1 ) {
|
||||||
{
|
|
||||||
throw new IndexOutOfRangeException();
|
throw new IndexOutOfRangeException();
|
||||||
}
|
}
|
||||||
Data[index] = value;
|
Data[ index ] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,31 +83,27 @@ namespace StgSharp.Data
|
|||||||
|
|
||||||
public short Size => Head.size;
|
public short Size => Head.size;
|
||||||
|
|
||||||
public void FillRandomBytes(int begin)
|
public void FillRandomBytes( int begin )
|
||||||
{
|
{
|
||||||
if (begin > 255)
|
if( begin > 255 ) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = begin; i < 255; i++)
|
for( int i = begin; i < 255; i++ ) {
|
||||||
{
|
Data[ i ] = Scaler.Random<byte>(); //TODO: 使用STGSHARP内部随机数工具处理它
|
||||||
Data[i] = Scaler.Random<byte>(); //TODO: 使用STGSHARP内部随机数工具处理它
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SSDSegment FromStream(byte[] stream)
|
public static SSDSegment FromStream( byte[] stream )
|
||||||
{
|
{
|
||||||
if (stream.Length != 16 * StgSharp.ssdSegmentLength)
|
if( stream.Length != 16 * StgSharp.ssdSegmentLength ) {
|
||||||
{
|
|
||||||
throw new ArgumentException();
|
throw new ArgumentException();
|
||||||
}
|
}
|
||||||
SSDSegment ret = new SSDSegment();
|
SSDSegment ret = new SSDSegment();
|
||||||
fixed (byte* bptr = stream)
|
fixed( byte* bptr = stream ) {
|
||||||
{
|
ret.Head.data = *( M128* )bptr;
|
||||||
ret.Head.data = *(M128*)bptr;
|
for( int i = 1; i < StgSharp.ssdSegmentLength; i++ ) {
|
||||||
for (int i = 1; i < StgSharp.ssdSegmentLength; i++)
|
ret.WriteData<M128>(
|
||||||
{
|
i - 1, *( M128* )( bptr + ( 16 * i ) ) );
|
||||||
ret.WriteData<M128>(i - 1, *(M128*)(bptr + (16 * i)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@@ -116,15 +112,12 @@ namespace StgSharp.Data
|
|||||||
public byte[] GetBytes()
|
public byte[] GetBytes()
|
||||||
{
|
{
|
||||||
byte[] ret = new byte[16 * StgSharp.ssdSegmentLength];
|
byte[] ret = new byte[16 * StgSharp.ssdSegmentLength];
|
||||||
fixed (M128* mptr = &Head.data)
|
fixed( M128* mptr = &Head.data ) {
|
||||||
{
|
fixed( byte* aptr = ret ) {
|
||||||
fixed (byte* aptr = ret)
|
Vector4* vsptr = ( Vector4* )mptr;
|
||||||
{
|
Vector4* vtptr = ( Vector4* )aptr;
|
||||||
Vector4* vsptr = (Vector4*)mptr;
|
for( int i = 0; i < 18; i++ ) {
|
||||||
Vector4* vtptr = (Vector4*)aptr;
|
*( vtptr + i ) = *( vsptr + i );
|
||||||
for (int i = 0; i < 18; i++)
|
|
||||||
{
|
|
||||||
*(vtptr + i) = *(vsptr + i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,15 +128,13 @@ namespace StgSharp.Data
|
|||||||
public int GetDataHash()
|
public int GetDataHash()
|
||||||
{
|
{
|
||||||
Vector4 v = Vector4.One;
|
Vector4 v = Vector4.One;
|
||||||
fixed (M128* mptr = &Head.data)
|
fixed( M128* mptr = &Head.data ) {
|
||||||
{
|
Vector4* vptr = ( Vector4* )mptr;
|
||||||
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;
|
||||||
{
|
|
||||||
v += (*vptr) * 31;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
M128 m = new M128(v);
|
M128 m = new M128( v );
|
||||||
DataHash = m.vec.GetHashCode();
|
DataHash = m.vec.GetHashCode();
|
||||||
return DataHash;
|
return DataHash;
|
||||||
}
|
}
|
||||||
@@ -151,45 +142,40 @@ namespace StgSharp.Data
|
|||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
int ret = 17;
|
int ret = 17;
|
||||||
fixed (M128* mptr = &Head.data)
|
fixed( M128* mptr = &Head.data ) {
|
||||||
{
|
Vector4* vptr = ( Vector4* )mptr;
|
||||||
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;
|
||||||
{
|
|
||||||
ret = (ret + (*vptr).GetHashCode()) * 31;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe T ReadData<T>(int index) where T : struct
|
public unsafe T ReadData<T>( int index ) where T: struct
|
||||||
{
|
{
|
||||||
fixed (byte* bptr = Data)
|
fixed( byte* bptr = Data ) {
|
||||||
{
|
T* tptr = ( T* )bptr;
|
||||||
T* tptr = (T*)bptr;
|
return *( tptr + index );
|
||||||
return *(tptr + index);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe void WriteData<T>(int index, T value) where T : struct
|
public unsafe void WriteData<T>( int index, T value ) where T: struct
|
||||||
{
|
{
|
||||||
fixed (byte* bptr = Data)
|
fixed( byte* bptr = Data ) {
|
||||||
{
|
T* tptr = ( T* )bptr;
|
||||||
T* tptr = (T*)bptr;
|
*( tptr + index ) = value;
|
||||||
*(tptr + index) = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int IComparable<int>.CompareTo(int other)
|
int IComparable<int>.CompareTo( int other )
|
||||||
{
|
{
|
||||||
return ID.CompareTo(other);
|
return ID.CompareTo( other );
|
||||||
}
|
}
|
||||||
|
|
||||||
int IComparable<SSDSegment>.CompareTo(SSDSegment other)
|
int IComparable<SSDSegment>.CompareTo( SSDSegment other )
|
||||||
{
|
{
|
||||||
return ID.CompareTo(other.ID);
|
return ID.CompareTo( other.ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,17 +50,19 @@ namespace StgSharp.Data
|
|||||||
fileList = new Dictionary<string, SSDraw>();
|
fileList = new Dictionary<string, SSDraw>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SSD(FileStream fileStream)
|
public SSD( FileStream fileStream )
|
||||||
{
|
{
|
||||||
fileList = new Dictionary<string, SSDraw>();
|
fileList = new Dictionary<string, SSDraw>();
|
||||||
file = fileStream;
|
file = fileStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SSD FromFile(string fileRoute)
|
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 ) )
|
||||||
|
{
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,19 +49,15 @@ namespace StgSharp.Data
|
|||||||
folders = new Dictionary<string, SSDFolder>();
|
folders = new Dictionary<string, SSDFolder>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal SSDFolder(string name)
|
internal SSDFolder( string name )
|
||||||
{
|
{
|
||||||
if (name == "root")
|
if( name == "root" ) {
|
||||||
{
|
|
||||||
throw new ArgumentException(
|
throw new ArgumentException(
|
||||||
"Name cannot be root," +
|
"Name cannot be root," + "it is preserved for root file indexer." );
|
||||||
"it is preserved for root file indexer.");
|
|
||||||
}
|
}
|
||||||
if (name == "default")
|
if( name == "default" ) {
|
||||||
{
|
|
||||||
throw new ArgumentException(
|
throw new ArgumentException(
|
||||||
"Name cannot be default," +
|
"Name cannot be default," + "it is preserved for default file id provider." );
|
||||||
"it is preserved for default file id provider.");
|
|
||||||
}
|
}
|
||||||
_name = name;
|
_name = name;
|
||||||
folders = new Dictionary<string, SSDFolder>();
|
folders = new Dictionary<string, SSDFolder>();
|
||||||
@@ -69,12 +65,11 @@ namespace StgSharp.Data
|
|||||||
|
|
||||||
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.VirtualFolder;
|
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.VirtualFolder;
|
||||||
|
|
||||||
public void FromBytes(byte[] stream)
|
public void FromBytes( byte[] stream )
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO 虚拟文件夹的GetBytes好难写
|
//TODO 虚拟文件夹的GetBytes好难写
|
||||||
public byte[] GetBytes()
|
public byte[] GetBytes()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,28 +50,30 @@ namespace StgSharp.Data.FileIO
|
|||||||
|
|
||||||
private byte[] data;
|
private byte[] data;
|
||||||
|
|
||||||
public SSDraw(string name, Stream streamSource)
|
public SSDraw( string name, Stream streamSource )
|
||||||
{
|
{
|
||||||
if ((streamSource == null) || (streamSource.Length == 0))
|
if( ( streamSource == null ) || ( streamSource.Length == 0 ) ) {
|
||||||
{
|
throw new ArgumentNullException( nameof( streamSource ) );
|
||||||
throw new ArgumentNullException(nameof(streamSource));
|
|
||||||
}
|
}
|
||||||
Name = name;
|
Name = name;
|
||||||
data = new byte[streamSource.Length];
|
data = new byte[streamSource.Length];
|
||||||
streamSource.Read(data.AsSpan());
|
streamSource.Read( data.AsSpan() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public SSDrawHead Head { get; set; }
|
public SSDrawHead Head
|
||||||
public string Name { get; set; }
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout( LayoutKind.Explicit, Size = 32 * 16 )]
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 32 * 16)]
|
public unsafe struct SSDrawHead { }
|
||||||
public unsafe struct SSDrawHead
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,8 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Data
|
namespace StgSharp.Data
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A class contains a sets of methods to serialize several types
|
/// A class contains a sets of methods to serialize several types
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static partial class Serializer
|
public static partial class Serializer { }
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,20 +36,23 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp.Data
|
namespace StgSharp.Data
|
||||||
{
|
{
|
||||||
|
|
||||||
public interface ISSDSerializable
|
public interface ISSDSerializable
|
||||||
{
|
{
|
||||||
|
|
||||||
public SerializableTypeCode SSDTypeCode { get; }
|
public SerializableTypeCode SSDTypeCode
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] GetBytes();
|
public byte[] GetBytes();
|
||||||
|
|
||||||
internal void FromBytes(byte[] stream);
|
internal void FromBytes( byte[] stream );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SerializableTypeCode
|
public enum SerializableTypeCode
|
||||||
{
|
{
|
||||||
|
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
IndexTable = 1,
|
IndexTable = 1,
|
||||||
PixelImage = 2,
|
PixelImage = 2,
|
||||||
@@ -59,22 +62,23 @@ namespace StgSharp.Data
|
|||||||
Text = 6,
|
Text = 6,
|
||||||
RawData = 7,
|
RawData = 7,
|
||||||
VirtualFolder = int.MaxValue,
|
VirtualFolder = int.MaxValue,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static partial class Serializer
|
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>();
|
T serializableObject = Activator.CreateInstance<T>();
|
||||||
serializableObject.FromBytes(stream);
|
serializableObject.FromBytes( stream );
|
||||||
return serializableObject;
|
return serializableObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetNameTail(SerializableTypeCode typeCode)
|
public static string GetNameTail( SerializableTypeCode typeCode )
|
||||||
{
|
{
|
||||||
switch (typeCode)
|
switch( typeCode ) {
|
||||||
{
|
|
||||||
case SerializableTypeCode.IndexTable:
|
case SerializableTypeCode.IndexTable:
|
||||||
return "_idt";
|
return "_idt";
|
||||||
case SerializableTypeCode.PixelImage:
|
case SerializableTypeCode.PixelImage:
|
||||||
@@ -92,10 +96,11 @@ namespace StgSharp.Data
|
|||||||
case SerializableTypeCode.VirtualFolder:
|
case SerializableTypeCode.VirtualFolder:
|
||||||
return "_fod";
|
return "_fod";
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Unknown file type");
|
throw new ArgumentException( "Unknown file type" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static byte[] Serialize(ISSDSerializable serializableObject)
|
|
||||||
|
public static byte[] Serialize( ISSDSerializable serializableObject )
|
||||||
{
|
{
|
||||||
return serializableObject.GetBytes();
|
return serializableObject.GetBytes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,5 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
namespace StgSharp.Entities
|
namespace StgSharp.Entities
|
||||||
{
|
{
|
||||||
public abstract class BehaviorArgs
|
public abstract class BehaviorArgs { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@@ -43,9 +42,23 @@ namespace StgSharp.Entities
|
|||||||
internal LinkedList<Launcher<EntityPartical>> _commonBulletLauncher;
|
internal LinkedList<Launcher<EntityPartical>> _commonBulletLauncher;
|
||||||
public bool _selectalbe;
|
public bool _selectalbe;
|
||||||
|
|
||||||
public Launcher<EntityPartical> AwardLauncher { get; set; }
|
public Launcher<EntityPartical> AwardLauncher
|
||||||
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
{
|
||||||
public LinkedList<Launcher<EntityPartical>> CommonBulletLauncher { get; set; }
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Launcher<EntityPartical> DieBulletLauncher
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinkedList<Launcher<EntityPartical>> CommonBulletLauncher
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void OnRender()
|
public virtual void OnRender()
|
||||||
{
|
{
|
||||||
@@ -55,8 +68,7 @@ namespace StgSharp.Entities
|
|||||||
public override void OnRenderFrame()
|
public override void OnRenderFrame()
|
||||||
{
|
{
|
||||||
this.OnUpdate();
|
this.OnUpdate();
|
||||||
foreach (Launcher<EntityPartical> launcher in CommonBulletLauncher)
|
foreach( Launcher<EntityPartical> launcher in CommonBulletLauncher ) {
|
||||||
{
|
|
||||||
launcher.Launch();
|
launcher.Launch();
|
||||||
}
|
}
|
||||||
this.OnRender();
|
this.OnRender();
|
||||||
@@ -67,6 +79,5 @@ namespace StgSharp.Entities
|
|||||||
new NotImplementedException();
|
new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,6 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
namespace StgSharp.Entities
|
namespace StgSharp.Entities
|
||||||
{
|
{
|
||||||
public class Enemy : IEntity
|
public class Enemy : IEntity
|
||||||
@@ -40,15 +39,28 @@ namespace StgSharp.Entities
|
|||||||
internal Launcher<EntityPartical> _dieBulletLauncher;
|
internal Launcher<EntityPartical> _dieBulletLauncher;
|
||||||
public bool _selectalbe;
|
public bool _selectalbe;
|
||||||
|
|
||||||
public Launcher<EntityPartical> AwardLauncher { get; set; }
|
public Launcher<EntityPartical> AwardLauncher
|
||||||
public Launcher<EntityPartical> CommonBulletLauncher { get; set; }
|
{
|
||||||
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Launcher<EntityPartical> CommonBulletLauncher
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Launcher<EntityPartical> DieBulletLauncher
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnRenderFrame()
|
public override void OnRenderFrame()
|
||||||
{
|
{
|
||||||
CommonBulletLauncher.Launch();
|
CommonBulletLauncher.Launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,5 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
namespace StgSharp.Entities
|
namespace StgSharp.Entities
|
||||||
{
|
{
|
||||||
public abstract class EntityPartical : IEntity
|
public abstract class EntityPartical : IEntity { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected uint _bornTick;
|
protected uint _bornTick;
|
||||||
internal Func<int, vec3d> _movHandler;
|
internal Func<int, Vec3> _movHandler;
|
||||||
internal LinkedList<PlainGeometry> _collisionBox;
|
internal LinkedList<PlainGeometry> _collisionBox;
|
||||||
internal Point _basePoint;
|
internal Point _basePoint;
|
||||||
internal Point _pos;
|
internal Point _pos;
|
||||||
@@ -51,12 +51,20 @@ namespace StgSharp
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// X position of an enenmy entity
|
/// X position of an enenmy entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float X { get; set; }
|
public float X
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Y position of an enemy entity
|
/// Y position of an enemy entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float Y { get; set; }
|
public float Y
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public LinkedList<PlainGeometry> CollisionBox
|
public LinkedList<PlainGeometry> CollisionBox
|
||||||
{
|
{
|
||||||
@@ -73,16 +81,24 @@ namespace StgSharp
|
|||||||
set => _collisionSensor = value;
|
set => _collisionSensor = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TextureGL { get; set; }
|
public string TextureGL
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public vec2d Location { get; }
|
public Vec2 Location
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void OnRenderFrame();
|
public abstract void OnRenderFrame();
|
||||||
|
|
||||||
public void SetLocation(Point p)
|
public void SetLocation( Point p )
|
||||||
{
|
{
|
||||||
_pos = p;
|
_pos = p;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ using StgSharp.Math;
|
|||||||
|
|
||||||
namespace StgSharp
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
public class Launcher<T> where T : IEntity
|
public class Launcher<T> where T: IEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
internal uint[] launchtick; //发射子弹的内部计时
|
internal uint[] launchtick; //发射子弹的内部计时
|
||||||
@@ -44,7 +44,7 @@ namespace StgSharp
|
|||||||
*用于发射其他的实体,主要是子弹 和 掉落物
|
*用于发射其他的实体,主要是子弹 和 掉落物
|
||||||
*/
|
*/
|
||||||
|
|
||||||
internal vec2d _center; //发射器的参考位置,运动轨迹的方程应当基于这个参考点构建
|
internal Vec2 _center; //发射器的参考位置,运动轨迹的方程应当基于这个参考点构建
|
||||||
|
|
||||||
public EntityPartical Bullet
|
public EntityPartical Bullet
|
||||||
{
|
{
|
||||||
@@ -52,12 +52,7 @@ namespace StgSharp
|
|||||||
set => _bulletSample = value;
|
set => _bulletSample = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual void Launch()
|
internal virtual void Launch() { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,5 @@ namespace StgSharp
|
|||||||
|
|
||||||
public float Velocity => _velocity;
|
public float Velocity => _velocity;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,11 +39,9 @@ namespace StgSharp
|
|||||||
public class UniformEmptyReferenceException : Exception
|
public class UniformEmptyReferenceException : Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
public UniformEmptyReferenceException(string program, string name) :
|
public UniformEmptyReferenceException( string program, string name )
|
||||||
base($"Location -1 returned when trying to find uniform {name} in shader program {program}")
|
: 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;
|
internal const int ssdSegmentLength = 16;
|
||||||
|
|
||||||
static byte[] _currentHash;
|
private static byte[] _currentHash;
|
||||||
|
|
||||||
private static bool _inited;
|
private static bool _inited;
|
||||||
private static int _mainThreadID = -1;
|
private static int _mainThreadID = -1;
|
||||||
@@ -53,14 +53,12 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_currentHash == null)
|
if( _currentHash == null ) {
|
||||||
{
|
|
||||||
string route = Assembly.GetExecutingAssembly().Location;
|
string route = Assembly.GetExecutingAssembly().Location;
|
||||||
string time = DateTime.UtcNow.ToString();
|
string time = DateTime.UtcNow.ToString();
|
||||||
using (SHA256 sh = SHA256.Create())
|
using( SHA256 sh = SHA256.Create() ) {
|
||||||
{
|
byte[] bytes = Encoding.UTF8.GetBytes( route );
|
||||||
byte[] bytes = Encoding.UTF8.GetBytes(route);
|
_currentHash = sh.ComputeHash( bytes );
|
||||||
_currentHash = sh.ComputeHash(bytes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _currentHash;
|
return _currentHash;
|
||||||
@@ -69,26 +67,24 @@ namespace StgSharp
|
|||||||
|
|
||||||
public static int MainThreadID
|
public static int MainThreadID
|
||||||
{
|
{
|
||||||
get => (_mainThreadID == -1) ?
|
get => ( _mainThreadID == -1 ) ?
|
||||||
throw new InvalidOperationException("StgSharp environment is not inited. " +
|
throw new InvalidOperationException(
|
||||||
"Main thread id is not available") : _mainThreadID;
|
"StgSharp environment is not inited. " + "Main thread id is not available" ) : _mainThreadID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CustomizeInit an instance of OpenGL program,
|
/// CustomizeInit an instance of OpenGL program, This method should be called before any
|
||||||
/// This method should be called before any other StgSharp api.
|
/// other StgSharp api.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void InitGL(int majorVersion, int minorVersion)
|
public static void InitGL( int majorVersion, int minorVersion )
|
||||||
{
|
{
|
||||||
if (API == default)
|
if( API == default ) {
|
||||||
{
|
|
||||||
API = GraphicAPI.GL;
|
API = GraphicAPI.GL;
|
||||||
}
|
}
|
||||||
if (API != GraphicAPI.GL)
|
if( API != GraphicAPI.GL ) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InternalIO.InternalInitGL(majorVersion, minorVersion);
|
InternalIO.InternalInitGL( majorVersion, minorVersion );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GlobalSetting
|
public static class GlobalSetting
|
||||||
@@ -101,7 +97,7 @@ namespace StgSharp
|
|||||||
get => vsyncActivated;
|
get => vsyncActivated;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
InternalIO.glfwSwapInterval(value ? 1 : 0);
|
InternalIO.glfwSwapInterval( value ? 1 : 0 );
|
||||||
vsyncActivated = value;
|
vsyncActivated = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (monitorsArray == null)
|
if( monitorsArray == null ) {
|
||||||
{
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
IntPtr* arrayhandle = InternalIO.glfwGetMonitors(&count);
|
IntPtr* arrayhandle = InternalIO.glfwGetMonitors( &count );
|
||||||
monitorsArray = new IntPtr[count];
|
monitorsArray = new IntPtr[count];
|
||||||
Marshal.Copy((IntPtr)arrayhandle, monitorsArray, 0, count);
|
Marshal.Copy(
|
||||||
Marshal.FreeHGlobal((IntPtr)arrayhandle);
|
( IntPtr )arrayhandle, monitorsArray, 0, count );
|
||||||
|
Marshal.FreeHGlobal( ( IntPtr )arrayhandle );
|
||||||
}
|
}
|
||||||
return monitorsArray;
|
return monitorsArray;
|
||||||
}
|
}
|
||||||
@@ -62,10 +62,8 @@ namespace StgSharp
|
|||||||
|
|
||||||
public static IntPtr DefaultMonitor
|
public static IntPtr DefaultMonitor
|
||||||
{
|
{
|
||||||
get { return MonitorsHandleArray[0]; }
|
get { return MonitorsHandleArray[ 0 ]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,18 +60,19 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
internal enum GraphicAPI : byte
|
internal enum GraphicAPI : byte
|
||||||
{
|
{
|
||||||
|
|
||||||
GL,
|
GL,
|
||||||
DX,
|
DX,
|
||||||
VK
|
VK
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static partial class StgSharp
|
public static partial class StgSharp
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of current StgSharp platform.
|
/// Version of current StgSharp platform. Main version represent in hundred's digit, and sub
|
||||||
/// Main version represent in hundred's digit,
|
/// version represent in ten's digit.
|
||||||
/// and sub version represent in ten's digit.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const long version = 430;
|
public const long version = 430;
|
||||||
|
|
||||||
@@ -85,38 +86,39 @@ namespace StgSharp
|
|||||||
mainTimeProvider = new StgSharpTime();
|
mainTimeProvider = new StgSharpTime();
|
||||||
MainTimeProvider.StartProvidingTime();
|
MainTimeProvider.StartProvidingTime();
|
||||||
InternalIO.glfwInit();
|
InternalIO.glfwInit();
|
||||||
InternalIO.InternalAppendLog("\n\n\n");
|
InternalIO.InternalAppendLog( "\n\n\n" );
|
||||||
InternalIO.InternalWriteLog(
|
InternalIO.InternalWriteLog(
|
||||||
$"Program {Assembly.GetEntryAssembly()!.FullName} Started.",
|
$"Program {Assembly.GetEntryAssembly()!.FullName} Started.",
|
||||||
LogType.Info);
|
LogType.Info );
|
||||||
_mainThreadID = Environment.CurrentManagedThreadId;
|
_mainThreadID = Environment.CurrentManagedThreadId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LogError(Exception ex)
|
public static void LogError( Exception ex )
|
||||||
{
|
{
|
||||||
InternalIO.InternalWriteLog(ex.Message, LogType.Error);
|
InternalIO.InternalWriteLog( ex.Message, LogType.Error );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LogInfo(string log)
|
public static void LogInfo( string log )
|
||||||
{
|
{
|
||||||
InternalIO.InternalWriteLog(log, LogType.Info);
|
InternalIO.InternalWriteLog( log, LogType.Info );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LogWarning(string log)
|
public static void LogWarning( string log )
|
||||||
{
|
{
|
||||||
InternalIO.InternalWriteLog(log, LogType.Warning);
|
InternalIO.InternalWriteLog( log, LogType.Warning );
|
||||||
}
|
|
||||||
public static void LogWarning(Exception notVerySeriesException)
|
|
||||||
{
|
|
||||||
InternalIO.InternalWriteLog(notVerySeriesException.Message, LogType.Warning);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Mark(bool needConsole)
|
public static void LogWarning( Exception notVerySeriesException )
|
||||||
|
{
|
||||||
|
InternalIO.InternalWriteLog(
|
||||||
|
notVerySeriesException.Message, LogType.Warning );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Mark( bool needConsole )
|
||||||
{
|
{
|
||||||
markCount++;
|
markCount++;
|
||||||
if (needConsole)
|
if( needConsole ) {
|
||||||
{
|
Console.WriteLine( markCount );
|
||||||
Console.WriteLine(markCount);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,68 +134,60 @@ namespace StgSharp
|
|||||||
bool isConsole,
|
bool isConsole,
|
||||||
[CallerFilePath] string filePath = "",
|
[CallerFilePath] string filePath = "",
|
||||||
[CallerMemberName] string callerName = "",
|
[CallerMemberName] string callerName = "",
|
||||||
[CallerLineNumber] int lineNumber = 0
|
[CallerLineNumber] int lineNumber = 0 )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Type t = target.GetType();
|
Type t = target.GetType();
|
||||||
string log = $"Tracked object: {nameof(target)}\t\tType:{t.Name}\n";
|
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";
|
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 += $"|{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 += $"Tracking at:\n{filePath}\t{callerName}\tline {lineNumber}\n";
|
||||||
log += $"Additional information:\n{message}\n";
|
log += $"Additional information:\n{message}\n";
|
||||||
if (isConsole)
|
if( isConsole ) {
|
||||||
{
|
Console.WriteLine( log );
|
||||||
Console.WriteLine(log);
|
} else {
|
||||||
}
|
InternalIO.InternalWriteLog( log, LogType.Info );
|
||||||
else
|
|
||||||
{
|
|
||||||
InternalIO.InternalWriteLog(log, LogType.Info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write a log message to log file, and mark the _level of this message.
|
/// Write a log message to log file, and mark the _level of this message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message">A string contains information of how current evironment runs.</param>
|
/// <param name="message"> A string contains information of how current evironment runs. </param>
|
||||||
/// <param name="logType">The severity of current message.</param>
|
/// <param name="logType"> The severity of current message. </param>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static void WriteLog(string message, LogType logType)
|
public static void WriteLog( string message, LogType logType )
|
||||||
{
|
{
|
||||||
InternalIO.InternalWriteLog(message, logType);
|
InternalIO.InternalWriteLog( message, logType );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static TDele ConvertAPI<TDele>(IntPtr funcPtr)
|
internal static TDele ConvertAPI<TDele>( IntPtr funcPtr )
|
||||||
{
|
{
|
||||||
if (funcPtr == IntPtr.Zero)
|
if( funcPtr == IntPtr.Zero ) {
|
||||||
{
|
throw new Exception(
|
||||||
throw new Exception("Failed to convert api, the function pointer is zero.");
|
"Failed to convert api, the function pointer is zero." );
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
return Marshal.GetDelegateForFunctionPointer<TDele>( funcPtr );
|
||||||
return Marshal.GetDelegateForFunctionPointer<TDele>(funcPtr);
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch( Exception ) {
|
||||||
{
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Delegate ConvertAPI(IntPtr funcPtr, Type T)
|
internal static Delegate ConvertAPI( IntPtr funcPtr, Type T )
|
||||||
{
|
{
|
||||||
if (funcPtr == IntPtr.Zero)
|
if( funcPtr == IntPtr.Zero ) {
|
||||||
{
|
throw new Exception(
|
||||||
throw new Exception("Failed to convert api, the function pointer is zero.");
|
"Failed to convert api, the function pointer is zero." );
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
return Marshal.GetDelegateForFunctionPointer( funcPtr, T );
|
||||||
return Marshal.GetDelegateForFunctionPointer(funcPtr, T);
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch( Exception ) {
|
||||||
{
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,18 +37,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
|
|
||||||
public static partial class StgSharp
|
public static partial class StgSharp
|
||||||
{
|
{
|
||||||
|
|
||||||
private static ConcurrentDictionary<int, KeyStatus> keyListener
|
private static ConcurrentDictionary<int, KeyStatus> keyListener
|
||||||
= new ConcurrentDictionary<int, KeyStatus>();
|
= new ConcurrentDictionary<int, KeyStatus>();
|
||||||
|
|
||||||
public static KeyStatus CheckKey(KeyboardKey key)
|
public static KeyStatus CheckKey( KeyboardKey key )
|
||||||
{
|
{
|
||||||
return keyListener.GetOrAdd((int)key, KeyStatus.RELEASE);
|
return keyListener.GetOrAdd( ( int )key, KeyStatus.RELEASE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,7 @@ namespace StgSharp.Geometries
|
|||||||
private CoordinationBase localCoordination;
|
private CoordinationBase localCoordination;
|
||||||
private Matrix44 coordMat;
|
private Matrix44 coordMat;
|
||||||
|
|
||||||
|
public CoordinationBase( CoordinationBase localCoordination )
|
||||||
public CoordinationBase(
|
|
||||||
CoordinationBase localCoordination)
|
|
||||||
{
|
{
|
||||||
this.localCoordination = localCoordination;
|
this.localCoordination = localCoordination;
|
||||||
coordMat = new Matrix44();
|
coordMat = new Matrix44();
|
||||||
@@ -55,23 +53,23 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public virtual Point LocalOrigin
|
public virtual Point LocalOrigin
|
||||||
{
|
{
|
||||||
get => new Point(coordMat.colum3.XYZ);
|
get => new Point( coordMat.colum3.XYZ );
|
||||||
internal set => coordMat.colum3.XYZ = value.Coord;
|
internal set => coordMat.colum3.XYZ = value.Coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d LocalX
|
public virtual Vec3 LocalX
|
||||||
{
|
{
|
||||||
get => coordMat.colum0.XYZ;
|
get => coordMat.colum0.XYZ;
|
||||||
internal set => coordMat.colum0.XYZ = value;
|
internal set => coordMat.colum0.XYZ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d LocalY
|
public virtual Vec3 LocalY
|
||||||
{
|
{
|
||||||
get => coordMat.colum1.XYZ;
|
get => coordMat.colum1.XYZ;
|
||||||
internal set => coordMat.colum1.XYZ = value;
|
internal set => coordMat.colum1.XYZ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d LocalZ
|
public virtual Vec3 LocalZ
|
||||||
{
|
{
|
||||||
get => coordMat.colum2.XYZ;
|
get => coordMat.colum2.XYZ;
|
||||||
set => coordMat.colum2.XYZ = value;
|
set => coordMat.colum2.XYZ = value;
|
||||||
|
|||||||
@@ -41,23 +41,22 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static PlainCoordinate statndardPlainCoordination = new PlainCoordinate(
|
private static PlainCoordinate statndardPlainCoordination = new PlainCoordinate(
|
||||||
null, new Point(0, 0, 0),
|
null, new Point( 0, 0, 0 ), new Vec3( 1, 0, 0 ),
|
||||||
new vec3d(1, 0, 0),
|
new Vec3( 0, 1, 0 ) );
|
||||||
new vec3d(0, 1, 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
public PlainCoordinate(
|
public PlainCoordinate(
|
||||||
CoordinationBase local,
|
CoordinationBase local,
|
||||||
Point origin,
|
Point origin,
|
||||||
vec3d xAxis,
|
Vec3 xAxis,
|
||||||
vec3d yAxis
|
Vec3 yAxis )
|
||||||
) : base(local)
|
: base( local )
|
||||||
{
|
{
|
||||||
CoordMat = Matrix44.Unit;
|
CoordMat = Matrix44.Unit;
|
||||||
|
|
||||||
CoordMat.colum0 = new vec4d(xAxis, 0);
|
CoordMat.colum0 = new Vec4( xAxis, 0 );
|
||||||
CoordMat.colum1 = new vec4d(yAxis, 0);
|
CoordMat.colum1 = new Vec4( yAxis, 0 );
|
||||||
CoordMat.colum2 = new vec4d(Linear.Normalize(Vec3d.Cross(xAxis, yAxis)), 0);
|
CoordMat.colum2 = new Vec4(
|
||||||
|
Linear.Normalize( Vec3.Cross( xAxis, yAxis ) ), 0 );
|
||||||
|
|
||||||
LocalOrigin = origin;
|
LocalOrigin = origin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,11 +40,12 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
|
|
||||||
public SpaceCoordinate(
|
public SpaceCoordinate(
|
||||||
CoordinationBase localCoordination, Point origin,
|
CoordinationBase localCoordination,
|
||||||
vec3d xAxis, vec3d yAxis, vec3d zAxis
|
Point origin,
|
||||||
) : base(localCoordination)
|
Vec3 xAxis,
|
||||||
{
|
Vec3 yAxis,
|
||||||
}
|
Vec3 zAxis )
|
||||||
|
: base( localCoordination ) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,20 +36,19 @@ namespace StgSharp.Geometries
|
|||||||
public unsafe class ToUpperDimensionException : Exception
|
public unsafe class ToUpperDimensionException : Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context)
|
protected ToUpperDimensionException(
|
||||||
{
|
SerializationInfo info,
|
||||||
}
|
StreamingContext context )
|
||||||
public ToUpperDimensionException()
|
: 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
|
public class UnusedVertexException : Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
protected UnusedVertexException(SerializationInfo info, StreamingContext context) : base(info, context)
|
protected UnusedVertexException(
|
||||||
{
|
SerializationInfo info,
|
||||||
}
|
StreamingContext context )
|
||||||
public UnusedVertexException()
|
: 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 ) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer( CallingConvention.Cdecl )]
|
||||||
public delegate vec3d GeometryMotionDelegate(TimeSpanProvider timeSource, out float rotation);
|
public delegate Vec3 GeometryMotionDelegate(
|
||||||
|
TimeSpanProvider timeSource,
|
||||||
|
out float rotation );
|
||||||
|
|
||||||
public class GeometryMotion
|
public class GeometryMotion
|
||||||
{
|
{
|
||||||
@@ -54,69 +56,60 @@ namespace StgSharp.Geometries
|
|||||||
public unsafe GeometryMotion(
|
public unsafe GeometryMotion(
|
||||||
bool isIncreament,
|
bool isIncreament,
|
||||||
TimeSpanProvider timeSource,
|
TimeSpanProvider timeSource,
|
||||||
GeometryMotionDelegate motionDelegate
|
GeometryMotionDelegate motionDelegate )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
isIncrementMode = isIncreament;
|
isIncrementMode = isIncreament;
|
||||||
time = timeSource;
|
time = timeSource;
|
||||||
if (motionDelegate == null)
|
if( motionDelegate == null ) {
|
||||||
{
|
handle = ( IntPtr )( delegate*<TimeSpanProvider, out float, Vec3> )&defaultMotion;
|
||||||
handle = (IntPtr)(delegate*<TimeSpanProvider, out float, vec3d>)&defaultMotion;
|
|
||||||
movement = defaultMotion;
|
movement = defaultMotion;
|
||||||
}
|
} else if( motionDelegate.Method.IsStatic ) {
|
||||||
else if (motionDelegate.Method.IsStatic)
|
|
||||||
{
|
|
||||||
sourceIsStatic = true;
|
sourceIsStatic = true;
|
||||||
handle = Marshal.GetFunctionPointerForDelegate(motionDelegate);
|
handle = Marshal.GetFunctionPointerForDelegate( motionDelegate );
|
||||||
movement = motionDelegate;
|
movement = motionDelegate;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
movement = motionDelegate;
|
movement = motionDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sourceIsStatic = false;
|
//sourceIsStatic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsIncrement
|
public bool IsIncrement
|
||||||
{
|
{
|
||||||
get => isIncrementMode;
|
get => isIncrementMode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GeometryMotion DefaultMotion
|
public static GeometryMotion DefaultMotion
|
||||||
{
|
{
|
||||||
get => new GeometryMotion(true, null, null);
|
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;
|
float rot;
|
||||||
vec3d vec;
|
Vec3 vec;
|
||||||
if (sourceIsStatic)
|
if( sourceIsStatic ) {
|
||||||
{
|
vec = ( ( delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, Vec3> )handle )(
|
||||||
vec = ((delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, vec3d>)handle)(time, out rot);
|
time, out rot );
|
||||||
}
|
} else {
|
||||||
else
|
vec = movement( time, out rot );
|
||||||
{
|
|
||||||
vec = movement(time, out rot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isIncrementMode)
|
if( isIncrementMode ) {
|
||||||
{
|
|
||||||
coord += vec;
|
coord += vec;
|
||||||
rotation += rot;
|
rotation += rot;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
coord = vec;
|
coord = vec;
|
||||||
rotation = rot;
|
rotation = rot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static vec3d defaultMotion(TimeSpanProvider provider, out float rotation)
|
private static Vec3 defaultMotion(
|
||||||
|
TimeSpanProvider provider,
|
||||||
|
out float rotation )
|
||||||
{
|
{
|
||||||
rotation = 0;
|
rotation = 0;
|
||||||
return Vec3d.Zero;
|
return Vec3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//------------------------------- End of Class -------------------------------
|
}//------------------------------- End of Class -------------------------------
|
||||||
|
|||||||
@@ -42,46 +42,46 @@ namespace StgSharp.Math
|
|||||||
|
|
||||||
internal const float DegToRad = 180 / Scaler.Pi;
|
internal const float DegToRad = 180 / Scaler.Pi;
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static float Cos(Radius r)
|
public static float Cos( Radius r )
|
||||||
{
|
{
|
||||||
return MathF.Cos(r._radius);
|
return MathF.Cos( r._radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static float Cos(Degree r)
|
public static float Cos( Degree r )
|
||||||
{
|
{
|
||||||
return MathF.Cos(r._degree / DegToRad);
|
return MathF.Cos( r._degree / DegToRad );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static float Sin(Radius r)
|
public static float Sin( Radius r )
|
||||||
{
|
{
|
||||||
return MathF.Sin(r._radius);
|
return MathF.Sin( r._radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static float Sin(Degree r)
|
public static float Sin( Degree r )
|
||||||
{
|
{
|
||||||
return MathF.Sin(r._degree / DegToRad);
|
return MathF.Sin( r._degree / DegToRad );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static float Tan(Radius r)
|
public static float Tan( Radius r )
|
||||||
{
|
{
|
||||||
return MathF.Tan(r._radius);
|
return MathF.Tan( r._radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static float Tan(Degree r)
|
public static float Tan( Degree r )
|
||||||
{
|
{
|
||||||
return MathF.Tan(r._degree / DegToRad);
|
return MathF.Tan( r._degree / DegToRad );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Degree ToDegree(float value)
|
public static Degree ToDegree( float value )
|
||||||
{
|
{
|
||||||
return new Degree(value);
|
return new Degree( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -91,14 +91,14 @@ namespace StgSharp.Math
|
|||||||
|
|
||||||
internal float _degree;
|
internal float _degree;
|
||||||
|
|
||||||
internal Degree(float dgree)
|
internal Degree( float dgree )
|
||||||
{
|
{
|
||||||
_degree = dgree;
|
_degree = dgree;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator Radius(Degree d)
|
public static implicit operator Radius( Degree d )
|
||||||
{
|
{
|
||||||
return new Radius(d._degree / GeometryScaler.DegToRad);
|
return new Radius( d._degree / GeometryScaler.DegToRad );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -108,70 +108,70 @@ namespace StgSharp.Math
|
|||||||
|
|
||||||
internal float _radius;
|
internal float _radius;
|
||||||
|
|
||||||
[Obsolete("Unsafe, you may forget this is radius.", true)]
|
[Obsolete( "Unsafe, you may forget this is radius.", true )]
|
||||||
public Radius() { }
|
public Radius() { }
|
||||||
|
|
||||||
public Radius(float radius)
|
public Radius( float radius )
|
||||||
{
|
{
|
||||||
_radius = radius;
|
_radius = radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Radius Zero
|
public static Radius Zero
|
||||||
{
|
{
|
||||||
get => new Radius(0);
|
get => new Radius( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Radius operator -(Radius r)
|
public static Radius operator -( Radius r )
|
||||||
{
|
{
|
||||||
return new Radius(-r._radius);
|
return new Radius( -r._radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Radius operator -(Radius left, Radius Right)
|
public static Radius operator -( Radius left, Radius Right )
|
||||||
{
|
{
|
||||||
return new Radius(left._radius - Right._radius);
|
return new Radius( left._radius - Right._radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static bool operator !=(Radius left, Radius right)
|
public static bool operator !=( Radius left, Radius right )
|
||||||
{
|
{
|
||||||
return left._radius != right._radius;
|
return left._radius != right._radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Radius operator *(Radius left, float right)
|
public static Radius operator *( Radius left, float right )
|
||||||
{
|
{
|
||||||
return new Radius(left._radius * right);
|
return new Radius( left._radius * right );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Radius operator /(Radius left, float right)
|
public static Radius operator /( Radius left, float right )
|
||||||
{
|
{
|
||||||
return new Radius(left._radius / right);
|
return new Radius( left._radius / right );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static float operator /(Radius left, Radius right)
|
public static float operator /( Radius left, Radius right )
|
||||||
{
|
{
|
||||||
return left._radius / right._radius;
|
return left._radius / right._radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Radius operator +(Radius left, Radius Right)
|
public static Radius operator +( Radius left, Radius Right )
|
||||||
{
|
{
|
||||||
return new Radius(left._radius + Right._radius);
|
return new Radius( left._radius + Right._radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static bool operator ==(Radius left, Radius right)
|
public static bool operator ==( Radius left, Radius right )
|
||||||
{
|
{
|
||||||
return left._radius == right._radius;
|
return left._radius == right._radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator Degree(Radius r)
|
public static implicit operator Degree( Radius r )
|
||||||
{
|
{
|
||||||
return new Degree((r._radius * 180) / Scaler.Pi);
|
return new Degree( ( r._radius * 180 ) / Scaler.Pi );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,19 +42,23 @@ namespace StgSharp.Geometries
|
|||||||
public interface IGeometry
|
public interface IGeometry
|
||||||
{
|
{
|
||||||
|
|
||||||
public Point this[int index]
|
public Point this[ int index ]
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable CA1819
|
#pragma warning disable CA1819
|
||||||
public vec4d[] VertexStream
|
public Vec4[] VertexStream
|
||||||
#pragma warning restore CA1819
|
#pragma warning restore CA1819
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CoordinationBase Coordination
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
public CoordinationBase Coordination { get; }
|
|
||||||
|
|
||||||
public int VertexCount
|
public int VertexCount
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,9 +36,5 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public interface IGeomtryBuffer
|
public interface IGeomtryBuffer { }
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,24 +45,25 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public float Rotation
|
public float Rotation
|
||||||
{
|
{
|
||||||
get { return GlobalBuffer.CoordAndRotationList[BufferId].W; }
|
get { return GlobalBuffer.CoordAndRotationList[ BufferId ].W; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
vec4d temp = GlobalBuffer.CoordAndRotationList[BufferId];
|
Vec4 temp = GlobalBuffer.CoordAndRotationList[ BufferId ];
|
||||||
temp.W = value;
|
temp.W = value;
|
||||||
GlobalBuffer.CoordAndRotationList[BufferId] = temp;
|
GlobalBuffer.CoordAndRotationList[ BufferId ] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Scale
|
public float Scale
|
||||||
{
|
{
|
||||||
get { return GlobalBuffer.ScalingList[BufferId]; }
|
get { return GlobalBuffer.ScalingList[ BufferId ]; }
|
||||||
set { GlobalBuffer.ScalingList[BufferId] = value; }
|
set { GlobalBuffer.ScalingList[ BufferId ] = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeometryMotion Motion
|
public GeometryMotion Motion
|
||||||
{
|
{
|
||||||
get; set;
|
get;
|
||||||
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInstancingBuffer GlobalBuffer
|
public IInstancingBuffer GlobalBuffer
|
||||||
@@ -77,25 +78,25 @@ namespace StgSharp.Geometries
|
|||||||
internal set;
|
internal set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public vec3d CenterPositionGlobal
|
public Vec3 CenterPositionGlobal
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
internal set;
|
internal set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public vec3d Coord
|
public Vec3 Coord
|
||||||
{
|
{
|
||||||
get { return GlobalBuffer.CoordAndRotationList[BufferId].XYZ; }
|
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()
|
public void Move()
|
||||||
{
|
{
|
||||||
(vec3d coord, float rotation) = (Coord, Rotation);
|
(Vec3 coord, float rotation) = (Coord, Rotation);
|
||||||
Motion.RunMotion(ref coord, ref rotation);
|
Motion.RunMotion( ref coord, ref rotation );
|
||||||
(Coord, Rotation) = (coord, rotation);
|
(Coord, Rotation) = (coord, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,19 +39,35 @@ namespace StgSharp.Geometries
|
|||||||
public interface IInstancingBuffer
|
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<IInstancing> InstanceList
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
internal List<vec4d> CoordAndRotationList { get; }
|
internal List<Vec4> CoordAndRotationList
|
||||||
|
{
|
||||||
internal List<float> ScalingList { get; }
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal List<float> ScalingList
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout( LayoutKind.Sequential )]
|
||||||
public struct PartialPlainCoordinate
|
public struct PartialPlainCoordinate
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -49,40 +49,36 @@ namespace StgSharp.Geometries
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The origin of this coordinate.
|
/// The origin of this coordinate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public vec3d origin;
|
public Vec3 origin;
|
||||||
|
|
||||||
public PartialPlainCoordinate
|
public PartialPlainCoordinate(
|
||||||
(
|
Vec3 origin,
|
||||||
vec3d origin,
|
Vec3 horiziontial,
|
||||||
vec3d horiziontial,
|
Vec3 vertical )
|
||||||
vec3d vertical
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
axis = new Matrix32();
|
axis = new Matrix32();
|
||||||
#if NET5_0_OR_GREATER
|
#if NET5_0_OR_GREATER
|
||||||
Unsafe.SkipInit(out axis.mat);
|
Unsafe.SkipInit( out axis.mat );
|
||||||
#endif
|
#endif
|
||||||
axis.colum0 = horiziontial;
|
axis.colum0 = horiziontial;
|
||||||
axis.colum1 = vertical;
|
axis.colum1 = vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The horizontial axis of the coordinate.
|
/// The horizontial axis of the coordinate. Point to the right direction.
|
||||||
/// Point to the right direction.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public vec3d axis_H => axis.colum0;
|
public Vec3 axis_H => axis.colum0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The vertical axis of the coordinate.
|
/// The vertical axis of the coordinate. Point to the top direction.
|
||||||
/// Point to the top direction.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public vec3d axis_V => axis.colum1;
|
public Vec3 axis_V => axis.colum1;
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public vec3d GetRealLocate(vec2d raletiveLocation)
|
public Vec3 GetRealLocate( Vec2 raletiveLocation )
|
||||||
{
|
{
|
||||||
return origin + axis.VerticalVecMultiply(raletiveLocation);
|
return origin + axis.VerticalVecMultiply( raletiveLocation );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,16 +34,14 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
|
|
||||||
public static unsafe class GeometryOperation
|
public static unsafe class GeometryOperation
|
||||||
{
|
{
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static vec3d DefaultMotion(int tick)
|
public static Vec3 DefaultMotion( int tick )
|
||||||
{
|
{
|
||||||
return default(vec3d);
|
return default( Vec3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,39 +38,39 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
|
|
||||||
public interface IPlainEntity
|
public interface IPlainEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
public vec2d CenterPosition { get; set; }
|
public Vec2 CenterPosition
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public bool CollideWith(IPlainEntity entity);
|
public bool CollideWith( IPlainEntity entity );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class PlainEntity : IPlainEntity
|
public class PlainEntity : IPlainEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
private PlainGeometry _shape;
|
private PlainGeometry _shape;
|
||||||
|
|
||||||
public PlainEntity(PlainGeometry shape)
|
public PlainEntity( PlainGeometry shape )
|
||||||
{
|
{
|
||||||
_shape = shape;
|
_shape = shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IPlainEntity.CollideWith(IPlainEntity entity)
|
bool IPlainEntity.CollideWith( IPlainEntity entity )
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2d IPlainEntity.CenterPosition
|
Vec2 IPlainEntity.CenterPosition
|
||||||
{
|
{
|
||||||
get => _shape.Coordination.LocalOrigin.Coord.XY;
|
get => _shape.Coordination.LocalOrigin.Coord.XY;
|
||||||
set => throw new InvalidOperationException();
|
set => throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,15 +43,14 @@ namespace StgSharp.Geometries
|
|||||||
public class ParticleOnPlain : IInstancing, IPlainEntity
|
public class ParticleOnPlain : IInstancing, IPlainEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
public ParticleOnPlain(PlainInstancingBuffer<ParticleOnPlain> buffer)
|
public ParticleOnPlain( PlainInstancingBuffer<ParticleOnPlain> buffer )
|
||||||
{
|
{
|
||||||
if (buffer == null)
|
if( buffer == null ) {
|
||||||
{
|
throw new ArgumentNullException( paramName: nameof( buffer ) );
|
||||||
throw new ArgumentNullException(paramName: nameof(buffer));
|
|
||||||
}
|
}
|
||||||
GlobalBuffer = buffer;
|
GlobalBuffer = buffer;
|
||||||
BufferId = buffer.CreateInstanceID();
|
BufferId = buffer.CreateInstanceID();
|
||||||
((IInstancingBuffer)buffer).InstanceList.Add(this);
|
( ( IInstancingBuffer )buffer ).InstanceList.Add( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeometryMotion Motion
|
public GeometryMotion Motion
|
||||||
@@ -72,21 +71,20 @@ namespace StgSharp.Geometries
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3d IInstancing.CenterPositionGlobal
|
Vec3 IInstancing.CenterPositionGlobal
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IPlainEntity.CollideWith( IPlainEntity entity )
|
||||||
bool IPlainEntity.CollideWith(IPlainEntity entity)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2d IPlainEntity.CenterPosition
|
Vec2 IPlainEntity.CenterPosition
|
||||||
{
|
{
|
||||||
get => GlobalBuffer.CoordAndRotationList[BufferId].XY;
|
get => GlobalBuffer.CoordAndRotationList[ BufferId ].XY;
|
||||||
set => throw new NotImplementedException();
|
set => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,33 +42,31 @@ namespace StgSharp.Geometries
|
|||||||
public abstract class PlainGeometry : IGeometry
|
public abstract class PlainGeometry : IGeometry
|
||||||
{
|
{
|
||||||
|
|
||||||
protected vec4d[] vertexMat;
|
protected Vec4[] vertexMat;
|
||||||
internal CoordinationBase coordinate;
|
internal CoordinationBase coordinate;
|
||||||
|
|
||||||
|
internal PlainGeometry( CoordinationBase coordination )
|
||||||
internal PlainGeometry(CoordinationBase coordination)
|
|
||||||
{
|
{
|
||||||
coordinate = coordination;
|
coordinate = coordination;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point this[int index]
|
public Point this[ int index ]
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat[index]);
|
get => new Point( vertexMat[ index ] );
|
||||||
set => vertexMat[index].vec = value.coordVec;
|
set => vertexMat[ index ].vec = value.coordVec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int VertexCount => this.vertexMat.Length;
|
public int VertexCount => this.vertexMat.Length;
|
||||||
|
|
||||||
public abstract ReadOnlySpan<int> VertexIndices { get; }
|
public abstract ReadOnlySpan<int> VertexIndices
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma warning disable CA1819
|
#pragma warning disable CA1819
|
||||||
public vec4d[] VertexStream => vertexMat;
|
public Vec4[] VertexStream => vertexMat;
|
||||||
|
|
||||||
public CoordinationBase Coordination => this.coordinate;
|
public CoordinationBase Coordination => this.coordinate;
|
||||||
#pragma warning restore CA1819
|
#pragma warning restore CA1819
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,26 +44,24 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class PlainInstancingBuffer<T> :
|
public class PlainInstancingBuffer<T> : IDisposable, IEnumerable<T>, IInstancingBuffer
|
||||||
IDisposable, IEnumerable<T>, IInstancingBuffer
|
where T: IInstancing
|
||||||
where T :
|
|
||||||
IInstancing
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private bool disposedValue;
|
private bool disposedValue;
|
||||||
|
|
||||||
private CoordinatePlain globalCorrdinnate;
|
private CoordinatePlain globalCorrdinnate;
|
||||||
private List<vec4d> coordList;
|
private List<Vec4> coordList;
|
||||||
private List<IInstancing> instanceList;
|
private List<IInstancing> instanceList;
|
||||||
private List<float> scalingList;
|
private List<float> scalingList;
|
||||||
private Mutex mutex;
|
private Mutex mutex;
|
||||||
|
|
||||||
public PlainInstancingBuffer()
|
public PlainInstancingBuffer()
|
||||||
{
|
{
|
||||||
coordList = new List<vec4d>(capacity: 100);
|
coordList = new List<Vec4>( capacity: 100 );
|
||||||
instanceList = new List<IInstancing>(capacity: 100);
|
instanceList = new List<IInstancing>( capacity: 100 );
|
||||||
scalingList = new List<float>(capacity: 100);
|
scalingList = new List<float>( capacity: 100 );
|
||||||
coordArray = Array.Empty<vec4d>();
|
coordArray = Array.Empty<Vec4>();
|
||||||
scaleArray = Array.Empty<float>();
|
scaleArray = Array.Empty<float>();
|
||||||
mutex = new Mutex();
|
mutex = new Mutex();
|
||||||
}
|
}
|
||||||
@@ -73,7 +71,7 @@ namespace StgSharp.Geometries
|
|||||||
get => instanceList;
|
get => instanceList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<vec4d> CoordAndRotationList
|
public List<Vec4> CoordAndRotationList
|
||||||
{
|
{
|
||||||
get => coordList;
|
get => coordList;
|
||||||
}
|
}
|
||||||
@@ -83,25 +81,25 @@ namespace StgSharp.Geometries
|
|||||||
get => scalingList;
|
get => scalingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span<vec4d> CoordAndRotationSpan
|
public Span<Vec4> CoordAndRotationSpan
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (coordArray.Length != coordList.Capacity)
|
if( coordArray.Length != coordList.Capacity ) {
|
||||||
{
|
FieldInfo fieldInfo = typeof( List<Vec4> ).
|
||||||
FieldInfo fieldInfo = typeof(List<vec4d>).
|
GetField(
|
||||||
GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance);
|
"_items",
|
||||||
if (fieldInfo == null)
|
BindingFlags.NonPublic | BindingFlags.Instance );
|
||||||
{
|
if( fieldInfo == null ) {
|
||||||
#pragma warning disable CA1065
|
#pragma warning disable CA1065
|
||||||
#pragma warning disable CA2201
|
#pragma warning disable CA2201
|
||||||
throw new NullReferenceException();
|
throw new NullReferenceException();
|
||||||
#pragma warning restore CA2201
|
#pragma warning restore CA2201
|
||||||
#pragma warning restore CA1065
|
#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,21 +107,21 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (scaleArray.Length != coordList.Capacity)
|
if( scaleArray.Length != coordList.Capacity ) {
|
||||||
{
|
FieldInfo fieldInfo = typeof( List<float> ).
|
||||||
FieldInfo fieldInfo = typeof(List<float>).
|
GetField(
|
||||||
GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance);
|
"_items",
|
||||||
if (fieldInfo == null)
|
BindingFlags.NonPublic | BindingFlags.Instance );
|
||||||
{
|
if( fieldInfo == null ) {
|
||||||
#pragma warning disable CA1065
|
#pragma warning disable CA1065
|
||||||
#pragma warning disable CA2201
|
#pragma warning disable CA2201
|
||||||
throw new NullReferenceException();
|
throw new NullReferenceException();
|
||||||
#pragma warning restore CA2201
|
#pragma warning restore CA2201
|
||||||
#pragma warning restore CA1065
|
#pragma warning restore CA1065
|
||||||
}
|
}
|
||||||
scaleArray = (float[])fieldInfo.GetValue(scalingList);
|
scaleArray = ( float[] )fieldInfo.GetValue( scalingList );
|
||||||
}
|
}
|
||||||
return new Span<float>(scaleArray, 0, coordList.Count);
|
return new Span<float>( scaleArray, 0, coordList.Count );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,8 +129,8 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
mutex.WaitOne();
|
mutex.WaitOne();
|
||||||
int ret = instanceList.Count;
|
int ret = instanceList.Count;
|
||||||
coordList.Add(new vec4d());
|
coordList.Add( new Vec4() );
|
||||||
scalingList.Add(0);
|
scalingList.Add( 0 );
|
||||||
mutex.ReleaseMutex();
|
mutex.ReleaseMutex();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -144,55 +142,51 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Dispose(disposing: true);
|
Dispose( disposing: true );
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator<T> GetEnumerator()
|
public IEnumerator<T> GetEnumerator()
|
||||||
{
|
{
|
||||||
foreach (IInstancing item in instanceList)
|
foreach( IInstancing item in instanceList ) {
|
||||||
{
|
yield return ( T )item;
|
||||||
yield return (T)item;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove(T instance)
|
public void Remove( T instance )
|
||||||
{
|
{
|
||||||
mutex.WaitOne();
|
mutex.WaitOne();
|
||||||
if (instance.GlobalBuffer != this)
|
if( instance.GlobalBuffer != this ) {
|
||||||
{
|
|
||||||
throw new ArgumentException(
|
throw new ArgumentException(
|
||||||
message: "instance does not belong to current Particle Buffer",
|
message: "instance does not belong to current Particle Buffer",
|
||||||
paramName: nameof(instance));
|
paramName: nameof( instance ) );
|
||||||
}
|
}
|
||||||
int index = instance.BufferId;
|
int index = instance.BufferId;
|
||||||
IInstancing temp = instanceList[instanceList.Count - 1];
|
IInstancing temp = instanceList[ instanceList.Count - 1 ];
|
||||||
instanceList[instance.BufferId] = temp;
|
instanceList[ instance.BufferId ] = temp;
|
||||||
temp.BufferId = instance.BufferId;
|
temp.BufferId = instance.BufferId;
|
||||||
|
|
||||||
coordList[instance.BufferId] = coordList[coordList.Count - 1];
|
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);
|
instanceList.RemoveAt( instanceList.Count - 1 );
|
||||||
coordList.RemoveAt(coordList.Count - 1);
|
coordList.RemoveAt( coordList.Count - 1 );
|
||||||
scalingList.RemoveAt(scalingList.Count - 1);
|
scalingList.RemoveAt( scalingList.Count - 1 );
|
||||||
mutex.ReleaseMutex();
|
mutex.ReleaseMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateAllParticles()
|
public void UpdateAllParticles()
|
||||||
{
|
{
|
||||||
foreach (IInstancing particle in instanceList)
|
foreach( IInstancing particle in instanceList ) {
|
||||||
{
|
|
||||||
particle.Move();
|
particle.Move();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose( bool disposing )
|
||||||
{
|
{
|
||||||
if (!disposedValue)
|
if( !disposedValue ) {
|
||||||
{
|
if( disposing ) {
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
mutex.Dispose();
|
mutex.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,21 +199,19 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
foreach (IInstancing item in instanceList)
|
foreach( IInstancing item in instanceList ) {
|
||||||
{
|
yield return ( T )item;
|
||||||
yield return (T)item;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IGeometry IInstancingBuffer.TypicalShape => throw new NotImplementedException();
|
IGeometry IInstancingBuffer.TypicalShape => throw new NotImplementedException(
|
||||||
|
);
|
||||||
|
|
||||||
#region field of mem opt
|
#region field of mem opt
|
||||||
|
|
||||||
vec4d[] coordArray;
|
private Vec4[] coordArray;
|
||||||
float[] scaleArray;
|
private float[] scaleArray;
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,52 +38,50 @@ namespace StgSharp.Geometries
|
|||||||
public class Parallelogram : Polygon4
|
public class Parallelogram : Polygon4
|
||||||
{
|
{
|
||||||
|
|
||||||
internal readonly Func<int, vec3d> movCenterOperation =
|
internal readonly Func<int, Vec3> movCenterOperation =
|
||||||
new Func<int, vec3d>(GeometryOperation.DefaultMotion);
|
new Func<int, Vec3>( GeometryOperation.DefaultMotion );
|
||||||
|
|
||||||
internal Point center;
|
internal Point center;
|
||||||
|
|
||||||
public Parallelogram(
|
public Parallelogram(
|
||||||
float v0x, float v0y,
|
float v0x,
|
||||||
float v1x, float v1y,
|
float v0y,
|
||||||
float v2x, float v2y,
|
float v1x,
|
||||||
float v3x, float v3y
|
float v1y,
|
||||||
) : base(
|
float v2x,
|
||||||
v0x, v0y, v1x, v1y,
|
float v2y,
|
||||||
v2x, v2y, v3x, v3y
|
float v3x,
|
||||||
)
|
float v3y )
|
||||||
|
: base( v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y )
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (
|
if( this[ 0 ].Coord + this[ 2 ].Coord != this[ 1 ].Coord + this[ 3 ].Coord ) {
|
||||||
this[0].Coord + this[2].Coord !=
|
InternalIO.InternalWriteLog(
|
||||||
this[1].Coord + this[3].Coord
|
"Init of geometry item failed, because four vertices cannot form a rectangle.",
|
||||||
)
|
LogType.Warning );
|
||||||
{
|
|
||||||
InternalIO.InternalWriteLog("Init of geometry item failed, because four vertices cannot form a rectangle.", LogType.Warning);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public Parallelogram(
|
public Parallelogram(
|
||||||
PlainCoordinate coordination,
|
PlainCoordinate coordination,
|
||||||
float v0x, float v0y,
|
float v0x,
|
||||||
float v1x, float v1y,
|
float v0y,
|
||||||
float v2x, float v2y,
|
float v1x,
|
||||||
float v3x, float v3y
|
float v1y,
|
||||||
) : base(coordination,
|
float v2x,
|
||||||
v0x, v0y, v1x, v1y,
|
float v2y,
|
||||||
v2x, v2y, v3x, v3y
|
float v3x,
|
||||||
)
|
float v3y )
|
||||||
|
: base( coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y )
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (
|
if( this[ 0 ].Coord + this[ 2 ].Coord != this[ 1 ].Coord + this[ 3 ].Coord ) {
|
||||||
this[0].Coord + this[2].Coord !=
|
InternalIO.InternalWriteLog(
|
||||||
this[1].Coord + this[3].Coord
|
"Init of geometry item failed, because four vertices cannot form a rectangle.",
|
||||||
)
|
LogType.Warning );
|
||||||
{
|
|
||||||
InternalIO.InternalWriteLog("Init of geometry item failed, because four vertices cannot form a rectangle.", LogType.Warning);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,52 +38,54 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
|
|
||||||
internal readonly float d = -1;
|
internal readonly float d = -1;
|
||||||
internal vec3d origin;
|
internal Vec3 origin;
|
||||||
|
|
||||||
internal vec3d plainParameter;
|
internal Vec3 plainParameter;
|
||||||
internal vec3d vec1;
|
internal Vec3 vec1;
|
||||||
internal vec3d vec2;
|
internal Vec3 vec2;
|
||||||
|
|
||||||
internal Plain(Vector4 origin, Vector4 p1, Vector4 p2)
|
internal Plain( Vector4 origin, Vector4 p1, Vector4 p2 )
|
||||||
{
|
{
|
||||||
this.origin = new vec3d(origin);
|
this.origin = new Vec3( origin );
|
||||||
|
|
||||||
vec1 = new vec3d(p1 - origin);
|
vec1 = new Vec3( p1 - origin );
|
||||||
vec2 = new vec3d(p2 - 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.origin = o;
|
||||||
this.vec1 = v1 - (v2 * (v1.Y / v2.Y)); //计算平面在xz平面上的方向投影
|
this.vec1 = v1 - ( v2 * ( v1.Y / v2.Y ) ); //计算平面在xz平面上的方向投影
|
||||||
this.vec2 = v2 - (vec1 * (v2.X / v1.X)); //计算平面在yz平面上的方向投影
|
this.vec2 = v2 - ( vec1 * ( v2.X / v1.X ) ); //计算平面在yz平面上的方向投影
|
||||||
|
|
||||||
//|origin|-k1*|vec1|-k2*|vec2|计算plainParameter.Z;
|
//|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 = origin.Z - ( vec1.Z * ( origin.X / vec1.X ) ) - ( vec2.Z * ( origin.Y / vec2.Y ) );
|
||||||
|
|
||||||
//根据plainParameter.Z和对应的方向矢量计算plainParameter.X和plainParameter.Y
|
//根据plainParameter.Z和对应的方向矢量计算plainParameter.X和plainParameter.Y
|
||||||
plainParameter.X = vec1.X * (vec1.Z / plainParameter.Z);
|
plainParameter.X = vec1.X * ( vec1.Z / plainParameter.Z );
|
||||||
plainParameter.Y = vec2.Y * (vec2.Z / plainParameter.Z);
|
plainParameter.Y = vec2.Y * ( vec2.Z / plainParameter.Z );
|
||||||
|
|
||||||
plainParameter.X = 1 / plainParameter.X;
|
plainParameter.X = 1 / plainParameter.X;
|
||||||
plainParameter.Y = 1 / plainParameter.Y;
|
plainParameter.Y = 1 / plainParameter.Y;
|
||||||
plainParameter.Z = 1 / plainParameter.Z;
|
plainParameter.Z = 1 / plainParameter.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plain(Point p1, Point p2, Point p3)
|
public Plain( Point p1, Point p2, Point p3 )
|
||||||
{
|
{
|
||||||
vec3d origin = p1.Coord;
|
Vec3 origin = p1.Coord;
|
||||||
vec3d v1 = p2.Coord - origin;
|
Vec3 v1 = p2.Coord - origin;
|
||||||
vec3d v2 = p3.Coord - origin;
|
Vec3 v2 = p3.Coord - origin;
|
||||||
|
|
||||||
|
|
||||||
vec1 = v1 - (v2 * (v1.Y / v2.Y)); //计算平面在xz平面上的方向投影
|
vec1 = v1 - ( v2 * ( v1.Y / v2.Y ) ); //计算平面在xz平面上的方向投影
|
||||||
vec2 = v2 - (vec1 * (v2.X / v1.X)); //计算平面在yz平面上的方向投影
|
vec2 = v2 - ( vec1 * ( v2.X / v1.X ) ); //计算平面在yz平面上的方向投影
|
||||||
|
|
||||||
//|origin|-k1*|vec1|-k2*|vec2|计算plainParameter.Z;
|
//|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 = origin.Z - ( vec1.Z * ( origin.X / vec1.X ) ) - ( vec2.Z * ( origin.Y / vec2.Y ) );
|
||||||
|
|
||||||
//根据plainParameter.Z和对应的方向矢量计算plainParameter.X和plainParameter.Y
|
//根据plainParameter.Z和对应的方向矢量计算plainParameter.X和plainParameter.Y
|
||||||
plainParameter.X = vec1.X * (vec1.Z / plainParameter.Z);
|
plainParameter.X = vec1.X * ( vec1.Z / plainParameter.Z );
|
||||||
plainParameter.Y = vec2.Y * (vec2.Z / plainParameter.Z);
|
plainParameter.Y = vec2.Y * ( vec2.Z / plainParameter.Z );
|
||||||
|
|
||||||
plainParameter.X = 1 / plainParameter.X;
|
plainParameter.X = 1 / plainParameter.X;
|
||||||
plainParameter.Y = 1 / plainParameter.Y;
|
plainParameter.Y = 1 / plainParameter.Y;
|
||||||
|
|||||||
@@ -41,17 +41,17 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
protected static int[] Indices = [0, 1, 2, 0, 2, 3];
|
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) :
|
internal Polygon4( Vec4[] rawCoord )
|
||||||
base(PlainCoordinate.StandardPlainCoordination)
|
: base( PlainCoordinate.StandardPlainCoordination )
|
||||||
{
|
{
|
||||||
if (rawCoord.Length != 4)
|
if( rawCoord.Length != 4 ) {
|
||||||
{
|
throw new ArgumentOutOfRangeException( nameof( rawCoord ) );
|
||||||
throw new ArgumentOutOfRangeException(nameof(rawCoord));
|
|
||||||
}
|
}
|
||||||
vertexMat = rawCoord;
|
vertexMat = rawCoord;
|
||||||
}
|
}
|
||||||
@@ -60,61 +60,67 @@ namespace StgSharp.Geometries
|
|||||||
Point topLeft,
|
Point topLeft,
|
||||||
Point topRight,
|
Point topRight,
|
||||||
Point bottomRight,
|
Point bottomRight,
|
||||||
Point bottomLeft
|
Point bottomLeft )
|
||||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
: base( PlainCoordinate.StandardPlainCoordination )
|
||||||
{
|
{
|
||||||
this[0] = topLeft;
|
this[ 0 ] = topLeft;
|
||||||
this[1] = topRight;
|
this[ 1 ] = topRight;
|
||||||
this[2] = bottomRight;
|
this[ 2 ] = bottomRight;
|
||||||
this[3] = bottomLeft;
|
this[ 3 ] = bottomLeft;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Polygon4(
|
||||||
public Polygon4(CoordinationBase coordinate,
|
CoordinationBase coordinate,
|
||||||
PlainCoordinate coordination,
|
PlainCoordinate coordination,
|
||||||
Point topLeft,
|
Point topLeft,
|
||||||
Point topRight,
|
Point topRight,
|
||||||
Point bottomRight,
|
Point bottomRight,
|
||||||
Point bottomLeft
|
Point bottomLeft )
|
||||||
) : base(coordinate)
|
: base( coordinate )
|
||||||
{
|
{
|
||||||
this[0] = topLeft;
|
this[ 0 ] = topLeft;
|
||||||
this[1] = topRight;
|
this[ 1 ] = topRight;
|
||||||
this[2] = bottomRight;
|
this[ 2 ] = bottomRight;
|
||||||
this[3] = bottomLeft;
|
this[ 3 ] = bottomLeft;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Polygon4(
|
public Polygon4(
|
||||||
float v0x, float v0y,
|
float v0x,
|
||||||
float v1x, float v1y,
|
float v0y,
|
||||||
float v2x, float v2y,
|
float v1x,
|
||||||
float v3x, float v3y
|
float v1y,
|
||||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
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[ 0 ] = new Point( v0x, v0y, 0 );
|
||||||
this[1] = new Point(v1x, v1y, 0);
|
this[ 1 ] = new Point( v1x, v1y, 0 );
|
||||||
this[2] = new Point(v2x, v2y, 0);
|
this[ 2 ] = new Point( v2x, v2y, 0 );
|
||||||
this[3] = new Point(v3x, v3y, 0);
|
this[ 3 ] = new Point( v3x, v3y, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Polygon4(
|
public Polygon4(
|
||||||
PlainCoordinate coordination,
|
PlainCoordinate coordination,
|
||||||
float v0x, float v0y,
|
float v0x,
|
||||||
float v1x, float v1y,
|
float v0y,
|
||||||
float v2x, float v2y,
|
float v1x,
|
||||||
float v3x, float v3y
|
float v1y,
|
||||||
) : base(coordination)
|
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[ 0 ] = new Point( v0x, v0y, 0 );
|
||||||
this[1] = new Point(v1x, v1y, 0);
|
this[ 1 ] = new Point( v1x, v1y, 0 );
|
||||||
this[2] = new Point(v2x, v2y, 0);
|
this[ 2 ] = new Point( v2x, v2y, 0 );
|
||||||
this[3] = new Point(v3x, v3y, 0);
|
this[ 3 ] = new Point( v3x, v3y, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ReadOnlySpan<int> VertexIndices => Indices;
|
public override ReadOnlySpan<int> VertexIndices => Indices;
|
||||||
|
|||||||
@@ -41,42 +41,53 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
internal static int[] Indices = [0, 1, 2, 0, 2, 3, 0, 3, 4];
|
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(
|
public Polygon5(
|
||||||
float v0x, float v0y,
|
float v0x,
|
||||||
float v1x, float v1y,
|
float v0y,
|
||||||
float v2x, float v2y,
|
float v1x,
|
||||||
float v3x, float v3y,
|
float v1y,
|
||||||
float v4x, float v4y
|
float v2x,
|
||||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
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[ 0 ] = new Point( v0x, v0y, 0 );
|
||||||
this[1] = new Point(v1x, v1y, 0);
|
this[ 1 ] = new Point( v1x, v1y, 0 );
|
||||||
this[2] = new Point(v2x, v2y, 0);
|
this[ 2 ] = new Point( v2x, v2y, 0 );
|
||||||
this[3] = new Point(v3x, v3y, 0);
|
this[ 3 ] = new Point( v3x, v3y, 0 );
|
||||||
this[4] = new Point(v4x, v4y, 0);
|
this[ 4 ] = new Point( v4x, v4y, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Polygon5(
|
public Polygon5(
|
||||||
PlainCoordinate coordination,
|
PlainCoordinate coordination,
|
||||||
float v0x, float v0y,
|
float v0x,
|
||||||
float v1x, float v1y,
|
float v0y,
|
||||||
float v2x, float v2y,
|
float v1x,
|
||||||
float v3x, float v3y,
|
float v1y,
|
||||||
float v4x, float v4y
|
float v2x,
|
||||||
) : base(coordination)
|
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[ 0 ] = new Point( v0x, v0y, 0 );
|
||||||
this[1] = new Point(v1x, v1y, 0);
|
this[ 1 ] = new Point( v1x, v1y, 0 );
|
||||||
this[2] = new Point(v2x, v2y, 0);
|
this[ 2 ] = new Point( v2x, v2y, 0 );
|
||||||
this[3] = new Point(v3x, v3y, 0);
|
this[ 3 ] = new Point( v3x, v3y, 0 );
|
||||||
this[4] = new Point(v4x, v4y, 0);
|
this[ 4 ] = new Point( v4x, v4y, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ReadOnlySpan<int> VertexIndices => Indices;
|
public override ReadOnlySpan<int> VertexIndices => Indices;
|
||||||
|
|||||||
@@ -41,30 +41,31 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
internal static int[] Indices = [0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5];
|
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(
|
public Polygon6(
|
||||||
PlainCoordinate coordination,
|
PlainCoordinate coordination,
|
||||||
vec2d vert0,
|
Vec2 vert0,
|
||||||
vec2d vert1,
|
Vec2 vert1,
|
||||||
vec2d vert2,
|
Vec2 vert2,
|
||||||
vec2d vert3,
|
Vec2 vert3,
|
||||||
vec2d vert4,
|
Vec2 vert4,
|
||||||
vec2d vert5,
|
Vec2 vert5,
|
||||||
vec2d vert6
|
Vec2 vert6 )
|
||||||
) : base(coordination)
|
: base( coordination )
|
||||||
{
|
{
|
||||||
vertexMat = new vec4d[6];
|
vertexMat = new Vec4[6];
|
||||||
vertexMat[0].vec = vert0.vec;
|
vertexMat[ 0 ].vec = vert0.vec;
|
||||||
vertexMat[1].vec = vert1.vec;
|
vertexMat[ 1 ].vec = vert1.vec;
|
||||||
vertexMat[2].vec = vert2.vec;
|
vertexMat[ 2 ].vec = vert2.vec;
|
||||||
vertexMat[3].vec = vert3.vec;
|
vertexMat[ 3 ].vec = vert3.vec;
|
||||||
vertexMat[4].vec = vert4.vec;
|
vertexMat[ 4 ].vec = vert4.vec;
|
||||||
vertexMat[5].vec = vert5.vec;
|
vertexMat[ 5 ].vec = vert5.vec;
|
||||||
vertexMat[6].vec = vert6.vec;
|
vertexMat[ 6 ].vec = vert6.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ReadOnlySpan<int> VertexIndices => Indices;
|
public override ReadOnlySpan<int> VertexIndices => Indices;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user