daily update on 2024.03.18 by itload youmu
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Root Type="DevExpress.IntelliRush.Options.IntelliRushOptions">
|
||||||
|
<Options Language="Neutral">
|
||||||
|
<Enabled>True</Enabled>
|
||||||
|
<DisabledLanguages />
|
||||||
|
</Options>
|
||||||
|
</Root>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Root Type="DevExpress.CodeRush.VisualizePlugins.RightMarginLine.Options.RightMarginLineOptions">
|
||||||
|
<Options Language="Neutral">
|
||||||
|
<Enabled>True</Enabled>
|
||||||
|
</Options>
|
||||||
|
</Root>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Root Type="DevExpress.CodeRush.VSFeatures.SpellChecker.Options.SpellCheckerOptions">
|
||||||
|
<Options Language="Neutral">
|
||||||
|
<SupportedElements>XmlComments|Comments|Strings|VerbatimStrings|PublicIdentifiers|InternalIdentifiers|ProtectedInternalIdentifiers|ProtectedIdentifiers</SupportedElements>
|
||||||
|
</Options>
|
||||||
|
</Root>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Root Type="DevExpress.CodeRush.Foundation.CodePlaces.Options.FavoritesListContainer">
|
||||||
|
<Options Language="Neutral">
|
||||||
|
<Groups />
|
||||||
|
</Options>
|
||||||
|
</Root>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Root Type="DevExpress.CodeRush.VisualStudio.Services.Options.BuildEngineOptions">
|
||||||
|
<Options Language="Neutral">
|
||||||
|
<Enabled>True</Enabled>
|
||||||
|
</Options>
|
||||||
|
</Root>
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Root Type="DevExpress.CodeRush.Foundation.Shortcuts.ShortcutsOptions">
|
||||||
|
<Options Language="Neutral">
|
||||||
|
<RootFolder>
|
||||||
|
<SubFolders>
|
||||||
|
<Item Id="{01ea3896-6cc1-4912-824e-88c7c5a82a25}">
|
||||||
|
<Bindings>
|
||||||
|
<Item Id="{88959174-9ffa-429b-bef8-aeddb65b9c2a}" />
|
||||||
|
<Item Id="{975814d0-802e-4143-a979-22d3f975cfc2}" />
|
||||||
|
<Item Id="{0260c6ac-cfdb-4874-88c5-66bbf9b84e9b}" />
|
||||||
|
<Item Id="{dd4ceb84-80b3-4517-ac9b-170dcffe646f}" />
|
||||||
|
<Item Id="{a1f4a77e-b674-41bd-880f-195c3c0c1dfe}" />
|
||||||
|
<Item Id="{ee0b4600-2d2c-4700-8d4d-578027321f74}" />
|
||||||
|
<Item Id="{d37c2c40-a7c6-403f-8556-8fb690d4c656}">
|
||||||
|
<Enabled>False</Enabled>
|
||||||
|
</Item>
|
||||||
|
<Item Id="{baf8010d-02d7-4ac9-b644-0c670f796ce4}" />
|
||||||
|
<Item Id="{676742ae-19ea-4884-840d-2be66d9bb49c}" />
|
||||||
|
<Item Id="{43d481e0-19e4-405d-b7e3-687fc610050c}">
|
||||||
|
<Enabled>False</Enabled>
|
||||||
|
</Item>
|
||||||
|
<Item Id="{f1a06e4e-3241-438d-84e5-044e3e907492}" />
|
||||||
|
<Item Id="{3b8cae25-e23f-443c-98ff-83d38711f26e}" />
|
||||||
|
<Item Id="{491253a6-324c-4a0f-b4e5-aff443b00fb9}" />
|
||||||
|
<Item Id="{a06ba470-2048-47ac-b7af-93653ce09359}" />
|
||||||
|
<Item Id="{1562ccb9-7f21-492d-8c71-42d5ff7ecf9a}" />
|
||||||
|
<Item Id="{34c575e6-55c2-4d7f-a839-8167bfa1a831}" />
|
||||||
|
<Item Id="{b253a65c-b13a-42bd-8d59-4a790ce19f3a}" />
|
||||||
|
<Item Id="{011d4fb6-22ba-4d11-8a05-ed753b5dbd8a}" />
|
||||||
|
<Item Id="{804634ae-7823-4541-a8fe-d7da6c807b41}" />
|
||||||
|
<Item Id="{eb8a243c-8645-46cf-98ac-e73a6e32cf3e}" />
|
||||||
|
<Item Id="{5f2e52af-bb7d-46cc-819d-3f2a2860ba8c}" />
|
||||||
|
<Item Id="{9848d5d7-d513-4f1e-98aa-fcd21b3eb498}" />
|
||||||
|
</Bindings>
|
||||||
|
</Item>
|
||||||
|
<Item Id="{66d31aae-e1f0-43b9-8108-123cb59d73bd}" />
|
||||||
|
<Item Id="{4fcfb46a-6fd9-4ba4-a790-6447cb1cf0a5}" />
|
||||||
|
<Item Id="{55d41133-671c-49f1-a934-6c5d59c3f319}">
|
||||||
|
<SubFolders>
|
||||||
|
<Item Id="{4bc2f87d-6dc0-41b5-9b0b-251498b765df}">
|
||||||
|
<Bindings>
|
||||||
|
<Item Id="{d18a79d1-fff5-4b71-8301-fb8f2397e0ac}" />
|
||||||
|
<Item Id="{cc238591-6417-4f4c-bca3-08b8ecbb8a1b}">
|
||||||
|
<Enabled>False</Enabled>
|
||||||
|
</Item>
|
||||||
|
</Bindings>
|
||||||
|
</Item>
|
||||||
|
<Item Id="{0d070b5c-9bc8-4784-9071-548ab0ef93e9}" />
|
||||||
|
</SubFolders>
|
||||||
|
</Item>
|
||||||
|
<Item Id="{a3f2b3b4-9497-4db5-9f8b-c4b30a2240ac}" />
|
||||||
|
<Item Id="{318b8900-85af-4c66-b37f-8a86508e7a89}" />
|
||||||
|
<Item Id="{d33fb6fa-56b3-40a1-b169-71e855b2e3a2}" />
|
||||||
|
<Item Id="{4aa0656f-7150-440b-8585-509c548e9d7e}" />
|
||||||
|
</SubFolders>
|
||||||
|
</RootFolder>
|
||||||
|
</Options>
|
||||||
|
</Root>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[*.cs]
|
||||||
|
|
||||||
|
# CS1591: 缺少对公共可见类型或成员的 XML 注释
|
||||||
|
dotnet_diagnostic.CS1591.severity = suggestion
|
||||||
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.
BIN
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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+1f2fca4c8fe323daf9751677ccfdf0f7b04a9be8")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+15bf989285b01c5617b5f5612667e0da6a2b1781")]
|
||||||
[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 @@
|
|||||||
1b559b7de794dd65a77a826f372c4869f4f694564820837fdd05922d644b8624
|
60748d6834d1deac3b68f29467e8af995e7f1690974ec71ee229ce37c30422b0
|
||||||
|
|||||||
@@ -835,3 +835,293 @@ Successfully load all OpenGL 4.5 APIs
|
|||||||
Successfully load all OpenGL 4.6 APIs
|
Successfully load all OpenGL 4.6 APIs
|
||||||
Info @ 2024-03-10T19:08:56.2960606+08:00
|
Info @ 2024-03-10T19:08:56.2960606+08:00
|
||||||
No supported OpenGL extensions are found.
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-17T04:45:55.3954687+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-17T04:45:55.6735067+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-17T04:45:55.6937329+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-17T04:47:21.7670457+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-17T04:47:22.0119777+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-17T04:47:22.0296646+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-17T04:47:42.0853362+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-17T04:47:42.3080473+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-17T04:47:42.3265901+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-17T15:58:11.5959143+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-17T15:58:12.0461885+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-17T15:58:12.0727471+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-17T15:58:37.5771520+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-17T15:58:38.0455835+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-17T15:58:38.0805927+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-18T03:20:05.6386752+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-18T03:20:05.8480991+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-18T03:20:05.8716535+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-18T03:20:29.6227810+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-18T03:20:29.8383555+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-18T03:20:29.8580492+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-18T03:21:01.4396770+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-18T03:21:01.6593394+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-18T03:21:01.6754045+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-18T03:24:20.1623397+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-18T03:24:20.3852138+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-18T03:24:20.4025580+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info @ 2024-03-18T23:22:58.5141260+08:00
|
||||||
|
Program start
|
||||||
|
Info @ 2024-03-18T23:22:58.7359661+08:00
|
||||||
|
Find core OpenGL version.
|
||||||
|
Successfully load all OpenGL 1.0 APIs
|
||||||
|
Successfully load all OpenGL 1.1 APIs
|
||||||
|
Successfully load all OpenGL 1.2 APIs
|
||||||
|
Successfully load all OpenGL 1.3 APIs
|
||||||
|
Successfully load all OpenGL 1.4 APIs
|
||||||
|
Successfully load all OpenGL 1.5 APIs
|
||||||
|
Successfully load all OpenGL 2.0 APIs
|
||||||
|
Successfully load all OpenGL 2.1 APIs
|
||||||
|
Successfully load all OpenGL 3.0 APIs
|
||||||
|
Successfully load all OpenGL 3.1 APIs
|
||||||
|
Successfully load all OpenGL 3.2 APIs
|
||||||
|
Successfully load all OpenGL 3.3 APIs
|
||||||
|
Successfully load all OpenGL 4.0 APIs
|
||||||
|
Successfully load all OpenGL 4.1 APIs
|
||||||
|
Successfully load all OpenGL 4.2 APIs
|
||||||
|
Successfully load all OpenGL 4.3 APIs
|
||||||
|
Successfully load all OpenGL 4.4 APIs
|
||||||
|
Successfully load all OpenGL 4.5 APIs
|
||||||
|
Successfully load all OpenGL 4.6 APIs
|
||||||
|
Info @ 2024-03-18T23:22:58.7529805+08:00
|
||||||
|
No supported OpenGL extensions are found.
|
||||||
|
|||||||
@@ -12,6 +12,6 @@ void main()
|
|||||||
{
|
{
|
||||||
vec4 tex1 = texture(ourTexture, TexCoord);
|
vec4 tex1 = texture(ourTexture, TexCoord);
|
||||||
vec4 tex2 = texture(ourTexture2,TexCoord);
|
vec4 tex2 = texture(ourTexture2,TexCoord);
|
||||||
FragColor = mix(tex1,tex2,0.2) /**/ *vec4( TexColor,1.0) /**/;
|
FragColor = mix(tex1 * vec4( TexColor,1.0),tex2,0.2) /* *vec4( TexColor,1.0) /**/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -26,7 +26,8 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Graphics.Form.GL">
|
<member name="P:StgSharp.Graphics.Form.GL">
|
||||||
<summary>
|
<summary>
|
||||||
OpenGL package used by current form context.
|
OpenGL package binded to current form context.
|
||||||
|
A OpenGL context is only binded to current form.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Graphics.Form.Height">
|
<member name="P:StgSharp.Graphics.Form.Height">
|
||||||
@@ -51,24 +52,18 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Graphics.Form.MakeAsCurrentContext">
|
<member name="M:StgSharp.Graphics.Form.MakeAsCurrentContext">
|
||||||
<summary>
|
<summary>
|
||||||
Init an OpenGl context if current form has not been binded to any context.
|
Init an OpenGl context if current form has not been binded to any context. and set the context binded to
|
||||||
and set the context binded to current form as current OpenGL context.
|
current form as current OpenGL context.
|
||||||
</summary>
|
</summary>
|
||||||
<exception cref="T:System.Exception">Something goes wrong and
|
<exception cref="T:System.Exception">
|
||||||
StgSharp fails in creating a new OpenGL context. </exception>
|
Something goes wrong and StgSharp fails in creating a new OpenGL context.
|
||||||
|
</exception>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Graphics.Form.SetMetadata(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
<member name="M:StgSharp.Graphics.Form.SetMetadata(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||||
<summary>
|
<summary>
|
||||||
Set all necessary metadata to current form instance
|
Set all necessary metadata to current form instance
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Graphics.Form.SetSize(System.Int32,System.Int32)">
|
|
||||||
<summary>
|
|
||||||
Resize the current form
|
|
||||||
</summary>
|
|
||||||
<param name="width">New width of the window</param>
|
|
||||||
<param name="height">New height of the window</param>
|
|
||||||
</member>
|
|
||||||
<member name="M:StgSharp.Graphics.Form.SetSize(StgSharp.Math.Vec2d)">
|
<member name="M:StgSharp.Graphics.Form.SetSize(StgSharp.Math.Vec2d)">
|
||||||
<summary>
|
<summary>
|
||||||
Resize the current form
|
Resize the current form
|
||||||
@@ -77,14 +72,12 @@
|
|||||||
A <see cref="T:StgSharp.Math.Vec2d"/> (width,height) representing the new size of current form
|
A <see cref="T:StgSharp.Math.Vec2d"/> (width,height) representing the new size of current form
|
||||||
</param>
|
</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Graphics.Form.SetSizeLimit(System.Int32,System.Int32,System.Int32,System.Int32)">
|
<member name="M:StgSharp.Graphics.Form.SetSize(System.Int32,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
Set the size limit of current form
|
Resize the current form
|
||||||
</summary>
|
</summary>
|
||||||
<param name="minWidth">Minimum width of current form </param>
|
<param name="width">New width of the window</param>
|
||||||
<param name="minHeight">Minimum height of current form</param>
|
<param name="height">New height of the window</param>
|
||||||
<param name="maxWidth">Maximum width of curent form</param>
|
|
||||||
<param name="maxHeight">Maximum height of current form</param>
|
|
||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Graphics.Form.SetSizeLimit(StgSharp.Math.Vec2d,StgSharp.Math.Vec2d)">
|
<member name="M:StgSharp.Graphics.Form.SetSizeLimit(StgSharp.Math.Vec2d,StgSharp.Math.Vec2d)">
|
||||||
<summary>
|
<summary>
|
||||||
@@ -97,6 +90,15 @@
|
|||||||
Maximum size of current form. In form of a <see cref="T:StgSharp.Math.Vec2d"/> of (width,height)
|
Maximum size of current form. In form of a <see cref="T:StgSharp.Math.Vec2d"/> of (width,height)
|
||||||
</param>
|
</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:StgSharp.Graphics.Form.SetSizeLimit(System.Int32,System.Int32,System.Int32,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
Set the size limit of current form
|
||||||
|
</summary>
|
||||||
|
<param name="minWidth">Minimum width of current form</param>
|
||||||
|
<param name="minHeight">Minimum height of current form</param>
|
||||||
|
<param name="maxWidth">Maximum width of curent form</param>
|
||||||
|
<param name="maxHeight">Maximum height of current form</param>
|
||||||
|
</member>
|
||||||
<member name="M:StgSharp.Graphics.Form.Init(System.Object[])">
|
<member name="M:StgSharp.Graphics.Form.Init(System.Object[])">
|
||||||
<summary>
|
<summary>
|
||||||
Necessary operation to init this form.
|
Necessary operation to init this form.
|
||||||
@@ -105,8 +107,7 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Graphics.Form.Main(System.Object[])">
|
<member name="M:StgSharp.Graphics.Form.Main(System.Object[])">
|
||||||
<summary>
|
<summary>
|
||||||
Behaviour of current form when in a render cycle.
|
Behaviour of current form when in a render cycle. When this form
|
||||||
When this form
|
|
||||||
</summary>
|
</summary>
|
||||||
<param name="args"></param>
|
<param name="args"></param>
|
||||||
</member>
|
</member>
|
||||||
@@ -119,7 +120,7 @@
|
|||||||
<summary>
|
<summary>
|
||||||
Get OpenGL library of this form's context.
|
Get OpenGL library of this form's context.
|
||||||
</summary>
|
</summary>
|
||||||
<returns>A <see cref="T:StgSharp.Graphics.IglFunc"/> package contains all opengl APIs </returns>
|
<returns>A <see cref="T:StgSharp.Graphics.IglFunc"/> package contains all opengl APIs</returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Graphics.Form.SetRenderThreads(System.Int32)">
|
<member name="M:StgSharp.Graphics.Form.SetRenderThreads(System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
@@ -163,23 +164,6 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns>New instance of <see cref="T:StgSharp.Graphics.Shader"/> instance. </returns>
|
<returns>New instance of <see cref="T:StgSharp.Graphics.Shader"/> instance. </returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:StgSharp.Graphics.FrameTimer">
|
|
||||||
<summary>
|
|
||||||
A timer counting frames after its construction.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:StgSharp.Graphics.FrameTimer.Time">
|
|
||||||
<summary>
|
|
||||||
Frames after this timer created.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:StgSharp.Graphics.FrameTimer.op_Implicit(StgSharp.Graphics.FrameTimer)~System.UInt32">
|
|
||||||
<summary>
|
|
||||||
Convert a <see cref="T:StgSharp.Graphics.FrameTimer"/> into uint value.
|
|
||||||
this will get total frames since the timer was created.
|
|
||||||
</summary>
|
|
||||||
<param name="timer"><see cref="T:StgSharp.Graphics.FrameTimer"/> to be converted</param>
|
|
||||||
</member>
|
|
||||||
<member name="T:StgSharp.Graphics.BufferObjectBase">
|
<member name="T:StgSharp.Graphics.BufferObjectBase">
|
||||||
<summary>
|
<summary>
|
||||||
Interface of all kinds OpenGL buffer onjects
|
Interface of all kinds OpenGL buffer onjects
|
||||||
@@ -611,21 +595,20 @@
|
|||||||
Y position of an enemy entity
|
Y position of an enemy entity
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:StgSharp.Platform.version">
|
<member name="M:StgSharp.StgSharp.InitGL(System.Int32,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
Init an instance of OpenGL program,
|
||||||
|
This method should be called before any other StgSharp api.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:StgSharp.StgSharp.version">
|
||||||
<summary>
|
<summary>
|
||||||
Version of current StgSharp platform.
|
Version of current StgSharp platform.
|
||||||
Main version represent in hundred's digit,
|
Main version represent in hundred's digit,
|
||||||
and sub version represent in ten's digit.
|
and sub version represent in ten's digit.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Platform.InitGL(System.Int32,System.Int32)">
|
<member name="M:StgSharp.StgSharp.WriteLog(System.String,StgSharp.LogType)">
|
||||||
<summary>
|
|
||||||
Init an instance of OpenGL program,
|
|
||||||
This method should be called before other
|
|
||||||
graphic methods, after LoadGL method.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:StgSharp.Platform.WriteLog(System.String,StgSharp.LogType)">
|
|
||||||
<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>
|
||||||
@@ -709,11 +692,6 @@
|
|||||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Geometries.PlainGeometry.BornTime">
|
|
||||||
<summary>
|
|
||||||
Tick time this geometry eas crested
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:StgSharp.Geometries.PlainGeometry.GetAllSides">
|
<member name="M:StgSharp.Geometries.PlainGeometry.GetAllSides">
|
||||||
<summary>
|
<summary>
|
||||||
Get all sides of this <see cref="T:StgSharp.Geometries.PlainGeometry"/>.
|
Get all sides of this <see cref="T:StgSharp.Geometries.PlainGeometry"/>.
|
||||||
@@ -726,6 +704,11 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:StgSharp.Geometries.PlainGeometry.BornTime">
|
||||||
|
<summary>
|
||||||
|
Tick time this geometry eas crested
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
|
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
|
||||||
<summary>
|
<summary>
|
||||||
Update the coordinate of the point. If this is a moving point,
|
Update the coordinate of the point. If this is a moving point,
|
||||||
@@ -795,6 +778,27 @@
|
|||||||
The second <see cref="T:System.Boolean"/> value.
|
The second <see cref="T:System.Boolean"/> value.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:StgSharp.TimeProvider">
|
||||||
|
<summary>
|
||||||
|
A microsecond-accuracy timer. It will refresh every a certain time span.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:StgSharp.TimeProvider.#ctor(System.Int64,StgSharp.TimeSourceProvider)">
|
||||||
|
<summary>
|
||||||
|
Create a new <see cref="T:StgSharp.TimeProvider"/> and define the length of time span. Length of a single time span is defined in microseconds.
|
||||||
|
</summary>
|
||||||
|
<param name="spanLength"></param>
|
||||||
|
</member>
|
||||||
|
<member name="P:StgSharp.TimeProvider.DefaultProvider">
|
||||||
|
<summary>
|
||||||
|
Time source provider provided in <see cref="T:StgSharp.StgSharp"/> internal framework.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:StgSharp.TimeProvider.SpanRefreshCallback">
|
||||||
|
<summary>
|
||||||
|
The method this <see cref="T:StgSharp.TimeProvider"/> will call every time a new time span started.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:StgSharp.Math.GLclampf">
|
<member name="T:StgSharp.Math.GLclampf">
|
||||||
<summary>
|
<summary>
|
||||||
OpenGL numeric type.
|
OpenGL numeric type.
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Get.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.Controlling;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Logic;
|
using StgSharp.Logic;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
@@ -7,6 +37,7 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
public static unsafe partial class Operation
|
public static unsafe partial class Operation
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the status of a certain key on the keyboard.
|
/// Get the status of a certain key on the keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -15,7 +46,7 @@ namespace StgSharp
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static KeyStatus GetKeyStatus(Form form, Key key)
|
public static KeyStatus GetKeyStatus(Form form, Key key)
|
||||||
{
|
{
|
||||||
return InternalIO.glfwGetKey(form.windowID, (int)key);
|
return InternalIO.glfwGetKey(form.id, (int)key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GLIO.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.Controlling;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,42 @@
|
|||||||
using StgSharp.Geometries;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="InternalIO.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.Geometries;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using System.Threading;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
#if Windows
|
#if Windows
|
||||||
|
|
||||||
@@ -24,10 +55,6 @@ namespace StgSharp
|
|||||||
|
|
||||||
internal static unsafe partial class InternalIO
|
internal static unsafe partial class InternalIO
|
||||||
{
|
{
|
||||||
internal static Dictionary<TypeCode, uint> GLtype =
|
|
||||||
new Dictionary<TypeCode, uint>();
|
|
||||||
|
|
||||||
internal static IntPtr SSClibPtr = IntPtr.Zero;
|
|
||||||
|
|
||||||
internal const string SS_errorlog =
|
internal const string SS_errorlog =
|
||||||
"SS_errorlog.log";
|
"SS_errorlog.log";
|
||||||
@@ -35,9 +62,16 @@ namespace StgSharp
|
|||||||
internal const string SSC_libname =
|
internal const string SSC_libname =
|
||||||
"StgSharpC";
|
"StgSharpC";
|
||||||
|
|
||||||
|
internal static Dictionary<TypeCode, uint> GLtype =
|
||||||
|
new Dictionary<TypeCode, uint>();
|
||||||
|
|
||||||
|
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
static InternalIO()
|
static InternalIO()
|
||||||
{
|
{
|
||||||
GLtype.Add(TypeCode.Single, GLconst.FLOAT);
|
GLtype.Add(TypeCode.Single, GLconst.FLOAT);
|
||||||
@@ -49,6 +83,20 @@ namespace StgSharp
|
|||||||
GLtype.Add(TypeCode.Byte, GLconst.UNSIGNED_BYTE);
|
GLtype.Add(TypeCode.Byte, GLconst.UNSIGNED_BYTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void InternalAppendLog(string log)
|
||||||
|
{
|
||||||
|
if (!File.Exists(SS_errorlog))
|
||||||
|
{
|
||||||
|
FileStream stream = File.Create(SS_errorlog);
|
||||||
|
stream.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
using (StreamWriter logStream = File.AppendText(SS_errorlog))
|
||||||
|
{
|
||||||
|
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
|
||||||
{
|
{
|
||||||
@@ -68,8 +116,9 @@ namespace StgSharp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InternalAppendLog(string log)
|
internal static void InternalWriteLog(string logLine, LogType logType)
|
||||||
{
|
{
|
||||||
|
logSyncSemaphore.Wait();
|
||||||
if (!File.Exists(SS_errorlog))
|
if (!File.Exists(SS_errorlog))
|
||||||
{
|
{
|
||||||
FileStream stream = File.Create(SS_errorlog);
|
FileStream stream = File.Create(SS_errorlog);
|
||||||
@@ -78,12 +127,12 @@ namespace StgSharp
|
|||||||
|
|
||||||
using (StreamWriter logStream = File.AppendText(SS_errorlog))
|
using (StreamWriter logStream = File.AppendText(SS_errorlog))
|
||||||
{
|
{
|
||||||
logStream.WriteLine(log);
|
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||||
|
logStream.WriteLine(logLine);
|
||||||
}
|
}
|
||||||
|
logSyncSemaphore.Release(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1);
|
|
||||||
|
|
||||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||||
{
|
{
|
||||||
logSyncSemaphore.Wait();
|
logSyncSemaphore.Wait();
|
||||||
@@ -102,21 +151,5 @@ namespace StgSharp
|
|||||||
logSyncSemaphore.Release(1);
|
logSyncSemaphore.Release(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
|
||||||
{
|
|
||||||
logSyncSemaphore.Wait();
|
|
||||||
if (!File.Exists(SS_errorlog))
|
|
||||||
{
|
|
||||||
FileStream stream = File.Create(SS_errorlog);
|
|
||||||
stream.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
using (StreamWriter logStream = File.AppendText(SS_errorlog))
|
|
||||||
{
|
|
||||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
|
||||||
logStream.WriteLine(logLine);
|
|
||||||
}
|
|
||||||
logSyncSemaphore.Release(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+154
-124
@@ -1,133 +1,163 @@
|
|||||||
namespace StgSharp
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="KeyControl.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.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
public static partial class Operation
|
public static partial class Operation
|
||||||
{
|
{
|
||||||
public enum Key : int
|
public enum Key : int
|
||||||
{
|
{
|
||||||
UNKNOWN = -1,
|
UNKNOWN = -1,
|
||||||
SPACE = 32,
|
SPACE = 32,
|
||||||
APOSTROPHE = 39/*'*/,
|
APOSTROPHE = 39/*'*/,
|
||||||
COMMA = 44/*,*/,
|
COMMA = 44/*,*/,
|
||||||
MINUS = 45/*-*/,
|
MINUS = 45/*-*/,
|
||||||
PERIOD = 46/*.*/,
|
PERIOD = 46/*.*/,
|
||||||
SLASH = 47/*/*/,
|
SLASH = 47/*/*/,
|
||||||
ZERO = 48,
|
ZERO = 48,
|
||||||
ONE = 49,
|
ONE = 49,
|
||||||
TWO = 50,
|
TWO = 50,
|
||||||
THREE = 51,
|
THREE = 51,
|
||||||
FOUR = 52,
|
FOUR = 52,
|
||||||
FIVE = 53,
|
FIVE = 53,
|
||||||
SIX = 54,
|
SIX = 54,
|
||||||
SEVEN = 55,
|
SEVEN = 55,
|
||||||
EIGHT = 56,
|
EIGHT = 56,
|
||||||
NINE = 57,
|
NINE = 57,
|
||||||
SEMICOLON = 59/*,*/,
|
SEMICOLON = 59/*,*/,
|
||||||
EQUAL = 61/*=*/,
|
EQUAL = 61/*=*/,
|
||||||
A = 65,
|
A = 65,
|
||||||
B = 66,
|
B = 66,
|
||||||
C = 67,
|
C = 67,
|
||||||
D = 68,
|
D = 68,
|
||||||
E = 69,
|
E = 69,
|
||||||
F = 70,
|
F = 70,
|
||||||
G = 71,
|
G = 71,
|
||||||
H = 72,
|
H = 72,
|
||||||
I = 73,
|
I = 73,
|
||||||
J = 74,
|
J = 74,
|
||||||
K = 75,
|
K = 75,
|
||||||
L = 76,
|
L = 76,
|
||||||
M = 77,
|
M = 77,
|
||||||
N = 78,
|
N = 78,
|
||||||
O = 79,
|
O = 79,
|
||||||
P = 80,
|
P = 80,
|
||||||
Q = 81,
|
Q = 81,
|
||||||
R = 82,
|
R = 82,
|
||||||
S = 83,
|
S = 83,
|
||||||
T = 84,
|
T = 84,
|
||||||
U = 85,
|
U = 85,
|
||||||
V = 86,
|
V = 86,
|
||||||
W = 87,
|
W = 87,
|
||||||
X = 88,
|
X = 88,
|
||||||
Y = 89,
|
Y = 89,
|
||||||
Z = 90,
|
Z = 90,
|
||||||
LEFT_BRACKET = 91/*[*/,
|
LEFT_BRACKET = 91/*[*/,
|
||||||
BACKSLASH = 92/*\*/,
|
BACKSLASH = 92/*\*/,
|
||||||
RIGHT_BRACKET = 93/*]*/,
|
RIGHT_BRACKET = 93/*]*/,
|
||||||
GRAVE_ACCENT = 96/*`*/,
|
GRAVE_ACCENT = 96/*`*/,
|
||||||
WORLD_1 = 161/*non-US#1*/,
|
WORLD_1 = 161/*non-US#1*/,
|
||||||
WORLD_2 = 162/*non-US#2*/,
|
WORLD_2 = 162/*non-US#2*/,
|
||||||
ESCAPE = 256,
|
ESCAPE = 256,
|
||||||
ENTER = 257,
|
ENTER = 257,
|
||||||
TAB = 258,
|
TAB = 258,
|
||||||
BACKSPACE = 259,
|
BACKSPACE = 259,
|
||||||
INSERT = 260,
|
INSERT = 260,
|
||||||
DELETE = 261,
|
DELETE = 261,
|
||||||
RIGHT = 262,
|
RIGHT = 262,
|
||||||
LEFT = 263,
|
LEFT = 263,
|
||||||
DOWN = 264,
|
DOWN = 264,
|
||||||
UP = 265,
|
UP = 265,
|
||||||
PAGE_UP = 266,
|
PAGE_UP = 266,
|
||||||
PAGE_DOWN = 267,
|
PAGE_DOWN = 267,
|
||||||
HOME = 268,
|
HOME = 268,
|
||||||
END = 269,
|
END = 269,
|
||||||
CAPS_LOCK = 280,
|
CAPS_LOCK = 280,
|
||||||
SCROLL_LOCK = 281,
|
SCROLL_LOCK = 281,
|
||||||
NUM_LOCK = 282,
|
NUM_LOCK = 282,
|
||||||
PRINT_SCREEN = 283,
|
PRINT_SCREEN = 283,
|
||||||
PAUSE = 284,
|
PAUSE = 284,
|
||||||
F1 = 290,
|
F1 = 290,
|
||||||
F2 = 291,
|
F2 = 291,
|
||||||
F3 = 292,
|
F3 = 292,
|
||||||
F4 = 293,
|
F4 = 293,
|
||||||
F5 = 294,
|
F5 = 294,
|
||||||
F6 = 295,
|
F6 = 295,
|
||||||
F7 = 296,
|
F7 = 296,
|
||||||
F8 = 297,
|
F8 = 297,
|
||||||
F9 = 298,
|
F9 = 298,
|
||||||
F10 = 299,
|
F10 = 299,
|
||||||
F11 = 300,
|
F11 = 300,
|
||||||
F12 = 301,
|
F12 = 301,
|
||||||
F13 = 302,
|
F13 = 302,
|
||||||
F14 = 303,
|
F14 = 303,
|
||||||
F15 = 304,
|
F15 = 304,
|
||||||
F16 = 305,
|
F16 = 305,
|
||||||
F17 = 306,
|
F17 = 306,
|
||||||
F18 = 307,
|
F18 = 307,
|
||||||
F19 = 308,
|
F19 = 308,
|
||||||
F20 = 309,
|
F20 = 309,
|
||||||
F21 = 310,
|
F21 = 310,
|
||||||
F22 = 311,
|
F22 = 311,
|
||||||
F23 = 312,
|
F23 = 312,
|
||||||
F24 = 313,
|
F24 = 313,
|
||||||
F25 = 314,
|
F25 = 314,
|
||||||
KP_0 = 320,
|
KP_0 = 320,
|
||||||
KP_1 = 321,
|
KP_1 = 321,
|
||||||
KP_2 = 322,
|
KP_2 = 322,
|
||||||
KP_3 = 323,
|
KP_3 = 323,
|
||||||
KP_4 = 324,
|
KP_4 = 324,
|
||||||
KP_5 = 325,
|
KP_5 = 325,
|
||||||
KP_6 = 326,
|
KP_6 = 326,
|
||||||
KP_7 = 327,
|
KP_7 = 327,
|
||||||
KP_8 = 328,
|
KP_8 = 328,
|
||||||
KP_9 = 329,
|
KP_9 = 329,
|
||||||
KP_DECIMAL = 330,
|
KP_DECIMAL = 330,
|
||||||
KP_DIVIDE = 331,
|
KP_DIVIDE = 331,
|
||||||
KP_MULTIPLY = 332,
|
KP_MULTIPLY = 332,
|
||||||
KP_SUBTRACT = 333,
|
KP_SUBTRACT = 333,
|
||||||
KP_ADD = 334,
|
KP_ADD = 334,
|
||||||
KP_ENTER = 335,
|
KP_ENTER = 335,
|
||||||
KP_EQUAL = 336,
|
KP_EQUAL = 336,
|
||||||
LEFT_SHIFT = 340,
|
LEFT_SHIFT = 340,
|
||||||
LEFT_CONTROL = 341,
|
LEFT_CONTROL = 341,
|
||||||
LEFT_ALT = 342,
|
LEFT_ALT = 342,
|
||||||
LEFT_SUPER = 343,
|
LEFT_SUPER = 343,
|
||||||
RIGHT_SHIFT = 344,
|
RIGHT_SHIFT = 344,
|
||||||
RIGHT_CONTROL = 345,
|
RIGHT_CONTROL = 345,
|
||||||
RIGHT_ALT = 346,
|
RIGHT_ALT = 346,
|
||||||
RIGHT_SUPER = 347,
|
RIGHT_SUPER = 347,
|
||||||
MENU = 348
|
MENU = 348
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Joystick:int
|
public enum Joystick : int
|
||||||
{
|
{
|
||||||
JOYSTICK_1 = 0,
|
JOYSTICK_1 = 0,
|
||||||
JOYSTICK_2 = 1,
|
JOYSTICK_2 = 1,
|
||||||
@@ -164,7 +194,7 @@
|
|||||||
BUTTON_MIDDLE = BUTTON_3
|
BUTTON_MIDDLE = BUTTON_3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum KeyStatus : int
|
public enum KeyStatus : int
|
||||||
|
|||||||
@@ -1,5 +1,36 @@
|
|||||||
using StgSharp.Entities;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="TimeLine.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.Entities;
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
@@ -9,24 +40,19 @@ namespace StgSharp.Controlling
|
|||||||
{
|
{
|
||||||
internal static partial class TimeLine
|
internal static partial class TimeLine
|
||||||
{
|
{
|
||||||
internal static Queue<Form> formList = new Queue<Form>();
|
|
||||||
|
private static bool isPaused = false;
|
||||||
private static bool renderChainStarted;
|
private static bool renderChainStarted;
|
||||||
|
|
||||||
internal static TimelineBlock currentOperation;
|
internal static TimelineBlock currentOperation;
|
||||||
private static bool isPaused = false;
|
internal static Queue<Form> formList = new Queue<Form>();
|
||||||
|
|
||||||
|
|
||||||
internal static bool RenderStarted
|
|
||||||
{
|
|
||||||
get { return renderChainStarted; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TimelineBlock CurrentOperation
|
public static TimelineBlock CurrentOperation
|
||||||
{
|
{
|
||||||
get { return currentOperation; }
|
get => currentOperation;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (currentOperation == default ||
|
if ((currentOperation == default) ||
|
||||||
currentOperation.isComplete)
|
currentOperation.isComplete)
|
||||||
{
|
{
|
||||||
currentOperation = value;
|
currentOperation = value;
|
||||||
@@ -35,6 +61,9 @@ namespace StgSharp.Controlling
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internal static bool RenderStarted => renderChainStarted;
|
||||||
|
|
||||||
|
|
||||||
internal static void RenderAll()
|
internal static void RenderAll()
|
||||||
{
|
{
|
||||||
renderChainStarted = true;
|
renderChainStarted = true;
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
namespace StgSharp.Controlling
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="TimelineBlock.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.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
namespace StgSharp.Controlling
|
||||||
{
|
{
|
||||||
public abstract class TimelineBlock
|
public abstract class TimelineBlock
|
||||||
{
|
{
|
||||||
@@ -8,12 +38,14 @@
|
|||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract bool GetShouldComplete();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A virtual method api to define what should program do
|
A virtual method api to define what should program do
|
||||||
in a framecycle, an int value is required to express
|
in a framecycle, an int value is required to express
|
||||||
the result of the cycle, that if there is any error in the cycle
|
the result of the cycle, that if there is any error in the cycle
|
||||||
*/
|
*/
|
||||||
public abstract int OnUpdating();
|
public abstract int OnUpdating();
|
||||||
public abstract bool GetShouldComplete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
namespace StgSharp.Entities
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="BehaviorArgs.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.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
namespace StgSharp.Entities
|
||||||
{
|
{
|
||||||
public abstract class BehaviorArgs
|
public abstract class BehaviorArgs
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="EliteEnemy.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.Controlling;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -7,20 +37,19 @@ namespace StgSharp.Entities
|
|||||||
{
|
{
|
||||||
public class EliteEnemy : IEntity
|
public class EliteEnemy : IEntity
|
||||||
{
|
{
|
||||||
public bool _selectalbe;
|
|
||||||
|
|
||||||
internal Launcher<EntityPartical> _awardLauncher;
|
internal Launcher<EntityPartical> _awardLauncher;
|
||||||
internal LinkedList<Launcher<EntityPartical>> _commonBulletLauncher;
|
internal LinkedList<Launcher<EntityPartical>> _commonBulletLauncher;
|
||||||
internal Launcher<EntityPartical> _dieBulletLauncher;
|
internal Launcher<EntityPartical> _dieBulletLauncher;
|
||||||
|
public bool _selectalbe;
|
||||||
|
|
||||||
public Launcher<EntityPartical> AwardLauncher { get; set; }
|
public Launcher<EntityPartical> AwardLauncher { get; set; }
|
||||||
public LinkedList<Launcher<EntityPartical>> CommonBulletLauncher { get; set; }
|
public LinkedList<Launcher<EntityPartical>> CommonBulletLauncher { get; set; }
|
||||||
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
||||||
|
|
||||||
internal void InternalDieOperation(Control home)
|
public virtual void OnRender()
|
||||||
{
|
{
|
||||||
_dieBulletLauncher.Launch();
|
new NotImplementedException();
|
||||||
_awardLauncher.Launch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRenderFrame()
|
public override void OnRenderFrame()
|
||||||
@@ -33,8 +62,16 @@ namespace StgSharp.Entities
|
|||||||
this.OnRender();
|
this.OnRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnRender() => new NotImplementedException();
|
public virtual void OnUpdate()
|
||||||
|
{
|
||||||
|
new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void InternalDieOperation(Control home)
|
||||||
|
{
|
||||||
|
_dieBulletLauncher.Launch();
|
||||||
|
_awardLauncher.Launch();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void OnUpdate() => new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,59 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Enemy.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.Controlling;
|
||||||
|
|
||||||
namespace StgSharp.Entities
|
namespace StgSharp.Entities
|
||||||
{
|
{
|
||||||
public class Enemy : IEntity
|
public class Enemy : IEntity
|
||||||
{
|
{
|
||||||
public bool _selectalbe;
|
|
||||||
|
|
||||||
internal Launcher<EntityPartical> _awardLauncher;
|
internal Launcher<EntityPartical> _awardLauncher;
|
||||||
internal Launcher<EntityPartical> _commonBulletLauncher;
|
internal Launcher<EntityPartical> _commonBulletLauncher;
|
||||||
internal Launcher<EntityPartical> _dieBulletLauncher;
|
internal Launcher<EntityPartical> _dieBulletLauncher;
|
||||||
|
public bool _selectalbe;
|
||||||
|
|
||||||
public Launcher<EntityPartical> AwardLauncher { get; set; }
|
public Launcher<EntityPartical> AwardLauncher { get; set; }
|
||||||
public Launcher<EntityPartical> CommonBulletLauncher { get; set; }
|
public Launcher<EntityPartical> CommonBulletLauncher { get; set; }
|
||||||
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
||||||
|
|
||||||
|
public override void OnRenderFrame()
|
||||||
|
{
|
||||||
|
CommonBulletLauncher.Launch();
|
||||||
|
}
|
||||||
|
|
||||||
internal void InternalDieOperation(Control home)
|
internal void InternalDieOperation(Control home)
|
||||||
{
|
{
|
||||||
_dieBulletLauncher.Launch();
|
_dieBulletLauncher.Launch();
|
||||||
_awardLauncher.Launch();
|
_awardLauncher.Launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRenderFrame()
|
|
||||||
{
|
|
||||||
CommonBulletLauncher.Launch();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
namespace StgSharp.Entities
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="EntityPartical.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.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
namespace StgSharp.Entities
|
||||||
{
|
{
|
||||||
public abstract class EntityPartical : IEntity
|
public abstract class EntityPartical : IEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Geometries;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="IEntity.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.Geometries;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -7,19 +37,20 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
public abstract class IEntity
|
public abstract class IEntity
|
||||||
{
|
{
|
||||||
internal Point _pos;
|
|
||||||
|
protected uint _bornTick;
|
||||||
|
internal Point _basePoint;
|
||||||
internal LinkedList<PlainGeometry> _collisionBox;
|
internal LinkedList<PlainGeometry> _collisionBox;
|
||||||
internal Sensor<PlainGeometry> _collisionSensor;
|
internal Sensor<PlainGeometry> _collisionSensor;
|
||||||
internal string _texture;
|
|
||||||
internal Point _position;
|
|
||||||
internal Point _basePoint;
|
|
||||||
internal GetLocationHandler _movHandler;
|
internal GetLocationHandler _movHandler;
|
||||||
protected uint _bornTick;
|
internal Point _pos;
|
||||||
|
internal Point _position;
|
||||||
|
internal string _texture;
|
||||||
|
|
||||||
public LinkedList<PlainGeometry> CollisionBox
|
public LinkedList<PlainGeometry> CollisionBox
|
||||||
{
|
{
|
||||||
get { return _collisionBox; }
|
get => _collisionBox;
|
||||||
set { _collisionBox = value; }
|
set => _collisionBox = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -27,17 +58,17 @@ namespace StgSharp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Sensor<PlainGeometry> CollisionSensor
|
public Sensor<PlainGeometry> CollisionSensor
|
||||||
{
|
{
|
||||||
get { return _collisionSensor; }
|
get => _collisionSensor;
|
||||||
set { _collisionSensor = value; }
|
set => _collisionSensor = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Texture { 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 Vec2d Location { get; }
|
||||||
|
|
||||||
|
public string Texture { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// X position of an enenmy entity
|
/// X position of an enenmy entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -48,11 +79,12 @@ namespace StgSharp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float Y { get; set; }
|
public float Y { get; set; }
|
||||||
|
|
||||||
|
public abstract void OnRenderFrame();
|
||||||
|
|
||||||
public void SetLocation(Point p)
|
public void SetLocation(Point p)
|
||||||
{
|
{
|
||||||
_pos = p;
|
_pos = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void OnRenderFrame();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,54 @@
|
|||||||
using StgSharp.Entities;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Launcher.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.Entities;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
namespace StgSharp
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
public class Launcher<T> where T : IEntity
|
public class Launcher<T> where T : IEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
|
internal EntityPartical _bulletSample; //发射的子弹类型
|
||||||
/*
|
/*
|
||||||
*用于发射其他的实体,主要是子弹 和 掉落物
|
*用于发射其他的实体,主要是子弹 和 掉落物
|
||||||
*/
|
*/
|
||||||
|
|
||||||
internal Vec2d _center; //发射器的参考位置,运动轨迹的方程应当基于这个参考点构建
|
internal Vec2d _center; //发射器的参考位置,运动轨迹的方程应当基于这个参考点构建
|
||||||
internal Counter<int> _internalParameter; //发射器的内部计时器
|
internal Counter<int> _internalParameter; //发射器的内部计时器
|
||||||
internal EntityPartical _bulletSample; //发射的子弹类型
|
|
||||||
internal uint[] launchtick; //发射子弹的内部计时
|
internal uint[] launchtick; //发射子弹的内部计时
|
||||||
|
|
||||||
public EntityPartical Bullet
|
public EntityPartical Bullet
|
||||||
{
|
{
|
||||||
get { return _bulletSample; }
|
get => _bulletSample;
|
||||||
set { _bulletSample = value; }
|
set => _bulletSample = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual void Launch()
|
internal virtual void Launch()
|
||||||
|
|||||||
@@ -1,12 +1,44 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Partical.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;
|
||||||
|
|
||||||
namespace StgSharp
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
public class Partical : IEntity
|
public class Partical : IEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
public override void OnRenderFrame()
|
public override void OnRenderFrame()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,41 @@
|
|||||||
namespace StgSharp
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Player.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.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
public abstract class Player : IEntity
|
public abstract class Player : IEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
internal float _velocity;
|
internal float _velocity;
|
||||||
|
|
||||||
public float Velocity
|
public float Velocity => _velocity;
|
||||||
{
|
|
||||||
get { return _velocity; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GlobalSetting.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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -9,6 +39,7 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
public static unsafe partial class StgSharp
|
public static unsafe partial class StgSharp
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Init an instance of OpenGL program,
|
/// Init an instance of OpenGL program,
|
||||||
/// This method should be called before any other StgSharp api.
|
/// This method should be called before any other StgSharp api.
|
||||||
@@ -28,17 +59,20 @@ namespace StgSharp
|
|||||||
|
|
||||||
public static class GlobalSetting
|
public static class GlobalSetting
|
||||||
{
|
{
|
||||||
|
|
||||||
private static bool vSyncActivated;
|
private static bool vSyncActivated;
|
||||||
|
|
||||||
public static bool VSyncActivated
|
public static bool VSyncActivated
|
||||||
{
|
{
|
||||||
get { return vsyncActivated; }
|
get => vsyncActivated;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
InternalIO.glfwSwapInterval(value ? 1 : 0);
|
InternalIO.glfwSwapInterval(value ? 1 : 0);
|
||||||
vsyncActivated = value;
|
vsyncActivated = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
// using StgSharp.Envitronment;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Platform.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.Envitronment;
|
||||||
// using StgSharp.Envitronment.Win32;
|
// using StgSharp.Envitronment.Win32;
|
||||||
// using StgSharp.Graphics;
|
// using StgSharp.Graphics;
|
||||||
// using StgSharp.Math;
|
// using StgSharp.Math;
|
||||||
@@ -36,9 +66,17 @@ namespace StgSharp
|
|||||||
|
|
||||||
public static partial class StgSharp
|
public static partial class StgSharp
|
||||||
{
|
{
|
||||||
internal static GraphicAPI API = default;
|
|
||||||
private static bool vsyncActivated;
|
/// <summary>
|
||||||
|
/// Version of current StgSharp platform.
|
||||||
|
/// Main version represent in hundred's digit,
|
||||||
|
/// and sub version represent in ten's digit.
|
||||||
|
/// </summary>
|
||||||
|
public const long version = 430;
|
||||||
|
|
||||||
private static uint markCount = 0;
|
private static uint markCount = 0;
|
||||||
|
private static bool vsyncActivated;
|
||||||
|
internal static GraphicAPI API = default;
|
||||||
|
|
||||||
public static void Mark(bool needConsole)
|
public static void Mark(bool needConsole)
|
||||||
{
|
{
|
||||||
@@ -49,12 +87,34 @@ namespace StgSharp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static void Track(
|
||||||
/// Version of current StgSharp platform.
|
object target,
|
||||||
/// Main version represent in hundred's digit,
|
string message,
|
||||||
/// and sub version represent in ten's digit.
|
bool isConsole,
|
||||||
/// </summary>
|
[CallerFilePath] string filePath = "",
|
||||||
public const long version = 430;
|
[CallerMemberName] string callerName = "",
|
||||||
|
[CallerLineNumber] int lineNumber = 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Type t = target.GetType();
|
||||||
|
string log = $"Tracked object: {nameof(target)}\t\tType:{t.Name}\n";
|
||||||
|
FieldInfo[] fieldInfo = t.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
log += "|\tFieldName\t|\tFieldType\t|\tFieldValue\t|\n";
|
||||||
|
foreach (FieldInfo field in fieldInfo)
|
||||||
|
{
|
||||||
|
log += $"|{field.Name}\t\t|{field.FieldType}\t\t|{field.GetValue(target)}\t\t|\n";
|
||||||
|
}
|
||||||
|
log += $"Tracking at:\n{filePath}\t{callerName}\tline {lineNumber}\n";
|
||||||
|
log += $"Additional information:\n{message}\n";
|
||||||
|
if (isConsole)
|
||||||
|
{
|
||||||
|
Console.WriteLine(log);
|
||||||
|
}
|
||||||
|
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.
|
||||||
@@ -99,33 +159,5 @@ namespace StgSharp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Track(
|
|
||||||
object target,
|
|
||||||
string message,
|
|
||||||
bool isConsole,
|
|
||||||
[CallerFilePath] string filePath = "",
|
|
||||||
[CallerMemberName] string callerName = "",
|
|
||||||
[CallerLineNumber] int lineNumber = 0
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Type t = target.GetType();
|
|
||||||
string log = $"Tracked object: {nameof(target)}\t\tType:{t.Name}\n";
|
|
||||||
FieldInfo[] fieldInfo = t.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
|
||||||
log += "|\tFieldName\t|\tFieldType\t|\tFieldValue\t|\n";
|
|
||||||
foreach (FieldInfo field in fieldInfo)
|
|
||||||
{
|
|
||||||
log += $"|{field.Name}\t\t|{field.FieldType}\t\t|{field.GetValue(target)}\t\t|\n";
|
|
||||||
}
|
|
||||||
log += $"Tracking at:\n{filePath}\t{callerName}\tline {lineNumber}\n";
|
|
||||||
log += $"Additional information:\n{message}\n";
|
|
||||||
if (isConsole)
|
|
||||||
{
|
|
||||||
Console.WriteLine(log);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
InternalIO.InternalWriteLog(log, LogType.Info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp
|
|
||||||
{
|
|
||||||
public static partial class StgSharp
|
|
||||||
{
|
|
||||||
private static Stopwatch mainProvider = new Stopwatch();
|
|
||||||
private static List<TimeProvider> subscriberList = new List<TimeProvider>();
|
|
||||||
private static Thread timeProvideThread;
|
|
||||||
private static long accuracy;
|
|
||||||
|
|
||||||
private static void ProvideTime()
|
|
||||||
{
|
|
||||||
long totalMS, previousFrameMS = 0,
|
|
||||||
internalFrequncy = Stopwatch.Frequency;
|
|
||||||
lock (mainProvider)
|
|
||||||
{
|
|
||||||
mainProvider.Restart();
|
|
||||||
}
|
|
||||||
while (mainProvider.IsRunning)
|
|
||||||
{
|
|
||||||
totalMS = mainProvider.ElapsedTicks / (internalFrequncy / (1000L * 1000L));
|
|
||||||
foreach (TimeProvider subscriber in subscriberList)
|
|
||||||
{
|
|
||||||
subscriber.CheckTime(totalMS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoOptimization)]
|
|
||||||
public static void TimerActivate(int maxFrameUpdateSensitiveTimeProviderCount)
|
|
||||||
{
|
|
||||||
if (!mainProvider.IsRunning)
|
|
||||||
{
|
|
||||||
mainProvider.Start();
|
|
||||||
//speed test
|
|
||||||
long totalMS, previousSecondMS = 0,
|
|
||||||
internalFrequncy = Stopwatch.Frequency;
|
|
||||||
for (int i = 0; i < 100; i++)
|
|
||||||
{
|
|
||||||
totalMS = mainProvider.ElapsedTicks / (internalFrequncy / (1000L * 1000L));
|
|
||||||
for (int t = 0; t < 10; t++)
|
|
||||||
{
|
|
||||||
if (totalMS < 1000)
|
|
||||||
{
|
|
||||||
subscriberList.Add(new TimeProvider(100L));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mainProvider.Stop();
|
|
||||||
subscriberList.Clear();
|
|
||||||
totalMS = (mainProvider.ElapsedTicks / (internalFrequncy / (1000L * 1000L))) / 100L;
|
|
||||||
accuracy = totalMS * 2 / 3;
|
|
||||||
mainProvider.Reset();
|
|
||||||
timeProvideThread = new Thread(new ThreadStart(ProvideTime));
|
|
||||||
timeProvideThread.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SubscribeTimeProvider(TimeProvider provider)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void TimerDeactivate()
|
|
||||||
{
|
|
||||||
lock (mainProvider)
|
|
||||||
{
|
|
||||||
mainProvider.Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="TimeProvider.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 StgSharpDebug.Logic;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace StgSharp
|
||||||
|
{
|
||||||
|
public partial class StgSharp
|
||||||
|
{
|
||||||
|
|
||||||
|
internal static StgSharpTime mainTimeProvider;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class StgSharpTime : TimeSourceProviderBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static long accuracy;
|
||||||
|
private static Stopwatch mainProvider = new Stopwatch();
|
||||||
|
private static List<TimeSpanProvider> subscriberList = new List<TimeSpanProvider>();
|
||||||
|
private static Thread timeProvideThread;
|
||||||
|
|
||||||
|
internal StgSharpTime()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StgSharpTime OnlyInstance
|
||||||
|
=> StgSharp.mainTimeProvider;
|
||||||
|
|
||||||
|
public override sealed void StartProvidingTime()
|
||||||
|
{
|
||||||
|
if (mainProvider.IsRunning)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mainProvider.Start();
|
||||||
|
//speed test
|
||||||
|
long totalMS, internalFrequncy = Stopwatch.Frequency;
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
totalMS = mainProvider.ElapsedTicks / (internalFrequncy / (1000L * 1000L));
|
||||||
|
for (int t = 0; t < 10; t++)
|
||||||
|
{
|
||||||
|
if (totalMS < 1000)
|
||||||
|
{
|
||||||
|
subscriberList.Add(new TimeSpanProvider(100L, TimeSpanProvider.DefaultProvider));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mainProvider.Stop();
|
||||||
|
subscriberList.Clear();
|
||||||
|
totalMS = mainProvider.ElapsedTicks / (internalFrequncy / (1000L * 1000L)) / 100L;
|
||||||
|
accuracy = (totalMS * 2) / 3;
|
||||||
|
mainProvider.Reset();
|
||||||
|
timeProvideThread = new Thread(new ThreadStart(ProvideTime));
|
||||||
|
timeProvideThread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoOptimization)]
|
||||||
|
public static void TimerActivate(int maxFrameUpdateSensitiveTimeProviderCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override sealed void AddSubscriberUnsynced(TimeSpanProvider subscriber)
|
||||||
|
{
|
||||||
|
subscriberList.Add(subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override sealed void RemoveSubscriberUnsynced(TimeSpanProvider subscriber)
|
||||||
|
{
|
||||||
|
subscriberList.Remove(subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProvideTime()
|
||||||
|
{
|
||||||
|
long totalMS, internalFrequncy = Stopwatch.Frequency;
|
||||||
|
lock (mainProvider)
|
||||||
|
{
|
||||||
|
mainProvider.Restart();
|
||||||
|
}
|
||||||
|
while (mainProvider.IsRunning)
|
||||||
|
{
|
||||||
|
totalMS = mainProvider.ElapsedTicks / (internalFrequncy / (1000L * 1000L));
|
||||||
|
foreach (TimeSpanProvider subscriber in subscriberList)
|
||||||
|
{
|
||||||
|
if (subscriber.CheckTime(totalMS))
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,35 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Arc.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;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
@@ -8,20 +39,40 @@ namespace StgSharp.Geometries
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Arc : PlainGeometry
|
public class Arc : PlainGeometry
|
||||||
{
|
{
|
||||||
internal Point center;
|
|
||||||
internal Point beginPoint;
|
internal Point beginPoint;
|
||||||
|
internal Point center;
|
||||||
internal Point endPoint;
|
internal Point endPoint;
|
||||||
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
|
||||||
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
|
||||||
internal override int[] Indices => throw new NotImplementedException();
|
internal override int[] Indices => throw new NotImplementedException();
|
||||||
|
|
||||||
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
public override Line[] GetAllSides()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d MovBegin(uint tick) => movBeginOperation.Invoke(tick);
|
public override Plain GetPlain()
|
||||||
|
{
|
||||||
|
return new Plain(this.center, this.beginPoint, this.endPoint);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
|
public virtual vec3d MovBegin(uint tick)
|
||||||
|
{
|
||||||
|
return movBeginOperation.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual vec3d MoveCenter(uint tick)
|
||||||
|
{
|
||||||
|
return movCenterOperation.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual vec3d MovEnd(uint tick)
|
||||||
|
{
|
||||||
|
return movEndOperation.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
internal override void UpdateCoordinate(uint tick)
|
internal override void UpdateCoordinate(uint tick)
|
||||||
{
|
{
|
||||||
@@ -31,12 +82,5 @@ namespace StgSharp.Geometries
|
|||||||
endPoint.Position = this.coordinate.origin + MovEnd(tick);
|
endPoint.Position = this.coordinate.origin + MovEnd(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Line[] GetAllSides() => throw new NotImplementedException();
|
|
||||||
|
|
||||||
public override Plain GetPlain()
|
|
||||||
{
|
|
||||||
return new Plain(this.center, this.beginPoint, this.endPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,35 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Circle.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;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
@@ -8,27 +39,42 @@ namespace StgSharp.Geometries
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Circle : PlainGeometry
|
public class Circle : PlainGeometry
|
||||||
{
|
{
|
||||||
|
|
||||||
internal Point center;
|
internal Point center;
|
||||||
|
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal Point pointOnCircle;
|
internal Point pointOnCircle;
|
||||||
internal Point pointOnPlain;
|
internal Point pointOnPlain;
|
||||||
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
|
||||||
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
|
||||||
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
|
||||||
|
|
||||||
|
|
||||||
internal override int[] Indices => throw new NotImplementedException();
|
internal override int[] Indices => throw new NotImplementedException();
|
||||||
|
|
||||||
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
public override Line[] GetAllSides()
|
||||||
|
{
|
||||||
public virtual vec3d UpdateRadius(uint tick) => movBeginOperation.Invoke(tick);
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
public virtual vec3d UpdatePlain(uint tick) => movEndOperation.Invoke(tick);
|
|
||||||
|
|
||||||
public override Plain GetPlain()
|
public override Plain GetPlain()
|
||||||
{
|
{
|
||||||
return new Plain(center, pointOnCircle, pointOnPlain);
|
return new Plain(center, pointOnCircle, pointOnPlain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual vec3d MoveCenter(uint tick)
|
||||||
|
{
|
||||||
|
return movCenterOperation.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual vec3d UpdatePlain(uint tick)
|
||||||
|
{
|
||||||
|
return movEndOperation.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual vec3d UpdateRadius(uint tick)
|
||||||
|
{
|
||||||
|
return movBeginOperation.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
internal override void UpdateCoordinate(uint tick)
|
internal override void UpdateCoordinate(uint tick)
|
||||||
{
|
{
|
||||||
@@ -38,9 +84,5 @@ namespace StgSharp.Geometries
|
|||||||
pointOnPlain.Position = this.coordinate.origin + UpdatePlain(tick);
|
pointOnPlain.Position = this.coordinate.origin + UpdatePlain(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,35 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Cordinate.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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -12,30 +43,13 @@ namespace StgSharp.Geometries
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct PartialPlainCoordinate
|
public struct PartialPlainCoordinate
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The origin of this coordinate.
|
/// The origin of this coordinate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public vec3d origin;
|
public vec3d origin;
|
||||||
internal Matrix3x2 axis;
|
internal Matrix3x2 axis;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The horizontial axis of the coordinate.
|
|
||||||
/// Point to the right direction.
|
|
||||||
/// </summary>
|
|
||||||
public vec3d axis_H
|
|
||||||
{
|
|
||||||
get { return axis.colum0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The vertical axis of the coordinate.
|
|
||||||
/// Point to the top direction.
|
|
||||||
/// </summary>
|
|
||||||
public vec3d axis_V
|
|
||||||
{
|
|
||||||
get { return axis.colum1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public PartialPlainCoordinate
|
public PartialPlainCoordinate
|
||||||
(
|
(
|
||||||
vec3d origin,
|
vec3d origin,
|
||||||
@@ -52,6 +66,18 @@ namespace StgSharp.Geometries
|
|||||||
axis.colum1 = vertical;
|
axis.colum1 = vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The horizontial axis of the coordinate.
|
||||||
|
/// Point to the right direction.
|
||||||
|
/// </summary>
|
||||||
|
public vec3d axis_H => axis.colum0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The vertical axis of the coordinate.
|
||||||
|
/// Point to the top direction.
|
||||||
|
/// </summary>
|
||||||
|
public vec3d axis_V => axis.colum1;
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public vec3d GetRealLocate(Vec2d raletiveLocation)
|
public vec3d GetRealLocate(Vec2d raletiveLocation)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
namespace StgSharp.Geometries
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ExpressionHandler.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.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public delegate float ExpressionHandler
|
public delegate float ExpressionHandler
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -1,10 +1,44 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GemoryException.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.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public unsafe class ToUpperDimensionException : Exception
|
public unsafe class ToUpperDimensionException : Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||||
|
{
|
||||||
|
}
|
||||||
public ToUpperDimensionException()
|
public ToUpperDimensionException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -17,9 +51,6 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -27,6 +58,10 @@ namespace StgSharp.Geometries
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class UnusedVertexException : Exception
|
public class UnusedVertexException : Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected UnusedVertexException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||||
|
{
|
||||||
|
}
|
||||||
public UnusedVertexException()
|
public UnusedVertexException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -39,8 +74,5 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UnusedVertexException(SerializationInfo info, StreamingContext context) : base(info, context)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GeometryOperation.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;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
@@ -11,10 +41,12 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public static unsafe class GeometryOperation
|
public static unsafe class GeometryOperation
|
||||||
{
|
{
|
||||||
|
|
||||||
public static vec3d DefualtMotion(uint tick)
|
public static vec3d DefualtMotion(uint tick)
|
||||||
{
|
{
|
||||||
return default(vec3d);
|
return default(vec3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,35 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Line.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;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
@@ -6,24 +37,13 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
public class Line : PlainGeometry
|
public class Line : PlainGeometry
|
||||||
{
|
{
|
||||||
|
|
||||||
internal Point basePoint;
|
internal Point basePoint;
|
||||||
internal Point beginPoint;
|
internal Point beginPoint;
|
||||||
internal Point endPoint;
|
internal Point endPoint;
|
||||||
internal GetLocationHandler movBegin;
|
internal GetLocationHandler movBegin;
|
||||||
internal GetLocationHandler movEnd;
|
internal GetLocationHandler movEnd;
|
||||||
|
|
||||||
|
|
||||||
internal override int[] Indices
|
|
||||||
{
|
|
||||||
get { throw new Exception(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Line(Point begin, Point end)
|
|
||||||
{
|
|
||||||
this.beginPoint = begin;
|
|
||||||
this.endPoint = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Line(Vector4 begin, Vector4 end)
|
internal Line(Vector4 begin, Vector4 end)
|
||||||
{
|
{
|
||||||
beginPoint = new Point(begin);
|
beginPoint = new Point(begin);
|
||||||
@@ -32,31 +52,15 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
public Line() { }
|
public Line() { }
|
||||||
|
|
||||||
/// <summary>
|
public Line(Point begin, Point end)
|
||||||
/// Move begin side of a line.
|
|
||||||
/// It is recommended to override this function rather than
|
|
||||||
/// loading an <see cref="GetLocationHandler"/> with same function.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tick">Time passed since current line was created.</param>
|
|
||||||
public virtual vec3d MoveBeginPoint(uint tick)
|
|
||||||
=> movBegin.Invoke(time);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Move end side of a line.
|
|
||||||
/// It is recommended to override this function rather than
|
|
||||||
/// loading an <see cref="GetLocationHandler"/> with same function.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tick">Time passed since current line was created.</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public virtual vec3d MoveEndPoint(uint tick)
|
|
||||||
=> movEnd.Invoke(time);
|
|
||||||
|
|
||||||
internal override void UpdateCoordinate(uint tick)
|
|
||||||
{
|
{
|
||||||
beginPoint.Position = coordinate.origin + MoveBeginPoint(time);
|
this.beginPoint = begin;
|
||||||
endPoint.Position = coordinate.origin + MoveEndPoint(time);
|
this.endPoint = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internal override int[] Indices => throw new Exception();
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@@ -66,5 +70,35 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
throw new ToUpperDimensionException();
|
throw new ToUpperDimensionException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Move begin side of a line.
|
||||||
|
/// It is recommended to override this function rather than
|
||||||
|
/// loading an <see cref="GetLocationHandler"/> with same function.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tick">Time passed since current line was created.</param>
|
||||||
|
public virtual vec3d MoveBeginPoint(uint tick)
|
||||||
|
{
|
||||||
|
return movBegin.Invoke(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Move end side of a line.
|
||||||
|
/// It is recommended to override this function rather than
|
||||||
|
/// loading an <see cref="GetLocationHandler"/> with same function.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tick">Time passed since current line was created.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual vec3d MoveEndPoint(uint tick)
|
||||||
|
{
|
||||||
|
return movEnd.Invoke(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void UpdateCoordinate(uint tick)
|
||||||
|
{
|
||||||
|
beginPoint.Position = coordinate.origin + MoveBeginPoint(time);
|
||||||
|
endPoint.Position = coordinate.origin + MoveEndPoint(time);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,46 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Parallelogram.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.Controlling;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Parallelogram : Polygon4
|
public class Parallelogram : Polygon4
|
||||||
{
|
{
|
||||||
|
|
||||||
internal Point center;
|
internal Point center;
|
||||||
|
|
||||||
internal readonly GetLocationHandler movCenterOperation =
|
internal readonly GetLocationHandler movCenterOperation =
|
||||||
new GetLocationHandler(GeometryOperation.DefualtMotion);
|
new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
|
||||||
public GetLocationHandler MovCenterOperation { get { return movCenterOperation; } }
|
|
||||||
public GetLocationHandler MovVertex01Operation { get { return moveVertex0Operation; } }
|
|
||||||
public GetLocationHandler MovVertex02Operation { get { return moveVertex1Operation; } }
|
|
||||||
|
|
||||||
public Parallelogram(
|
public Parallelogram(
|
||||||
float v0x, float v0y, float v0z,
|
float v0x, float v0y, float v0z,
|
||||||
float v1x, float v1y, float v1z,
|
float v1x, float v1y, float v1z,
|
||||||
@@ -35,6 +62,10 @@ namespace StgSharp.Geometries
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GetLocationHandler MovCenterOperation => movCenterOperation;
|
||||||
|
public GetLocationHandler MovVertex01Operation => moveVertex0Operation;
|
||||||
|
public GetLocationHandler MovVertex02Operation => moveVertex1Operation;
|
||||||
|
|
||||||
public virtual vec3d MovCenter(uint tick)
|
public virtual vec3d MovCenter(uint tick)
|
||||||
{
|
{
|
||||||
return movCenterOperation.Invoke(tick);
|
return movCenterOperation.Invoke(tick);
|
||||||
@@ -46,7 +77,7 @@ namespace StgSharp.Geometries
|
|||||||
/// <param name="tick">Current time tick</param>
|
/// <param name="tick">Current time tick</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="UnusedVertexException">Geometry overdefined</exception>
|
/// <exception cref="UnusedVertexException">Geometry overdefined</exception>
|
||||||
public sealed override vec3d MoveVertex2(uint tick)
|
public override sealed vec3d MoveVertex2(uint tick)
|
||||||
{
|
{
|
||||||
throw new UnusedVertexException();
|
throw new UnusedVertexException();
|
||||||
}
|
}
|
||||||
@@ -57,12 +88,12 @@ namespace StgSharp.Geometries
|
|||||||
/// <param name="tick">Current time tick</param>
|
/// <param name="tick">Current time tick</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="UnusedVertexException">Geometry overdefined</exception>
|
/// <exception cref="UnusedVertexException">Geometry overdefined</exception>
|
||||||
public sealed override vec3d MoveVertex3(uint tick)
|
public override sealed vec3d MoveVertex3(uint tick)
|
||||||
{
|
{
|
||||||
throw new UnusedVertexException();
|
throw new UnusedVertexException();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal sealed override void UpdateCoordinate(uint tick)
|
internal override sealed void UpdateCoordinate(uint tick)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,48 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Plain.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.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public unsafe class Plain
|
public unsafe class Plain
|
||||||
{
|
{
|
||||||
|
|
||||||
|
internal readonly float d = -1;
|
||||||
internal vec3d origin;
|
internal vec3d origin;
|
||||||
internal vec3d vec1;
|
|
||||||
internal vec3d vec2;
|
|
||||||
|
|
||||||
internal vec3d plainParameter;
|
internal vec3d plainParameter;
|
||||||
internal readonly float d = -1;
|
internal vec3d vec1;
|
||||||
|
internal vec3d vec2;
|
||||||
|
|
||||||
internal Plain(Vector4 origin, Vector4 p1, Vector4 p2)
|
internal Plain(Vector4 origin, Vector4 p1, Vector4 p2)
|
||||||
{
|
{
|
||||||
@@ -23,11 +55,11 @@ namespace StgSharp.Geometries
|
|||||||
public Plain(vec3d o, vec3d v1, vec3d v2)
|
public Plain(vec3d o, vec3d v1, vec3d 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);
|
||||||
@@ -44,11 +76,11 @@ namespace StgSharp.Geometries
|
|||||||
vec3d v2 = p3.Position - origin;
|
vec3d v2 = p3.Position - 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);
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Graphics;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="PlainGeometry.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.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
@@ -8,34 +38,25 @@ namespace StgSharp.Geometries
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class PlainGeometry
|
public abstract class PlainGeometry
|
||||||
{
|
{
|
||||||
protected TimeProvider time;
|
|
||||||
|
protected TimeSpanProvider time;
|
||||||
|
|
||||||
internal PartialPlainCoordinate coordinate;
|
internal PartialPlainCoordinate coordinate;
|
||||||
internal Matrix2x4 textureFrame;
|
internal Matrix2x4 textureFrame;
|
||||||
|
|
||||||
public PartialPlainCoordinate ReferenceCoordinate
|
public PlainGeometry()
|
||||||
{
|
{
|
||||||
get => this.coordinate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tick time this geometry eas crested
|
/// Tick time this geometry eas crested
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// </summary>
|
|
||||||
public uint BornTime => time;
|
public uint BornTime => time;
|
||||||
|
|
||||||
|
public PartialPlainCoordinate ReferenceCoordinate => this.coordinate;
|
||||||
|
|
||||||
internal abstract int[] Indices { get; }
|
internal abstract int[] Indices { get; }
|
||||||
|
|
||||||
public PlainGeometry(Form form)
|
|
||||||
{
|
|
||||||
time = new TimeProvider(form);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlainGeometry()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
internal abstract void UpdateCoordinate(uint tick);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all sides of this <see cref="PlainGeometry"/>.
|
/// Get all sides of this <see cref="PlainGeometry"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -48,6 +69,9 @@ namespace StgSharp.Geometries
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public abstract Plain GetPlain();
|
public abstract Plain GetPlain();
|
||||||
|
|
||||||
|
|
||||||
|
internal abstract void UpdateCoordinate(uint tick);
|
||||||
|
|
||||||
//public abstract Rectangle GetRenderFrame();
|
//public abstract Rectangle GetRenderFrame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,35 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Point.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;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -8,10 +39,9 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
public unsafe class Point
|
public unsafe class Point
|
||||||
{
|
{
|
||||||
internal vec3d position;
|
|
||||||
internal readonly bool isVertex;
|
|
||||||
|
|
||||||
public Point() { }
|
internal readonly bool isVertex;
|
||||||
|
internal vec3d position;
|
||||||
|
|
||||||
internal Point(vec3d p)
|
internal Point(vec3d p)
|
||||||
{
|
{
|
||||||
@@ -23,47 +53,40 @@ namespace StgSharp.Geometries
|
|||||||
position = new vec3d(vector);
|
position = new vec3d(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Point() { }
|
||||||
|
|
||||||
public Point(float x, float y, float z)
|
public Point(float x, float y, float z)
|
||||||
{
|
{
|
||||||
position = new vec3d(x, y, z);
|
position = new vec3d(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsVertex => isVertex;
|
||||||
|
|
||||||
public vec3d Position
|
public vec3d Position
|
||||||
{
|
{
|
||||||
get { return position; }
|
get => position;
|
||||||
set { position = value; }
|
set => position = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float X
|
public float X
|
||||||
{
|
{
|
||||||
get { return position.X; }
|
get => position.X;
|
||||||
set { position.X = value; }
|
set => position.X = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Y
|
public float Y
|
||||||
{
|
{
|
||||||
get { return position.Y; }
|
get => position.Y;
|
||||||
set { position.Y = value; }
|
set => position.Y = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Z
|
public float Z
|
||||||
{
|
{
|
||||||
get { return position.Z; }
|
get => position.Z;
|
||||||
set { position.Z = value; }
|
set => position.Z = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool IsVertex => isVertex;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Update the coordinate of the point. If this is a moving point,
|
|
||||||
/// (Points on sides or surface if other geometry items)
|
|
||||||
/// please do not define any motion here, codes will be ignored by program
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tick">Time passes since the program begin, counted by frames</param>
|
|
||||||
public virtual void Update(uint tick) { }
|
|
||||||
|
|
||||||
public bool IsInGeometry(PlainGeometry geo)
|
public bool IsInGeometry(PlainGeometry geo)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@@ -75,6 +98,15 @@ namespace StgSharp.Geometries
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the coordinate of the point. If this is a moving point,
|
||||||
|
/// (Points on sides or surface if other geometry items)
|
||||||
|
/// please do not define any motion here, codes will be ignored by program
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tick">Time passes since the program begin, counted by frames</param>
|
||||||
|
public virtual void Update(uint tick) { }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,43 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Polygon4.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.Controlling;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Polygon4 : PlainGeometry
|
public class Polygon4 : PlainGeometry
|
||||||
{
|
{
|
||||||
|
|
||||||
internal readonly GetLocationHandler moveVertex0Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
internal readonly GetLocationHandler moveVertex0Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal readonly GetLocationHandler moveVertex1Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
internal readonly GetLocationHandler moveVertex1Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal readonly GetLocationHandler moveVertex2Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
internal readonly GetLocationHandler moveVertex2Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
@@ -61,50 +93,39 @@ namespace StgSharp.Geometries
|
|||||||
vertexMat.mat.colum3 = new Vector4(v3x, v3y, v3z, 0);
|
vertexMat.mat.colum3 = new Vector4(v3x, v3y, v3z, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetLocationHandler MovVertex0Operaion { get { return moveVertex0Operation; } }
|
public GetLocationHandler MovVertex0Operaion => moveVertex0Operation;
|
||||||
public GetLocationHandler MovVertex1Operaion { get { return moveVertex1Operation; } }
|
public GetLocationHandler MovVertex1Operaion => moveVertex1Operation;
|
||||||
public GetLocationHandler MovVertex2Operaion { get { return moveVertex2Operation; } }
|
public GetLocationHandler MovVertex2Operaion => moveVertex2Operation;
|
||||||
public GetLocationHandler MovVertex3Operaion { get { return moveVertex3Operation; } }
|
public GetLocationHandler MovVertex3Operaion => moveVertex3Operation;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
internal sealed override int[] Indices
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new int[6] {
|
|
||||||
0,1,2,
|
|
||||||
0,2,3};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Mat4 VertexBuffer
|
|
||||||
{
|
|
||||||
get { return vertexMat.mat; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Point Vertex0
|
public Point Vertex0
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.mat.colum0);
|
get => new Point(vertexMat.mat.colum0);
|
||||||
set { vertexMat.mat.colum0 = value.position.vec; }
|
set => vertexMat.mat.colum0 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex1
|
public Point Vertex1
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.mat.colum1);
|
get => new Point(vertexMat.mat.colum1);
|
||||||
set { vertexMat.mat.colum1 = value.position.vec; }
|
set => vertexMat.mat.colum1 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex2
|
public Point Vertex2
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.mat.colum2);
|
get => new Point(vertexMat.mat.colum2);
|
||||||
set { vertexMat.mat.colum1 = value.position.vec; }
|
set => vertexMat.mat.colum1 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mat4 VertexBuffer => vertexMat.mat;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
internal override sealed int[] Indices => new int[6] { 0, 1, 2, 0, 2, 3 };
|
||||||
|
|
||||||
internal Point Vertex3
|
internal Point Vertex3
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.mat.colum3);
|
get => new Point(vertexMat.mat.colum3);
|
||||||
set { vertexMat.mat.colum1 = value.position.vec; }
|
set => vertexMat.mat.colum1 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -131,21 +152,30 @@ namespace StgSharp.Geometries
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d MoveVertex0(uint tick)
|
public virtual vec3d MoveVertex0(uint tick)
|
||||||
=> moveVertex0Operation(tick);
|
{
|
||||||
|
return moveVertex0Operation(tick);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d MoveVertex1(uint tick)
|
public virtual vec3d MoveVertex1(uint tick)
|
||||||
=> moveVertex1Operation(tick);
|
{
|
||||||
|
return moveVertex1Operation(tick);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d MoveVertex2(uint tick)
|
public virtual vec3d MoveVertex2(uint tick)
|
||||||
=> moveVertex2Operation(tick);
|
{
|
||||||
|
return moveVertex2Operation(tick);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d MoveVertex3(uint tick)
|
public virtual vec3d MoveVertex3(uint tick)
|
||||||
=> moveVertex3Operation(tick);
|
{
|
||||||
|
return moveVertex3Operation(tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
internal override void UpdateCoordinate(uint tick)
|
internal override void UpdateCoordinate(uint tick)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,44 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Polygon5.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.Controlling;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
using StgSharp.Math.Linear;
|
using StgSharp.Math.Linear;
|
||||||
|
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public unsafe class Polygon5 : PlainGeometry
|
public unsafe class Polygon5 : PlainGeometry
|
||||||
{
|
{
|
||||||
|
|
||||||
internal Point _refOrigin;
|
internal Point _refOrigin;
|
||||||
internal GetLocationHandler movP01Operation = default;
|
internal GetLocationHandler movP01Operation = default;
|
||||||
internal GetLocationHandler movP02Operation = default;
|
internal GetLocationHandler movP02Operation = default;
|
||||||
@@ -35,57 +67,46 @@ namespace StgSharp.Geometries
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public GetLocationHandler MovP01Operation { get => movP01Operation; }
|
public GetLocationHandler MovP01Operation => movP01Operation;
|
||||||
public GetLocationHandler MovP02Operation { get => movP02Operation; }
|
public GetLocationHandler MovP02Operation => movP02Operation;
|
||||||
public GetLocationHandler MovP03Operation { get => movP03Operation; }
|
public GetLocationHandler MovP03Operation => movP03Operation;
|
||||||
public GetLocationHandler MovP04Operation { get => movP04Operation; }
|
public GetLocationHandler MovP04Operation => movP04Operation;
|
||||||
public GetLocationHandler MovP05Operation { get => movP05Operation; }
|
public GetLocationHandler MovP05Operation => movP05Operation;
|
||||||
|
|
||||||
public mat5 VertexBuffer
|
|
||||||
{
|
|
||||||
get { return vertexMat; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Point Vertex0
|
public Point Vertex0
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec0);
|
get => new Point(vertexMat.vec0);
|
||||||
set { vertexMat.vec0 = value.position.vec; }
|
set => vertexMat.vec0 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex1
|
public Point Vertex1
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec1);
|
get => new Point(vertexMat.vec1);
|
||||||
set { vertexMat.vec1 = value.position.vec; }
|
set => vertexMat.vec1 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex2
|
public Point Vertex2
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec2);
|
get => new Point(vertexMat.vec2);
|
||||||
set { vertexMat.vec2 = value.position.vec; }
|
set => vertexMat.vec2 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex3
|
public Point Vertex3
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec3);
|
get => new Point(vertexMat.vec3);
|
||||||
set { vertexMat.vec3 = value.position.vec; }
|
set => vertexMat.vec3 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex4
|
public Point Vertex4
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec4);
|
get => new Point(vertexMat.vec4);
|
||||||
set { vertexMat.vec4 = value.position.vec; }
|
set => vertexMat.vec4 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override int[] Indices
|
public mat5 VertexBuffer => vertexMat;
|
||||||
{
|
|
||||||
get
|
internal override int[] Indices => new int[9] { 0, 1, 2, 0, 2, 3, 0, 3, 4 };
|
||||||
{
|
|
||||||
return new int[9]{
|
|
||||||
0,1,2,
|
|
||||||
0,2,3,
|
|
||||||
0,3,4};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
{
|
{
|
||||||
return new Line[5]
|
return new Line[5]
|
||||||
@@ -103,15 +124,30 @@ namespace StgSharp.Geometries
|
|||||||
return new Plain(Vertex0, Vertex1, Vertex2);
|
return new Plain(Vertex0, Vertex1, Vertex2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d movVertex01(uint tick) => movP01Operation.Invoke(time);
|
public virtual vec3d movVertex01(uint tick)
|
||||||
|
{
|
||||||
|
return movP01Operation.Invoke(time);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d movVertex02(uint tick) => movP02Operation.Invoke(time);
|
public virtual vec3d movVertex02(uint tick)
|
||||||
|
{
|
||||||
|
return movP02Operation.Invoke(time);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d movVertex03(uint tick) => movP03Operation.Invoke(time);
|
public virtual vec3d movVertex03(uint tick)
|
||||||
|
{
|
||||||
|
return movP03Operation.Invoke(time);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d movVertex04(uint tick) => movP04Operation.Invoke(time);
|
public virtual vec3d movVertex04(uint tick)
|
||||||
|
{
|
||||||
|
return movP04Operation.Invoke(time);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d movVertex05(uint tick) => movP05Operation.Invoke(time);
|
public virtual vec3d movVertex05(uint tick)
|
||||||
|
{
|
||||||
|
return movP05Operation.Invoke(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
internal override void UpdateCoordinate(uint tick)
|
internal override void UpdateCoordinate(uint tick)
|
||||||
@@ -123,5 +159,6 @@ namespace StgSharp.Geometries
|
|||||||
vertexMat.vec3 = (coordinate.origin + movVertex04(nowTick)).vec;
|
vertexMat.vec3 = (coordinate.origin + movVertex04(nowTick)).vec;
|
||||||
vertexMat.vec4 = (coordinate.origin + movVertex05(nowTick)).vec;
|
vertexMat.vec4 = (coordinate.origin + movVertex05(nowTick)).vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Polygon6.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.Controlling;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
using StgSharp.Math.Linear;
|
using StgSharp.Math.Linear;
|
||||||
|
|
||||||
@@ -8,6 +38,7 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
public class Polygon6 : PlainGeometry
|
public class Polygon6 : PlainGeometry
|
||||||
{
|
{
|
||||||
|
|
||||||
internal Point _refOrigin;
|
internal Point _refOrigin;
|
||||||
internal GetLocationHandler movVertex0Operation;
|
internal GetLocationHandler movVertex0Operation;
|
||||||
internal GetLocationHandler movVertex1Operation;
|
internal GetLocationHandler movVertex1Operation;
|
||||||
@@ -17,61 +48,51 @@ namespace StgSharp.Geometries
|
|||||||
internal GetLocationHandler movVertex5Operation;
|
internal GetLocationHandler movVertex5Operation;
|
||||||
internal mat6 vertexMat;
|
internal mat6 vertexMat;
|
||||||
|
|
||||||
public GetLocationHandler MovVertex0Operation { get => movVertex0Operation; }
|
public GetLocationHandler MovVertex0Operation => movVertex0Operation;
|
||||||
public GetLocationHandler MovVertex1Operation { get => movVertex1Operation; }
|
public GetLocationHandler MovVertex1Operation => movVertex1Operation;
|
||||||
public GetLocationHandler MovVertex2Operation { get => movVertex2Operation; }
|
public GetLocationHandler MovVertex2Operation => movVertex2Operation;
|
||||||
public GetLocationHandler MovVertex3Operation { get => movVertex3Operation; }
|
public GetLocationHandler MovVertex3Operation => movVertex3Operation;
|
||||||
public GetLocationHandler MovVertex4Operation { get => movVertex4Operation; }
|
public GetLocationHandler MovVertex4Operation => movVertex4Operation;
|
||||||
public GetLocationHandler MovVertex5Operation { get => movVertex5Operation; }
|
public GetLocationHandler MovVertex5Operation => movVertex5Operation;
|
||||||
|
|
||||||
internal override int[] Indices
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new int[12] {
|
|
||||||
0,1,2,
|
|
||||||
0,2,3,
|
|
||||||
0,3,4,
|
|
||||||
0,4,5};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Point Vertex0
|
public Point Vertex0
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec0);
|
get => new Point(vertexMat.vec0);
|
||||||
set { vertexMat.vec0 = value.position.vec; }
|
set => vertexMat.vec0 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex1
|
public Point Vertex1
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec1);
|
get => new Point(vertexMat.vec1);
|
||||||
set { vertexMat.vec1 = value.position.vec; }
|
set => vertexMat.vec1 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex2
|
public Point Vertex2
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec2);
|
get => new Point(vertexMat.vec2);
|
||||||
set { vertexMat.vec2 = value.position.vec; }
|
set => vertexMat.vec2 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex3
|
public Point Vertex3
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec3);
|
get => new Point(vertexMat.vec3);
|
||||||
set { vertexMat.vec3 = value.position.vec; }
|
set => vertexMat.vec3 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex4
|
public Point Vertex4
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec4);
|
get => new Point(vertexMat.vec4);
|
||||||
set { vertexMat.vec4 = value.position.vec; }
|
set => vertexMat.vec4 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Vertex5
|
public Point Vertex5
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat.vec5);
|
get => new Point(vertexMat.vec5);
|
||||||
set { vertexMat.vec5 = value.position.vec; }
|
set => vertexMat.vec5 = value.position.vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal override int[] Indices => new int[12] { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5 };
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
{
|
{
|
||||||
return new Line[6]
|
return new Line[6]
|
||||||
@@ -131,5 +152,6 @@ namespace StgSharp.Geometries
|
|||||||
vertexMat.vec4 = origin + movVertex4(nowTick).vec;
|
vertexMat.vec4 = origin + movVertex4(nowTick).vec;
|
||||||
vertexMat.vec5 = origin + movVertex5(nowTick).vec;
|
vertexMat.vec5 = origin + movVertex5(nowTick).vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,42 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Rectangle.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.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Rectangle : Parallelogram
|
public class Rectangle : Parallelogram
|
||||||
{
|
{
|
||||||
|
|
||||||
public Rectangle(
|
public Rectangle(
|
||||||
float v0x, float v0y, float v0z,
|
float v0x, float v0y, float v0z,
|
||||||
float v1x, float v1y, float v1z,
|
float v1x, float v1y, float v1z,
|
||||||
@@ -30,7 +62,10 @@ namespace StgSharp.Geometries
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tick">当前游戏刻</param>
|
/// <param name="tick">当前游戏刻</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual vec3d MovCenter(uint tick) => default(vec3d);
|
public virtual vec3d MovCenter(uint tick)
|
||||||
|
{
|
||||||
|
return default(vec3d);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,35 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Square.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.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
@@ -9,6 +40,7 @@ namespace StgSharp.Geometries
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Square : Rectangle
|
public class Square : Rectangle
|
||||||
{
|
{
|
||||||
|
|
||||||
public Square(
|
public Square(
|
||||||
float v0x, float v0y, float v0z,
|
float v0x, float v0y, float v0z,
|
||||||
float v1x, float v1y, float v1z,
|
float v1x, float v1y, float v1z,
|
||||||
@@ -21,7 +53,7 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override vec3d MoveVertex1(uint tick)
|
public override sealed vec3d MoveVertex1(uint tick)
|
||||||
{
|
{
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,36 @@
|
|||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Triangle.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.Controlling;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
@@ -46,15 +77,9 @@ namespace StgSharp.Geometries
|
|||||||
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
|
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
|
||||||
public GetLocationHandler MovVertex03Operation => this.movVertex03Opearion;
|
public GetLocationHandler MovVertex03Operation => this.movVertex03Opearion;
|
||||||
|
|
||||||
public Mat3 VertexBuffer
|
public Mat3 VertexBuffer => vertexMat.mat;
|
||||||
{
|
|
||||||
get { return vertexMat.mat; }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal sealed override int[] Indices
|
internal override sealed int[] Indices => new int[3] { 0, 1, 2 };
|
||||||
{
|
|
||||||
get { return new int[3] { 0, 1, 2 }; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
{
|
{
|
||||||
@@ -73,18 +98,28 @@ namespace StgSharp.Geometries
|
|||||||
return new Plain(this.vertexMat.mat.colum0, this.vertexMat.mat.colum1, this.vertexMat.mat.colum2);
|
return new Plain(this.vertexMat.mat.colum0, this.vertexMat.mat.colum1, this.vertexMat.mat.colum2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual vec3d MovVertex01(uint tick) => movVertex01Opearion.Invoke(tick);
|
public virtual vec3d MovVertex01(uint tick)
|
||||||
|
{
|
||||||
|
return movVertex01Opearion.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d MovVertex02(uint tick) => movVertex02Opearion.Invoke(tick);
|
public virtual vec3d MovVertex02(uint tick)
|
||||||
|
{
|
||||||
|
return movVertex02Opearion.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual vec3d MovVertex03(uint tick) => movVertex03Opearion.Invoke(tick);
|
public virtual vec3d MovVertex03(uint tick)
|
||||||
|
{
|
||||||
|
return movVertex03Opearion.Invoke(tick);
|
||||||
|
}
|
||||||
|
|
||||||
internal sealed override void UpdateCoordinate(uint tick)
|
internal override sealed void UpdateCoordinate(uint tick)
|
||||||
{
|
{
|
||||||
tick = time;
|
tick = time;
|
||||||
vertexMat.mat.colum0 = coordinate.origin.vec + MovVertex01(time).vec;
|
vertexMat.mat.colum0 = coordinate.origin.vec + MovVertex01(time).vec;
|
||||||
vertexMat.mat.colum1 = coordinate.origin.vec + MovVertex02(time).vec;
|
vertexMat.mat.colum1 = coordinate.origin.vec + MovVertex02(time).vec;
|
||||||
vertexMat.mat.colum2 = coordinate.origin.vec + MovVertex03(time).vec;
|
vertexMat.mat.colum2 = coordinate.origin.vec + MovVertex03(time).vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Class1.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.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="StructDefine.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.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
@@ -16,6 +46,7 @@ namespace StgSharp.Graphics
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWcontext
|
public unsafe struct GLFWcontext
|
||||||
{
|
{
|
||||||
|
|
||||||
private int client;
|
private int client;
|
||||||
private int source;
|
private int source;
|
||||||
private int major, minor, revision;
|
private int major, minor, revision;
|
||||||
@@ -51,6 +82,7 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
internal struct egl
|
internal struct egl
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
EGLConfig config;
|
EGLConfig config;
|
||||||
EGLContext handle;
|
EGLContext handle;
|
||||||
@@ -60,16 +92,19 @@ namespace StgSharp.Graphics
|
|||||||
private void* handle;
|
private void* handle;
|
||||||
private void* surface;
|
private void* surface;
|
||||||
private void* client;
|
private void* client;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal struct osmesa
|
internal struct osmesa
|
||||||
{
|
{
|
||||||
|
|
||||||
//OSMesaContext handle;
|
//OSMesaContext handle;
|
||||||
private void* handle;
|
private void* handle;
|
||||||
|
|
||||||
private int width;
|
private int width;
|
||||||
private int height;
|
private int height;
|
||||||
private void* buffer;
|
private void* buffer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is defined in platform.h
|
// This is defined in platform.h
|
||||||
@@ -79,6 +114,7 @@ namespace StgSharp.Graphics
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWvidmode
|
public unsafe struct GLFWvidmode
|
||||||
{
|
{
|
||||||
|
|
||||||
/*! The width, in screen coordinates, of the video mode.
|
/*! The width, in screen coordinates, of the video mode.
|
||||||
*/
|
*/
|
||||||
public int width;
|
public int width;
|
||||||
@@ -97,11 +133,13 @@ namespace StgSharp.Graphics
|
|||||||
/*! The refresh rate, in Hz, of the video mode.
|
/*! The refresh rate, in Hz, of the video mode.
|
||||||
*/
|
*/
|
||||||
private int refreshRate;
|
private int refreshRate;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWgammaramp
|
public unsafe struct GLFWgammaramp
|
||||||
{
|
{
|
||||||
|
|
||||||
/*! An array of value describing the response of the red channel.
|
/*! An array of value describing the response of the red channel.
|
||||||
*/
|
*/
|
||||||
private ushort* red;
|
private ushort* red;
|
||||||
@@ -114,11 +152,13 @@ namespace StgSharp.Graphics
|
|||||||
/*! The number of elements in each array.
|
/*! The number of elements in each array.
|
||||||
*/
|
*/
|
||||||
private uint size;
|
private uint size;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWimage
|
public unsafe struct GLFWimage
|
||||||
{
|
{
|
||||||
|
|
||||||
/*! The width, in pixels, of this image.
|
/*! The width, in pixels, of this image.
|
||||||
*/
|
*/
|
||||||
private int width;
|
private int width;
|
||||||
@@ -128,11 +168,13 @@ namespace StgSharp.Graphics
|
|||||||
/*! The pixel data of this image, arranged left-to-right, top-to-bottom.
|
/*! The pixel data of this image, arranged left-to-right, top-to-bottom.
|
||||||
*/
|
*/
|
||||||
private byte* pixels;
|
private byte* pixels;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWgamepadstate
|
public unsafe struct GLFWgamepadstate
|
||||||
{
|
{
|
||||||
|
|
||||||
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
|
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
|
||||||
* or `GLFW_RELEASE`.
|
* or `GLFW_RELEASE`.
|
||||||
*/
|
*/
|
||||||
@@ -141,11 +183,13 @@ namespace StgSharp.Graphics
|
|||||||
* to 1.0 inclusive.
|
* to 1.0 inclusive.
|
||||||
*/
|
*/
|
||||||
public fixed float axes[6];
|
public fixed float axes[6];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWallocator
|
public unsafe struct GLFWallocator
|
||||||
{
|
{
|
||||||
|
|
||||||
//GLFWallocatefun allocate;
|
//GLFWallocatefun allocate;
|
||||||
private IntPtr allocate;
|
private IntPtr allocate;
|
||||||
|
|
||||||
@@ -156,11 +200,13 @@ namespace StgSharp.Graphics
|
|||||||
private IntPtr deallocate;
|
private IntPtr deallocate;
|
||||||
|
|
||||||
private void* user;
|
private void* user;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWmonitor
|
public unsafe struct GLFWmonitor
|
||||||
{
|
{
|
||||||
|
|
||||||
private byte[] name = new byte[128];
|
private byte[] name = new byte[128];
|
||||||
private void* userPointer;
|
private void* userPointer;
|
||||||
|
|
||||||
@@ -185,53 +231,116 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
public GLFWmonitor()
|
public GLFWmonitor()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWwindow
|
public unsafe struct GLFWwindow
|
||||||
{
|
{
|
||||||
|
|
||||||
//struct GLFWwindow* next in GLFW
|
//struct GLFWwindow* next in GLFW
|
||||||
public IntPtr next = IntPtr.Zero;
|
public GLFWwindow* next;
|
||||||
|
|
||||||
public bool resizable = false;
|
private int resizable;
|
||||||
public bool decorated = false;
|
private int decorated;
|
||||||
public bool autoIconify = false;
|
private int autoIconify;
|
||||||
public bool floating = false;
|
private int floating;
|
||||||
public bool focusOnShow = false;
|
private int focusOnShow;
|
||||||
public bool mousePassthrough = false;
|
private int mousePassthrough;
|
||||||
public bool shouldClose = false;
|
internal int shouldClose;
|
||||||
public void* userPointer = (void*)0;
|
private void* userPointer = (void*)0;
|
||||||
public bool doublebuffer = false;
|
private bool doubleBuffer;
|
||||||
public GLFWvidmode videoMode = default;
|
private GLFWvidmode videoMode = default;
|
||||||
public IntPtr monitor = IntPtr.Zero; //public GLFWmonitor* monitor;
|
private IntPtr monitor = IntPtr.Zero; //public GLFWmonitor* monitor;
|
||||||
public GLFWcursor* cursor = (GLFWcursor*)0;
|
private GLFWcursor* cursor = (GLFWcursor*)0;
|
||||||
|
|
||||||
public int minwidth = 0, minheight = 0;
|
private int minWidth = 0, minHeight = 0;
|
||||||
public int maxwidth = 0, maxheight = 0;
|
private int maxWidth = 0, maxHeight = 0;
|
||||||
public int numer = 0, denom = 0;
|
private int numer = 0, denom = 0;
|
||||||
|
private int stickyKeys;
|
||||||
public bool stickyKeys = false;
|
private int stickyMouseButtons;
|
||||||
public bool stickyMouseButtons = false;
|
private int lockKeyMods;
|
||||||
public bool lockKeyMods = false;
|
private int cursorMode = 0;
|
||||||
public int cursorMode = 0;
|
private fixed byte mouseButtons[8];
|
||||||
public fixed byte mouseButtons[8];
|
private fixed byte keys[349];
|
||||||
public fixed byte keys[349];
|
|
||||||
|
|
||||||
// Virtual cursor position when cursor is disabled
|
// Virtual cursor position when cursor is disabled
|
||||||
public double virtualCursorPosX = 0, virtualCursorPosY = 0;
|
public double virtualCursorPosX = 0, virtualCursorPosY = 0;
|
||||||
|
private int rawMouseMotion;
|
||||||
public bool rawMouseMotion = false;
|
|
||||||
|
|
||||||
public GLFWcontext context = default;
|
public GLFWcontext context = default;
|
||||||
|
|
||||||
|
private fixed long callBacks[17];
|
||||||
|
|
||||||
public GLFWwindow()
|
public GLFWwindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AutoIconify
|
||||||
|
{
|
||||||
|
get => autoIconify != 0;
|
||||||
|
set => autoIconify = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
public bool Decorated
|
||||||
|
{
|
||||||
|
get => decorated != 0;
|
||||||
|
set => decorated = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
public bool Floating
|
||||||
|
{
|
||||||
|
get => floating != 0;
|
||||||
|
set => floating = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
public bool FocusOnShow
|
||||||
|
{
|
||||||
|
get => focusOnShow != 0;
|
||||||
|
set => focusOnShow = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
public bool LockKeyMods
|
||||||
|
{
|
||||||
|
get => lockKeyMods != 0;
|
||||||
|
set => lockKeyMods = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
public bool MousePassThrough
|
||||||
|
{
|
||||||
|
get => mousePassthrough != 0;
|
||||||
|
set => mousePassthrough = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
public bool RawMouseMotion { get => rawMouseMotion != 0; set => rawMouseMotion = value ? 1 : 0; }
|
||||||
|
public bool Resizable
|
||||||
|
{
|
||||||
|
get => resizable != 0;
|
||||||
|
set => resizable = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
public bool ShouldClose
|
||||||
|
{
|
||||||
|
get => shouldClose != 0;
|
||||||
|
set => shouldClose = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool StickyKey
|
||||||
|
{
|
||||||
|
get => stickyKeys != 0;
|
||||||
|
set => stickyKeys = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
public bool StickyMouseButtons
|
||||||
|
{
|
||||||
|
get => stickyMouseButtons != 0;
|
||||||
|
set => stickyMouseButtons = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct GLFWwindowCallback
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct GLFWcursor
|
public struct GLFWcursor
|
||||||
{
|
{
|
||||||
|
|
||||||
//GLFWcursor* next;
|
//GLFWcursor* next;
|
||||||
private IntPtr next;
|
private IntPtr next;
|
||||||
|
|
||||||
@@ -259,6 +368,7 @@ namespace StgSharp.Graphics
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWinitconfig
|
public unsafe struct GLFWinitconfig
|
||||||
{
|
{
|
||||||
|
|
||||||
private GLFWbool hatButtons;
|
private GLFWbool hatButtons;
|
||||||
private int angleType;
|
private int angleType;
|
||||||
private int platformID;
|
private int platformID;
|
||||||
@@ -266,26 +376,12 @@ namespace StgSharp.Graphics
|
|||||||
//PFN_vkGetInstanceProcAddr vulkanLoader;
|
//PFN_vkGetInstanceProcAddr vulkanLoader;
|
||||||
private IntPtr vulkanLoader;
|
private IntPtr vulkanLoader;
|
||||||
|
|
||||||
private struct ns
|
|
||||||
{
|
|
||||||
private GLFWbool menubar;
|
|
||||||
private GLFWbool chdir;
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct x11
|
|
||||||
{
|
|
||||||
private GLFWbool xcbVulkanSurface;
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct wl
|
|
||||||
{
|
|
||||||
private int libdecorMode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWwndconfig
|
public unsafe struct GLFWwndconfig
|
||||||
{
|
{
|
||||||
|
|
||||||
private int xpos;
|
private int xpos;
|
||||||
private int ypos;
|
private int ypos;
|
||||||
private int width;
|
private int width;
|
||||||
@@ -303,56 +399,66 @@ namespace StgSharp.Graphics
|
|||||||
private GLFWbool mousePassthrough;
|
private GLFWbool mousePassthrough;
|
||||||
private GLFWbool scaleToMonitor;
|
private GLFWbool scaleToMonitor;
|
||||||
|
|
||||||
internal struct Ns
|
|
||||||
{
|
|
||||||
private GLFWbool retina = false;
|
|
||||||
public fixed byte frameName[256];
|
|
||||||
|
|
||||||
public Ns()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Ns ns = new Ns();
|
internal Ns ns = new Ns();
|
||||||
|
|
||||||
internal struct X11
|
|
||||||
{
|
|
||||||
public fixed byte className[256];
|
|
||||||
public fixed byte instanceName[256];
|
|
||||||
|
|
||||||
public X11()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal X11 x11 = new X11();
|
internal X11 x11 = new X11();
|
||||||
|
|
||||||
internal struct Win32
|
|
||||||
{
|
|
||||||
private GLFWbool keymenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Win32 win32 = new Win32();
|
internal Win32 win32 = new Win32();
|
||||||
|
|
||||||
internal struct Wl
|
|
||||||
{
|
|
||||||
public fixed byte appId[256];
|
|
||||||
|
|
||||||
public Wl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Wl wl = new Wl();
|
internal Wl wl = new Wl();
|
||||||
|
|
||||||
public GLFWwndconfig()
|
public GLFWwndconfig()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal struct Ns
|
||||||
|
{
|
||||||
|
|
||||||
|
private GLFWbool retina = false;
|
||||||
|
public fixed byte frameName[256];
|
||||||
|
|
||||||
|
public Ns()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal struct X11
|
||||||
|
{
|
||||||
|
|
||||||
|
public fixed byte className[256];
|
||||||
|
public fixed byte instanceName[256];
|
||||||
|
|
||||||
|
public X11()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal struct Win32
|
||||||
|
{
|
||||||
|
|
||||||
|
private GLFWbool keymenu;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal struct Wl
|
||||||
|
{
|
||||||
|
|
||||||
|
public fixed byte appId[256];
|
||||||
|
|
||||||
|
public Wl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWctxconfig
|
public unsafe struct GLFWctxconfig
|
||||||
{
|
{
|
||||||
|
|
||||||
private int client;
|
private int client;
|
||||||
private int source;
|
private int source;
|
||||||
private int major;
|
private int major;
|
||||||
@@ -367,21 +473,25 @@ namespace StgSharp.Graphics
|
|||||||
//GLFWwindow* share;
|
//GLFWwindow* share;
|
||||||
private IntPtr share;
|
private IntPtr share;
|
||||||
|
|
||||||
internal struct Nsgl
|
|
||||||
{
|
|
||||||
private GLFWbool offline;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Nsgl nsgl = new Nsgl();
|
internal Nsgl nsgl = new Nsgl();
|
||||||
|
|
||||||
public GLFWctxconfig()
|
public GLFWctxconfig()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal struct Nsgl
|
||||||
|
{
|
||||||
|
|
||||||
|
private GLFWbool offline;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWfbconfig
|
public unsafe struct GLFWfbconfig
|
||||||
{
|
{
|
||||||
|
|
||||||
private int redBits;
|
private int redBits;
|
||||||
private int greenBits;
|
private int greenBits;
|
||||||
private int blueBits;
|
private int blueBits;
|
||||||
@@ -399,25 +509,18 @@ namespace StgSharp.Graphics
|
|||||||
private GLFWbool doublebuffer;
|
private GLFWbool doublebuffer;
|
||||||
private GLFWbool transparent;
|
private GLFWbool transparent;
|
||||||
private uintptr_t handle;
|
private uintptr_t handle;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
internal unsafe struct GLFWlibrary
|
internal unsafe struct GLFWlibrary
|
||||||
{
|
{
|
||||||
|
|
||||||
private GLFWbool initialized;
|
private GLFWbool initialized;
|
||||||
private GLFWallocator allocator;
|
private GLFWallocator allocator;
|
||||||
|
|
||||||
private GLFWplatform platform;
|
private GLFWplatform platform;
|
||||||
|
|
||||||
internal unsafe struct Hints
|
|
||||||
{
|
|
||||||
private GLFWinitconfig init;
|
|
||||||
private GLFWfbconfig framebuffer;
|
|
||||||
private GLFWwndconfig window;
|
|
||||||
private GLFWctxconfig context;
|
|
||||||
private int refreshRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Hints hints = new Hints();
|
internal Hints hints = new Hints();
|
||||||
|
|
||||||
//GLFWerror* errorListHead;
|
//GLFWerror* errorListHead;
|
||||||
@@ -448,8 +551,30 @@ namespace StgSharp.Graphics
|
|||||||
private GLFWls contextSlot;
|
private GLFWls contextSlot;
|
||||||
private GLFWmutex errorLock;
|
private GLFWmutex errorLock;
|
||||||
|
|
||||||
|
internal Egl egl = new Egl();
|
||||||
|
|
||||||
|
internal Osmesa osmesa = new Osmesa();
|
||||||
|
|
||||||
|
internal Callbacks callbacks = new Callbacks();
|
||||||
|
|
||||||
|
public GLFWlibrary()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal unsafe struct Hints
|
||||||
|
{
|
||||||
|
|
||||||
|
private GLFWinitconfig init;
|
||||||
|
private GLFWfbconfig framebuffer;
|
||||||
|
private GLFWwndconfig window;
|
||||||
|
private GLFWctxconfig context;
|
||||||
|
private int refreshRate;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
internal unsafe struct timer
|
internal unsafe struct timer
|
||||||
{
|
{
|
||||||
|
|
||||||
private ulong offset;
|
private ulong offset;
|
||||||
// This is defined in platform.h
|
// This is defined in platform.h
|
||||||
|
|
||||||
@@ -459,6 +584,7 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
internal unsafe struct Egl
|
internal unsafe struct Egl
|
||||||
{
|
{
|
||||||
|
|
||||||
internal int platform;
|
internal int platform;
|
||||||
internal void* display;
|
internal void* display;
|
||||||
internal int major, minor;
|
internal int major, minor;
|
||||||
@@ -466,7 +592,7 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
internal bool KHR_create_context;
|
internal bool KHR_create_context;
|
||||||
internal bool KHR_create_context_no_error;
|
internal bool KHR_create_context_no_error;
|
||||||
internal bool KHR_colorspace;
|
internal bool KHR_colorSpace;
|
||||||
internal bool KHR_get_all_proc_addresses;
|
internal bool KHR_get_all_proc_addresses;
|
||||||
internal bool KHR_context_flush_control;
|
internal bool KHR_context_flush_control;
|
||||||
internal bool EXT_client_extensions;
|
internal bool EXT_client_extensions;
|
||||||
@@ -501,12 +627,12 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
internal IntPtr GetPlatformDisplayEXT;
|
internal IntPtr GetPlatformDisplayEXT;
|
||||||
internal IntPtr CreatePlatformWindowSurfaceEXT;
|
internal IntPtr CreatePlatformWindowSurfaceEXT;
|
||||||
}
|
|
||||||
|
|
||||||
internal Egl egl = new Egl();
|
}
|
||||||
|
|
||||||
internal unsafe struct Osmesa
|
internal unsafe struct Osmesa
|
||||||
{
|
{
|
||||||
|
|
||||||
private void* handle;
|
private void* handle;
|
||||||
|
|
||||||
private IntPtr CreateContextExt;
|
private IntPtr CreateContextExt;
|
||||||
@@ -516,12 +642,12 @@ namespace StgSharp.Graphics
|
|||||||
private IntPtr GetColorBuffer;
|
private IntPtr GetColorBuffer;
|
||||||
private IntPtr GetDepthBuffer;
|
private IntPtr GetDepthBuffer;
|
||||||
private IntPtr GetProcAddress;
|
private IntPtr GetProcAddress;
|
||||||
}
|
|
||||||
|
|
||||||
internal Osmesa osmesa = new Osmesa();
|
}
|
||||||
|
|
||||||
internal unsafe struct vk
|
internal unsafe struct vk
|
||||||
{
|
{
|
||||||
|
|
||||||
private GLFWbool available;
|
private GLFWbool available;
|
||||||
private void* handle;
|
private void* handle;
|
||||||
private fixed ulong extensions[2];
|
private fixed ulong extensions[2];
|
||||||
@@ -537,33 +663,34 @@ namespace StgSharp.Graphics
|
|||||||
public vk()
|
public vk()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe struct Callbacks
|
internal unsafe struct Callbacks
|
||||||
{
|
{
|
||||||
|
|
||||||
private IntPtr monitor;
|
private IntPtr monitor;
|
||||||
private IntPtr joystick;
|
private IntPtr joystick;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Callbacks callbacks = new Callbacks();
|
|
||||||
|
|
||||||
public GLFWlibrary()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWmapelement
|
public unsafe struct GLFWmapelement
|
||||||
{
|
{
|
||||||
|
|
||||||
private byte type;
|
private byte type;
|
||||||
private byte index;
|
private byte index;
|
||||||
private sbyte axisScale;
|
private sbyte axisScale;
|
||||||
private sbyte axisOffset;
|
private sbyte axisOffset;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWmapping
|
public unsafe struct GLFWmapping
|
||||||
{
|
{
|
||||||
|
|
||||||
private fixed byte name[128];
|
private fixed byte name[128];
|
||||||
private fixed byte guid[33];
|
private fixed byte guid[33];
|
||||||
|
|
||||||
@@ -575,11 +702,13 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
public GLFWmapping()
|
public GLFWmapping()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWjoystick
|
public unsafe struct GLFWjoystick
|
||||||
{
|
{
|
||||||
|
|
||||||
private GLFWbool allocated;
|
private GLFWbool allocated;
|
||||||
private GLFWbool connected;
|
private GLFWbool connected;
|
||||||
private float* axes;
|
private float* axes;
|
||||||
@@ -601,6 +730,7 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
public GLFWjoystick()
|
public GLFWjoystick()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
@@ -614,6 +744,7 @@ namespace StgSharp.Graphics
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct GLFWplatform
|
public unsafe struct GLFWplatform
|
||||||
{
|
{
|
||||||
|
|
||||||
private int platformID;
|
private int platformID;
|
||||||
|
|
||||||
// init
|
// init
|
||||||
@@ -623,73 +754,75 @@ namespace StgSharp.Graphics
|
|||||||
//void (* terminate) (void);
|
//void (* terminate) (void);
|
||||||
private IntPtr terminate;
|
private IntPtr terminate;
|
||||||
|
|
||||||
// input
|
#region input
|
||||||
/* void (* getCursorPos) (GLFWwindow*, double*, double*);
|
/* void (* getCursorPos) (GLFWwindow*, double*, double*);
|
||||||
void (* setCursorPos) (GLFWwindow*, double, double);
|
void (* setCursorPos) (GLFWwindow*, double, double);
|
||||||
void (* setCursorMode) (GLFWwindow*, int);
|
void (* setCursorMode) (GLFWwindow*, int);
|
||||||
void (* setRawMouseMotion) (GLFWwindow*, GLFWbool);
|
void (* setRawMouseMotion) (GLFWwindow*, GLFWbool);
|
||||||
GLFWbool(*rawMouseMotionSupported)(void);
|
GLFWbool(*rawMouseMotionSupported)(void);
|
||||||
GLFWbool(*createCursor)(GLFWcursor*,const GLFWimage*,int,int);
|
GLFWbool(*createCursor)(GLFWcursor*,const GLFWimage*,int,int);
|
||||||
GLFWbool(*createStandardCursor)(GLFWcursor*, int);
|
GLFWbool(*createStandardCursor)(GLFWcursor*, int);
|
||||||
void (* destroyCursor) (GLFWcursor*);
|
void (* destroyCursor) (GLFWcursor*);
|
||||||
void (* setCursor) (GLFWwindow*, GLFWcursor*);
|
void (* setCursor) (GLFWwindow*, GLFWcursor*);
|
||||||
const byte* (*getScancodeName)(int);
|
const byte* (*getScancodeName)(int);
|
||||||
int (* getKeyScancode) (int);
|
int (* getKeyScancode) (int);
|
||||||
void (* setClipboardString) (const byte*);
|
void (* setClipboardString) (const byte*);
|
||||||
const byte* (*getClipboardString)(void);
|
const byte* (*getClipboardString)(void);
|
||||||
GLFWbool(*initJoysticks)(void);
|
GLFWbool(*initJoysticks)(void);
|
||||||
void (* terminateJoysticks) (void);
|
void (* terminateJoysticks) (void);
|
||||||
GLFWbool(*pollJoystick)(GLFWjoystick*, int);
|
GLFWbool(*pollJoystick)(GLFWjoystick*, int);
|
||||||
const byte* (*getMappingName)(void);
|
const byte* (*getMappingName)(void);
|
||||||
void (* updateGamepadGUID) (byte*);
|
void (* updateGamepadGUID) (byte*);
|
||||||
// monitor
|
// monitor
|
||||||
void (* freeMonitor) (GLFWmonitor*);
|
void (* freeMonitor) (GLFWmonitor*);
|
||||||
void (* getMonitorPos) (GLFWmonitor*, int*, int*);
|
void (* getMonitorPos) (GLFWmonitor*, int*, int*);
|
||||||
void (* getMonitorContentScale) (GLFWmonitor*, float*, float*);
|
void (* getMonitorContentScale) (GLFWmonitor*, float*, float*);
|
||||||
void (* getMonitorWorkarea) (GLFWmonitor*, int*, int*, int*, int*);
|
void (* getMonitorWorkarea) (GLFWmonitor*, int*, int*, int*, int*);
|
||||||
GLFWvidmode* (* getVideoModes) (GLFWmonitor*, int*);
|
GLFWvidmode* (* getVideoModes) (GLFWmonitor*, int*);
|
||||||
void (* getVideoMode) (GLFWmonitor*, GLFWvidmode*);
|
void (* getVideoMode) (GLFWmonitor*, GLFWvidmode*);
|
||||||
GLFWbool(*getGammaRamp)(GLFWmonitor*, GLFWgammaramp*);
|
GLFWbool(*getGammaRamp)(GLFWmonitor*, GLFWgammaramp*);
|
||||||
void (* setGammaRamp) (GLFWmonitor*,const GLFWgammaramp*);
|
void (* setGammaRamp) (GLFWmonitor*,const GLFWgammaramp*);
|
||||||
// window
|
// window
|
||||||
GLFWbool(*createWindow)(GLFWwindow*,const GLFWwndconfig*,const GLFWctxconfig*,const GLFWfbconfig*);
|
GLFWbool(*createWindow)(GLFWwindow*,const GLFWwndconfig*,const GLFWctxconfig*,const GLFWfbconfig*);
|
||||||
void (* destroyWindow) (GLFWwindow*);
|
void (* destroyWindow) (GLFWwindow*);
|
||||||
void (* setWindowTitle) (GLFWwindow*,const byte*);
|
void (* setWindowTitle) (GLFWwindow*,const byte*);
|
||||||
void (* setWindowIcon) (GLFWwindow*, int,const GLFWimage*);
|
void (* setWindowIcon) (GLFWwindow*, int,const GLFWimage*);
|
||||||
void (* getWindowPos) (GLFWwindow*, int*, int*);
|
void (* getWindowPos) (GLFWwindow*, int*, int*);
|
||||||
void (* setWindowPos) (GLFWwindow*, int, int);
|
void (* setWindowPos) (GLFWwindow*, int, int);
|
||||||
void (* getWindowSize) (GLFWwindow*, int*, int*);
|
void (* getWindowSize) (GLFWwindow*, int*, int*);
|
||||||
void (* setWindowSize) (GLFWwindow*, int, int);
|
void (* setWindowSize) (GLFWwindow*, int, int);
|
||||||
void (* setWindowSizeLimits) (GLFWwindow*, int, int, int, int);
|
void (* setWindowSizeLimits) (GLFWwindow*, int, int, int, int);
|
||||||
void (* setWindowAspectRatio) (GLFWwindow*, int, int);
|
void (* setWindowAspectRatio) (GLFWwindow*, int, int);
|
||||||
void (* getFramebufferSize) (GLFWwindow*, int*, int*);
|
void (* getFramebufferSize) (GLFWwindow*, int*, int*);
|
||||||
void (* getWindowFrameSize) (GLFWwindow*, int*, int*, int*, int*);
|
void (* getWindowFrameSize) (GLFWwindow*, int*, int*, int*, int*);
|
||||||
void (* getWindowContentScale) (GLFWwindow*, float*, float*);
|
void (* getWindowContentScale) (GLFWwindow*, float*, float*);
|
||||||
void (* iconifyWindow) (GLFWwindow*);
|
void (* iconifyWindow) (GLFWwindow*);
|
||||||
void (* restoreWindow) (GLFWwindow*);
|
void (* restoreWindow) (GLFWwindow*);
|
||||||
void (* maximizeWindow) (GLFWwindow*);
|
void (* maximizeWindow) (GLFWwindow*);
|
||||||
void (* showWindow) (GLFWwindow*);
|
void (* showWindow) (GLFWwindow*);
|
||||||
void (* hideWindow) (GLFWwindow*);
|
void (* hideWindow) (GLFWwindow*);
|
||||||
void (* requestWindowAttention) (GLFWwindow*);
|
void (* requestWindowAttention) (GLFWwindow*);
|
||||||
void (* focusWindow) (GLFWwindow*);
|
void (* focusWindow) (GLFWwindow*);
|
||||||
void (* setWindowMonitor) (GLFWwindow*, GLFWmonitor*, int, int, int, int, int);
|
void (* setWindowMonitor) (GLFWwindow*, GLFWmonitor*, int, int, int, int, int);
|
||||||
GLFWbool(*windowFocused)(GLFWwindow*);
|
GLFWbool(*windowFocused)(GLFWwindow*);
|
||||||
GLFWbool(*windowIconified)(GLFWwindow*);
|
GLFWbool(*windowIconified)(GLFWwindow*);
|
||||||
GLFWbool(*windowVisible)(GLFWwindow*);
|
GLFWbool(*windowVisible)(GLFWwindow*);
|
||||||
GLFWbool(*windowMaximized)(GLFWwindow*);
|
GLFWbool(*windowMaximized)(GLFWwindow*);
|
||||||
GLFWbool(*windowHovered)(GLFWwindow*);
|
GLFWbool(*windowHovered)(GLFWwindow*);
|
||||||
GLFWbool(*framebufferTransparent)(GLFWwindow*);
|
GLFWbool(*framebufferTransparent)(GLFWwindow*);
|
||||||
float (* getWindowOpacity) (GLFWwindow*);
|
float (* getWindowOpacity) (GLFWwindow*);
|
||||||
void (* setWindowResizable) (GLFWwindow*, GLFWbool);
|
void (* setWindowResizable) (GLFWwindow*, GLFWbool);
|
||||||
void (* setWindowDecorated) (GLFWwindow*, GLFWbool);
|
void (* setWindowDecorated) (GLFWwindow*, GLFWbool);
|
||||||
void (* setWindowFloating) (GLFWwindow*, GLFWbool);
|
void (* setWindowFloating) (GLFWwindow*, GLFWbool);
|
||||||
void (* setWindowOpacity) (GLFWwindow*, float);
|
void (* setWindowOpacity) (GLFWwindow*, float);
|
||||||
void (* setWindowMousePassthrough) (GLFWwindow*, GLFWbool);
|
void (* setWindowMousePassthrough) (GLFWwindow*, GLFWbool);
|
||||||
void (* pollEvents) (void);
|
void (* pollEvents) (void);
|
||||||
void (* waitEvents) (void);
|
void (* waitEvents) (void);
|
||||||
void (* waitEventsTimeout) (double);
|
void (* waitEventsTimeout) (double);
|
||||||
void (* postEmptyEvent) (void);
|
void (* postEmptyEvent) (void);
|
||||||
*/
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
internal IntPtr setCursorPos;
|
internal IntPtr setCursorPos;
|
||||||
internal IntPtr setCursorMode;
|
internal IntPtr setCursorMode;
|
||||||
internal IntPtr setRawMouseMotion;
|
internal IntPtr setRawMouseMotion;
|
||||||
@@ -776,6 +909,7 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
internal IntPtr VkPhysicalDevice;
|
internal IntPtr VkPhysicalDevice;
|
||||||
internal IntPtr GLFWwindow;
|
internal IntPtr GLFWwindow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
@@ -790,12 +924,14 @@ namespace StgSharp.Graphics
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
internal unsafe struct VkExtensionProperties
|
internal unsafe struct VkExtensionProperties
|
||||||
{
|
{
|
||||||
|
|
||||||
private fixed byte extensionName[256];
|
private fixed byte extensionName[256];
|
||||||
private uint specVersion;
|
private uint specVersion;
|
||||||
|
|
||||||
public VkExtensionProperties()
|
public VkExtensionProperties()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -816,11 +952,13 @@ namespace StgSharp.Graphics
|
|||||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
||||||
public struct uintptr_t
|
public struct uintptr_t
|
||||||
{
|
{
|
||||||
|
|
||||||
[FieldOffset(0)]
|
[FieldOffset(0)]
|
||||||
private long part1;
|
private long part1;
|
||||||
|
|
||||||
[FieldOffset(8)]
|
[FieldOffset(8)]
|
||||||
private long part2;
|
private long part2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion GLFW3 struct
|
#endregion GLFW3 struct
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
/*
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="glApiDefine.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.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/*
|
||||||
* This file is created to link functions in OpenGL to version in C#
|
* This file is created to link functions in OpenGL to version in C#
|
||||||
* The name of delegates and organization to init all these delegates
|
* The name of delegates and organization to init all these delegates
|
||||||
* are refferd from GLAD1 in agreement of MIT license generated from
|
* are refferd from GLAD1 in agreement of MIT license generated from
|
||||||
@@ -7,12 +37,19 @@
|
|||||||
|
|
||||||
|
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Graphics
|
namespace StgSharp.Graphics
|
||||||
{
|
{
|
||||||
|
#region StgSharpDele
|
||||||
|
|
||||||
|
public unsafe delegate void FrameBufferSizeHandler(IntPtr window, uint width, uint height);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Function handler to load an opengl function by serching its name.
|
/// Function handler to load an opengl function by serching its name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -143,12 +180,6 @@ namespace StgSharp.Graphics
|
|||||||
//[UnmanagedFunctionPointer(callingConvention: CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal unsafe delegate VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
//[UnmanagedFunctionPointer(callingConvention: CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal unsafe delegate VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region StgSharpDele
|
|
||||||
|
|
||||||
public unsafe delegate void FrameBufferSizeHandler(IntPtr window, uint width, uint height);
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region glDEBUG
|
#region glDEBUG
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="glConst.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;
|
||||||
|
|
||||||
namespace StgSharp.Graphics
|
namespace StgSharp.Graphics
|
||||||
{
|
{
|
||||||
@@ -22,10 +52,10 @@ namespace StgSharp.Graphics
|
|||||||
internal const int GLFW_HAT_RIGHT = 2;
|
internal const int GLFW_HAT_RIGHT = 2;
|
||||||
internal const int GLFW_HAT_DOWN = 4;
|
internal const int GLFW_HAT_DOWN = 4;
|
||||||
internal const int GLFW_HAT_LEFT = 8;
|
internal const int GLFW_HAT_LEFT = 8;
|
||||||
internal const int GLFW_HAT_RIGHT_UP = (GLFW_HAT_RIGHT | GLFW_HAT_UP);
|
internal const int GLFW_HAT_RIGHT_UP = GLFW_HAT_RIGHT | GLFW_HAT_UP;
|
||||||
internal const int GLFW_HAT_RIGHT_DOWN = (GLFW_HAT_RIGHT | GLFW_HAT_DOWN);
|
internal const int GLFW_HAT_RIGHT_DOWN = GLFW_HAT_RIGHT | GLFW_HAT_DOWN;
|
||||||
internal const int GLFW_HAT_LEFT_UP = (GLFW_HAT_LEFT | GLFW_HAT_UP);
|
internal const int GLFW_HAT_LEFT_UP = GLFW_HAT_LEFT | GLFW_HAT_UP;
|
||||||
internal const int GLFW_HAT_LEFT_DOWN = (GLFW_HAT_LEFT | GLFW_HAT_DOWN);
|
internal const int GLFW_HAT_LEFT_DOWN = GLFW_HAT_LEFT | GLFW_HAT_DOWN;
|
||||||
internal const int GLFW_KEY_UNKNOWN = -1;
|
internal const int GLFW_KEY_UNKNOWN = -1;
|
||||||
internal const int GLFW_KEY_SPACE = 32;
|
internal const int GLFW_KEY_SPACE = 32;
|
||||||
internal const int GLFW_KEY_APOSTROPHE = 39;
|
internal const int GLFW_KEY_APOSTROPHE = 39;
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
namespace StgSharp.Graphics
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="glEnum.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.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
namespace StgSharp.Graphics
|
||||||
{
|
{
|
||||||
internal enum VkStructureType : uint
|
internal enum VkStructureType : uint
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,35 @@
|
|||||||
using StgSharp.Geometries;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="glType.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.Geometries;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -9,35 +40,10 @@ using System.Text;
|
|||||||
namespace StgSharp.Graphics
|
namespace StgSharp.Graphics
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public delegate IntPtr GLfuncLoader(string name);
|
||||||
|
|
||||||
internal delegate void GLVULKANPROCNV();
|
internal delegate void GLVULKANPROCNV();
|
||||||
|
|
||||||
#region GLFW_dele
|
|
||||||
|
|
||||||
internal unsafe delegate void GLFWwindowsizefun(GLFWwindow* window, int width, int height);
|
|
||||||
internal unsafe delegate void GLFWwindowrefreshfun(GLFWwindow* window);
|
|
||||||
internal unsafe delegate void GLFWwindowposfun(GLFWwindow* window, int xpos, int ypos);
|
|
||||||
internal unsafe delegate void GLFWwindowmaximizefun(GLFWwindow* window, int maximized);
|
|
||||||
internal unsafe delegate void GLFWwindowiconifyfun(GLFWwindow* window, int iconified);
|
|
||||||
internal unsafe delegate void GLFWwindowfocusfun(GLFWwindow* window, int focused);
|
|
||||||
internal unsafe delegate void GLFWwindowcontentscalefun(GLFWwindow* window, float xscale, float yscale);
|
|
||||||
internal unsafe delegate void GLFWwindowclosefun(GLFWwindow* window);
|
|
||||||
internal unsafe delegate void GLFWvkproc();
|
|
||||||
internal unsafe delegate void GLFWscrollfun(GLFWwindow* window, double xoffset, double yoffset);
|
|
||||||
internal unsafe delegate void GLFWmousebuttonfun(GLFWwindow* window, int button, int action, int mods);
|
|
||||||
internal unsafe delegate void GLFWmonitorfun(GLFWmonitor* monitor, int monitorevent);
|
|
||||||
internal unsafe delegate void GLFWkeyfun(GLFWwindow* window, int key, int scancode, int action, int mods);
|
|
||||||
internal unsafe delegate void GLFWjoystickfun(int jid, int keyevent);
|
|
||||||
public unsafe delegate void GLFWglproc();
|
|
||||||
internal unsafe delegate void FramebuffersizeHandler(IntPtr window, int width, int height); //window is the pointer to a GLFWwindow instance
|
|
||||||
internal unsafe delegate void GLFWerrorfun(int error_code, sbyte* description);
|
|
||||||
internal unsafe delegate void GLFWdropfun(GLFWwindow* window, int path_count, sbyte*[] paths);
|
|
||||||
internal unsafe delegate void GLFWcursorposfun(GLFWwindow* window, double xpos, double ypos);
|
|
||||||
internal unsafe delegate void GLFWcursorenterfun(GLFWwindow* window, int entered);
|
|
||||||
internal unsafe delegate void GLFWcharmodsfun(GLFWwindow* window, uint codepoint, int mods);
|
|
||||||
internal unsafe delegate void GLFWcharfun(GLFWwindow* window, uint codepoint);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public unsafe struct GLhandleARB
|
public unsafe struct GLhandleARB
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -80,6 +86,32 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate IntPtr GLfuncLoader(string name);
|
#region GLFW_dele
|
||||||
|
|
||||||
|
internal unsafe delegate void GLFWwindowsizefun(GLFWwindow* window, int width, int height);
|
||||||
|
internal unsafe delegate void GLFWwindowrefreshfun(GLFWwindow* window);
|
||||||
|
internal unsafe delegate void GLFWwindowposfun(GLFWwindow* window, int xpos, int ypos);
|
||||||
|
internal unsafe delegate void GLFWwindowmaximizefun(GLFWwindow* window, int maximized);
|
||||||
|
internal unsafe delegate void GLFWwindowiconifyfun(GLFWwindow* window, int iconified);
|
||||||
|
internal unsafe delegate void GLFWwindowfocusfun(GLFWwindow* window, int focused);
|
||||||
|
internal unsafe delegate void GLFWwindowcontentscalefun(GLFWwindow* window, float xscale, float yscale);
|
||||||
|
internal unsafe delegate void GLFWwindowclosefun(GLFWwindow* window);
|
||||||
|
internal unsafe delegate void GLFWvkproc();
|
||||||
|
internal unsafe delegate void GLFWscrollfun(GLFWwindow* window, double xoffset, double yoffset);
|
||||||
|
internal unsafe delegate void GLFWmousebuttonfun(GLFWwindow* window, int button, int action, int mods);
|
||||||
|
internal unsafe delegate void GLFWmonitorfun(GLFWmonitor* monitor, int monitorevent);
|
||||||
|
internal unsafe delegate void GLFWkeyfun(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||||
|
internal unsafe delegate void GLFWjoystickfun(int jid, int keyevent);
|
||||||
|
public unsafe delegate void GLFWglproc();
|
||||||
|
internal unsafe delegate void FramebuffersizeHandler(IntPtr window, int width, int height); //window is the pointer to a GLFWwindow instance
|
||||||
|
internal unsafe delegate void GLFWerrorfun(int error_code, sbyte* description);
|
||||||
|
internal unsafe delegate void GLFWdropfun(GLFWwindow* window, int path_count, sbyte*[] paths);
|
||||||
|
internal unsafe delegate void GLFWcursorposfun(GLFWwindow* window, double xpos, double ypos);
|
||||||
|
internal unsafe delegate void GLFWcursorenterfun(GLFWwindow* window, int entered);
|
||||||
|
internal unsafe delegate void GLFWcharmodsfun(GLFWwindow* window, uint codepoint, int mods);
|
||||||
|
internal unsafe delegate void GLFWcharfun(GLFWwindow* window, uint codepoint);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+107
-129
@@ -1,20 +1,41 @@
|
|||||||
using StgSharp;
|
//-----------------------------------------------------------------------
|
||||||
using StgSharp.Controlling;
|
//-----------------------------------------------------------------------
|
||||||
using StgSharp.Logic;
|
// file="Form.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 StgSharp.Math;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Reflection;
|
|
||||||
using System.Reflection.Emit;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Principal;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
@@ -23,52 +44,45 @@ namespace StgSharp.Graphics
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract partial class Form
|
public abstract unsafe partial class Form
|
||||||
{
|
{
|
||||||
#region metadata
|
#region metadata
|
||||||
|
|
||||||
internal LinkedList<Control> allControl;
|
internal LinkedList<Control> allControl;
|
||||||
internal Vector4 backgroundColor;
|
internal Vector4 backgroundColor;
|
||||||
internal IglFunc gl;
|
internal IglFunc gl;
|
||||||
internal unsafe IntPtr graphicContextID;
|
internal IntPtr graphicContextID;
|
||||||
internal int height;
|
internal int height;
|
||||||
internal IntPtr monitor;
|
internal IntPtr monitor;
|
||||||
internal string name;
|
internal string name;
|
||||||
internal Form sharedForm;
|
internal Form sharedForm;
|
||||||
internal int width;
|
internal int width;
|
||||||
internal IntPtr windowID;
|
private GLFWwindow* windowID;
|
||||||
|
|
||||||
protected readonly TimeProvider FrameTimeFrocider;
|
|
||||||
|
|
||||||
|
internal TimeSpanProvider frameTimeProvider;
|
||||||
#endregion metadata
|
#endregion metadata
|
||||||
|
|
||||||
#region form thread setting
|
|
||||||
|
|
||||||
private bool isSingleThread = true;
|
|
||||||
|
|
||||||
#endregion form thread setting
|
|
||||||
|
|
||||||
#region glapicount
|
#region glapicount
|
||||||
|
|
||||||
private int missingAPIcount = 0;
|
private int missingAPIcount = 0;
|
||||||
private int problemAPIcount = 0;
|
private int problemAPIcount = 0;
|
||||||
|
|
||||||
#endregion glapicount
|
#endregion glapicount
|
||||||
|
#region form main
|
||||||
|
|
||||||
|
|
||||||
|
#region form thread setting
|
||||||
|
private bool isSingleThread = true;
|
||||||
|
#endregion form thread setting
|
||||||
|
|
||||||
|
|
||||||
private int _shouldClose = 0;
|
|
||||||
|
|
||||||
protected Form()
|
protected Form()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OpenGL package used by current form context.
|
/// OpenGL package binded to current form context.
|
||||||
|
/// A OpenGL context is only binded to current form.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IglFunc GL
|
public IglFunc GL => gl;
|
||||||
{
|
|
||||||
get => gl;
|
|
||||||
internal set => gl = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Height of this form, represent in <see cref="int"/>
|
/// Height of this form, represent in <see cref="int"/>
|
||||||
@@ -82,24 +96,13 @@ namespace StgSharp.Graphics
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Representing
|
/// Representing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsDoubleRendering
|
public bool IsDoubleRendering => isSingleThread;
|
||||||
{
|
|
||||||
get { return isSingleThread; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ShouldClose
|
public bool ShouldClose
|
||||||
{
|
{
|
||||||
get
|
get => InternalIO.glfwWindowShouldClose(windowID) != 0;
|
||||||
{
|
|
||||||
Interlocked.Exchange(ref _shouldClose, InternalIO.glfwWindowShouldClose(windowID));
|
|
||||||
return 0 != _shouldClose;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set => InternalIO.glfwSetWindowShouldClose(windowID, value ? 1 : 0);
|
||||||
{
|
|
||||||
InternalIO.glfwSetWindowShouldClose(windowID, value ? 1 : 0);
|
|
||||||
Interlocked.Exchange(ref _shouldClose, value ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -107,7 +110,7 @@ namespace StgSharp.Graphics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Vec2d Size
|
public Vec2d Size
|
||||||
{
|
{
|
||||||
get { return new Vec2d(width, height); }
|
get => new Vec2d(width, height);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
width = (int)value.X;
|
width = (int)value.X;
|
||||||
@@ -124,10 +127,9 @@ namespace StgSharp.Graphics
|
|||||||
set => width = value;
|
set => width = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool IsSingleThread
|
public unsafe IntPtr WindowID => (IntPtr)windowID;
|
||||||
{
|
|
||||||
get { return isSingleThread; }
|
internal unsafe GLFWwindow* id => windowID;
|
||||||
}
|
|
||||||
|
|
||||||
protected FrameBufferSizeHandler FrameBufferSizeCallback
|
protected FrameBufferSizeHandler FrameBufferSizeCallback
|
||||||
{
|
{
|
||||||
@@ -138,12 +140,15 @@ namespace StgSharp.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal bool IsSingleThread => isSingleThread;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Init an OpenGl context if current form has not been binded to any context.
|
/// Init an OpenGl context if current form has not been binded to any context. and set the context binded to
|
||||||
/// and set the context binded to current form as current OpenGL context.
|
/// current form as current OpenGL context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="Exception">Something goes wrong and
|
/// <exception cref="Exception">
|
||||||
/// StgSharp fails in creating a new OpenGL context. </exception>
|
/// Something goes wrong and StgSharp fails in creating a new OpenGL context.
|
||||||
|
/// </exception>
|
||||||
public unsafe void MakeAsCurrentContext()
|
public unsafe void MakeAsCurrentContext()
|
||||||
{
|
{
|
||||||
if (windowID == default)
|
if (windowID == default)
|
||||||
@@ -152,21 +157,19 @@ namespace StgSharp.Graphics
|
|||||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(name);
|
byte[] tittleBytes = Encoding.UTF8.GetBytes(name);
|
||||||
if (sharedForm == null)
|
if (sharedForm == null)
|
||||||
{
|
{
|
||||||
windowPtr = InternalIO.glfwCreateWindow(
|
windowPtr = InternalIO.glfwCreateWindow(width, height, tittleBytes, monitor, (GLFWwindow*)IntPtr.Zero);
|
||||||
width, height, tittleBytes, monitor, IntPtr.Zero);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPtr = InternalIO.glfwCreateWindow(
|
windowPtr = InternalIO.glfwCreateWindow(width, height, tittleBytes, monitor, sharedForm.windowID);
|
||||||
width, height, tittleBytes, monitor, sharedForm.windowID);
|
|
||||||
}
|
}
|
||||||
if ((long)windowPtr == -1 || (long)windowPtr == -2)
|
if (((long)windowPtr == -1) || ((long)windowPtr == -2))
|
||||||
{
|
{
|
||||||
throw new Exception("Cannot create window instance!");
|
throw new Exception("Cannot create window instance!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowID = windowPtr;
|
windowID = (GLFWwindow*)windowPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
graphicContextID = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GLcontext)));
|
graphicContextID = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GLcontext)));
|
||||||
@@ -191,18 +194,6 @@ namespace StgSharp.Graphics
|
|||||||
this.monitor = monitor;
|
this.monitor = monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resize the current form
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="width">New width of the window</param>
|
|
||||||
/// <param name="height">New height of the window</param>
|
|
||||||
public void SetSize(int width, int height)
|
|
||||||
{
|
|
||||||
this.Width = width;
|
|
||||||
this.Height = height;
|
|
||||||
InternalIO.glfwSetWindowSize(this.windowID, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resize the current form
|
/// Resize the current form
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -217,18 +208,15 @@ namespace StgSharp.Graphics
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the size limit of current form
|
/// Resize the current form
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="minWidth">Minimum width of current form </param>
|
/// <param name="width">New width of the window</param>
|
||||||
/// <param name="minHeight">Minimum height of current form</param>
|
/// <param name="height">New height of the window</param>
|
||||||
/// <param name="maxWidth">Maximum width of curent form</param>
|
public void SetSize(int width, int height)
|
||||||
/// <param name="maxHeight">Maximum height of current form</param>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public void SetSizeLimit(int minWidth, int minHeight, int maxWidth, int maxHeight)
|
|
||||||
{
|
{
|
||||||
InternalIO.glfwSetWindowSizeLimits(
|
this.Width = width;
|
||||||
this.windowID,
|
this.Height = height;
|
||||||
minWidth, minHeight, maxWidth, maxHeight);
|
InternalIO.glfwSetWindowSize(this.windowID, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -245,19 +233,26 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
InternalIO.glfwSetWindowSizeLimits(
|
InternalIO.glfwSetWindowSizeLimits(
|
||||||
this.windowID,
|
this.windowID,
|
||||||
(int)minSize.X, (int)minSize.Y, (int)maxSize.X, (int)maxSize.Y);
|
(int)minSize.X,
|
||||||
|
(int)minSize.Y,
|
||||||
|
(int)maxSize.X,
|
||||||
|
(int)maxSize.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe ~Form()
|
/// <summary>
|
||||||
{
|
/// Set the size limit of current form
|
||||||
Marshal.FreeHGlobal(graphicContextID);
|
/// </summary>
|
||||||
}
|
/// <param name="minWidth">Minimum width of current form</param>
|
||||||
|
/// <param name="minHeight">Minimum height of current form</param>
|
||||||
|
/// <param name="maxWidth">Maximum width of curent form</param>
|
||||||
|
/// <param name="maxHeight">Maximum height of current form</param>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void SetSizeLimit(int minWidth, int minHeight, int maxWidth, int maxHeight)
|
||||||
|
{ InternalIO.glfwSetWindowSizeLimits(this.windowID, minWidth, minHeight, maxWidth, maxHeight); }
|
||||||
|
|
||||||
#region form main
|
unsafe ~Form() { Marshal.FreeHGlobal(graphicContextID); }
|
||||||
|
|
||||||
private static unsafe delegate*<void> pollEventPtr = &InternalIO.glfwPollEvents;
|
|
||||||
|
|
||||||
private static unsafe delegate*<void> swapBufferPtr = &InternalSwapBuffers;
|
|
||||||
|
|
||||||
public abstract void Deinit(params object[] args);
|
public abstract void Deinit(params object[] args);
|
||||||
|
|
||||||
@@ -268,22 +263,14 @@ namespace StgSharp.Graphics
|
|||||||
public abstract void Init(params object[] args);
|
public abstract void Init(params object[] args);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Behaviour of current form when in a render cycle.
|
/// Behaviour of current form when in a render cycle. When this form
|
||||||
/// When this form
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
public abstract void Main(params object[] args);
|
public abstract void Main(params object[] args);
|
||||||
|
|
||||||
public unsafe void PollEvents()
|
public unsafe void PollEvents()
|
||||||
{
|
{
|
||||||
if (isSingleThread)
|
InternalIO.glfwPollEvents();
|
||||||
{
|
|
||||||
InternalIO.glfwPollEvents();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gl.frameworkHandleEnqueue((IntPtr)pollEventPtr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -303,61 +290,49 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
Main(args);
|
Main(args);
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
PollEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLonUpdate update = new GLonUpdate((GLcontext*)graphicContextID);
|
GLonUpdate update = new GLonUpdate((GLcontext*)graphicContextID);
|
||||||
FrameThread renderThread = new FrameThread(update);
|
FrameAsyncTask renderTask = new FrameAsyncTask(update);
|
||||||
FrameThread updateThread = new FrameThread(update);
|
FrameAsyncTask updateTask = new FrameAsyncTask(update);
|
||||||
renderThread.SetNext(updateThread);
|
|
||||||
updateThread.SetNext(renderThread);
|
|
||||||
gl = update;
|
gl = update;
|
||||||
int a = 0;
|
|
||||||
while (!ShouldClose)
|
while (!ShouldClose)
|
||||||
{
|
{
|
||||||
|
renderTask.StartAsync();
|
||||||
|
updateTask.StartAsync();
|
||||||
|
FrameAsyncTask.CombineAsync(renderTask, updateTask);
|
||||||
|
SwapBuffers();
|
||||||
|
PollEvents();
|
||||||
}
|
}
|
||||||
//TODO 对逻辑线程和渲染线程进行同步,两种gl模式包需要改名字
|
//TODO 对逻辑线程和渲染线程进行同步,两种gl模式包需要改名字
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe void InternalSwapBuffers()
|
internal static unsafe void InternalSwapBuffers(FrameOperationBuffer operationBuffer, GLcontext* context)
|
||||||
{
|
{
|
||||||
IntPtr winHandle = default;
|
IntPtr window = default;
|
||||||
InternalIO.glfwSwapBuffers(winHandle);
|
operationBuffer.TryDequeue(out window);
|
||||||
|
InternalIO.glfwSwapBuffers((GLFWwindow*)window);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal void InternalDeinit(params object[] args)
|
internal void InternalDeinit(params object[] args) { Deinit(args); }
|
||||||
{
|
|
||||||
Deinit(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal void InternalInit(params object[] args)
|
|
||||||
{
|
|
||||||
Init(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal unsafe void SwapBuffers()
|
internal unsafe void SwapBuffers()
|
||||||
{
|
{
|
||||||
if (isSingleThread)
|
InternalIO.glfwSwapBuffers(windowID);
|
||||||
{
|
|
||||||
InternalIO.glfwSwapBuffers(windowID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
M128 m = new M128();
|
|
||||||
m.Write<ulong>(0, (ulong)windowID);
|
|
||||||
gl.frameworkHandleEnqueue((IntPtr)swapBufferPtr, m);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get OpenGL library of this form's context.
|
/// Get OpenGL library of this form's context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A <see cref="IglFunc"/> package contains all opengl APIs </returns>
|
/// <returns>A <see cref="IglFunc"/> package contains all opengl APIs</returns>
|
||||||
protected IglFunc GetGL()
|
protected IglFunc GetGL()
|
||||||
{
|
{
|
||||||
if (StgSharp.API == GraphicAPI.GL)
|
if (StgSharp.API == GraphicAPI.GL)
|
||||||
@@ -366,7 +341,9 @@ namespace StgSharp.Graphics
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InternalIO.InternalWriteLog("Attempt to get OpenGL API package in other graphic envitronment.", LogType.Error);
|
InternalIO.InternalWriteLog(
|
||||||
|
"Attempt to get OpenGL API package in other graphic envitronment.",
|
||||||
|
LogType.Error);
|
||||||
throw new InvalidOperationException("Attempt to get OpenGL API package in other graphic envitronment.");
|
throw new InvalidOperationException("Attempt to get OpenGL API package in other graphic envitronment.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -396,7 +373,8 @@ namespace StgSharp.Graphics
|
|||||||
throw new ArgumentException("Amount of threads should be bigger than 0");
|
throw new ArgumentException("Amount of threads should be bigger than 0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion form main
|
#endregion form main
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,39 @@
|
|||||||
using StgSharp.Logic;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="FrameAsyncTask.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 StgSharp.Math;
|
||||||
using System;
|
|
||||||
|
|
||||||
using System.Runtime.CompilerServices;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -14,9 +42,10 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
internal sealed class FrameOperationBuffer
|
internal sealed class FrameOperationBuffer
|
||||||
{
|
{
|
||||||
private readonly unsafe GLcontext* currentContext;
|
|
||||||
private IntPtr _func;
|
private IntPtr _func;
|
||||||
private ConcurrentQueue<IntPtr> _funcQueue;
|
private ConcurrentQueue<IntPtr> _funcQueue;
|
||||||
|
private readonly unsafe GLcontext* currentContext;
|
||||||
|
|
||||||
public unsafe bool CallNext()
|
public unsafe bool CallNext()
|
||||||
{
|
{
|
||||||
@@ -451,50 +480,52 @@ namespace StgSharp.Graphics
|
|||||||
/**/
|
/**/
|
||||||
|
|
||||||
#endregion gl param queue
|
#endregion gl param queue
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal sealed class FrameThread
|
//TODO 任务组绑定机制有问题,现在一次只能绑定两个
|
||||||
|
//TODO 目前还不能加载任何任务
|
||||||
|
//TODO 任务的启动逻辑需要重构
|
||||||
|
|
||||||
|
internal class FrameAsyncTask
|
||||||
{
|
{
|
||||||
private Thread _thread;
|
|
||||||
private FrameOperationBuffer renderBuffer;
|
|
||||||
private SemaphoreSlim renderCompleteSemaphore = new SemaphoreSlim(1, 1);
|
|
||||||
private SemaphoreSlim renderStartSemaphore;
|
|
||||||
private bool shouldTerminate;
|
|
||||||
private FrameOperationBuffer updateBuffer;
|
|
||||||
|
|
||||||
internal FrameThread(GLonUpdate gl)
|
private SemaphoreSlim _refrshSemaphore;
|
||||||
|
private SemaphoreSlim _frameCompleteSemaphore;
|
||||||
|
private Task _task;
|
||||||
|
private FrameOperationBuffer opBuffer = new FrameOperationBuffer();
|
||||||
|
|
||||||
|
internal FrameAsyncTask(GLonUpdate gl)
|
||||||
{
|
{
|
||||||
updateBuffer = gl.ActivatedOperationBuffer;
|
|
||||||
_thread = new Thread(new ThreadStart(PrivateMain));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsRunning
|
public static void ExchangeBuffer(FrameAsyncTask task0, FrameAsyncTask task1)
|
||||||
{
|
{
|
||||||
get { return _thread.IsAlive; }
|
FrameOperationBuffer cache = task0.opBuffer;
|
||||||
|
task0.opBuffer = task1.opBuffer;
|
||||||
|
task1.opBuffer = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start()
|
public async Task StartAsync()
|
||||||
{
|
{
|
||||||
_thread.Start();
|
_task.Start();
|
||||||
|
await _task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Terminate()
|
public static SemaphoreSlim CombineAsync(FrameAsyncTask task0, FrameAsyncTask task1)
|
||||||
{
|
{
|
||||||
shouldTerminate = true;
|
SemaphoreSlim refresh = new SemaphoreSlim(2);
|
||||||
|
task0._refrshSemaphore = refresh;
|
||||||
|
task1._refrshSemaphore = refresh;
|
||||||
|
return refresh;
|
||||||
|
}
|
||||||
|
public static SemaphoreSlim AsyncWait(FrameAsyncTask task0, FrameAsyncTask task1)
|
||||||
|
{
|
||||||
|
SemaphoreSlim refresh = new SemaphoreSlim(2);
|
||||||
|
task0._refrshSemaphore = refresh;
|
||||||
|
task1._refrshSemaphore = refresh;
|
||||||
|
return refresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrivateMain()
|
|
||||||
{
|
|
||||||
renderStartSemaphore.Wait();
|
|
||||||
while (shouldTerminate && renderBuffer.CallNext())
|
|
||||||
{ }
|
|
||||||
renderCompleteSemaphore.Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public void SetNext(FrameThread thread)
|
|
||||||
{
|
|
||||||
renderStartSemaphore = thread.renderCompleteSemaphore;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="BufferObjectBase.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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -11,6 +41,7 @@ namespace StgSharp.Graphics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BufferObjectBase : IDisposable
|
public abstract class BufferObjectBase : IDisposable
|
||||||
{
|
{
|
||||||
|
|
||||||
protected glHandleSet _bufferHandle;
|
protected glHandleSet _bufferHandle;
|
||||||
protected IglFunc GL;
|
protected IglFunc GL;
|
||||||
|
|
||||||
@@ -19,10 +50,7 @@ namespace StgSharp.Graphics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public glHandle this[int index]
|
public glHandle this[int index] => _bufferHandle[index];
|
||||||
{
|
|
||||||
get { return _bufferHandle[index]; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bind a buffer instance to OpenGL
|
/// Bind a buffer instance to OpenGL
|
||||||
@@ -30,6 +58,12 @@ namespace StgSharp.Graphics
|
|||||||
/// <param name="index">Index of handle of the object in this instance to be bind</param>
|
/// <param name="index">Index of handle of the object in this instance to be bind</param>
|
||||||
public abstract void Bind(int index);
|
public abstract void Bind(int index);
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(disposing: true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@@ -43,10 +77,5 @@ namespace StgSharp.Graphics
|
|||||||
Dispose(disposing: false);
|
Dispose(disposing: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(disposing: true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="EBO.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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -15,6 +45,7 @@ namespace StgSharp.Graphics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public unsafe class ElementBuffer : BufferObjectBase
|
public unsafe class ElementBuffer : BufferObjectBase
|
||||||
{
|
{
|
||||||
|
|
||||||
internal ElementBuffer(int n, IglFunc gl)
|
internal ElementBuffer(int n, IglFunc gl)
|
||||||
{
|
{
|
||||||
GL = gl;
|
GL = gl;
|
||||||
@@ -41,5 +72,6 @@ namespace StgSharp.Graphics
|
|||||||
_bufferHandle.Release();
|
_bufferHandle.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="VAO.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.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -7,6 +37,7 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public unsafe class VertexArray : BufferObjectBase
|
public unsafe class VertexArray : BufferObjectBase
|
||||||
{
|
{
|
||||||
|
|
||||||
internal VertexArray(int n, IglFunc gl)
|
internal VertexArray(int n, IglFunc gl)
|
||||||
{
|
{
|
||||||
GL = gl;
|
GL = gl;
|
||||||
@@ -42,5 +73,6 @@ namespace StgSharp.Graphics
|
|||||||
_bufferHandle.Release();
|
_bufferHandle.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="VBO.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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -12,6 +42,7 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public unsafe class VertexBuffer : BufferObjectBase
|
public unsafe class VertexBuffer : BufferObjectBase
|
||||||
{
|
{
|
||||||
|
|
||||||
internal VertexBuffer(int n, IglFunc glFunc)
|
internal VertexBuffer(int n, IglFunc glFunc)
|
||||||
{
|
{
|
||||||
GL = glFunc;
|
GL = glFunc;
|
||||||
@@ -72,5 +103,6 @@ namespace StgSharp.Graphics
|
|||||||
_bufferHandle.Release();
|
_bufferHandle.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="texture.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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -12,10 +42,11 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public unsafe class Texture
|
public unsafe class Texture
|
||||||
{
|
{
|
||||||
|
|
||||||
internal static bool[] unitActivated = new bool[16];
|
internal static bool[] unitActivated = new bool[16];
|
||||||
|
private IglFunc GL;
|
||||||
internal glHandleSet _textureHandle;
|
internal glHandleSet _textureHandle;
|
||||||
internal Image[] sourceList;
|
internal Image[] sourceList;
|
||||||
private IglFunc GL;
|
|
||||||
|
|
||||||
internal Texture(int n, IglFunc gl)
|
internal Texture(int n, IglFunc gl)
|
||||||
{
|
{
|
||||||
@@ -96,6 +127,7 @@ namespace StgSharp.Graphics
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion texture setting
|
#endregion texture setting
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Filter
|
public enum Filter
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GLhandle.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.Collections.Generic;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -18,12 +48,14 @@ namespace StgSharp.Graphics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public unsafe struct glHandle
|
public unsafe struct glHandle
|
||||||
{
|
{
|
||||||
|
|
||||||
internal glHandleSet source;
|
internal glHandleSet source;
|
||||||
internal uint* valuePtr;
|
internal uint* valuePtr;
|
||||||
|
|
||||||
[Obsolete("Cannot init instance of this type", true)]
|
private glHandle(IntPtr handle)
|
||||||
public glHandle()
|
|
||||||
{
|
{
|
||||||
|
this.valuePtr = (uint*)handle;
|
||||||
|
source = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal glHandle(uint* val, glHandleSet set)
|
internal glHandle(uint* val, glHandleSet set)
|
||||||
@@ -32,15 +64,9 @@ namespace StgSharp.Graphics
|
|||||||
valuePtr = val;
|
valuePtr = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
private glHandle(IntPtr handle)
|
[Obsolete("Cannot init instance of this type", true)]
|
||||||
|
public glHandle()
|
||||||
{
|
{
|
||||||
this.valuePtr = (uint*)handle;
|
|
||||||
source = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static glHandle Zero
|
|
||||||
{
|
|
||||||
get { return Alloc(0); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntPtr Handle
|
public IntPtr Handle
|
||||||
@@ -75,13 +101,9 @@ namespace StgSharp.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal uint DirectValue
|
public static glHandle Zero => Alloc(0);
|
||||||
{
|
|
||||||
get
|
internal uint DirectValue => *valuePtr;
|
||||||
{
|
|
||||||
return *valuePtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static glHandle Alloc(uint value)
|
public static glHandle Alloc(uint value)
|
||||||
{
|
{
|
||||||
@@ -97,10 +119,12 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
return new glHandle(handle);
|
return new glHandle(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe struct glSHandle
|
public unsafe struct glSHandle
|
||||||
{
|
{
|
||||||
|
|
||||||
internal glHandleSet source;
|
internal glHandleSet source;
|
||||||
internal int* valuePtr;
|
internal int* valuePtr;
|
||||||
|
|
||||||
@@ -110,29 +134,25 @@ namespace StgSharp.Graphics
|
|||||||
valuePtr = val;
|
valuePtr = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static glSHandle Zero
|
public static glSHandle Zero => Alloc(0);
|
||||||
{
|
|
||||||
get { return Alloc(0); }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal int DirectValue
|
internal int DirectValue => *valuePtr;
|
||||||
{
|
|
||||||
get { return *valuePtr; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static glSHandle Alloc(int value)
|
public static glSHandle Alloc(int value)
|
||||||
{
|
{
|
||||||
glSHandle ret = default;
|
glSHandle ret = default;
|
||||||
ret.source = new glHandleSet(1);
|
ret.source = new glHandleSet(1);
|
||||||
ret.valuePtr = (int*)ret.source.handle;
|
ret.valuePtr = (int*)ret.source.handle;
|
||||||
*ret.valuePtr = (int)value;
|
*ret.valuePtr = value;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO 发现一个大问题,paramQueue大多数时候取出的是数组,不是数组句柄,也就是说其内存将被长期固定且不能回收,这是内存泄漏
|
//TODO 发现一个大问题,paramQueue大多数时候取出的是数组,不是数组句柄,也就是说其内存将被长期固定且不能回收,这是内存泄漏
|
||||||
public unsafe class glArrayHandle
|
public unsafe class glArrayHandle
|
||||||
{
|
{
|
||||||
|
|
||||||
internal readonly Array a;
|
internal readonly Array a;
|
||||||
internal GCHandle handle;
|
internal GCHandle handle;
|
||||||
|
|
||||||
@@ -142,20 +162,6 @@ namespace StgSharp.Graphics
|
|||||||
handle = GCHandle.Alloc(array, GCHandleType.Pinned);
|
handle = GCHandle.Alloc(array, GCHandleType.Pinned);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static glArrayHandle CopyAlloc<T>(T[] array) where T : struct
|
|
||||||
{
|
|
||||||
Array copy = new T[array.Length];
|
|
||||||
array.CopyTo(copy, 0);
|
|
||||||
return new glArrayHandle(copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static glArrayHandle Alloc<T>(T[] array) where T : struct
|
|
||||||
{
|
|
||||||
return new glArrayHandle(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public IntPtr AddressOfArray()
|
public IntPtr AddressOfArray()
|
||||||
{
|
{
|
||||||
@@ -169,11 +175,26 @@ namespace StgSharp.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static glArrayHandle Alloc<T>(T[] array) where T : struct
|
||||||
|
{
|
||||||
|
return new glArrayHandle(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static glArrayHandle CopyAlloc<T>(T[] array) where T : struct
|
||||||
|
{
|
||||||
|
Array copy = new T[array.Length];
|
||||||
|
array.CopyTo(copy, 0);
|
||||||
|
return new glArrayHandle(copy);
|
||||||
|
}
|
||||||
|
|
||||||
public void Release()
|
public void Release()
|
||||||
{
|
{
|
||||||
handle.Free();
|
handle.Free();
|
||||||
handle = default;
|
handle = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -181,9 +202,10 @@ namespace StgSharp.Graphics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public unsafe class glHandleSet
|
public unsafe class glHandleSet
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private readonly uint[] _value;
|
||||||
internal uint* handle;
|
internal uint* handle;
|
||||||
internal int length;
|
internal int length;
|
||||||
private readonly uint[] _value;
|
|
||||||
|
|
||||||
public glHandleSet(int count)
|
public glHandleSet(int count)
|
||||||
{
|
{
|
||||||
@@ -212,13 +234,13 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
throw new IndexOutOfRangeException();
|
throw new IndexOutOfRangeException();
|
||||||
}
|
}
|
||||||
return new glSHandle((int*)handle + index, this);
|
return new glSHandle(((int*)handle) + index, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Copy(in glHandleSet source, glHandleSet target)
|
public static void Copy(in glHandleSet source, glHandleSet target)
|
||||||
{
|
{
|
||||||
if (source == null || target == null)
|
if ((source == null) || (target == null))
|
||||||
{
|
{
|
||||||
throw new NullReferenceException();
|
throw new NullReferenceException();
|
||||||
}
|
}
|
||||||
@@ -279,5 +301,6 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
_value[index] = value;
|
_value[index] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Logic;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GLonRender.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.Logic;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@@ -12,23 +42,15 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
internal unsafe partial class GLonRender : IglFunc
|
internal unsafe partial class GLonRender : IglFunc
|
||||||
{
|
{
|
||||||
internal GLcontext* api;
|
|
||||||
private FrameTimeoutException refreshSIgnal = new FrameTimeoutException();
|
private FrameTimeoutException refreshSIgnal = new FrameTimeoutException();
|
||||||
|
internal GLcontext* api;
|
||||||
|
|
||||||
internal GLonRender(GLcontext* context)
|
internal GLonRender(GLcontext* context)
|
||||||
{
|
{
|
||||||
api = context;
|
api = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLcontext* IglFunc.Context
|
|
||||||
{
|
|
||||||
get => api;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IglFunc.SwitchContext()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
void IglFunc.ActiveTexture(uint type)
|
void IglFunc.ActiveTexture(uint type)
|
||||||
{
|
{
|
||||||
@@ -87,35 +109,6 @@ namespace StgSharp.Graphics
|
|||||||
while (api->glGetError() != 0) { }
|
while (api->glGetError() != 0) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
unsafe void IglFunc.LoadShaderSource(glHandle shaderHandle, string codeStream)
|
|
||||||
{
|
|
||||||
byte[] stream = Encoding.UTF8.GetBytes(codeStream);
|
|
||||||
fixed (byte* streamPtr = stream)
|
|
||||||
{
|
|
||||||
api->glShaderSource(shaderHandle.DirectValue, 1, &streamPtr, (void*)0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
glHandleSet IglFunc.CreateShaderSet(int count, ShaderType type)
|
|
||||||
{
|
|
||||||
glHandleSet ret = new glHandleSet(count);
|
|
||||||
uint t = (uint)type;
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
uint id = api->glCreateShader(t);
|
|
||||||
if (id == 0)
|
|
||||||
{
|
|
||||||
uint error = api->glGetError();
|
|
||||||
InternalIO.InternalWriteLog($"Failed in creating shader: {error}", LogType.Error);
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
ret.SetValue(i, id);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
void IglFunc.CompileShader(glHandle shaderhandle)
|
void IglFunc.CompileShader(glHandle shaderhandle)
|
||||||
{
|
{
|
||||||
@@ -139,6 +132,25 @@ namespace StgSharp.Graphics
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
glHandleSet IglFunc.CreateShaderSet(int count, ShaderType type)
|
||||||
|
{
|
||||||
|
glHandleSet ret = new glHandleSet(count);
|
||||||
|
uint t = (uint)type;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
uint id = api->glCreateShader(t);
|
||||||
|
if (id == 0)
|
||||||
|
{
|
||||||
|
uint error = api->glGetError();
|
||||||
|
InternalIO.InternalWriteLog($"Failed in creating shader: {error}", LogType.Error);
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
ret.SetValue(i, id);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
unsafe IntPtr IglFunc.CreateWindowHandle(
|
unsafe IntPtr IglFunc.CreateWindowHandle(
|
||||||
int width, int height, string tittle, IntPtr monitor, Form share)
|
int width, int height, string tittle, IntPtr monitor, Form share)
|
||||||
{
|
{
|
||||||
@@ -147,15 +159,15 @@ namespace StgSharp.Graphics
|
|||||||
if (share == null)
|
if (share == null)
|
||||||
{
|
{
|
||||||
windowPtr = InternalIO.glfwCreateWindow(
|
windowPtr = InternalIO.glfwCreateWindow(
|
||||||
width, height, tittleBytes, monitor, IntPtr.Zero);
|
width, height, tittleBytes, monitor, (GLFWwindow*)IntPtr.Zero);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPtr = InternalIO.glfwCreateWindow(
|
windowPtr = InternalIO.glfwCreateWindow(
|
||||||
width, height, tittleBytes, monitor, share.windowID);
|
width, height, tittleBytes, monitor, share.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((long)windowPtr == -1 || (long)windowPtr == -2)
|
if (((long)windowPtr == -1) || ((long)windowPtr == -2))
|
||||||
{
|
{
|
||||||
throw new Exception("Cannot create window instance!");
|
throw new Exception("Cannot create window instance!");
|
||||||
}
|
}
|
||||||
@@ -180,14 +192,14 @@ namespace StgSharp.Graphics
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
unsafe void IglFunc.DeleteBuffers(glHandleSet handle)
|
unsafe void IglFunc.DeleteBuffers(glHandleSet handle)
|
||||||
{
|
{
|
||||||
api->glDeleteBuffers((uint)handle.length, (uint*)handle.handle);
|
api->glDeleteBuffers((uint)handle.length, handle.handle);
|
||||||
handle.Free();
|
handle.Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
unsafe void IglFunc.DeleteVertexArrays(glHandleSet arrays)
|
unsafe void IglFunc.DeleteVertexArrays(glHandleSet arrays)
|
||||||
{
|
{
|
||||||
api->glDeleteVertexArrays((uint)arrays.length, (uint*)arrays.handle);
|
api->glDeleteVertexArrays((uint)arrays.length, arrays.handle);
|
||||||
arrays.Free();
|
arrays.Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,18 +223,22 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
InternalIO.InternalWriteLog(
|
InternalIO.InternalWriteLog(
|
||||||
$"Parameter error in parameter {nameof(type)} method DrawElements. " +
|
$"{($"Parameter error in parameter {nameof(type)} method DrawElements. ")}{($"Only {typeof(uint).Name},{typeof(ushort).Name},{typeof(byte).Name} types are suporrted.")}",
|
||||||
$"Only {typeof(uint).Name},{typeof(ushort).Name},{typeof(byte).Name} types are suporrted.",
|
|
||||||
LogType.Error);
|
LogType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
api->glDrawElements((uint)mode, count, a, (void*)ptr);
|
api->glDrawElements((uint)mode, count, a, (void*)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IglFunc.frameworkHandleEnqueue(System.IntPtr handle, params M128[] param)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
unsafe glHandleSet IglFunc.GenBuffers(int count)
|
unsafe glHandleSet IglFunc.GenBuffers(int count)
|
||||||
{
|
{
|
||||||
glHandleSet h = new glHandleSet((int)count);
|
glHandleSet h = new glHandleSet(count);
|
||||||
api->glGenBuffers((uint)count, h.handle);
|
api->glGenBuffers((uint)count, h.handle);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
@@ -230,7 +246,7 @@ namespace StgSharp.Graphics
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
unsafe glHandleSet IglFunc.GenTextures(int count)
|
unsafe glHandleSet IglFunc.GenTextures(int count)
|
||||||
{
|
{
|
||||||
glHandleSet h = new glHandleSet((int)count);
|
glHandleSet h = new glHandleSet(count);
|
||||||
api->glGenTextures((uint)count, h.handle);
|
api->glGenTextures((uint)count, h.handle);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
@@ -256,18 +272,28 @@ namespace StgSharp.Graphics
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
unsafe bool IglFunc.GetWindowShouldClose(Form form)
|
unsafe bool IglFunc.GetWindowShouldClose(Form form)
|
||||||
{
|
{
|
||||||
return InternalIO.glfwWindowShouldClose(form.windowID) == 0;
|
return InternalIO.glfwWindowShouldClose(form.id) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
unsafe void IglFunc.LoadShaderSource(glHandle shaderHandle, string codeStream)
|
||||||
|
{
|
||||||
|
byte[] stream = Encoding.UTF8.GetBytes(codeStream);
|
||||||
|
fixed (byte* streamPtr = stream)
|
||||||
|
{
|
||||||
|
api->glShaderSource(shaderHandle.DirectValue, 1, &streamPtr, (void*)0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
unsafe void IglFunc.MakeContexCurrent(Form form)
|
unsafe void IglFunc.MakeContexCurrent(Form form)
|
||||||
{
|
{
|
||||||
if (form.windowID == IntPtr.Zero)
|
if (form.WindowID == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
InternalIO.InternalWriteLog($"From {nameof(form)} is not initted.", LogType.Warning);
|
InternalIO.InternalWriteLog($"From {nameof(form)} is not initted.", LogType.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InternalIO.glfwMakeContextCurrent(form.windowID);
|
InternalIO.glfwMakeContextCurrent(form.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -290,11 +316,13 @@ namespace StgSharp.Graphics
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fixed (void* bufferPtr = bufferArray)
|
fixed (void* bufferPtr = bufferArray)
|
||||||
|
{
|
||||||
api->glBufferData(
|
api->glBufferData(
|
||||||
(uint)bufferType,
|
(uint)bufferType,
|
||||||
(IntPtr)size,
|
(IntPtr)size,
|
||||||
(IntPtr)bufferPtr,
|
(IntPtr)bufferPtr,
|
||||||
(uint)usage);
|
(uint)usage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -305,6 +333,10 @@ namespace StgSharp.Graphics
|
|||||||
api->glEnableVertexAttribArray(index);
|
api->glEnableVertexAttribArray(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IglFunc.SwitchContext()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, glHandle pixels)
|
void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, glHandle pixels)
|
||||||
{
|
{
|
||||||
@@ -331,9 +363,8 @@ namespace StgSharp.Graphics
|
|||||||
api->glViewport(x, y, width, height);
|
api->glViewport(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IglFunc.frameworkHandleEnqueue(System.IntPtr handle, params M128[] param)
|
GLcontext* IglFunc.Context
|
||||||
{
|
=> api;
|
||||||
throw new InvalidOperationException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Logic;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GLonUpdate.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.Logic;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@@ -15,10 +45,10 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
internal unsafe partial class GLonUpdate : IglFunc
|
internal unsafe partial class GLonUpdate : IglFunc
|
||||||
{
|
{
|
||||||
|
|
||||||
private GLcontext* api;
|
private GLcontext* api;
|
||||||
private IntPtr SwapBufferPtr = (IntPtr)(delegate*<IntPtr, void>)&InternalIO.glfwSwapBuffers;
|
|
||||||
private glSHandle unupdatedFrame = glSHandle.Alloc(0);
|
|
||||||
private FrameOperationBuffer frameOpBuffer;
|
private FrameOperationBuffer frameOpBuffer;
|
||||||
|
private glSHandle unupdatedFrame = glSHandle.Alloc(0);
|
||||||
|
|
||||||
internal GLonUpdate(GLcontext* context)
|
internal GLonUpdate(GLcontext* context)
|
||||||
{
|
{
|
||||||
@@ -29,15 +59,19 @@ namespace StgSharp.Graphics
|
|||||||
api = context;
|
api = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLcontext* IglFunc.Context
|
|
||||||
{
|
|
||||||
get => api;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FrameOperationBuffer ActivatedOperationBuffer
|
public FrameOperationBuffer ActivatedOperationBuffer
|
||||||
{
|
{
|
||||||
get { return frameOpBuffer; }
|
get => frameOpBuffer;
|
||||||
set { frameOpBuffer = value; }
|
set => frameOpBuffer = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GLswapBuffers(Form form)
|
||||||
|
{
|
||||||
|
if (form.WindowID == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InternalIO.glfwSwapBuffers(form.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IglFunc.ActiveTexture(uint type)
|
void IglFunc.ActiveTexture(uint type)
|
||||||
@@ -77,7 +111,7 @@ namespace StgSharp.Graphics
|
|||||||
void IglFunc.BindTexture(uint type, glHandle texture)
|
void IglFunc.BindTexture(uint type, glHandle texture)
|
||||||
{
|
{
|
||||||
M128 m = default;
|
M128 m = default;
|
||||||
m.Write<uint>(0, (uint)type);
|
m.Write<uint>(0, type);
|
||||||
m.Write<ulong>(1, (ulong)texture.valuePtr);
|
m.Write<ulong>(1, (ulong)texture.valuePtr);
|
||||||
frameOpBuffer.ParamEnqueue(m);
|
frameOpBuffer.ParamEnqueue(m);
|
||||||
frameOpBuffer.MethodEnqueue(BindTexturePtr);
|
frameOpBuffer.MethodEnqueue(BindTexturePtr);
|
||||||
@@ -156,15 +190,15 @@ namespace StgSharp.Graphics
|
|||||||
if (share == null)
|
if (share == null)
|
||||||
{
|
{
|
||||||
windowPtr = InternalIO.glfwCreateWindow(
|
windowPtr = InternalIO.glfwCreateWindow(
|
||||||
width, height, tittleBytes, monitor, IntPtr.Zero);
|
width, height, tittleBytes, monitor, (GLFWwindow*)IntPtr.Zero);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPtr = InternalIO.glfwCreateWindow(
|
windowPtr = InternalIO.glfwCreateWindow(
|
||||||
width, height, tittleBytes, monitor, share.windowID);
|
width, height, tittleBytes, monitor, share.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((long)windowPtr == -1 || (long)windowPtr == -2)
|
if (((long)windowPtr == -1) || ((long)windowPtr == -2))
|
||||||
{
|
{
|
||||||
throw new Exception("Cannot create window instance!");
|
throw new Exception("Cannot create window instance!");
|
||||||
}
|
}
|
||||||
@@ -229,8 +263,7 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
InternalIO.InternalWriteLog(
|
InternalIO.InternalWriteLog(
|
||||||
$"Parameter error in parameter {type} method DrawElements. " +
|
$"{($"Parameter error in parameter {type} method DrawElements. ")}{($"Only {TypeCode.Byte}, {TypeCode.UInt16}, {TypeCode.UInt32} types are suporrted.")}",
|
||||||
$"Only {TypeCode.Byte}, {TypeCode.UInt16}, {TypeCode.UInt32} types are suporrted.",
|
|
||||||
LogType.Error);
|
LogType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -239,6 +272,16 @@ namespace StgSharp.Graphics
|
|||||||
frameOpBuffer.MethodEnqueue(DrawElementsPtr);
|
frameOpBuffer.MethodEnqueue(DrawElementsPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
void IglFunc.frameworkHandleEnqueue(IntPtr methodHandle, params M128[] param)
|
||||||
|
{
|
||||||
|
foreach (M128 item in param)
|
||||||
|
{
|
||||||
|
frameOpBuffer.ParamEnqueue(item);
|
||||||
|
}
|
||||||
|
frameOpBuffer.ParamEnqueue(methodHandle);
|
||||||
|
}
|
||||||
|
|
||||||
unsafe glHandleSet IglFunc.GenBuffers(int count)
|
unsafe glHandleSet IglFunc.GenBuffers(int count)
|
||||||
{
|
{
|
||||||
glHandleSet h = new glHandleSet(count);
|
glHandleSet h = new glHandleSet(count);
|
||||||
@@ -282,16 +325,7 @@ namespace StgSharp.Graphics
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
bool IglFunc.GetWindowShouldClose(Form form)
|
bool IglFunc.GetWindowShouldClose(Form form)
|
||||||
{
|
{
|
||||||
return InternalIO.glfwWindowShouldClose(form.windowID) == 0;
|
return InternalIO.glfwWindowShouldClose(form.id) == 0;
|
||||||
}
|
|
||||||
|
|
||||||
public void GLswapBuffers(Form form)
|
|
||||||
{
|
|
||||||
if (form.windowID == IntPtr.Zero)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
InternalIO.glfwSwapBuffers(form.windowID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IglFunc.LoadShaderSource(glHandle shaderHandle, string codeStream)
|
void IglFunc.LoadShaderSource(glHandle shaderHandle, string codeStream)
|
||||||
@@ -304,11 +338,11 @@ namespace StgSharp.Graphics
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
void IglFunc.MakeContexCurrent(Form form)
|
void IglFunc.MakeContexCurrent(Form form)
|
||||||
{
|
{
|
||||||
if (form.windowID == IntPtr.Zero)
|
if (form.WindowID == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InternalIO.glfwMakeContextCurrent(form.windowID);
|
InternalIO.glfwMakeContextCurrent(form.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IglFunc.SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage)
|
void IglFunc.SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage)
|
||||||
@@ -370,14 +404,8 @@ namespace StgSharp.Graphics
|
|||||||
frameOpBuffer.MethodEnqueue(ViewPortPtr);
|
frameOpBuffer.MethodEnqueue(ViewPortPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
GLcontext* IglFunc.Context
|
||||||
void IglFunc.frameworkHandleEnqueue(IntPtr methodHandle, params M128[] param)
|
=> api;
|
||||||
{
|
|
||||||
foreach (M128 item in param)
|
|
||||||
{
|
|
||||||
frameOpBuffer.ParamEnqueue(item);
|
|
||||||
}
|
|
||||||
frameOpBuffer.ParamEnqueue(methodHandle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,49 @@
|
|||||||
using StgSharp.Logic;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GLonUpdateInternal.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 StgSharp.Math;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StgSharp.Graphics
|
namespace StgSharp.Graphics
|
||||||
{
|
{
|
||||||
internal unsafe partial class GLonUpdate : IglFunc
|
internal unsafe partial class GLonUpdate : IglFunc
|
||||||
{
|
{
|
||||||
|
|
||||||
private IntPtr ActiveTexturePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalActiveTexture;
|
private IntPtr ActiveTexturePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalActiveTexture;
|
||||||
private IntPtr AttachShaderPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalAttachShader;
|
private IntPtr AttachShaderPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalAttachShader;
|
||||||
private IntPtr BindBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindBuffer;
|
private IntPtr BindBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindBuffer;
|
||||||
private IntPtr BindTexturePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindTexture;
|
private IntPtr BindTexturePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindTexture;
|
||||||
private IntPtr BindVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindVertexArray;
|
private IntPtr BindVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindVertexArray;
|
||||||
private IntPtr BufferDataPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalSetBufferData;
|
private IntPtr BufferDataPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalSetBufferData;
|
||||||
private IntPtr CanUpdatePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalFrameCanUpdate;
|
|
||||||
private IntPtr ClearColorPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClearColor;
|
private IntPtr ClearColorPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClearColor;
|
||||||
private IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClearGraphicError;
|
private IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClearGraphicError;
|
||||||
private IntPtr ClearPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClear;
|
private IntPtr ClearPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClear;
|
||||||
@@ -35,7 +56,6 @@ namespace StgSharp.Graphics
|
|||||||
private IntPtr DrawElementsPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalDrawElements;
|
private IntPtr DrawElementsPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalDrawElements;
|
||||||
private IntPtr GenBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenBuffers;
|
private IntPtr GenBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenBuffers;
|
||||||
private IntPtr GenTexturesPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenTextures;
|
private IntPtr GenTexturesPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenTextures;
|
||||||
private IntPtr GenVertexArraysPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenVertexArrays;
|
|
||||||
private IntPtr GetUniformLocationPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGetUniformLocation;
|
private IntPtr GetUniformLocationPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGetUniformLocation;
|
||||||
private IntPtr SetVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalSetVertexAttribute;
|
private IntPtr SetVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalSetVertexAttribute;
|
||||||
private IntPtr ShaderSourcePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalShaderSource;
|
private IntPtr ShaderSourcePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalShaderSource;
|
||||||
@@ -147,7 +167,7 @@ namespace StgSharp.Graphics
|
|||||||
activatedContext->glDeleteBuffers(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
activatedContext->glDeleteBuffers(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
||||||
for (int i = 0; i < m.Read<uint>(2); i++)
|
for (int i = 0; i < m.Read<uint>(2); i++)
|
||||||
{
|
{
|
||||||
*((uint*)m.Read<ulong>(0) + i) = 0;
|
*(((uint*)m.Read<ulong>(0)) + i) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,13 +187,6 @@ namespace StgSharp.Graphics
|
|||||||
activatedContext->glDrawElements(mode, count, type, (void*)ptr);
|
activatedContext->glDrawElements(mode, count, type, (void*)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InternalFrameCanUpdate(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
|
|
||||||
{
|
|
||||||
IntPtr ptr;
|
|
||||||
frameBuffer.TryDequeue(out ptr);
|
|
||||||
Interlocked.Add(ref *(int*)ptr, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void InternalGenBuffers(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
|
private static void InternalGenBuffers(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
|
||||||
{
|
{
|
||||||
M128 m = default;
|
M128 m = default;
|
||||||
@@ -188,13 +201,6 @@ namespace StgSharp.Graphics
|
|||||||
activatedContext->glGenTextures(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
activatedContext->glGenTextures(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InternalGenVertexArrays(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
|
|
||||||
{
|
|
||||||
M128 m = default;
|
|
||||||
frameBuffer.TryDequeue(out m);
|
|
||||||
activatedContext->glGenVertexArrays(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void InternalGetUniformLocation(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
|
private static void InternalGetUniformLocation(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
|
||||||
{
|
{
|
||||||
IntPtr programHandle = default, nameHandle = default, targetHandle = default;
|
IntPtr programHandle = default, nameHandle = default, targetHandle = default;
|
||||||
@@ -265,14 +271,5 @@ namespace StgSharp.Graphics
|
|||||||
activatedContext->glViewport(m.Read<int>(0), m.Read<int>(1), m.Read<uint>(2), m.Read<uint>(3));
|
activatedContext->glViewport(m.Read<int>(0), m.Read<int>(1), m.Read<uint>(2), m.Read<uint>(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InternalMakeContexCurrent(Form form)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InternalSwitchContext()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="GLresourceGenrator.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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -9,6 +39,7 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public partial class Form
|
public partial class Form
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a set of <see cref="ElementBuffer"/>.
|
/// Create a set of <see cref="ElementBuffer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -20,17 +51,6 @@ namespace StgSharp.Graphics
|
|||||||
return new ElementBuffer(count, this.gl);
|
return new ElementBuffer(count, this.gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a set of <see cref="VertexArray"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="count">Amount of VAO to be crated.</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
protected VertexArray CreateVertexArray(int count)
|
|
||||||
{
|
|
||||||
return new VertexArray(count, gl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a sets of <see cref="Texture"/>
|
/// Create a sets of <see cref="Texture"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -42,6 +62,17 @@ namespace StgSharp.Graphics
|
|||||||
return new Texture(count, this.GL);
|
return new Texture(count, this.GL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a set of <see cref="VertexArray"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="count">Amount of VAO to be crated.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
protected VertexArray CreateVertexArray(int count)
|
||||||
|
{
|
||||||
|
return new VertexArray(count, gl);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create aset of <see cref="VertexBuffer"/>.
|
/// Create aset of <see cref="VertexBuffer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -52,5 +83,6 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
return new VertexBuffer(count, gl);
|
return new VertexBuffer(count, gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Shader.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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -10,6 +40,12 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public partial class Form
|
public partial class Form
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
protected Shader CreateShader(ShaderType type, int count)
|
||||||
|
{
|
||||||
|
return new Shader(this.gl, gl.CreateShaderSet(count, type), type);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create an instance of <see cref="Shader"/> program
|
/// Create an instance of <see cref="Shader"/> program
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -20,18 +56,14 @@ namespace StgSharp.Graphics
|
|||||||
return new ShaderProgram(GL);
|
return new ShaderProgram(GL);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
protected Shader CreateShader(ShaderType type, int count)
|
|
||||||
{
|
|
||||||
return new Shader(this.gl, gl.CreateShaderSet(count, type), type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Shader
|
public class Shader
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private readonly IglFunc GL;
|
||||||
internal readonly glHandleSet handle;
|
internal readonly glHandleSet handle;
|
||||||
public readonly ShaderType type;
|
public readonly ShaderType type;
|
||||||
private readonly IglFunc GL;
|
|
||||||
|
|
||||||
internal Shader(IglFunc gl, glHandleSet handle, ShaderType usage)
|
internal Shader(IglFunc gl, glHandleSet handle, ShaderType usage)
|
||||||
{
|
{
|
||||||
@@ -40,17 +72,6 @@ namespace StgSharp.Graphics
|
|||||||
type = usage;
|
type = usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public unsafe void Compile(int index, string code)
|
|
||||||
{
|
|
||||||
if (code == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Must provide enough code");
|
|
||||||
}
|
|
||||||
GL.LoadShaderSource(handle[index], code + '\0');
|
|
||||||
GL.CompileShader(handle[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO:写链接着色器的文档注释
|
//TODO:写链接着色器的文档注释
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -63,16 +84,29 @@ namespace StgSharp.Graphics
|
|||||||
GL.AttachShader(target.handle, handle[index]);
|
GL.AttachShader(target.handle, handle[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public unsafe void Compile(int index, string code)
|
||||||
|
{
|
||||||
|
if (code == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Must provide enough code");
|
||||||
|
}
|
||||||
|
GL.LoadShaderSource(handle[index], $"{code}\0");
|
||||||
|
GL.CompileShader(handle[index]);
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"This is a {type} shader, its shader handles are {handle.ToString()}.";
|
return $"This is a {type} shader, its shader handles are {handle.ToString()}.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShaderProgram
|
public class ShaderProgram
|
||||||
{
|
{
|
||||||
internal readonly glHandle handle;
|
|
||||||
private readonly IglFunc GL;
|
private readonly IglFunc GL;
|
||||||
|
internal readonly glHandle handle;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Inti a shader with no program attached.
|
/// Inti a shader with no program attached.
|
||||||
@@ -83,29 +117,6 @@ namespace StgSharp.Graphics
|
|||||||
handle = GL.CreateProgram();
|
handle = GL.CreateProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Link the shader to current context.
|
|
||||||
/// </summary>
|
|
||||||
public unsafe void Link()
|
|
||||||
{
|
|
||||||
if (InternalIO.InternalLinkShaderProgram(GL.Context, handle.Value) == 0)
|
|
||||||
{
|
|
||||||
IntPtr logPtr = InternalIO.InternalReadSSCLog();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
byte[] logByte = new byte[512];
|
|
||||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
|
||||||
string log = Encoding.UTF8.GetString(logByte);
|
|
||||||
log = log.Replace("\0", "");
|
|
||||||
InternalIO.InternalWriteLog(log, LogType.Error);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
InternalIO.InternalWriteLog(ex.Message, LogType.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a uniform form current shader,
|
/// Get a uniform form current shader,
|
||||||
/// the value type of the uniform should be provided.
|
/// the value type of the uniform should be provided.
|
||||||
@@ -145,6 +156,29 @@ namespace StgSharp.Graphics
|
|||||||
return new Uniform<T, U, V>(this, name, GL);
|
return new Uniform<T, U, V>(this, name, GL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Link the shader to current context.
|
||||||
|
/// </summary>
|
||||||
|
public unsafe void Link()
|
||||||
|
{
|
||||||
|
if (InternalIO.InternalLinkShaderProgram(GL.Context, handle.Value) == 0)
|
||||||
|
{
|
||||||
|
IntPtr logPtr = InternalIO.InternalReadSSCLog();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] logByte = new byte[512];
|
||||||
|
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||||
|
string log = Encoding.UTF8.GetString(logByte);
|
||||||
|
log = log.Replace("\0", string.Empty);
|
||||||
|
InternalIO.InternalWriteLog(log, LogType.Error);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
InternalIO.InternalWriteLog(ex.Message, LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Let the current context use this shader.
|
/// Let the current context use this shader.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -153,5 +187,6 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
GL.UseProgram(handle);
|
GL.UseProgram(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Graphics;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ShaderGenerator.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 System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -11,6 +41,7 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
|||||||
{
|
{
|
||||||
public class ShaderGenerator
|
public class ShaderGenerator
|
||||||
{
|
{
|
||||||
|
|
||||||
private List<string> codeList;
|
private List<string> codeList;
|
||||||
private List<ShaderFunction> usedShaderFunctions;
|
private List<ShaderFunction> usedShaderFunctions;
|
||||||
|
|
||||||
@@ -18,19 +49,18 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
|||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShaderFunction
|
public class ShaderFunction
|
||||||
{
|
{
|
||||||
private string name;
|
|
||||||
private List<string> codeList;
|
private List<string> codeList;
|
||||||
private List<ShaderParameter> inputList;
|
private List<ShaderParameter> inputList;
|
||||||
|
private string name;
|
||||||
private ShaderParameter outPut;
|
private ShaderParameter outPut;
|
||||||
|
|
||||||
public int ParameterCount
|
public int ParameterCount => inputList.Count;
|
||||||
{
|
|
||||||
get { return inputList.Count; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EmitCall(ShaderFunction function, ShaderParameter outPut, params ShaderParameter[] inputParams)
|
public void EmitCall(ShaderFunction function, ShaderParameter outPut, params ShaderParameter[] inputParams)
|
||||||
{
|
{
|
||||||
@@ -52,7 +82,7 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
|||||||
throw new Exception("Provided parameters does not match function's parameter list.");
|
throw new Exception("Provided parameters does not match function's parameter list.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string codeLine = ""; // adding a line like " outvalue = Func(input1, input2,...); "
|
string codeLine = string.Empty; // adding a line like " outvalue = Func(input1, input2,...); "
|
||||||
if (outPut != ShaderParameter.Void)
|
if (outPut != ShaderParameter.Void)
|
||||||
{
|
{
|
||||||
codeLine += $"{outPut.name} = ";
|
codeLine += $"{outPut.name} = ";
|
||||||
@@ -65,13 +95,16 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
|||||||
codeLine += ");\n";
|
codeLine += ");\n";
|
||||||
codeList.Add(codeLine);
|
codeList.Add(codeLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShaderParameter
|
public class ShaderParameter
|
||||||
{
|
{
|
||||||
internal readonly InternalShaderType type;
|
|
||||||
internal readonly string name;
|
public static readonly ShaderParameter Void = new ShaderParameter(string.Empty, InternalShaderType.Void);
|
||||||
internal readonly bool isReadOnly;
|
internal readonly bool isReadOnly;
|
||||||
|
internal readonly string name;
|
||||||
|
internal readonly InternalShaderType type;
|
||||||
|
|
||||||
public ShaderParameter(string name, InternalShaderType type)
|
public ShaderParameter(string name, InternalShaderType type)
|
||||||
{
|
{
|
||||||
@@ -80,8 +113,6 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
|||||||
isReadOnly = false;
|
isReadOnly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly ShaderParameter Void = new ShaderParameter("", InternalShaderType.Void);
|
|
||||||
|
|
||||||
public static bool IsSameType(ShaderParameter param1, ShaderParameter param2)
|
public static bool IsSameType(ShaderParameter param1, ShaderParameter param2)
|
||||||
{
|
{
|
||||||
if (param1.type != InternalShaderType.Struct)
|
if (param1.type != InternalShaderType.Struct)
|
||||||
@@ -93,6 +124,7 @@ namespace StgSharp.Graphics.GL.ShaderEdit
|
|||||||
throw new Exception("Struct is currently not supported.");
|
throw new Exception("Struct is currently not supported.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum InternalShaderType
|
public enum InternalShaderType
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Uniform.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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -11,8 +41,14 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public class Uniform<T> where T : struct
|
public class Uniform<T> where T : struct
|
||||||
{
|
{
|
||||||
internal glSHandle id;
|
|
||||||
private IglFunc GL;
|
private IglFunc GL;
|
||||||
|
internal glSHandle id;
|
||||||
|
|
||||||
|
internal unsafe Uniform(glSHandle id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
internal unsafe Uniform(
|
internal unsafe Uniform(
|
||||||
ShaderProgram program, string name, IglFunc gl)
|
ShaderProgram program, string name, IglFunc gl)
|
||||||
@@ -21,18 +57,20 @@ namespace StgSharp.Graphics
|
|||||||
id = GL.GetUniformLocation(program.handle, name);
|
id = GL.GetUniformLocation(program.handle, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe Uniform(glSHandle id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Uniform<T, U>
|
public class Uniform<T, U>
|
||||||
where T : struct
|
where T : struct
|
||||||
where U : struct
|
where U : struct
|
||||||
{
|
{
|
||||||
internal glSHandle id;
|
|
||||||
private IglFunc GL;
|
private IglFunc GL;
|
||||||
|
internal glSHandle id;
|
||||||
|
|
||||||
|
internal unsafe Uniform(glSHandle id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
internal unsafe Uniform(
|
internal unsafe Uniform(
|
||||||
ShaderProgram program, string name, IglFunc gl)
|
ShaderProgram program, string name, IglFunc gl)
|
||||||
@@ -41,10 +79,6 @@ namespace StgSharp.Graphics
|
|||||||
id = GL.GetUniformLocation(program.handle, name);
|
id = GL.GetUniformLocation(program.handle, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe Uniform(glSHandle id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Uniform<T, U, V>
|
public class Uniform<T, U, V>
|
||||||
@@ -52,8 +86,14 @@ namespace StgSharp.Graphics
|
|||||||
where U : struct
|
where U : struct
|
||||||
where V : struct
|
where V : struct
|
||||||
{
|
{
|
||||||
internal glSHandle id;
|
|
||||||
private IglFunc GL;
|
private IglFunc GL;
|
||||||
|
internal glSHandle id;
|
||||||
|
|
||||||
|
internal unsafe Uniform(glSHandle id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
|
public unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
|
||||||
{
|
{
|
||||||
@@ -61,10 +101,6 @@ namespace StgSharp.Graphics
|
|||||||
id = GL.GetUniformLocation(program.handle, name);
|
id = GL.GetUniformLocation(program.handle, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe Uniform(glSHandle id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Uniform<T, U, V, W>
|
public class Uniform<T, U, V, W>
|
||||||
@@ -73,8 +109,14 @@ namespace StgSharp.Graphics
|
|||||||
where V : struct
|
where V : struct
|
||||||
where W : struct
|
where W : struct
|
||||||
{
|
{
|
||||||
internal glSHandle id;
|
|
||||||
private IglFunc GL;
|
private IglFunc GL;
|
||||||
|
internal glSHandle id;
|
||||||
|
|
||||||
|
internal unsafe Uniform(glSHandle id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
internal unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
|
internal unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
|
||||||
{
|
{
|
||||||
@@ -82,14 +124,23 @@ namespace StgSharp.Graphics
|
|||||||
id = GL.GetUniformLocation(program.handle, name);
|
id = GL.GetUniformLocation(program.handle, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe Uniform(glSHandle id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal partial class GLonRender : IglFunc
|
internal partial class GLonRender : IglFunc
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public unsafe void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
||||||
|
{
|
||||||
|
api->glUniform1fv(uniform.id.DirectValue, 4, &vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public unsafe void SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||||
|
{
|
||||||
|
api->glUniform1fv(uniform.id.DirectValue, 4, &vec);
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
unsafe void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
unsafe void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||||
{
|
{
|
||||||
@@ -120,21 +171,11 @@ namespace StgSharp.Graphics
|
|||||||
api->glUniform4f(uniform.id.DirectValue, v0, v1, v2, v3);
|
api->glUniform4f(uniform.id.DirectValue, v0, v1, v2, v3);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public unsafe void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
|
||||||
{
|
|
||||||
api->glUniform1fv(uniform.id.DirectValue, 4, &vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public unsafe void SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
|
||||||
{
|
|
||||||
api->glUniform1fv(uniform.id.DirectValue, 4, &vec);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe partial class GLonUpdate
|
internal unsafe partial class GLonUpdate
|
||||||
{
|
{
|
||||||
|
|
||||||
private IntPtr UniformVal1fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1f;
|
private IntPtr UniformVal1fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1f;
|
||||||
private IntPtr UniformVal1fvPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1fv;
|
private IntPtr UniformVal1fvPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1fv;
|
||||||
private IntPtr UniformVal1iPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1i;
|
private IntPtr UniformVal1iPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1i;
|
||||||
@@ -142,6 +183,53 @@ namespace StgSharp.Graphics
|
|||||||
private IntPtr UniformVal3fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal3f;
|
private IntPtr UniformVal3fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal3f;
|
||||||
private IntPtr UniformVal4fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal4f;
|
private IntPtr UniformVal4fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal4f;
|
||||||
|
|
||||||
|
private static void UniformVal1f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||||
|
{
|
||||||
|
M128 m = default;
|
||||||
|
frameOpBuffer.TryDequeue(out m);
|
||||||
|
activatedContext->glUniform1f(*(int*)m.Read<ulong>(0), m.Read<uint>(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static unsafe void UniformVal1fv(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||||
|
{
|
||||||
|
M128 m = default, v = default;
|
||||||
|
frameOpBuffer.TryDequeue(out m);
|
||||||
|
frameOpBuffer.TryDequeue(out v);
|
||||||
|
activatedContext->glUniform1fv(*(int*)m.Read<ulong>(0), 4, (Vec4d*)&v);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UniformVal1i(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||||
|
{
|
||||||
|
M128 m = default;
|
||||||
|
frameOpBuffer.TryDequeue(out m);
|
||||||
|
activatedContext->glUniform1i(*(int*)m.Read<ulong>(0), m.Read<int>(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UniformVal2f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||||
|
{
|
||||||
|
M128 m = default;
|
||||||
|
frameOpBuffer.TryDequeue(out m);
|
||||||
|
activatedContext->glUniform2f(*(int*)m.Read<ulong>(0), m.Read<float>(2), m.Read<float>(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UniformVal3f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||||
|
{
|
||||||
|
IntPtr handle = IntPtr.Zero;
|
||||||
|
M128 m = default;
|
||||||
|
frameOpBuffer.TryDequeue(out handle);
|
||||||
|
frameOpBuffer.TryDequeue(out m);
|
||||||
|
activatedContext->glUniform3f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UniformVal4f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
||||||
|
{
|
||||||
|
IntPtr handle = IntPtr.Zero;
|
||||||
|
M128 m = default;
|
||||||
|
frameOpBuffer.TryDequeue(out handle);
|
||||||
|
frameOpBuffer.TryDequeue(out m);
|
||||||
|
activatedContext->glUniform4f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2), m.Read<float>(3));
|
||||||
|
}
|
||||||
|
|
||||||
unsafe void IglFunc.SetValue(Uniform<float, float, float> uniform, float f0, float f1, float f2)
|
unsafe void IglFunc.SetValue(Uniform<float, float, float> uniform, float f0, float f1, float f2)
|
||||||
{
|
{
|
||||||
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
|
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
|
||||||
@@ -194,55 +282,9 @@ namespace StgSharp.Graphics
|
|||||||
unsafe void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
unsafe void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||||
{
|
{
|
||||||
Vec4d m = vec;
|
Vec4d m = vec;
|
||||||
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr, (IntPtr)(Vec4d*)&m);
|
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr, (IntPtr)(&m));
|
||||||
frameOpBuffer.MethodEnqueue(UniformVal1fvPtr);
|
frameOpBuffer.MethodEnqueue(UniformVal1fvPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UniformVal1f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
|
||||||
{
|
|
||||||
M128 m = default;
|
|
||||||
frameOpBuffer.TryDequeue(out m);
|
|
||||||
activatedContext->glUniform1f(*(int*)m.Read<ulong>(0), m.Read<uint>(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static unsafe void UniformVal1fv(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
|
||||||
{
|
|
||||||
M128 m = default, v = default;
|
|
||||||
frameOpBuffer.TryDequeue(out m);
|
|
||||||
frameOpBuffer.TryDequeue(out v);
|
|
||||||
activatedContext->glUniform1fv(*(int*)m.Read<ulong>(0), 4, (Vec4d*)&v);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void UniformVal1i(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
|
||||||
{
|
|
||||||
M128 m = default;
|
|
||||||
frameOpBuffer.TryDequeue(out m);
|
|
||||||
activatedContext->glUniform1i(*(int*)m.Read<ulong>(0), m.Read<int>(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void UniformVal2f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
|
||||||
{
|
|
||||||
M128 m = default;
|
|
||||||
frameOpBuffer.TryDequeue(out m);
|
|
||||||
activatedContext->glUniform2f(*(int*)m.Read<ulong>(0), m.Read<float>(2), m.Read<float>(3));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void UniformVal3f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
|
||||||
{
|
|
||||||
IntPtr handle = IntPtr.Zero;
|
|
||||||
M128 m = default;
|
|
||||||
frameOpBuffer.TryDequeue(out handle);
|
|
||||||
frameOpBuffer.TryDequeue(out m);
|
|
||||||
activatedContext->glUniform3f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void UniformVal4f(FrameOperationBuffer frameOpBuffer, GLcontext* activatedContext)
|
|
||||||
{
|
|
||||||
IntPtr handle = IntPtr.Zero;
|
|
||||||
M128 m = default;
|
|
||||||
frameOpBuffer.TryDequeue(out handle);
|
|
||||||
frameOpBuffer.TryDequeue(out m);
|
|
||||||
activatedContext->glUniform4f(*(int*)handle, m.Read<float>(0), m.Read<float>(1), m.Read<float>(2), m.Read<float>(3));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Graphics;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="framework.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 System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -67,83 +97,83 @@ namespace StgSharp
|
|||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowHintString")] internal static extern unsafe void glfwWindowHintString(int hint, byte* value);
|
[DllImport(SSC_libname, EntryPoint = "glfwWindowHintString")] internal static extern unsafe void glfwWindowHintString(int hint, byte* value);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateWindow")] internal static extern unsafe IntPtr glfwCreateWindow(int width, int height, byte[] title, IntPtr monitor, IntPtr share);
|
[DllImport(SSC_libname, EntryPoint = "glfwCreateWindow")] internal static extern unsafe IntPtr glfwCreateWindow(int width, int height, byte[] title, IntPtr monitor, GLFWwindow* share);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyWindow")] internal static extern unsafe void glfwDestroyWindow(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwDestroyWindow")] internal static extern unsafe void glfwDestroyWindow(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowShouldClose")] internal static extern unsafe int glfwWindowShouldClose(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwWindowShouldClose")] internal static extern unsafe int glfwWindowShouldClose(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowShouldClose")] internal static extern unsafe void glfwSetWindowShouldClose(IntPtr window, int value);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowShouldClose")] internal static extern unsafe void glfwSetWindowShouldClose(GLFWwindow* window, int value);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowTitle")] internal static extern unsafe void glfwSetWindowTitle(IntPtr window, byte* title);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowTitle")] internal static extern unsafe void glfwSetWindowTitle(GLFWwindow* window, byte* title);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIcon")] internal static extern unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIcon")] internal static extern unsafe void glfwSetWindowIcon(GLFWwindow* window, int count, GLFWimage* images);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowPos")] internal static extern unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowPos")] internal static extern unsafe void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPos")] internal static extern unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPos")] internal static extern unsafe void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowSize")] internal static extern unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowSize")] internal static extern unsafe void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeLimits")] internal static extern unsafe void glfwSetWindowSizeLimits(IntPtr window, int minwidth, int minheight, int maxwidth, int maxheight);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeLimits")] internal static extern unsafe void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAspectRatio")] internal static extern unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAspectRatio")] internal static extern unsafe void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSize")] internal static extern unsafe void glfwSetWindowSize(IntPtr window, int width, int height);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSize")] internal static extern unsafe void glfwSetWindowSize(GLFWwindow* window, int width, int height);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetFramebufferSize")] internal static extern unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetFramebufferSize")] internal static extern unsafe void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowFrameSize")] internal static extern unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowFrameSize")] internal static extern unsafe void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowContentScale")] internal static extern unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowContentScale")] internal static extern unsafe void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowOpacity")] internal static extern unsafe float glfwGetWindowOpacity(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowOpacity")] internal static extern unsafe float glfwGetWindowOpacity(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowOpacity")] internal static extern unsafe void glfwSetWindowOpacity(IntPtr window, float opacity);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowOpacity")] internal static extern unsafe void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwIconifyWindow")] internal static extern unsafe void glfwIconifyWindow(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwIconifyWindow")] internal static extern unsafe void glfwIconifyWindow(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwRestoreWindow")] internal static extern unsafe void glfwRestoreWindow(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwRestoreWindow")] internal static extern unsafe void glfwRestoreWindow(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwMaximizeWindow")] internal static extern unsafe void glfwMaximizeWindow(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwMaximizeWindow")] internal static extern unsafe void glfwMaximizeWindow(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwShowWindow")] internal static extern unsafe void glfwShowWindow(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwShowWindow")] internal static extern unsafe void glfwShowWindow(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwHideWindow")] internal static extern unsafe void glfwHideWindow(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwHideWindow")] internal static extern unsafe void glfwHideWindow(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwFocusWindow")] internal static extern unsafe void glfwFocusWindow(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwFocusWindow")] internal static extern unsafe void glfwFocusWindow(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwRequestWindowAttention")] internal static extern unsafe void glfwRequestWindowAttention(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwRequestWindowAttention")] internal static extern unsafe void glfwRequestWindowAttention(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowMonitor")] internal static extern unsafe IntPtr glfwGetWindowMonitor(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowMonitor")] internal static extern unsafe IntPtr glfwGetWindowMonitor(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMonitor")] internal static extern unsafe void glfwSetWindowMonitor(IntPtr window, IntPtr monitor, int xpos, int ypos, int width, int height, int refreshRate);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMonitor")] internal static extern unsafe void glfwSetWindowMonitor(GLFWwindow* window, IntPtr monitor, int xpos, int ypos, int width, int height, int refreshRate);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowAttrib")] internal static extern unsafe int glfwGetWindowAttrib(IntPtr window, int attrib);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowAttrib")] internal static extern unsafe int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAttrib")] internal static extern unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAttrib")] internal static extern unsafe void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowUserPointer")] internal static extern unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowUserPointer")] internal static extern unsafe void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowUserPointer")] internal static extern unsafe void* glfwGetWindowUserPointer(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowUserPointer")] internal static extern unsafe void* glfwGetWindowUserPointer(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPosCallback")] internal static extern unsafe GLFWwindowposfun glfwSetWindowPosCallback(IntPtr window, GLFWwindowposfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPosCallback")] internal static extern unsafe GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeCallback")] internal static extern unsafe GLFWwindowsizefun glfwSetWindowSizeCallback(IntPtr window, GLFWwindowsizefun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeCallback")] internal static extern unsafe GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowCloseCallback")] internal static extern unsafe GLFWwindowclosefun glfwSetWindowCloseCallback(IntPtr window, GLFWwindowclosefun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowCloseCallback")] internal static extern unsafe GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowRefreshCallback")] internal static extern unsafe GLFWwindowrefreshfun glfwSetWindowRefreshCallback(IntPtr window, GLFWwindowrefreshfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowRefreshCallback")] internal static extern unsafe GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowFocusCallback")] internal static extern unsafe GLFWwindowfocusfun glfwSetWindowFocusCallback(IntPtr window, GLFWwindowfocusfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowFocusCallback")] internal static extern unsafe GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIconifyCallback")] internal static extern unsafe GLFWwindowiconifyfun glfwSetWindowIconifyCallback(IntPtr window, GLFWwindowiconifyfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIconifyCallback")] internal static extern unsafe GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMaximizeCallback")] internal static extern unsafe GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(IntPtr window, GLFWwindowmaximizefun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMaximizeCallback")] internal static extern unsafe GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetFramebufferSizeCallback")] internal static extern unsafe FramebuffersizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetFramebufferSizeCallback")] internal static extern unsafe FramebuffersizeHandler glfwSetFramebufferSizeCallback(GLFWwindow* window, IntPtr callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowContentScaleCallback")] internal static extern unsafe GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(IntPtr window, GLFWwindowcontentscalefun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowContentScaleCallback")] internal static extern unsafe GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwPollEvents")] internal static extern unsafe void glfwPollEvents();
|
[DllImport(SSC_libname, EntryPoint = "glfwPollEvents")] internal static extern unsafe void glfwPollEvents();
|
||||||
|
|
||||||
@@ -153,9 +183,9 @@ namespace StgSharp
|
|||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwPostEmptyEvent")] internal static extern unsafe void glfwPostEmptyEvent();
|
[DllImport(SSC_libname, EntryPoint = "glfwPostEmptyEvent")] internal static extern unsafe void glfwPostEmptyEvent();
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetInputMode")] internal static extern unsafe int glfwGetInputMode(IntPtr window, int mode);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetInputMode")] internal static extern unsafe int glfwGetInputMode(GLFWwindow* window, int mode);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetInputMode")] internal static extern unsafe void glfwSetInputMode(IntPtr window, int mode, int value);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetInputMode")] internal static extern unsafe void glfwSetInputMode(GLFWwindow* window, int mode, int value);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwRawMouseMotionSupported")] internal static extern unsafe int glfwRawMouseMotionSupported();
|
[DllImport(SSC_libname, EntryPoint = "glfwRawMouseMotionSupported")] internal static extern unsafe int glfwRawMouseMotionSupported();
|
||||||
|
|
||||||
@@ -163,13 +193,13 @@ namespace StgSharp
|
|||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyScancode")] internal static extern unsafe int glfwGetKeyScancode(int key);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyScancode")] internal static extern unsafe int glfwGetKeyScancode(int key);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKey")] internal static extern unsafe KeyStatus glfwGetKey(IntPtr window, int key);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetKey")] internal static extern unsafe KeyStatus glfwGetKey(GLFWwindow* window, int key);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMouseButton")] internal static extern unsafe int glfwGetMouseButton(IntPtr window, int button);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetMouseButton")] internal static extern unsafe int glfwGetMouseButton(GLFWwindow* window, int button);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetCursorPos")] internal static extern unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetCursorPos")] internal static extern unsafe void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPos")] internal static extern unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPos")] internal static extern unsafe void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateCursor")] internal static extern unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
|
[DllImport(SSC_libname, EntryPoint = "glfwCreateCursor")] internal static extern unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
|
||||||
|
|
||||||
@@ -177,23 +207,23 @@ namespace StgSharp
|
|||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyCursor")] internal static extern unsafe void glfwDestroyCursor(GLFWcursor* cursor);
|
[DllImport(SSC_libname, EntryPoint = "glfwDestroyCursor")] internal static extern unsafe void glfwDestroyCursor(GLFWcursor* cursor);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursor")] internal static extern unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetCursor")] internal static extern unsafe void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetKeyCallback")] internal static extern unsafe GLFWkeyfun glfwSetKeyCallback(IntPtr window, GLFWkeyfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetKeyCallback")] internal static extern unsafe GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCharCallback")] internal static extern unsafe GLFWcharfun glfwSetCharCallback(IntPtr window, GLFWcharfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetCharCallback")] internal static extern unsafe GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCharModsCallback")] internal static extern unsafe GLFWcharmodsfun glfwSetCharModsCallback(IntPtr window, GLFWcharmodsfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetCharModsCallback")] internal static extern unsafe GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMouseButtonCallback")] internal static extern unsafe GLFWmousebuttonfun glfwSetMouseButtonCallback(IntPtr window, GLFWmousebuttonfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetMouseButtonCallback")] internal static extern unsafe GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPosCallback")] internal static extern unsafe GLFWcursorposfun glfwSetCursorPosCallback(IntPtr window, GLFWcursorposfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPosCallback")] internal static extern unsafe GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorEnterCallback")] internal static extern unsafe GLFWcursorenterfun glfwSetCursorEnterCallback(IntPtr window, GLFWcursorenterfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorEnterCallback")] internal static extern unsafe GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetScrollCallback")] internal static extern unsafe GLFWscrollfun glfwSetScrollCallback(IntPtr window, GLFWscrollfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetScrollCallback")] internal static extern unsafe GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetDropCallback")] internal static extern unsafe GLFWdropfun glfwSetDropCallback(IntPtr window, GLFWdropfun callback);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetDropCallback")] internal static extern unsafe GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwJoystickPresent")] internal static extern unsafe int glfwJoystickPresent(int jid);
|
[DllImport(SSC_libname, EntryPoint = "glfwJoystickPresent")] internal static extern unsafe int glfwJoystickPresent(int jid);
|
||||||
|
|
||||||
@@ -221,9 +251,9 @@ namespace StgSharp
|
|||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGamepadState")] internal static extern unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetGamepadState")] internal static extern unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSetClipboardString")] internal static extern unsafe void glfwSetClipboardString(IntPtr window, byte* str);
|
[DllImport(SSC_libname, EntryPoint = "glfwSetClipboardString")] internal static extern unsafe void glfwSetClipboardString(GLFWwindow* window, byte* str);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetClipboardString")] internal static extern unsafe byte* glfwGetClipboardString(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwGetClipboardString")] internal static extern unsafe byte* glfwGetClipboardString(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTime")] internal static extern unsafe double glfwGetTime();
|
[DllImport(SSC_libname, EntryPoint = "glfwGetTime")] internal static extern unsafe double glfwGetTime();
|
||||||
|
|
||||||
@@ -233,11 +263,11 @@ namespace StgSharp
|
|||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerFrequency")] internal static extern unsafe ulong* glfwGetTimerFrequency();
|
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerFrequency")] internal static extern unsafe ulong* glfwGetTimerFrequency();
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwMakeContextCurrent")] internal static extern unsafe void glfwMakeContextCurrent(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwMakeContextCurrent")] internal static extern unsafe void glfwMakeContextCurrent(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwGetCurrentContext")] internal static extern unsafe IntPtr glfwGetCurrentContext();
|
[DllImport(SSC_libname, EntryPoint = "glfwGetCurrentContext")] internal static extern unsafe IntPtr glfwGetCurrentContext();
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSwapBuffers")] internal static extern unsafe void glfwSwapBuffers(IntPtr window);
|
[DllImport(SSC_libname, EntryPoint = "glfwSwapBuffers")] internal static extern unsafe void glfwSwapBuffers(GLFWwindow* window);
|
||||||
|
|
||||||
[DllImport(SSC_libname, EntryPoint = "glfwSwapInterval")] internal static extern unsafe void glfwSwapInterval(int interval);
|
[DllImport(SSC_libname, EntryPoint = "glfwSwapInterval")] internal static extern unsafe void glfwSwapInterval(int interval);
|
||||||
|
|
||||||
@@ -251,7 +281,7 @@ namespace StgSharp
|
|||||||
|
|
||||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetInstanceProcAddress")] internal extern unsafe static GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, byte* procname);
|
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetInstanceProcAddress")] internal extern unsafe static GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, byte* procname);
|
||||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal extern unsafe static int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint* queuefamily);
|
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal extern unsafe static int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint* queuefamily);
|
||||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwCreateWindowSurface")] internal extern unsafe static VkResult glfwCreateWindowSurface(VkInstance instance, IntPtr window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwCreateWindowSurface")] internal extern unsafe static VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||||
|
|
||||||
#endregion api call
|
#endregion api call
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="glApiManager.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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -11,6 +41,7 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public static partial class glManager
|
public static partial class glManager
|
||||||
{
|
{
|
||||||
|
|
||||||
private const int glExtension = 0x1f03;
|
private const int glExtension = 0x1f03;
|
||||||
private const int glVersion = 0x1f02;
|
private const int glVersion = 0x1f02;
|
||||||
|
|
||||||
@@ -63,7 +94,7 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
if (coreVersion.Contains(branch))
|
if (coreVersion.Contains(branch))
|
||||||
{
|
{
|
||||||
coreVersion.Replace(branch, "");
|
coreVersion.Replace(branch, string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string[] versionSep = coreVersion.Split('.');
|
string[] versionSep = coreVersion.Split('.');
|
||||||
@@ -99,7 +130,10 @@ namespace StgSharp.Graphics
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (ex.Message != "Final Version") throw;
|
if (ex.Message != "Final Version")
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPtr strPtr = context->glGetString(glExtension);
|
IntPtr strPtr = context->glGetString(glExtension);
|
||||||
@@ -763,27 +797,178 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
internal static void CheckCoreVersion(int majorVersion, int minorVersion)
|
internal static void CheckCoreVersion(int majorVersion, int minorVersion)
|
||||||
{
|
{
|
||||||
if ((majorVersion >= 1) || (majorVersion == 1 && minorVersion == 0)) core10 = true; else goto log;
|
if ((majorVersion >= 1) || ((majorVersion == 1) && (minorVersion == 0)))
|
||||||
if ((majorVersion >= 1) || (majorVersion == 1 && minorVersion == 1)) core11 = true; else goto log;
|
{
|
||||||
if ((majorVersion >= 1) || (majorVersion == 1 && minorVersion == 2)) core12 = true; else goto log;
|
core10 = true;
|
||||||
if ((majorVersion >= 1) || (majorVersion == 1 && minorVersion == 3)) core13 = true; else goto log;
|
}
|
||||||
if ((majorVersion >= 1) || (majorVersion == 1 && minorVersion == 4)) core14 = true; else goto log;
|
else
|
||||||
if ((majorVersion >= 1) || (majorVersion == 1 && minorVersion == 5)) core15 = true; else goto log;
|
{
|
||||||
if ((majorVersion >= 2) || (majorVersion == 2 && minorVersion == 0)) core20 = true; else goto log;
|
goto log;
|
||||||
if ((majorVersion >= 2) || (majorVersion == 2 && minorVersion == 1)) core21 = true; else goto log;
|
}
|
||||||
if ((majorVersion >= 3) || (majorVersion == 3 && minorVersion == 0)) core30 = true; else goto log;
|
|
||||||
if ((majorVersion >= 3) || (majorVersion == 3 && minorVersion == 1)) core31 = true; else goto log;
|
|
||||||
if ((majorVersion >= 3) || (majorVersion == 3 && minorVersion == 2)) core32 = true; else goto log;
|
|
||||||
if ((majorVersion >= 3) || (majorVersion == 3 && minorVersion == 3)) core33 = true; else goto log;
|
|
||||||
if ((majorVersion >= 4) || (majorVersion == 4 && minorVersion == 0)) core40 = true; else goto log;
|
|
||||||
if ((majorVersion >= 4) || (majorVersion == 4 && minorVersion == 1)) core41 = true; else goto log;
|
|
||||||
if ((majorVersion >= 4) || (majorVersion == 4 && minorVersion == 2)) core42 = true; else goto log;
|
|
||||||
if ((majorVersion >= 4) || (majorVersion == 4 && minorVersion == 3)) core43 = true; else goto log;
|
|
||||||
if ((majorVersion >= 4) || (majorVersion == 4 && minorVersion == 4)) core44 = true; else goto log;
|
|
||||||
if ((majorVersion >= 4) || (majorVersion == 4 && minorVersion == 5)) core45 = true; else goto log;
|
|
||||||
if ((majorVersion >= 4) || (majorVersion == 4 && minorVersion == 6)) core46 = true; else goto log;
|
|
||||||
|
|
||||||
log:
|
if ((majorVersion >= 1) || ((majorVersion == 1) && (minorVersion == 1)))
|
||||||
|
{
|
||||||
|
core11 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 1) || ((majorVersion == 1) && (minorVersion == 2)))
|
||||||
|
{
|
||||||
|
core12 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 1) || ((majorVersion == 1) && (minorVersion == 3)))
|
||||||
|
{
|
||||||
|
core13 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 1) || ((majorVersion == 1) && (minorVersion == 4)))
|
||||||
|
{
|
||||||
|
core14 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 1) || ((majorVersion == 1) && (minorVersion == 5)))
|
||||||
|
{
|
||||||
|
core15 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 2) || ((majorVersion == 2) && (minorVersion == 0)))
|
||||||
|
{
|
||||||
|
core20 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 2) || ((majorVersion == 2) && (minorVersion == 1)))
|
||||||
|
{
|
||||||
|
core21 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 3) || ((majorVersion == 3) && (minorVersion == 0)))
|
||||||
|
{
|
||||||
|
core30 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 3) || ((majorVersion == 3) && (minorVersion == 1)))
|
||||||
|
{
|
||||||
|
core31 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 3) || ((majorVersion == 3) && (minorVersion == 2)))
|
||||||
|
{
|
||||||
|
core32 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 3) || ((majorVersion == 3) && (minorVersion == 3)))
|
||||||
|
{
|
||||||
|
core33 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 4) || ((majorVersion == 4) && (minorVersion == 0)))
|
||||||
|
{
|
||||||
|
core40 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 4) || ((majorVersion == 4) && (minorVersion == 1)))
|
||||||
|
{
|
||||||
|
core41 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 4) || ((majorVersion == 4) && (minorVersion == 2)))
|
||||||
|
{
|
||||||
|
core42 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 4) || ((majorVersion == 4) && (minorVersion == 3)))
|
||||||
|
{
|
||||||
|
core43 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 4) || ((majorVersion == 4) && (minorVersion == 4)))
|
||||||
|
{
|
||||||
|
core44 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 4) || ((majorVersion == 4) && (minorVersion == 5)))
|
||||||
|
{
|
||||||
|
core45 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((majorVersion >= 4) || ((majorVersion == 4) && (minorVersion == 6)))
|
||||||
|
{
|
||||||
|
core46 = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto log;
|
||||||
|
}
|
||||||
|
|
||||||
|
log:
|
||||||
{
|
{
|
||||||
InternalIO.InternalWriteLog("Find core OpenGL version.", LogType.Info);
|
InternalIO.InternalWriteLog("Find core OpenGL version.", LogType.Info);
|
||||||
return;
|
return;
|
||||||
@@ -794,7 +979,7 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
if (context.glGetString == null)
|
if (context.glGetString == null)
|
||||||
{
|
{
|
||||||
return "";
|
return string.Empty;
|
||||||
}
|
}
|
||||||
return Marshal.PtrToStringAnsi(
|
return Marshal.PtrToStringAnsi(
|
||||||
context.glGetString(glExtension));
|
context.glGetString(glExtension));
|
||||||
@@ -812,7 +997,7 @@ namespace StgSharp.Graphics
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
InternalIO.InternalWriteLog(
|
InternalIO.InternalWriteLog(
|
||||||
$"Failed to convert the api {typeof(T).Name}.\n" + ex.Message, LogType.Warning);
|
$"{($"Failed to convert the api {typeof(T).Name}.\n")}{ex.Message}", LogType.Warning);
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1781,5 +1966,6 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.6 APIs");
|
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.6 APIs");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="glApiManagerConst.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.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="IglFunc.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;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
@@ -8,6 +38,12 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public interface IglFunc
|
public interface IglFunc
|
||||||
{
|
{
|
||||||
|
|
||||||
|
internal unsafe GLcontext* Context
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Same function as OpenGL api glActiveTexture
|
/// Same function as OpenGL api glActiveTexture
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -86,18 +122,14 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
void ClearGraphicError();
|
void ClearGraphicError();
|
||||||
|
|
||||||
|
void CompileShader(glHandle shaderhandle);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Same function as OpenGL api, glCreateProgram
|
/// Same function as OpenGL api, glCreateProgram
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A handle representing a single shader program</returns>
|
/// <returns>A handle representing a single shader program</returns>
|
||||||
glHandle CreateProgram();
|
glHandle CreateProgram();
|
||||||
|
|
||||||
glHandleSet CreateShaderSet(int count, ShaderType type);
|
|
||||||
|
|
||||||
void LoadShaderSource(glHandle shaderHandle, string codeStream);
|
|
||||||
|
|
||||||
void CompileShader(glHandle shaderhandle);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Same function as OpenGL api, glCreateProgram.
|
/// Same function as OpenGL api, glCreateProgram.
|
||||||
/// Used for creating multiple shader program.
|
/// Used for creating multiple shader program.
|
||||||
@@ -105,6 +137,8 @@ namespace StgSharp.Graphics
|
|||||||
/// <returns>A handle representing all shader programs</returns>
|
/// <returns>A handle representing all shader programs</returns>
|
||||||
glHandleSet CreateProgram(int count);
|
glHandleSet CreateProgram(int count);
|
||||||
|
|
||||||
|
glHandleSet CreateShaderSet(int count, ShaderType type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a form and its associated
|
/// Creates a form and its associated
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -174,6 +208,8 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
bool GetWindowShouldClose(Form form);
|
bool GetWindowShouldClose(Form form);
|
||||||
|
|
||||||
|
void LoadShaderSource(glHandle shaderHandle, string codeStream);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make the OpenGL context of a certain <see cref="Form"/> as the activated OpenGL context.
|
/// Make the OpenGL context of a certain <see cref="Form"/> as the activated OpenGL context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -184,17 +220,6 @@ namespace StgSharp.Graphics
|
|||||||
|
|
||||||
void SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible;
|
void SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set data value to a float <see cref="Uniform{T,U,V,W}"/>,
|
|
||||||
/// all types of parameters are float.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uniform">The <see cref="Uniform{T,U,V,W}"/> target</param>
|
|
||||||
/// <param name="v0">The first value to be set</param>
|
|
||||||
/// <param name="v1">The second value to be set</param>
|
|
||||||
/// <param name="v2">The third value to be set</param>
|
|
||||||
/// <param name="v3">The forth value to be set</param>
|
|
||||||
void SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set data value to a float <see cref="Uniform{T,U,V,W}"/>,
|
/// Set data value to a float <see cref="Uniform{T,U,V,W}"/>,
|
||||||
/// all types of parameters are float.
|
/// all types of parameters are float.
|
||||||
@@ -203,25 +228,6 @@ namespace StgSharp.Graphics
|
|||||||
/// <param name="vec">A <see cref="Vec4d"/> packing four parameters of the uniform </param>
|
/// <param name="vec">A <see cref="Vec4d"/> packing four parameters of the uniform </param>
|
||||||
void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec);
|
void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set data value to a float <see cref="Uniform{T,U,V}"/>,
|
|
||||||
/// all types of parameters are float.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uniform">The <see cref="Uniform{T,U,V}"/> target</param>
|
|
||||||
/// <param name="v0">The first value to be set</param>
|
|
||||||
/// <param name="v1">The second value to be set</param>
|
|
||||||
/// <param name="v2">The third value to be set</param>
|
|
||||||
void SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set data value to a float <see cref="Uniform{T,U}"/>,
|
|
||||||
/// all types of parameters are float.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uniform">The <see cref="Uniform{T,U}"/> target</param>
|
|
||||||
/// <param name="v0">The first value to be set</param>
|
|
||||||
/// <param name="v1">The second value to be set</param>
|
|
||||||
void SetValue(Uniform<float, float> uniform, float v0, float v1);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set data value to a float <see cref="Uniform{T}"/>,
|
/// Set data value to a float <see cref="Uniform{T}"/>,
|
||||||
/// all types of parameters are float.
|
/// all types of parameters are float.
|
||||||
@@ -246,6 +252,36 @@ namespace StgSharp.Graphics
|
|||||||
/// <param name="vec">A <see cref="Vec4d"/> value of the uniform </param>
|
/// <param name="vec">A <see cref="Vec4d"/> value of the uniform </param>
|
||||||
void SetValue(Uniform<Vec4d> uniform, Vec4d vec);
|
void SetValue(Uniform<Vec4d> uniform, Vec4d vec);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set data value to a float <see cref="Uniform{T,U}"/>,
|
||||||
|
/// all types of parameters are float.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uniform">The <see cref="Uniform{T,U}"/> target</param>
|
||||||
|
/// <param name="v0">The first value to be set</param>
|
||||||
|
/// <param name="v1">The second value to be set</param>
|
||||||
|
void SetValue(Uniform<float, float> uniform, float v0, float v1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set data value to a float <see cref="Uniform{T,U,V}"/>,
|
||||||
|
/// all types of parameters are float.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uniform">The <see cref="Uniform{T,U,V}"/> target</param>
|
||||||
|
/// <param name="v0">The first value to be set</param>
|
||||||
|
/// <param name="v1">The second value to be set</param>
|
||||||
|
/// <param name="v2">The third value to be set</param>
|
||||||
|
void SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set data value to a float <see cref="Uniform{T,U,V,W}"/>,
|
||||||
|
/// all types of parameters are float.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uniform">The <see cref="Uniform{T,U,V,W}"/> target</param>
|
||||||
|
/// <param name="v0">The first value to be set</param>
|
||||||
|
/// <param name="v1">The second value to be set</param>
|
||||||
|
/// <param name="v2">The third value to be set</param>
|
||||||
|
/// <param name="v3">The forth value to be set</param>
|
||||||
|
void SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set how a shader parameter read data from a VBO.
|
/// Set how a shader parameter read data from a VBO.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -293,13 +329,9 @@ namespace StgSharp.Graphics
|
|||||||
/// <param name="height"></param>
|
/// <param name="height"></param>
|
||||||
void Viewport(int x, int y, uint width, uint height);
|
void Viewport(int x, int y, uint width, uint height);
|
||||||
|
|
||||||
|
internal void frameworkHandleEnqueue(IntPtr handle, params M128[] param);
|
||||||
|
|
||||||
internal void SwitchContext();
|
internal void SwitchContext();
|
||||||
|
|
||||||
internal unsafe GLcontext* Context
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void frameworkHandleEnqueue(IntPtr handle, params M128[] param);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Math;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Image.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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -12,21 +42,10 @@ namespace StgSharp.Graphics
|
|||||||
{
|
{
|
||||||
public class Image
|
public class Image
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal struct ImageInfo
|
|
||||||
{
|
|
||||||
internal int width;
|
|
||||||
internal int height;
|
|
||||||
internal int channel;
|
|
||||||
internal IntPtr pixelPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal glHandle pixelArrayHandle;
|
|
||||||
internal ImageInfo info;
|
internal ImageInfo info;
|
||||||
|
|
||||||
public int Width { get => info.width; }
|
internal glHandle pixelArrayHandle;
|
||||||
public int Height { get => info.height; }
|
|
||||||
public int Channel { get => info.channel; }
|
|
||||||
|
|
||||||
internal Image(ImageInfo information)
|
internal Image(ImageInfo information)
|
||||||
{
|
{
|
||||||
@@ -40,9 +59,26 @@ namespace StgSharp.Graphics
|
|||||||
info = new ImageInfo();
|
info = new ImageInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int Channel => info.channel;
|
||||||
|
public int Height => info.height;
|
||||||
|
|
||||||
|
public int Width => info.width;
|
||||||
|
|
||||||
~Image()
|
~Image()
|
||||||
{
|
{
|
||||||
Marshal.FreeHGlobal(info.pixelPtr);
|
Marshal.FreeHGlobal(info.pixelPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct ImageInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
internal int width;
|
||||||
|
internal int height;
|
||||||
|
internal int channel;
|
||||||
|
internal IntPtr pixelPtr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Graphics;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ArrayList.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 System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@@ -14,6 +44,7 @@ namespace StgSharp.Logic
|
|||||||
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
||||||
internal struct LogSeperator
|
internal struct LogSeperator
|
||||||
{
|
{
|
||||||
|
|
||||||
[FieldOffset(0)] public ulong all;
|
[FieldOffset(0)] public ulong all;
|
||||||
[FieldOffset(0)] public long all_s;
|
[FieldOffset(0)] public long all_s;
|
||||||
|
|
||||||
@@ -28,6 +59,7 @@ namespace StgSharp.Logic
|
|||||||
this.high = high;
|
this.high = high;
|
||||||
this.low = low;
|
this.low = low;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,6 +70,7 @@ namespace StgSharp.Logic
|
|||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public class DynamicArrayList<T>
|
public class DynamicArrayList<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
private List<T[]> arrayIndexList;
|
private List<T[]> arrayIndexList;
|
||||||
private LogSeperator indexpair;
|
private LogSeperator indexpair;
|
||||||
private int lastMain = 0;
|
private int lastMain = 0;
|
||||||
@@ -139,10 +172,10 @@ namespace StgSharp.Logic
|
|||||||
{
|
{
|
||||||
indexpair.all_s = index;
|
indexpair.all_s = index;
|
||||||
if (
|
if (
|
||||||
indexpair.low_s > lastSub ||
|
(indexpair.low_s > lastSub) ||
|
||||||
indexpair.high_s > lastMain ||
|
(indexpair.high_s > lastMain) ||
|
||||||
indexpair.low_s < 0 ||
|
(indexpair.low_s < 0) ||
|
||||||
indexpair.high_s < 0)
|
(indexpair.high_s < 0))
|
||||||
{
|
{
|
||||||
throw new IndexOutOfRangeException();
|
throw new IndexOutOfRangeException();
|
||||||
}
|
}
|
||||||
@@ -152,10 +185,10 @@ namespace StgSharp.Logic
|
|||||||
{
|
{
|
||||||
indexpair.all_s = index;
|
indexpair.all_s = index;
|
||||||
if (
|
if (
|
||||||
indexpair.low_s > lastSub ||
|
(indexpair.low_s > lastSub) ||
|
||||||
indexpair.high_s > lastMain ||
|
(indexpair.high_s > lastMain) ||
|
||||||
indexpair.low_s < 0 ||
|
(indexpair.low_s < 0) ||
|
||||||
indexpair.high_s < 0)
|
(indexpair.high_s < 0))
|
||||||
{
|
{
|
||||||
throw new IndexOutOfRangeException();
|
throw new IndexOutOfRangeException();
|
||||||
}
|
}
|
||||||
@@ -163,30 +196,11 @@ namespace StgSharp.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyTo(DynamicArrayList<T> target)
|
|
||||||
{
|
|
||||||
target.arrayIndexList.Clear();
|
|
||||||
int length = 1;
|
|
||||||
foreach (T[] tList in target.arrayIndexList)
|
|
||||||
{
|
|
||||||
T[] newIndex = new T[length];
|
|
||||||
Buffer.BlockCopy(tList, 0, newIndex, 0, length);
|
|
||||||
target.arrayIndexList.Add(newIndex);
|
|
||||||
length <<= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
target.lastMain = lastMain;
|
|
||||||
target.lastSub = lastSub;
|
|
||||||
target.length = length;
|
|
||||||
target.unusedMainIndex = new Queue<int>(unusedMainIndex.ToArray());
|
|
||||||
target.unusedSubIndex = new Queue<int>(unusedSubIndex.ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public T this[int index]
|
public T this[int index]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (index + 1 > length || index < 0)
|
if ((index + 1 > length) || (index < 0))
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("index");
|
throw new ArgumentOutOfRangeException("index");
|
||||||
}
|
}
|
||||||
@@ -195,7 +209,7 @@ namespace StgSharp.Logic
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (index + 1 > length || index < 0)
|
if ((index + 1 > length) || (index < 0))
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("index");
|
throw new ArgumentOutOfRangeException("index");
|
||||||
}
|
}
|
||||||
@@ -208,7 +222,7 @@ namespace StgSharp.Logic
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (index + 1 > length || index < 0)
|
if ((index + 1 > length) || (index < 0))
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("index");
|
throw new ArgumentOutOfRangeException("index");
|
||||||
}
|
}
|
||||||
@@ -217,7 +231,7 @@ namespace StgSharp.Logic
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (index + 1 > length || index < 0)
|
if ((index + 1 > length) || (index < 0))
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("index");
|
throw new ArgumentOutOfRangeException("index");
|
||||||
}
|
}
|
||||||
@@ -231,10 +245,7 @@ namespace StgSharp.Logic
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Length of this <see cref="DynamicArrayList{T}"/>
|
/// Length of this <see cref="DynamicArrayList{T}"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Length
|
public int Length => length;
|
||||||
{
|
|
||||||
get { return length; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Add(T item)
|
public int Add(T item)
|
||||||
{
|
{
|
||||||
@@ -297,6 +308,25 @@ namespace StgSharp.Logic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CopyTo(DynamicArrayList<T> target)
|
||||||
|
{
|
||||||
|
target.arrayIndexList.Clear();
|
||||||
|
int length = 1;
|
||||||
|
foreach (T[] tList in target.arrayIndexList)
|
||||||
|
{
|
||||||
|
T[] newIndex = new T[length];
|
||||||
|
Buffer.BlockCopy(tList, 0, newIndex, 0, length);
|
||||||
|
target.arrayIndexList.Add(newIndex);
|
||||||
|
length <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.lastMain = lastMain;
|
||||||
|
target.lastSub = lastSub;
|
||||||
|
target.length = length;
|
||||||
|
target.unusedMainIndex = new Queue<int>(unusedMainIndex.ToArray());
|
||||||
|
target.unusedSubIndex = new Queue<int>(unusedSubIndex.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
public int IndexOf(T item)
|
public int IndexOf(T item)
|
||||||
{
|
{
|
||||||
int index = 1;
|
int index = 1;
|
||||||
@@ -307,7 +337,7 @@ namespace StgSharp.Logic
|
|||||||
{
|
{
|
||||||
if (i.Equals(item))
|
if (i.Equals(item))
|
||||||
{
|
{
|
||||||
return index + subindex - 1;
|
return (index + subindex) - 1;
|
||||||
}
|
}
|
||||||
subindex++;
|
subindex++;
|
||||||
}
|
}
|
||||||
@@ -328,11 +358,11 @@ namespace StgSharp.Logic
|
|||||||
if (i.Equals(item))
|
if (i.Equals(item))
|
||||||
{
|
{
|
||||||
list[subindex] = default;
|
list[subindex] = default;
|
||||||
if (subindex == lastSub && index == lastMain)
|
if ((subindex == lastSub) && (index == lastMain))
|
||||||
{
|
{
|
||||||
if (lastSub == 0)
|
if (lastSub == 0)
|
||||||
{
|
{
|
||||||
lastMain = lastMain == 0 ? 0 : lastMain - 1;
|
lastMain = (lastMain == 0) ? 0 : (lastMain - 1);
|
||||||
lastSub = arrayIndexList[lastMain].Length - 1;
|
lastSub = arrayIndexList[lastMain].Length - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -356,7 +386,7 @@ namespace StgSharp.Logic
|
|||||||
[Obsolete("This method is not same, you may read data form an empty index.", false)]
|
[Obsolete("This method is not same, you may read data form an empty index.", false)]
|
||||||
public void RemoveAt(int index)
|
public void RemoveAt(int index)
|
||||||
{
|
{
|
||||||
if (index > length || index < 0)
|
if ((index > length) || (index < 0))
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException(nameof(index));
|
throw new ArgumentOutOfRangeException(nameof(index));
|
||||||
}
|
}
|
||||||
@@ -402,7 +432,7 @@ namespace StgSharp.Logic
|
|||||||
mainindex++;
|
mainindex++;
|
||||||
}
|
}
|
||||||
indexpair.high_s = mainindex;
|
indexpair.high_s = mainindex;
|
||||||
indexpair.low >>= (int)(32 - mainindex);
|
indexpair.low >>= 32 - mainindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SeprateIndex(int longIndex)
|
private void SeprateIndex(int longIndex)
|
||||||
@@ -415,7 +445,8 @@ namespace StgSharp.Logic
|
|||||||
mainindex++;
|
mainindex++;
|
||||||
}
|
}
|
||||||
indexpair.high_s = mainindex;
|
indexpair.high_s = mainindex;
|
||||||
indexpair.low >>= (int)(32 - mainindex);
|
indexpair.low >>= 32 - mainindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Entities;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Control.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.Entities;
|
||||||
using StgSharp.Geometries;
|
using StgSharp.Geometries;
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
|
|
||||||
@@ -6,15 +36,17 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
public partial class Control
|
public partial class Control
|
||||||
{
|
{
|
||||||
|
|
||||||
|
internal Line bottomBoader;
|
||||||
internal Line leftBoader;
|
internal Line leftBoader;
|
||||||
internal Line rightBoader;
|
internal Line rightBoader;
|
||||||
internal Line topBoader;
|
internal Line topBoader;
|
||||||
internal Line bottomBoader;
|
|
||||||
|
public Line BottomBoarder => bottomBoader;
|
||||||
|
|
||||||
public Line LeftBoarder => leftBoader;
|
public Line LeftBoarder => leftBoader;
|
||||||
public Line RightBoarder => rightBoader;
|
public Line RightBoarder => rightBoader;
|
||||||
public Line TopBoarder => topBoader;
|
public Line TopBoarder => topBoader;
|
||||||
public Line BottomBoarder => bottomBoader;
|
|
||||||
|
|
||||||
|
|
||||||
private void initContainers()
|
private void initContainers()
|
||||||
|
|||||||
@@ -1,80 +1,48 @@
|
|||||||
using System;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Counter.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.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
namespace StgSharp
|
namespace StgSharp
|
||||||
{
|
{
|
||||||
public delegate void TimeSourceProvider(TimeProvider subscriber);
|
|
||||||
|
|
||||||
public class TimeProvider
|
|
||||||
{
|
|
||||||
private readonly long _spanLength;
|
|
||||||
private long _spanBegin;
|
|
||||||
private Counter<uint> timeSpanCount = new Counter<uint>(0, 1, 1);
|
|
||||||
|
|
||||||
public static TimeSourceProvider DefaultProvider
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new(StgSharp.SubscribeTimeProvider);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TimeProvider(
|
|
||||||
long spanLength
|
|
||||||
)
|
|
||||||
{
|
|
||||||
_spanLength = spanLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void CheckTime(long microseconds)
|
|
||||||
{
|
|
||||||
if (microseconds - _spanBegin > _spanLength)
|
|
||||||
{
|
|
||||||
_spanBegin = microseconds;
|
|
||||||
timeSpanCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SubcsribeToTimeSource(TimeSourceProvider serviceHandler)
|
|
||||||
{
|
|
||||||
serviceHandler(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator uint(TimeProvider provider)
|
|
||||||
{
|
|
||||||
return provider.timeSpanCount.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Counter<T> where T : struct, IConvertible, IFormattable, IComparable
|
public class Counter<T> where T : struct, IConvertible, IFormattable, IComparable
|
||||||
{
|
{
|
||||||
internal readonly T _defualtValue;
|
|
||||||
internal readonly T _defualtAddValue;
|
internal readonly T _defualtAddValue;
|
||||||
internal readonly T _defualtSubValue;
|
internal readonly T _defualtSubValue;
|
||||||
|
internal readonly T _defualtValue;
|
||||||
|
|
||||||
internal dynamic _value;
|
internal dynamic _value;
|
||||||
|
|
||||||
public T Value
|
|
||||||
{
|
|
||||||
get { return _value; }
|
|
||||||
set { _value = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Span
|
|
||||||
{
|
|
||||||
get { return _value - _defualtValue; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Increament
|
|
||||||
{
|
|
||||||
get { return _defualtAddValue; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Decreament
|
|
||||||
{
|
|
||||||
get { return _defualtSubValue; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Counter(T defualtValue, T defualtAddValue, T defualtSubValue)
|
public Counter(T defualtValue, T defualtAddValue, T defualtSubValue)
|
||||||
{
|
{
|
||||||
var type = Type.GetTypeCode(defualtValue.GetType());
|
var type = Type.GetTypeCode(defualtValue.GetType());
|
||||||
@@ -120,6 +88,18 @@ namespace StgSharp
|
|||||||
_defualtSubValue = defualtSubValue;
|
_defualtSubValue = defualtSubValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T Decreament => _defualtSubValue;
|
||||||
|
|
||||||
|
public T Increament => _defualtAddValue;
|
||||||
|
|
||||||
|
public T Span => _value - _defualtValue;
|
||||||
|
|
||||||
|
public T Value
|
||||||
|
{
|
||||||
|
get => _value;
|
||||||
|
set => _value = value;
|
||||||
|
}
|
||||||
|
|
||||||
public void Add(T value)
|
public void Add(T value)
|
||||||
{
|
{
|
||||||
_value += value;
|
_value += value;
|
||||||
@@ -130,11 +110,6 @@ namespace StgSharp
|
|||||||
_value += _defualtAddValue;
|
_value += _defualtAddValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Sub(T value)
|
|
||||||
{
|
|
||||||
_value -= value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void QuickSub()
|
public void QuickSub()
|
||||||
{
|
{
|
||||||
_value -= _defualtSubValue;
|
_value -= _defualtSubValue;
|
||||||
@@ -145,10 +120,14 @@ namespace StgSharp
|
|||||||
_value = _defualtValue;
|
_value = _defualtValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Counter<T> operator ++(Counter<T> counter)
|
public void Sub(T value)
|
||||||
{
|
{
|
||||||
counter.QuickAdd();
|
_value -= value;
|
||||||
return counter;
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Value.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Counter<T> operator --(Counter<T> counter)
|
public static Counter<T> operator --(Counter<T> counter)
|
||||||
@@ -157,14 +136,16 @@ namespace StgSharp
|
|||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public static Counter<T> operator ++(Counter<T> counter)
|
||||||
{
|
{
|
||||||
return Value.ToString();
|
counter.QuickAdd();
|
||||||
|
return counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator T(Counter<T> counter)
|
public static implicit operator T(Counter<T> counter)
|
||||||
{
|
{
|
||||||
return counter.Value;
|
return counter.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
using StgSharp.Graphics;
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="Exception.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 System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -11,6 +41,12 @@ namespace StgSharp.Logic
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
internal class FrameTimeoutException : Exception
|
internal class FrameTimeoutException : Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected FrameTimeoutException(
|
||||||
|
System.Runtime.Serialization.SerializationInfo info,
|
||||||
|
System.Runtime.Serialization.StreamingContext context) : base(info, context)
|
||||||
|
{
|
||||||
|
}
|
||||||
internal FrameTimeoutException()
|
internal FrameTimeoutException()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -22,10 +58,5 @@ namespace StgSharp.Logic
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FrameTimeoutException(
|
|
||||||
System.Runtime.Serialization.SerializationInfo info,
|
|
||||||
System.Runtime.Serialization.StreamingContext context) : base(info, context)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user