daily update on 20240328 by nitload youmu, building thread blueprint

This commit is contained in:
YoumuLiu
2024-03-29 11:05:57 +08:00
parent ea2a4a7dcb
commit b207f16616
68 changed files with 1083 additions and 2181 deletions
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.
+192 -54
View File
@@ -2,9 +2,9 @@
Info @ 2024-03-26T02:38:59.2314168+08:00
Info @ 2024-03-28T02:37:44.5856361+08:00
Program start
Info @ 2024-03-26T02:38:59.8036526+08:00
Info @ 2024-03-28T02:37:45.4546914+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -25,15 +25,15 @@ 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-26T02:38:59.8248466+08:00
Info @ 2024-03-28T02:37:45.4716696+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T02:39:43.2284613+08:00
Info @ 2024-03-28T02:39:16.6162724+08:00
Program start
Info @ 2024-03-26T02:39:43.3495223+08:00
Info @ 2024-03-28T02:39:17.2036484+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -54,15 +54,24 @@ 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-26T02:39:43.3602993+08:00
Info @ 2024-03-28T02:39:17.2151445+08:00
No supported OpenGL extensions are found.
Error @ 2024-03-28T02:39:44.1007021+08:00
External component has thrown an exception.
at System.Runtime.InteropServices.GCHandle.Free()
at StgSharp.Graphics.glHandleSet.Free() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\GL\GLhandle.cs:line 267
at StgSharp.Graphics.VertexArray.Dispose(Boolean disposing) in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\GL\Buffer\VAO.cs:line 72
at StgSharp.Graphics.BufferObjectBase.Dispose() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\GL\Buffer\BufferObjectBase.cs:line 63
at StgSharp.StgSharpDemoForm.Deinit() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Program.cs:line 33
at StgSharp.Graphics.Form.Show() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\Form.cs:line 351
at StgSharp.Program.Main(String[] args) in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Program.cs:line 196
Info @ 2024-03-26T02:39:53.4731136+08:00
Info @ 2024-03-28T02:40:25.6999139+08:00
Program start
Info @ 2024-03-26T02:39:54.0832657+08:00
Info @ 2024-03-28T02:40:26.2628730+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -83,15 +92,15 @@ 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-26T02:39:54.0997214+08:00
Info @ 2024-03-28T02:40:26.2728356+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T02:45:11.6704555+08:00
Info @ 2024-03-28T02:42:17.6365230+08:00
Program start
Info @ 2024-03-26T02:45:11.7890817+08:00
Info @ 2024-03-28T02:42:18.1893886+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -112,15 +121,15 @@ 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-26T02:45:11.8028837+08:00
Info @ 2024-03-28T02:42:18.1997649+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T02:45:53.1983817+08:00
Info @ 2024-03-28T02:43:17.5246694+08:00
Program start
Info @ 2024-03-26T02:45:53.3626305+08:00
Info @ 2024-03-28T02:43:17.6296786+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -141,15 +150,15 @@ 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-26T02:45:53.3775527+08:00
Info @ 2024-03-28T02:43:17.6396982+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T14:48:28.4518633+08:00
Info @ 2024-03-28T19:33:19.0856926+08:00
Program start
Info @ 2024-03-26T14:48:29.4711610+08:00
Info @ 2024-03-28T19:33:19.3154651+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -170,15 +179,15 @@ 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-26T14:48:29.5572570+08:00
Info @ 2024-03-28T19:33:19.3251692+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:03:44.9899596+08:00
Info @ 2024-03-28T19:35:44.9383316+08:00
Program start
Info @ 2024-03-26T15:03:45.3004785+08:00
Info @ 2024-03-28T19:35:45.0656943+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -199,15 +208,24 @@ 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-26T15:03:45.3284880+08:00
Info @ 2024-03-28T19:35:45.0748902+08:00
No supported OpenGL extensions are found.
Error @ 2024-03-28T19:36:02.0539438+08:00
Handle is not initialized.
at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
at StgSharp.Graphics.glHandleSet.Release() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\GL\GLhandle.cs:line 293
at StgSharp.Graphics.VertexArray.Dispose(Boolean disposing) in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\GL\Buffer\VAO.cs:line 73
at StgSharp.Graphics.BufferObjectBase.Dispose() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\GL\Buffer\BufferObjectBase.cs:line 63
at StgSharp.StgSharpDemoForm.Deinit() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Program.cs:line 34
at StgSharp.Graphics.Form.Show() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\Form.cs:line 351
at StgSharp.Program.Main(String[] args) in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Program.cs:line 200
Info @ 2024-03-26T15:04:56.8205124+08:00
Info @ 2024-03-28T19:37:53.0318626+08:00
Program start
Info @ 2024-03-26T15:04:57.1338899+08:00
Info @ 2024-03-28T19:37:53.1657730+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -228,15 +246,15 @@ 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-26T15:04:57.1612430+08:00
Info @ 2024-03-28T19:37:53.1761109+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:06:14.3441903+08:00
Info @ 2024-03-28T19:46:12.7061731+08:00
Program start
Info @ 2024-03-26T15:06:14.6937829+08:00
Info @ 2024-03-28T19:46:12.8144834+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -257,15 +275,15 @@ 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-26T15:06:14.7437964+08:00
Info @ 2024-03-28T19:46:12.8239001+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:11:10.4773525+08:00
Info @ 2024-03-28T19:46:31.8717881+08:00
Program start
Info @ 2024-03-26T15:11:10.7953562+08:00
Info @ 2024-03-28T19:46:31.9823512+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -286,15 +304,15 @@ 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-26T15:11:10.8238982+08:00
Info @ 2024-03-28T19:46:31.9935106+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:11:42.7440586+08:00
Info @ 2024-03-29T02:54:39.2538926+08:00
Program start
Info @ 2024-03-26T15:11:43.0557655+08:00
Info @ 2024-03-29T02:54:39.3771936+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -315,15 +333,19 @@ 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-26T15:11:43.0766569+08:00
Info @ 2024-03-29T02:54:39.3860174+08:00
No supported OpenGL extensions are found.
Error @ 2024-03-29T02:54:39.4445589+08:00
Object reference not set to an instance of an object.
at StgSharp.Graphics.Form.Show() in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Graphics\Form\FormThreading.cs:line 52
at StgSharp.Program.Main(String[] args) in D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpDebug\Program.cs:line 200
Info @ 2024-03-26T15:14:24.6347093+08:00
Info @ 2024-03-29T02:54:54.4727336+08:00
Program start
Info @ 2024-03-26T15:14:24.9663728+08:00
Info @ 2024-03-29T02:54:55.6259857+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -344,15 +366,15 @@ 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-26T15:14:24.9961743+08:00
Info @ 2024-03-29T02:54:55.6489902+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:19:57.8485545+08:00
Info @ 2024-03-29T02:55:48.3977425+08:00
Program start
Info @ 2024-03-26T15:19:58.1045088+08:00
Info @ 2024-03-29T02:55:48.9538521+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -373,15 +395,15 @@ 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-26T15:19:58.1252119+08:00
Info @ 2024-03-29T02:55:48.9683933+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:28:47.7454195+08:00
Info @ 2024-03-29T02:56:12.8041360+08:00
Program start
Info @ 2024-03-26T15:28:48.0907375+08:00
Info @ 2024-03-29T02:56:12.9030514+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -402,15 +424,15 @@ 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-26T15:28:48.1316555+08:00
Info @ 2024-03-29T02:56:12.9115618+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:30:16.6975932+08:00
Info @ 2024-03-29T03:00:01.1380209+08:00
Program start
Info @ 2024-03-26T15:30:17.0316180+08:00
Info @ 2024-03-29T03:00:01.2460392+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -431,15 +453,15 @@ 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-26T15:30:17.0718828+08:00
Info @ 2024-03-29T03:00:01.2550415+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:30:53.1424105+08:00
Info @ 2024-03-29T03:05:19.2503616+08:00
Program start
Info @ 2024-03-26T15:30:53.4553141+08:00
Info @ 2024-03-29T03:05:19.3615209+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -460,15 +482,15 @@ 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-26T15:30:53.4843378+08:00
Info @ 2024-03-29T03:05:19.3706004+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:40:02.9998174+08:00
Info @ 2024-03-29T03:07:09.3313156+08:00
Program start
Info @ 2024-03-26T15:40:03.4134380+08:00
Info @ 2024-03-29T03:07:09.4426094+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -489,15 +511,15 @@ 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-26T15:40:03.4461095+08:00
Info @ 2024-03-29T03:07:09.4555261+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-26T15:41:59.4311862+08:00
Info @ 2024-03-29T03:09:16.2846670+08:00
Program start
Info @ 2024-03-26T15:41:59.7176573+08:00
Info @ 2024-03-29T03:09:16.4006091+08:00
Find core OpenGL version.
Successfully load all OpenGL 1.0 APIs
Successfully load all OpenGL 1.1 APIs
@@ -518,5 +540,121 @@ 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-26T15:41:59.7758968+08:00
Info @ 2024-03-29T03:09:16.4093329+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-29T03:09:53.7531927+08:00
Program start
Info @ 2024-03-29T03:09:53.8640307+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-29T03:09:53.8733857+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-29T03:10:31.0492916+08:00
Program start
Info @ 2024-03-29T03:10:31.1705588+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-29T03:10:31.1791396+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-29T03:10:42.8959757+08:00
Program start
Info @ 2024-03-29T03:10:43.0032521+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-29T03:10:43.0131709+08:00
No supported OpenGL extensions are found.
Info @ 2024-03-29T03:10:54.1391996+08:00
Program start
Info @ 2024-03-29T03:10:54.2442451+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-29T03:10:54.2553193+08:00
No supported OpenGL extensions are found.
@@ -11,7 +11,15 @@ uniform vec3 color;
void main()
{
gl_Position = vec4(aPos.xyz,1.0) + vec4(color.xy-vec2(0.5,0.5),0.0,0.0);
float as = color.z-0.5;
float ac = sqrt(1 - as * as);
mat4x4 rotation = mat4x4(
ac,-as,0,0,
as,ac,0,0,
0,0,1,0,
0,0,0,1
);
gl_Position = rotation * (vec4(aPos.xyz,1.0) + vec4(color.xy-vec2(0.5,0.5),0.0,-2.0));
TexColor = color;
TexCoord = aTextCoord;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -35,11 +35,6 @@
Height of this form, represent in <see cref="T:System.Int32"/>
</summary>
</member>
<member name="P:StgSharp.Graphics.Form.IsDoubleRendering">
<summary>
Representing
</summary>
</member>
<member name="P:StgSharp.Graphics.Form.Size">
<summary>
Width of this form, represent in <see cref="T:System.Int32"/>
@@ -50,17 +45,15 @@
Width of this form, represent in <see cref="T:System.Int32"/>
</summary>
</member>
<member name="M:StgSharp.Graphics.Form.Init(System.Object[])">
<member name="M:StgSharp.Graphics.Form.Init">
<summary>
Necessary operation to init this form.
</summary>
<param name="args"></param>
</member>
<member name="M:StgSharp.Graphics.Form.Main">
<summary>
Behaviour of current form when in a frame cycle.
</summary>
<param name="args"></param>
</member>
<member name="M:StgSharp.Graphics.Form.MakeAsCurrentContext">
<summary>
@@ -111,24 +104,16 @@
<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.Show">
<summary>
Init this form and render it on screen, and respond with operation
</summary>
</member>
<member name="M:StgSharp.Graphics.Form.GetGL">
<summary>
Get OpenGL library of this form's context.
</summary>
<returns>A <see cref="T:StgSharp.Graphics.IglFunc"/> package contains all opengl APIs</returns>
</member>
<member name="M:StgSharp.Graphics.Form.SetRenderThreads(System.Int32)">
<member name="M:StgSharp.Graphics.Form.Show">
<summary>
Define how current form render in one frame.
Init this form and render it on screen, and respond with operation
</summary>
<param name="leastThreds">
Please define this befor calling any OpenGL api and other graphic methods.
</param>
</member>
<member name="M:StgSharp.Graphics.Form.CreateElementBuffer(System.Int32)">
<summary>
@@ -164,9 +149,65 @@
</summary>
<returns>New instance of <see cref="T:StgSharp.Graphics.Shader"/> instance. </returns>
</member>
<member name="T:StgSharp.Graphics.RenderActivityAttribute">
<summary>
Mark that a method in a <see cref="T:StgSharp.Graphics.Form"/>
should be called when rendering.
</summary>
</member>
<member name="T:StgSharp.Graphics.RenderPriority">
<summary>
Priority level of a render activity.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_1">
<summary>
One level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_2">
<summary>
Two level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_3">
<summary>
Three level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_1">
<summary>
One level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_2">
<summary>
Two level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_3">
<summary>
Three level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Highest">
<summary>
Highest priority, in <see cref="T:StgSharp.Graphics.RenderPriority"/>, it is <see cref="F:StgSharp.Graphics.RenderPriority.Pre_3"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Default">
<summary>
Default priority, usually <see cref="M:StgSharp.Graphics.Form.Main"/> is in this priority.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Least">
<summary>
Lowest priority, in <see cref="T:StgSharp.Graphics.RenderPriority"/>, it is <see cref="F:StgSharp.Graphics.RenderPriority.Aft_3"/>.
</summary>
</member>
<member name="T:StgSharp.Graphics.BufferObjectBase">
<summary>
Interface of all kinds OpenGL buffer onjects
Interface of all kinds OpenGL buffer objects
</summary>
</member>
<member name="P:StgSharp.Graphics.BufferObjectBase.Item(System.Int32)">
@@ -256,7 +297,7 @@
</member>
<member name="M:StgSharp.Graphics.glHandleSet.Release">
<summary>
Realse all resource in this handle.
Release all resource in this handle.
This will release all resource in this <see cref="T:StgSharp.Graphics.glHandle"/>.
This <see langword="glHandle"/> will be not usable.
</summary>
@@ -53,12 +53,6 @@ namespace StgSharp.Graphics
private short fpsCount;
#region form thread setting
private List<FrameAsyncThread> frameAsyncTaskList;
#endregion form thread setting
private IntPtr windowID;
internal LinkedList<Control> allControl;
@@ -75,8 +69,16 @@ namespace StgSharp.Graphics
protected Form()
{
frameAsyncTaskList = new List<FrameAsyncThread>();
fpsCountProvider = new TimeSpanProvider(1.0, TimeSpanProvider.DefaultProvider);
_frameSpeed = 0;
_frameCount = 0;
fpsCountProvider.SpanRefreshCallback = new TimeSpanRefeshCallback(
() =>
{
Interlocked.Exchange(ref _frameSpeed, _frameCount);
Interlocked.Exchange(ref _frameCount, 0);
});
frameAsyncThreadList = new List<FrameAsyncThread>();
}
@@ -100,7 +102,10 @@ namespace StgSharp.Graphics
public bool ShouldClose
{
get => InternalIO.glfwWindowShouldClose(windowID) != 0;
get
{
return InternalIO.glfwWindowShouldClose(windowID) != 0;
}
set => InternalIO.glfwSetWindowShouldClose(windowID, value ? 1 : 0);
}
@@ -126,6 +131,7 @@ namespace StgSharp.Graphics
set => width = value;
}
public unsafe IntPtr WindowID => windowID;
internal unsafe IntPtr id => windowID;
@@ -185,7 +191,7 @@ namespace StgSharp.Graphics
GLcontext* contextID = (GLcontext*)graphicContextID;
*contextID = new GLcontext();
contextID->glGetString = (delegate*<uint, IntPtr>)IntPtr.Zero;
gl = new GLonRender(contextID);
gl = new GLpack(contextID);
}
InternalIO.glfwMakeContextCurrent(windowID);
}
@@ -264,57 +270,11 @@ namespace StgSharp.Graphics
public void SetSizeLimit(int minWidth, int minHeight, int maxWidth, int maxHeight)
{ InternalIO.glfwSetWindowSizeLimits(this.windowID, minWidth, minHeight, maxWidth, maxHeight); }
#region form main
/// <summary>
/// Init this form and render it on screen, and respond with operation
/// </summary>
public unsafe void Show()
{
if (gl == null)
{
InternalIO.InternalWriteLog($"Attempt to show form {name} before init", LogType.Error);
}
else
{
frameTimeProvider = new TimeSpanProvider(1 / 60.0, TimeSpanProvider.DefaultProvider);
MethodInfo[] methods = this.GetType().GetMethods(
BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
if (methods.Length != 0)
foreach (MethodInfo m in methods)
{
if (m.GetCustomAttribute<RenderActivityAttribute>(false) != null)
{
if (!m.IsStatic && m.GetParameters().Length == 0 && m.ReturnType == typeof(void) )
{
if (m.Name != "Main")
{
FrameAsyncThread t = new();
}
}
else
{
throw new NotSupportedException("A render activity cannot have parameters, returning value or be static.");
}
}
}
while (!ShouldClose)
{
Main();
SwapBuffers();
PollEvents();
frameTimeProvider.WaitNextSpan();
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void InternalDeinit(params object[] args) { Deinit(args); }
internal void InternalDeinit() { Deinit(); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -345,14 +305,8 @@ namespace StgSharp.Graphics
unsafe ~Form() { Marshal.FreeHGlobal(graphicContextID); }
#endregion form main
}
/// <summary>
/// Mark that a method in a <see cref="Form"/>
/// should be called when rendering.
/// </summary>
public class RenderActivityAttribute : Attribute
{
}
}
@@ -0,0 +1,102 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="FormThreadAttribute.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphics
{
/// <summary>
/// Mark that a method in a <see cref="Form"/>
/// should be called when rendering.
/// </summary>
public class RenderActivityAttribute : Attribute
{
internal bool _isRenderProgress;
internal int _priority;
public RenderActivityAttribute(RenderPriority priority, bool IsRenderProgress)
{
_priority = (int)priority; _isRenderProgress = IsRenderProgress;
}
public RenderActivityAttribute(int priority, bool IsRenderProgress)
{
_priority = priority; _isRenderProgress = IsRenderProgress;
}
public int Priority { get => _priority; set => _priority = value; }
}
/// <summary>
/// Priority level of a render activity.
/// </summary>
public enum RenderPriority: int
{
/// <summary>
/// One level higher than <see cref="RenderPriority.Default"/>.
/// </summary>
Pre_1 = -1,
/// <summary>
/// Two level higher than <see cref="RenderPriority.Default"/>.
/// </summary>
Pre_2 = -2,
/// <summary>
/// Three level higher than <see cref="RenderPriority.Default"/>.
/// </summary>
Pre_3 = -3,
/// <summary>
/// One level lower than <see cref="RenderPriority.Default"/>.
/// </summary>
Aft_1 = 1,
/// <summary>
/// Two level lower than <see cref="RenderPriority.Default"/>.
/// </summary>
Aft_2 = 2,
/// <summary>
/// Three level lower than <see cref="RenderPriority.Default"/>.
/// </summary>
Aft_3 = 3,
/// <summary>
/// Highest priority, in <see cref="RenderPriority"/>, it is <see cref="Pre_3"/>.
/// </summary>
Highest = Pre_3,
/// <summary>
/// Default priority, usually <see cref="Form.Main"/> is in this priority.
/// </summary>
Default = 0,
/// <summary>
/// Lowest priority, in <see cref="RenderPriority"/>, it is <see cref="Aft_3"/>.
/// </summary>
Least = Aft_3,
}
}
@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.Graphics
{
public abstract partial class Form
{
#region form thread setting
private List<FrameAsyncThread> frameAsyncThreadList;
#endregion form thread setting
/// <summary>
/// Init this form and render it on screen, and respond with operation
/// </summary>
public unsafe void Show()
{
if (gl == null)
{
InternalIO.InternalWriteLog($"Attempt to show form {name} before init", LogType.Error);
}
else
{
frameTimeProvider = new TimeSpanProvider(1 / 60.0, TimeSpanProvider.DefaultProvider);
MethodInfo[] methods = this.GetType().GetMethods(
BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
if (methods.Length != 0)
{
foreach (MethodInfo m in methods) //find all methods decorated by RenderActivityAttribute
{
RenderActivityAttribute attr = m.GetCustomAttribute<RenderActivityAttribute>(false);
if (attr == null)
{
continue;
}
if (!m.IsStatic && (m.GetParameters().Length != 0) && (m.ReturnType != typeof(void)))
{
throw new NotSupportedException("A render activity cannot have parameters, returning value or be static.");
}
if (m.Name != "Main")
{
ThreadStart s = (ThreadStart)Delegate.CreateDelegate(typeof(ThreadStart), this, m);
FrameAsyncThread t = new(s,attr._priority);
frameAsyncThreadList.Add(t);
}
}
}
List<IGrouping<int,FrameAsyncThread>> threadGroup = frameAsyncThreadList.GroupBy<FrameAsyncThread, int>((t) => t.Priority).ToList();
int priority = 0;
foreach (var group in threadGroup)
{
foreach (var t in group)
{
t.Priority = priority;
}
priority++;
}
(Barrier, Barrier) b = FrameAsyncThread.CombineAsync(true, frameAsyncThreadList);
FrameAsyncThread.AsyncStartAll(frameAsyncThreadList);
if (b.Item1 == null)
{
while (!ShouldClose)
{
Main();
SwapBuffers();
PollEvents();
frameTimeProvider.WaitNextSpan();
Interlocked.Add(ref _frameCount, 1);
}
}
else
{
while (!ShouldClose)
{
b.Item1.SignalAndWait();
Main();
b.Item2.SignalAndWait();
SwapBuffers();
PollEvents();
frameTimeProvider.WaitNextSpan();
Interlocked.Add(ref _frameCount, 1);
}
FrameAsyncThread.TerminateAll(frameAsyncThreadList);
b.Item1.SignalAndWait();
FrameAsyncThread.WaitAll(frameAsyncThreadList);
}
//InternalDeinit();
}
}
}
}
@@ -498,98 +498,128 @@ namespace StgSharp.Graphics
{
private Thread _task;
private int _terminateToken;
private volatile int _terminateToken;
private int _priority;
protected Barrier _frameSpeedSyncBarrier;
protected Barrier _spanCompleteBarrier;
protected Action _taskTODO;
internal FrameOperationBuffer opBuffer;
protected ThreadStart _taskTODO;
internal FrameAsyncThread(Action action, IglFunc gl)
public FrameAsyncThread(ThreadStart action, int priority)
{
_taskTODO = action;
opBuffer = new FrameOperationBuffer(gl);
_terminateToken = 1;
_spanCompleteBarrier = new Barrier(2);
_priority = priority;
}
public Action TaskTODO
public int Priority
{
get => _priority;
internal set { _priority = value; }
}
public ThreadStart TaskTODO
{
get => _taskTODO;
set => _taskTODO = value;
}
public Barrier TodoCompleteBarrier
=> _spanCompleteBarrier;
public virtual void AsyncStart()
public void AsyncStart()
{
_task = new Thread(
() =>
{
while (_terminateToken != 0)
while (true)
{
_frameSpeedSyncBarrier.SignalAndWait();
if (_terminateToken == 0)
{
break;
}
_taskTODO();
_spanCompleteBarrier.SignalAndWait();
}
Console.WriteLine("Thread terminated");
});
_task.Start();
}
public static Barrier CombineAsync(bool needOuterMonitor, List<FrameAsyncThread> taskList)
public static void AsyncStartAll(IEnumerable<FrameAsyncThread> threadList)
{
if (taskList.Count == 0)
foreach (FrameAsyncThread t in threadList)
{
return null;
t.AsyncStart();
}
Barrier b = new Barrier(taskList.Count + (needOuterMonitor ? 1 : 0));
foreach (FrameAsyncThread item in taskList)
{
item._frameSpeedSyncBarrier = b;
}
return b;
}
public static Barrier CombineBeginningAsync(bool needOuterMonitor, params FrameAsyncThread[] taskList)
public static void WaitAll(IEnumerable<FrameAsyncThread> threadList)
{
foreach (FrameAsyncThread t in threadList)
{
t._task.Join();
}
}
public static (Barrier, Barrier) CombineAsync(bool needOuterMonitor, IEnumerable<FrameAsyncThread> taskList)
{
if (taskList.Count() == 0)
{
return (null, null);
}
Barrier b_start = new Barrier(taskList.Count() + (needOuterMonitor ? 1 : 0));
Barrier b_complete = new Barrier(taskList.Count() + (needOuterMonitor ? 1 : 0));
foreach (FrameAsyncThread item in taskList)
{
item._frameSpeedSyncBarrier = b_start;
item._spanCompleteBarrier = b_complete;
}
return (b_start, b_complete);
}
public static (Barrier, Barrier) CombineAsync(bool needOuterMonitor, params FrameAsyncThread[] taskList)
{
if (taskList.Length == 0)
{
return null;
return (null, null);
}
Barrier b = new Barrier(taskList.Length + (needOuterMonitor ? 1 : 0));
Barrier b_start = new Barrier(taskList.Length + (needOuterMonitor ? 1 : 0));
Barrier b_complete = new Barrier(taskList.Length + (needOuterMonitor ? 1 : 0));
foreach (FrameAsyncThread item in taskList)
{
item._frameSpeedSyncBarrier = b;
item._frameSpeedSyncBarrier = b_start;
item._spanCompleteBarrier = b_complete;
}
return b;
}
public static void ExchangeBuffer(FrameAsyncThread task0, FrameAsyncThread task1)
{
FrameOperationBuffer cache = task0.opBuffer;
task0.opBuffer = task1.opBuffer;
task1.opBuffer = cache;
return (b_start, b_complete);
}
public void Terminate()
{
Interlocked.Exchange(ref _terminateToken, 0);
Interlocked.Exchange(ref _terminateToken,0);
}
}
internal sealed class AsyncUpdateDataTask : FrameAsyncThread
{
public AsyncUpdateDataTask(Form f) : base(f.Main, f.GL)
public static void TerminateAll(params FrameAsyncThread[] threadList)
{
foreach (FrameAsyncThread t in threadList)
{
t.Terminate();
}
}
public static void TerminateAll(IEnumerable<FrameAsyncThread> threadList)
{
foreach (FrameAsyncThread t in threadList)
{
t.Terminate();
}
}
}
}
@@ -37,13 +37,13 @@ using System.Threading.Tasks;
namespace StgSharp.Graphics
{
/// <summary>
/// Interface of all kinds OpenGL buffer onjects
/// Interface of all kinds OpenGL buffer objects
/// </summary>
public abstract class BufferObjectBase : IDisposable
{
protected glHandleSet _bufferHandle;
protected Form binding;
protected IglFunc binding;
/// <summary>
/// Get the only handle to one of the Object instance
+6 -6
View File
@@ -48,27 +48,27 @@ namespace StgSharp.Graphics
internal ElementBuffer(int n, Form binding)
{
this.binding = binding;
_bufferHandle = binding.GL.GenBuffers(n);
this.binding = binding.GL;
_bufferHandle = this.binding.GenBuffers(n);
}
public override sealed void Bind(int index)
{
binding.GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
binding.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
}
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage)
where T : struct, IConvertible
{
binding.GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
binding.GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
binding.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
binding.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
}
protected override sealed void Dispose(bool disposing)
{
if (disposing)
{
binding.GL.DeleteBuffers(_bufferHandle);
binding.DeleteBuffers(_bufferHandle);
_bufferHandle.Release();
}
}
+6 -6
View File
@@ -40,26 +40,26 @@ namespace StgSharp.Graphics
internal VertexArray(int n, Form binding)
{
this.binding = binding;
_bufferHandle = binding.GL.GenVertexArrays(n);
this.binding = binding.GL;
_bufferHandle = this.binding.GenVertexArrays(n);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override sealed void Bind(int index)
{
binding.GL.BindVertexArray(_bufferHandle[index]);
binding.BindVertexArray(_bufferHandle[index]);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindNull()
{
binding.GL.BindVertexArray(glHandle.Zero);
binding.BindVertexArray(glHandle.Zero);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute(uint index, int vertexLength, TypeCode dataType, bool isNomalized, uint stride, int pointer)
{
binding.GL.SetVertexAttribute(
binding.SetVertexAttribute(
index, vertexLength, dataType,
isNomalized,
stride, pointer);
@@ -69,7 +69,7 @@ namespace StgSharp.Graphics
{
if (disposing)
{
binding.GL.DeleteVertexArrays(_bufferHandle);
binding.DeleteVertexArrays(_bufferHandle);
_bufferHandle.Release();
}
}
+9 -11
View File
@@ -45,13 +45,13 @@ namespace StgSharp.Graphics
internal VertexBuffer(int n, Form binding)
{
this.binding = binding;
_bufferHandle = binding.GL.GenBuffers(n);
this.binding = binding.GL;
_bufferHandle = this.binding.GenBuffers(n);
}
public override sealed void Bind(int index)
{
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
binding.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
}
/// <summary>
@@ -63,8 +63,8 @@ namespace StgSharp.Graphics
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
public void SetValue<T>(int index, T bufferData, BufferUsage usage) where T : struct, IMat
{
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
binding.GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
binding.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
binding.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
}
/// <summary>
@@ -76,8 +76,8 @@ namespace StgSharp.Graphics
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
public void SetValueArray<T>(int index, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible
{
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
binding.GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
binding.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
binding.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
}
/// <summary>
@@ -86,16 +86,14 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Unbind()
{
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
binding.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
}
protected override sealed void Dispose(bool disposing)
{
if (disposing)
{
binding.GL.DeleteBuffers(_bufferHandle);
binding.DeleteBuffers(_bufferHandle);
_bufferHandle.Release();
}
}
+1 -1
View File
@@ -278,7 +278,7 @@ namespace StgSharp.Graphics
}
/// <summary>
/// Realse all resource in this handle.
/// Release all resource in this handle.
/// This will release all resource in this <see cref="glHandle"/>.
/// This <see langword="glHandle"/> will be not usable.
/// </summary>
+2 -2
View File
@@ -40,13 +40,13 @@ using System.Text;
namespace StgSharp.Graphics
{
internal unsafe partial class GLonRender : IglFunc
internal unsafe partial class GLpack : IglFunc
{
private FrameTimeoutException refreshSIgnal = new FrameTimeoutException();
internal GLcontext* api;
internal GLonRender(GLcontext* context)
internal GLpack(GLcontext* context)
{
api = context;
}
@@ -1,407 +0,0 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// 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 System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.Graphics
{
internal sealed unsafe partial class GLonUpdate : IglFunc
{
private GLcontext* api;
private FrameOperationBuffer frameOpBuffer;
internal GLonUpdate(GLcontext* context)
{
api = context;
}
public FrameOperationBuffer ActivatedOperationBuffer
{
get => frameOpBuffer;
set => frameOpBuffer = value;
}
public void GLswapBuffers(Form form)
{
if (form.WindowID == IntPtr.Zero)
{
return;
}
InternalIO.glfwSwapBuffers(form.id);
}
void IglFunc.ActiveTexture(uint type)
{
frameOpBuffer.ParamEnqueue(type);
frameOpBuffer.MethodEnqueue(ActiveTexturePtr);
}
void IglFunc.AfterAlign(Form form, Action action)
{
throw new NotImplementedException();
}
void IglFunc.AlignFrame(Form form)
{
throw new NotImplementedException();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
unsafe void IglFunc.AttachShader(glHandle program, glHandle shader)
{
frameOpBuffer.ParamEnqueue(program, shader);
frameOpBuffer.MethodEnqueue(AttachShaderPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindBuffer(BufferType bufferType, glHandle handle)
{
M128 m = default;
m.Write<uint>(0, (uint)bufferType);
m.Write<ulong>(1, (ulong)handle.valuePtr);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(BindBufferPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindTexture(uint type, glHandle texture)
{
M128 m = default;
m.Write<uint>(0, type);
m.Write<ulong>(1, (ulong)texture.valuePtr);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(BindTexturePtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindVertexArray(glHandle index)
{
frameOpBuffer.ParamEnqueue(index);
frameOpBuffer.MethodEnqueue(BindVertexArrayPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.Clear(MaskBufferBit mask)
{
frameOpBuffer.ParamEnqueue((uint)mask);
frameOpBuffer.MethodEnqueue(ClearPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.ClearColor(float R, float G, float B, float A)
{
frameOpBuffer.ParamEnqueue(R, G, B, A);
frameOpBuffer.MethodEnqueue(ClearColorPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.ClearGraphicError()
{
frameOpBuffer.MethodEnqueue(ClearGraphicErrorPtr);
}
unsafe void IglFunc.CompileShader(glHandle shaderhandle)
{
frameOpBuffer.ParamEnqueue((IntPtr)shaderhandle.valuePtr);
frameOpBuffer.MethodEnqueue(CompileShaderPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandle IglFunc.CreateProgram()
{
glHandle h = glHandle.Alloc(1);
frameOpBuffer.ParamEnqueue(h);
frameOpBuffer.MethodEnqueue(CreateProgramPtr);
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandleSet IglFunc.CreateProgram(int count)
{
M128 m = default;
glHandleSet h = new glHandleSet(count);
m.Write<ulong>(0, (ulong)h.handle);
m.Write<int>(2, count);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(CreateProgramSetPtr);
return h;
}
glHandleSet IglFunc.CreateShaderSet(int count, ShaderType type)
{
glHandleSet ret = new glHandleSet(count);
M128 m = new M128();
m.Write<int>(0, count);
m.Write<uint>(1, (uint)type);
m.Write<ulong>(1, (ulong)ret.handle);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(CreateShaderPtr);
return ret;
}
IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share)
{
byte[] tittleBytes = Encoding.UTF8.GetBytes(tittle);
IntPtr windowPtr;
if (share == null)
{
windowPtr = InternalIO.glfwCreateWindow(
width, height, tittleBytes, monitor, IntPtr.Zero);
}
else
{
windowPtr = InternalIO.glfwCreateWindow(
width, height, tittleBytes, monitor, share.id);
}
if (((long)windowPtr == -1) || ((long)windowPtr == -2))
{
throw new Exception("Cannot create window instance!");
}
else
{
return windowPtr;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandle IglFunc.CreatGraphicProgram()
{
glHandle h = glHandle.Alloc(1);
frameOpBuffer.ParamEnqueue(h);
frameOpBuffer.MethodEnqueue(CreateProgramPtr);
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
unsafe void IglFunc.DeleteBuffer(glHandle handle)
{
M128 m = default;
m.Write<ulong>(0, (ulong)handle.valuePtr);
m.Write(2, 1);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(DeleBufferPtr);
}
unsafe void IglFunc.DeleteBuffers(glHandleSet handle)
{
M128 m = default;
m.Write<ulong>(0, (ulong)handle.handle);
m.Write<uint>(2, (uint)handle.length);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(DeleBufferPtr);
}
unsafe void IglFunc.DeleteVertexArrays(glHandleSet arrays)
{
M128 m = default; m.Write<ulong>(1, (ulong)arrays.handle);
m.Write<int>(0, arrays.length);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(DeleteVertexArrayPtr);
}
void IglFunc.DrawElements(GepmetryType mode, uint count, TypeCode type, IntPtr ptr)
{
uint a;
switch (type)
{
case TypeCode.UInt32:
a = GLconst.UNSIGNED_INT;
break;
case TypeCode.UInt16:
a = GLconst.UNSIGNED_SHORT;
break;
case TypeCode.Byte:
a = GLconst.UNSIGNED_BYTE;
break;
default:
InternalIO.InternalWriteLog(
$"{$"Parameter error in parameter {type} method DrawElements. "}{$"Only {TypeCode.Byte}, {TypeCode.UInt16}, {TypeCode.UInt32} types are suporrted."}",
LogType.Error);
return;
}
frameOpBuffer.ParamEnqueue((uint)mode, count, a);
frameOpBuffer.ParamEnqueue(ptr);
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)
{
glHandleSet h = new glHandleSet(count);
M128 m = default; m.Write<uint>(2, (uint)count); m.Write<ulong>(0, (ulong)h.handle);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(GenBufferPtr);
return h;
}
unsafe glHandleSet IglFunc.GenTextures(int count)
{
glHandleSet h = new glHandleSet(count);
M128 m = default; m.Write<uint>(2, (uint)count); m.Write<ulong>(0, (ulong)h.handle);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(GenTexturesPtr);
return h;
}
unsafe glHandleSet IglFunc.GenVertexArrays(int count)
{
glHandleSet h = new glHandleSet(count);
M128 m = default; m.Write<uint>(2, (uint)count); m.Write<ulong>(0, (ulong)h.handle);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(GenTexturesPtr);
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
unsafe glSHandle IglFunc.GetUniformLocation(glHandle program, string ptr)
{
glSHandle h = glSHandle.Alloc(0);
M128 m = default;
m.Write<ulong>(0, (ulong)program.Handle);
m.Write<ulong>(1, (ulong)GCHandle.Alloc(Encoding.UTF8.GetBytes(ptr), GCHandleType.Pinned).AddrOfPinnedObject());
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.ParamEnqueue((IntPtr)h.valuePtr);
frameOpBuffer.MethodEnqueue(GetUniformLocationPtr);
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
bool IglFunc.GetWindowShouldClose(Form form)
{
return InternalIO.glfwWindowShouldClose(form.id) == 0;
}
void IglFunc.LoadShaderSource(glHandle shaderHandle, string codeStream)
{
frameOpBuffer.ParamEnqueue(shaderHandle);
frameOpBuffer.ParamEnqueue(codeStream);
frameOpBuffer.MethodEnqueue(ShaderSourcePtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.MakeContexCurrent(Form form)
{
if (form.WindowID == IntPtr.Zero)
{
return;
}
InternalIO.glfwMakeContextCurrent(form.id);
}
void IglFunc.SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage)
{
frameOpBuffer.ParamEnqueue((uint)bufferType, (uint)usage);
frameOpBuffer.ParamEnqueue((IntPtr)sizeof(T));
frameOpBuffer.ParamEnqueue<T>(new T[] { bufferData });
frameOpBuffer.MethodEnqueue(BufferDataPtr);
}
void IglFunc.SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage)
{
T[] copy = new T[bufferArray.Length];
lock (bufferArray)
{
bufferArray.CopyTo(copy, 0);
}
frameOpBuffer.ParamEnqueue((uint)bufferType, (uint)usage);
frameOpBuffer.ParamEnqueue((IntPtr)(Marshal.SizeOf<T>() * bufferArray.Length));
frameOpBuffer.ParamEnqueue<T>(copy);
frameOpBuffer.MethodEnqueue(BufferDataPtr);
}
void IglFunc.SetVertexAttribute(uint index, int size, TypeCode t, bool normalized, uint stride, int pointer)
{
uint type = InternalIO.GLtype[t];
frameOpBuffer.ParamEnqueue(index, type, stride);
frameOpBuffer.ParamEnqueue(size, normalized ? 1 : 0, pointer);
frameOpBuffer.MethodEnqueue(SetVertexArrayPtr);
}
unsafe void IglFunc.TextureImage2d<T>(int target, int level, uint internalFormat, uint width, uint height, uint format, uint type, glHandle pixels)
{
frameOpBuffer.ParamEnqueue(pixels);
frameOpBuffer.ParamEnqueue((uint)level, internalFormat, width, height);
frameOpBuffer.ParamEnqueue((uint)target, format, type);
frameOpBuffer.MethodEnqueue(textureImage2dPtr);
}
void IglFunc.TextureParameter(int target, uint pname, int param)
{
M128 m = default;
m.Write<int>(0, target);
m.Write<uint>(2, pname);
m.Write<int>(3, param);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(TextureParameterPtr);
}
void IglFunc.UseProgram(glHandle program)
{
frameOpBuffer.ParamEnqueue((IntPtr)program.valuePtr);
frameOpBuffer.MethodEnqueue(UseProgramPtr);
}
void IglFunc.Viewport(int x, int y, uint width, uint height)
{
Vec4d v = new Vec4d(x, y, (int)width, (int)height);
frameOpBuffer.ParamEnqueue(v);
frameOpBuffer.MethodEnqueue(ViewPortPtr);
}
GLcontext* IglFunc.Context => api;
}
}
@@ -1,275 +0,0 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// 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 System;
using System.Linq;
namespace StgSharp.Graphics
{
internal unsafe partial class GLonUpdate : IglFunc
{
private IntPtr ActiveTexturePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalActiveTexture;
private IntPtr AttachShaderPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalAttachShader;
private IntPtr BindBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindBuffer;
private IntPtr BindTexturePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindTexture;
private IntPtr BindVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindVertexArray;
private IntPtr BufferDataPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalSetBufferData;
private IntPtr ClearColorPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClearColor;
private IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClearGraphicError;
private IntPtr ClearPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClear;
private IntPtr CompileShaderPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalCompileShader;
private IntPtr CreateProgramPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalCreateProgram;
private IntPtr CreateProgramSetPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalCreateProgramSet;
private IntPtr CreateShaderPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalCreateShader;
private IntPtr DeleBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalDeleteBuffer;
private IntPtr DeleteVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalDeleteVertexArrays;
private IntPtr DrawElementsPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalDrawElements;
private IntPtr GenBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenBuffers;
private IntPtr GenTexturesPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenTextures;
private IntPtr GetUniformLocationPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGetUniformLocation;
private IntPtr SetVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalSetVertexAttribute;
private IntPtr ShaderSourcePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalShaderSource;
private IntPtr textureImage2dPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalTextureImage2d;
private IntPtr TextureParameterPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalTextureParameter;
private IntPtr UseProgramPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalUseProgram;
private IntPtr ViewPortPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalViewport;
private static void InternalActiveTexture(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
uint t;
frameBuffer.TryDequeue(out t);
activatedContext->glActiveTexture(t);
}
private static void InternalAttachShader(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
uint p, s;
frameBuffer.TryDequeue(out p, out s);
activatedContext->glAttachShader(p, s);
}
private static void InternalBindBuffer(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = new M128();
frameBuffer.TryDequeue(out m);
uint usage = m.Read<uint>(0);
uint handle = *(uint*)m.Read<ulong>(1);
activatedContext->glBindBuffer(usage, handle);
}
private static void InternalBindTexture(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
activatedContext->glBindTexture(
m.Read<uint>(0),
*(uint*)m.Read<ulong>(1)
);
}
private static void InternalBindVertexArray(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr i;
frameBuffer.TryDequeue(out i);
activatedContext->glBindVertexArray(*(uint*)i);
}
private static void InternalClear(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
uint mt;
frameBuffer.TryDequeue(out mt);
activatedContext->glClear(mt);
}
private static void InternalClearColor(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
float r, g, b, a;
frameBuffer.TryDequeue(out r, out g, out b, out a);
activatedContext->glClearColor(r, g, b, a);
}
private static void InternalClearGraphicError(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
while (activatedContext->glGetError() != 0) { }
}
private static unsafe void InternalCompileShader(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr handle = default;
frameBuffer.TryDequeue(out handle);
activatedContext->glCompileShader(*(uint*)handle);
}
private static void InternalCreateProgram(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr programHandle = default;
frameBuffer.TryDequeue(out programHandle);
*(uint*)programHandle = activatedContext->glCreateProgram();
}
private static void InternalCreateProgramSet(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
uint* programHandle;
M128 m = default;
frameBuffer.TryDequeue(out m);
programHandle = (uint*)m.Read<ulong>(0);
for (int i = 0; i < m.Read<int>(2); i++)
{
*(programHandle + i) = activatedContext->glCreateProgram();
}
}
private static unsafe void InternalCreateShader(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
int count = m.Read<int>(0); uint type = m.Read<uint>(1); uint* handle = (uint*)m.Read<ulong>(1);
for (int i = 0; i < count; i++)
{
*(handle + i) = activatedContext->glCreateShader(type);
}
}
private static void InternalDeleteBuffer(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
activatedContext->glDeleteBuffers(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
for (int i = 0; i < m.Read<uint>(2); i++)
{
*(((uint*)m.Read<ulong>(0)) + i) = 0;
}
}
private static void InternalDeleteVertexArrays(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
activatedContext->glDeleteVertexArrays((uint)m.Read<int>(0), (uint*)m.Read<ulong>(0));
}
private static void InternalDrawElements(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
uint mode, count, type;
IntPtr ptr;
frameBuffer.TryDequeue(out mode, out count, out type);
frameBuffer.TryDequeue(out ptr);
activatedContext->glDrawElements(mode, count, type, (void*)ptr);
}
private static void InternalGenBuffers(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
activatedContext->glGenBuffers(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
}
private static void InternalGenTextures(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
activatedContext->glGenTextures(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
}
private static void InternalGetUniformLocation(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr programHandle = default, nameHandle = default, targetHandle = default;
frameBuffer.TryDequeue(out programHandle, out nameHandle);
frameBuffer.TryDequeue(out targetHandle);
*(int*)targetHandle = activatedContext->glGetUniformLocation(*(uint*)programHandle, (byte*)nameHandle);
}
private static void InternalSetBufferData(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
uint type = 0, use = 0;
IntPtr size = default;
glArrayHandle array = default;
frameBuffer.TryDequeue(out type, out use);
frameBuffer.TryDequeue(out size);
frameBuffer.TryDequeue(out array);
activatedContext->glBufferData(type, size, array.AddressOfArray(), use);
}
private static void InternalSetVertexAttribute(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
uint index, type, stride;
int size, normalized, pointer;
frameBuffer.TryDequeue(out index, out type, out stride);
frameBuffer.TryDequeue(out size, out normalized, out pointer);
activatedContext->glVertexAttribPointer(index, size, type, normalized, stride, (void*)pointer);
activatedContext->glEnableVertexAttribArray(index);
}
private static unsafe void InternalShaderSource(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr handle = default;
glArrayHandle stream = default;
frameBuffer.TryDequeue(out handle);
frameBuffer.TryDequeue(out stream);
IntPtr buffer = stream.AddressOfArray();
activatedContext->glShaderSource(*(uint*)handle, 1, (byte**)&buffer, (void*)0);
}
private static void InternalTextureImage2d(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr pix = IntPtr.Zero;
uint target, level, internalFormat, width, height, format, type;
frameBuffer.TryDequeue(out pix);
frameBuffer.TryDequeue(out level, out internalFormat, out width, out height);
frameBuffer.TryDequeue(out target, out format, out type);
activatedContext->glTexImage2D(target, (int)level, internalFormat, width, height, 0, format, type, (void*)pix);
}
private static void InternalTextureParameter(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
activatedContext->glTextureParameteri(m.Read<uint>(0), m.Read<uint>(2), m.Read<int>(3));
}
private static void InternalUseProgram(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr handle = IntPtr.Zero;
frameBuffer.TryDequeue(out handle);
activatedContext->glUseProgram(*(uint*)handle);
}
private static void InternalViewport(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
activatedContext->glViewport(m.Read<int>(0), m.Read<int>(1), m.Read<uint>(2), m.Read<uint>(3));
}
}
}
@@ -126,7 +126,7 @@ namespace StgSharp.Graphics
}
internal partial class GLonRender : IglFunc
internal partial class GLpack : IglFunc
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -173,118 +173,4 @@ namespace StgSharp.Graphics
}
internal unsafe partial class GLonUpdate
{
private IntPtr UniformVal1fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1f;
private IntPtr UniformVal1fvPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1fv;
private IntPtr UniformVal1iPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal1i;
private IntPtr UniformVal2fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal2f;
private IntPtr UniformVal3fPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&UniformVal3f;
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)
{
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
frameOpBuffer.ParamEnqueue(f0, f1, f2);
frameOpBuffer.MethodEnqueue(UniformVal3fPtr);
}
unsafe void IglFunc.SetValue(Uniform<float, float> uniform, float f0, float f1)
{
M128 m = default;
m.Write<ulong>(0, (ulong)uniform.id.valuePtr);
m.Write<float>(2, f0);
m.Write<float>(3, f1);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(UniformVal2fPtr);
}
unsafe void IglFunc.SetValue(Uniform<float, float, float, float> uniform, float f0, float f1, float f2, float f3)
{
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
frameOpBuffer.ParamEnqueue(f0, f1, f2, f3);
frameOpBuffer.MethodEnqueue(UniformVal4fPtr);
}
unsafe void IglFunc.SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
{
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
frameOpBuffer.ParamEnqueue(vec);
frameOpBuffer.MethodEnqueue(UniformVal1fvPtr);
}
unsafe void IglFunc.SetValue(Uniform<float> uniform, float f0)
{
M128 m = default;
m.Write<ulong>(0, (ulong)uniform.id.valuePtr);
m.Write<float>(2, f0);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(UniformVal1fPtr);
}
unsafe void IglFunc.SetValue(Uniform<int> uniform, int i0)
{
M128 m = default;
m.Write<ulong>(0, (ulong)uniform.id.valuePtr);
m.Write<int>(2, i0);
frameOpBuffer.ParamEnqueue(m);
frameOpBuffer.MethodEnqueue(UniformVal1fPtr);
}
unsafe void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
{
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
frameOpBuffer.ParamEnqueue(vec);
frameOpBuffer.MethodEnqueue(UniformVal1fvPtr);
}
}
}
@@ -66,6 +66,7 @@ namespace StgSharp
_maxSpanCount = int.MaxValue;
provider.AddSubscriber(this);
_subscribed = true;
_refeshCallback = () => { };
}
/// <summary>
@@ -81,6 +82,7 @@ namespace StgSharp
_maxSpanCount = int.MaxValue;
provider.AddSubscriber(this);
_subscribed = true;
_refeshCallback = () => { };
}
/// <summary>
@@ -144,6 +146,7 @@ namespace StgSharp
timeSpanCount++;
try
{
_refeshCallback();
_refreshSemaphore.Release();
}
catch (SemaphoreFullException ex)
@@ -35,11 +35,6 @@
Height of this form, represent in <see cref="T:System.Int32"/>
</summary>
</member>
<member name="P:StgSharp.Graphics.Form.IsDoubleRendering">
<summary>
Representing
</summary>
</member>
<member name="P:StgSharp.Graphics.Form.Size">
<summary>
Width of this form, represent in <see cref="T:System.Int32"/>
@@ -50,17 +45,15 @@
Width of this form, represent in <see cref="T:System.Int32"/>
</summary>
</member>
<member name="M:StgSharp.Graphics.Form.Init(System.Object[])">
<member name="M:StgSharp.Graphics.Form.Init">
<summary>
Necessary operation to init this form.
</summary>
<param name="args"></param>
</member>
<member name="M:StgSharp.Graphics.Form.Main">
<summary>
Behaviour of current form when in a frame cycle.
</summary>
<param name="args"></param>
</member>
<member name="M:StgSharp.Graphics.Form.MakeAsCurrentContext">
<summary>
@@ -111,24 +104,16 @@
<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.Show">
<summary>
Init this form and render it on screen, and respond with operation
</summary>
</member>
<member name="M:StgSharp.Graphics.Form.GetGL">
<summary>
Get OpenGL library of this form's context.
</summary>
<returns>A <see cref="T:StgSharp.Graphics.IglFunc"/> package contains all opengl APIs</returns>
</member>
<member name="M:StgSharp.Graphics.Form.SetRenderThreads(System.Int32)">
<member name="M:StgSharp.Graphics.Form.Show">
<summary>
Define how current form render in one frame.
Init this form and render it on screen, and respond with operation
</summary>
<param name="leastThreds">
Please define this befor calling any OpenGL api and other graphic methods.
</param>
</member>
<member name="M:StgSharp.Graphics.Form.CreateElementBuffer(System.Int32)">
<summary>
@@ -164,9 +149,65 @@
</summary>
<returns>New instance of <see cref="T:StgSharp.Graphics.Shader"/> instance. </returns>
</member>
<member name="T:StgSharp.Graphics.RenderActivityAttribute">
<summary>
Mark that a method in a <see cref="T:StgSharp.Graphics.Form"/>
should be called when rendering.
</summary>
</member>
<member name="T:StgSharp.Graphics.RenderPriority">
<summary>
Priority level of a render activity.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_1">
<summary>
One level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_2">
<summary>
Two level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_3">
<summary>
Three level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_1">
<summary>
One level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_2">
<summary>
Two level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_3">
<summary>
Three level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Highest">
<summary>
Highest priority, in <see cref="T:StgSharp.Graphics.RenderPriority"/>, it is <see cref="F:StgSharp.Graphics.RenderPriority.Pre_3"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Default">
<summary>
Default priority, usually <see cref="M:StgSharp.Graphics.Form.Main"/> is in this priority.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Least">
<summary>
Lowest priority, in <see cref="T:StgSharp.Graphics.RenderPriority"/>, it is <see cref="F:StgSharp.Graphics.RenderPriority.Aft_3"/>.
</summary>
</member>
<member name="T:StgSharp.Graphics.BufferObjectBase">
<summary>
Interface of all kinds OpenGL buffer onjects
Interface of all kinds OpenGL buffer objects
</summary>
</member>
<member name="P:StgSharp.Graphics.BufferObjectBase.Item(System.Int32)">
@@ -256,7 +297,7 @@
</member>
<member name="M:StgSharp.Graphics.glHandleSet.Release">
<summary>
Realse all resource in this handle.
Release all resource in this handle.
This will release all resource in this <see cref="T:StgSharp.Graphics.glHandle"/>.
This <see langword="glHandle"/> will be not usable.
</summary>
@@ -1,33 +1,3 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="StgSharp.AssemblyInfo.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.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
@@ -44,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f0d91b6d5195682edaab2a326e5daaba61f53271")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ea2a4a7dcb0a67c25bbc49839aeb8cd582ba0408")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
8f8cd456f79aeac09162ed14b0ca15407c6bbf42d945e66dbac8506190809dde
e98209826223496877066c7b9b8fb747c9a4fad28c0ba7f1290b1d697534cfd6
@@ -1 +1 @@
88b26f7107904754ed6637d3c4e9c3be1765bb7c3e311b32b6041c64e70bd4bc
8d3f5e7e5848b154dd92fb1ad2c808cc693bc89b81e0604c294eb6d67b6397da
@@ -1 +1 @@
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/f0d91b6d5195682edaab2a326e5daaba61f53271/*"}}
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/ea2a4a7dcb0a67c25bbc49839aeb8cd582ba0408/*"}}
@@ -35,11 +35,6 @@
Height of this form, represent in <see cref="T:System.Int32"/>
</summary>
</member>
<member name="P:StgSharp.Graphics.Form.IsDoubleRendering">
<summary>
Representing
</summary>
</member>
<member name="P:StgSharp.Graphics.Form.Size">
<summary>
Width of this form, represent in <see cref="T:System.Int32"/>
@@ -50,17 +45,15 @@
Width of this form, represent in <see cref="T:System.Int32"/>
</summary>
</member>
<member name="M:StgSharp.Graphics.Form.Init(System.Object[])">
<member name="M:StgSharp.Graphics.Form.Init">
<summary>
Necessary operation to init this form.
</summary>
<param name="args"></param>
</member>
<member name="M:StgSharp.Graphics.Form.Main">
<summary>
Behaviour of current form when in a frame cycle.
</summary>
<param name="args"></param>
</member>
<member name="M:StgSharp.Graphics.Form.MakeAsCurrentContext">
<summary>
@@ -111,24 +104,16 @@
<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.Show">
<summary>
Init this form and render it on screen, and respond with operation
</summary>
</member>
<member name="M:StgSharp.Graphics.Form.GetGL">
<summary>
Get OpenGL library of this form's context.
</summary>
<returns>A <see cref="T:StgSharp.Graphics.IglFunc"/> package contains all opengl APIs</returns>
</member>
<member name="M:StgSharp.Graphics.Form.SetRenderThreads(System.Int32)">
<member name="M:StgSharp.Graphics.Form.Show">
<summary>
Define how current form render in one frame.
Init this form and render it on screen, and respond with operation
</summary>
<param name="leastThreds">
Please define this befor calling any OpenGL api and other graphic methods.
</param>
</member>
<member name="M:StgSharp.Graphics.Form.CreateElementBuffer(System.Int32)">
<summary>
@@ -164,9 +149,65 @@
</summary>
<returns>New instance of <see cref="T:StgSharp.Graphics.Shader"/> instance. </returns>
</member>
<member name="T:StgSharp.Graphics.RenderActivityAttribute">
<summary>
Mark that a method in a <see cref="T:StgSharp.Graphics.Form"/>
should be called when rendering.
</summary>
</member>
<member name="T:StgSharp.Graphics.RenderPriority">
<summary>
Priority level of a render activity.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_1">
<summary>
One level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_2">
<summary>
Two level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_3">
<summary>
Three level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_1">
<summary>
One level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_2">
<summary>
Two level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_3">
<summary>
Three level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Highest">
<summary>
Highest priority, in <see cref="T:StgSharp.Graphics.RenderPriority"/>, it is <see cref="F:StgSharp.Graphics.RenderPriority.Pre_3"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Default">
<summary>
Default priority, usually <see cref="M:StgSharp.Graphics.Form.Main"/> is in this priority.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Least">
<summary>
Lowest priority, in <see cref="T:StgSharp.Graphics.RenderPriority"/>, it is <see cref="F:StgSharp.Graphics.RenderPriority.Aft_3"/>.
</summary>
</member>
<member name="T:StgSharp.Graphics.BufferObjectBase">
<summary>
Interface of all kinds OpenGL buffer onjects
Interface of all kinds OpenGL buffer objects
</summary>
</member>
<member name="P:StgSharp.Graphics.BufferObjectBase.Item(System.Int32)">
@@ -256,7 +297,7 @@
</member>
<member name="M:StgSharp.Graphics.glHandleSet.Release">
<summary>
Realse all resource in this handle.
Release all resource in this handle.
This will release all resource in this <see cref="T:StgSharp.Graphics.glHandle"/>.
This <see langword="glHandle"/> will be not usable.
</summary>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3 -1
View File
@@ -1 +1,3 @@
StgSharpC.vcxproj -> D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpC.dll
正在创建库 D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpC.lib 和对象 D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpC.exp
LINK : warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
StgSharpC.vcxproj -> D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharpC.dll
+19 -7
View File
@@ -27,12 +27,16 @@ namespace StgSharp
}
}
public override void Deinit(object[] args)
public override void Deinit()
{
/**/
Console.WriteLine(1);
vao.Dispose();
Console.WriteLine(2);
vbo.Dispose();
Console.WriteLine(3);
ebo.Dispose();
Console.WriteLine(4);
/**/
}
@@ -42,15 +46,13 @@ namespace StgSharp
gl.Viewport(0, 0, width, height);
}
public override void Init(object[] args)
public override void Init()
{
InternalIO.InternalWriteLog("\n\n\n", "Program start", LogType.Info);
SetRenderThreads(2);
SetMetadata(800, 600, "Hello, STG#!", IntPtr.Zero, null);
SetMetadata(800, 800, "Hello, STG#!", IntPtr.Zero, null);
MakeAsCurrentContext();
SetSizeLimit(800, 600, 800, 600);
SetSizeLimit(800, 800, 800, 800);
this.LoadGLapi(null);
FrameBufferSizeCallback =
(IntPtr id, uint width, uint height) =>
@@ -167,7 +169,17 @@ namespace StgSharp
vao.BindNull();
/**/
Console.WriteLine(1);
Console.Clear();
Console.WriteLine(FrameSpeed);
}
//[RenderActivity(RenderPriority.Default,false)]
public void Beep()
{
if (CurrentFrameCount%60==0)
{
Console.Beep();
}
}
}
+9 -1
View File
@@ -11,7 +11,15 @@ uniform vec3 color;
void main()
{
gl_Position = vec4(aPos.xyz,1.0) + vec4(color.xy-vec2(0.5,0.5),0.0,0.0);
float as = color.z-0.5;
float ac = sqrt(1 - as * as);
mat4x4 rotation = mat4x4(
ac,-as,0,0,
as,ac,0,0,
0,0,1,0,
0,0,0,1
);
gl_Position = rotation * (vec4(aPos.xyz,1.0) + vec4(color.xy-vec2(0.5,0.5),0.0,0.0));
TexColor = color;
TexCoord = aTextCoord;
}
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f0d91b6d5195682edaab2a326e5daaba61f53271")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ea2a4a7dcb0a67c25bbc49839aeb8cd582ba0408")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
f9459952dd47bd41dcc123b52a4718f98eb61cf0fdc390afb1acf1f1b33d7062
c385dcdffa8fc64c5dbee012681b30ca72e22bfa0e770022c4e8ab92f11215ca
@@ -1 +1 @@
575ff880dd336b341cc36500cd23ede305b168666cb797489c1cb322b8eb07cb
87387179d403eda220c231b05b13d28d27488334b6bc1d1fc43e415db883f5d6
@@ -1 +1 @@
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/f0d91b6d5195682edaab2a326e5daaba61f53271/*"}}
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/ea2a4a7dcb0a67c25bbc49839aeb8cd582ba0408/*"}}
@@ -35,11 +35,6 @@
Height of this form, represent in <see cref="T:System.Int32"/>
</summary>
</member>
<member name="P:StgSharp.Graphics.Form.IsDoubleRendering">
<summary>
Representing
</summary>
</member>
<member name="P:StgSharp.Graphics.Form.Size">
<summary>
Width of this form, represent in <see cref="T:System.Int32"/>
@@ -50,17 +45,15 @@
Width of this form, represent in <see cref="T:System.Int32"/>
</summary>
</member>
<member name="M:StgSharp.Graphics.Form.Init(System.Object[])">
<member name="M:StgSharp.Graphics.Form.Init">
<summary>
Necessary operation to init this form.
</summary>
<param name="args"></param>
</member>
<member name="M:StgSharp.Graphics.Form.Main">
<summary>
Behaviour of current form when in a frame cycle.
</summary>
<param name="args"></param>
</member>
<member name="M:StgSharp.Graphics.Form.MakeAsCurrentContext">
<summary>
@@ -111,24 +104,16 @@
<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.Show">
<summary>
Init this form and render it on screen, and respond with operation
</summary>
</member>
<member name="M:StgSharp.Graphics.Form.GetGL">
<summary>
Get OpenGL library of this form's context.
</summary>
<returns>A <see cref="T:StgSharp.Graphics.IglFunc"/> package contains all opengl APIs</returns>
</member>
<member name="M:StgSharp.Graphics.Form.SetRenderThreads(System.Int32)">
<member name="M:StgSharp.Graphics.Form.Show">
<summary>
Define how current form render in one frame.
Init this form and render it on screen, and respond with operation
</summary>
<param name="leastThreds">
Please define this befor calling any OpenGL api and other graphic methods.
</param>
</member>
<member name="M:StgSharp.Graphics.Form.CreateElementBuffer(System.Int32)">
<summary>
@@ -164,9 +149,65 @@
</summary>
<returns>New instance of <see cref="T:StgSharp.Graphics.Shader"/> instance. </returns>
</member>
<member name="T:StgSharp.Graphics.RenderActivityAttribute">
<summary>
Mark that a method in a <see cref="T:StgSharp.Graphics.Form"/>
should be called when rendering.
</summary>
</member>
<member name="T:StgSharp.Graphics.RenderPriority">
<summary>
Priority level of a render activity.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_1">
<summary>
One level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_2">
<summary>
Two level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Pre_3">
<summary>
Three level higher than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_1">
<summary>
One level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_2">
<summary>
Two level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Aft_3">
<summary>
Three level lower than <see cref="F:StgSharp.Graphics.RenderPriority.Default"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Highest">
<summary>
Highest priority, in <see cref="T:StgSharp.Graphics.RenderPriority"/>, it is <see cref="F:StgSharp.Graphics.RenderPriority.Pre_3"/>.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Default">
<summary>
Default priority, usually <see cref="M:StgSharp.Graphics.Form.Main"/> is in this priority.
</summary>
</member>
<member name="F:StgSharp.Graphics.RenderPriority.Least">
<summary>
Lowest priority, in <see cref="T:StgSharp.Graphics.RenderPriority"/>, it is <see cref="F:StgSharp.Graphics.RenderPriority.Aft_3"/>.
</summary>
</member>
<member name="T:StgSharp.Graphics.BufferObjectBase">
<summary>
Interface of all kinds OpenGL buffer onjects
Interface of all kinds OpenGL buffer objects
</summary>
</member>
<member name="P:StgSharp.Graphics.BufferObjectBase.Item(System.Int32)">
@@ -256,7 +297,7 @@
</member>
<member name="M:StgSharp.Graphics.glHandleSet.Release">
<summary>
Realse all resource in this handle.
Release all resource in this handle.
This will release all resource in this <see cref="T:StgSharp.Graphics.glHandle"/>.
This <see langword="glHandle"/> will be not usable.
</summary>
+2 -2
View File
@@ -13,12 +13,12 @@ namespace StgsharpEnvDebug
public class DemoForm : Form
{
public override void Deinit(object[] args)
public override void Deinit()
{
throw new NotImplementedException();
}
public override void Init(object[] args)
public override void Init()
{
throw new NotImplementedException();
}
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgsharpEnvDebug")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f0d91b6d5195682edaab2a326e5daaba61f53271")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ea2a4a7dcb0a67c25bbc49839aeb8cd582ba0408")]
[assembly: System.Reflection.AssemblyProductAttribute("StgsharpEnvDebug")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgsharpEnvDebug")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
b9481a1705b922cb6180ea19b079eccf6f1408c7eae2da01d72bacb3bf1ae096
b685f0723cb2d3bf06c00533f1d0d0ae59d2f675b0ab5010621832e4478c9216