diff --git a/源代码/.vs/ProjectEvaluation/stgsharpdevelop.metadata.v7.bin b/源代码/.vs/ProjectEvaluation/stgsharpdevelop.metadata.v7.bin index 9adcff4d..e59ee0ed 100644 Binary files a/源代码/.vs/ProjectEvaluation/stgsharpdevelop.metadata.v7.bin and b/源代码/.vs/ProjectEvaluation/stgsharpdevelop.metadata.v7.bin differ diff --git a/源代码/.vs/ProjectEvaluation/stgsharpdevelop.projects.v7.bin b/源代码/.vs/ProjectEvaluation/stgsharpdevelop.projects.v7.bin index 9813e2ab..fd4b5072 100644 Binary files a/源代码/.vs/ProjectEvaluation/stgsharpdevelop.projects.v7.bin and b/源代码/.vs/ProjectEvaluation/stgsharpdevelop.projects.v7.bin differ diff --git a/源代码/.vs/StgSharpDevelop/DesignTimeBuild/.dtbcache.v2 b/源代码/.vs/StgSharpDevelop/DesignTimeBuild/.dtbcache.v2 index 0393237e..5b976e9f 100644 Binary files a/源代码/.vs/StgSharpDevelop/DesignTimeBuild/.dtbcache.v2 and b/源代码/.vs/StgSharpDevelop/DesignTimeBuild/.dtbcache.v2 differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/08051b70-582d-4512-a8d3-b0528db24eee.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/08051b70-582d-4512-a8d3-b0528db24eee.vsidx new file mode 100644 index 00000000..5fbfd98a Binary files /dev/null and b/源代码/.vs/StgSharpDevelop/FileContentIndex/08051b70-582d-4512-a8d3-b0528db24eee.vsidx differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/1f1f5394-27fb-4218-9f50-bae42ed078ca.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/1f1f5394-27fb-4218-9f50-bae42ed078ca.vsidx new file mode 100644 index 00000000..897aafc6 Binary files /dev/null and b/源代码/.vs/StgSharpDevelop/FileContentIndex/1f1f5394-27fb-4218-9f50-bae42ed078ca.vsidx differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/2d022621-543d-4e28-893b-814a4531387f.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/2d022621-543d-4e28-893b-814a4531387f.vsidx new file mode 100644 index 00000000..13b2656c Binary files /dev/null and b/源代码/.vs/StgSharpDevelop/FileContentIndex/2d022621-543d-4e28-893b-814a4531387f.vsidx differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/41d38200-9465-432d-8c50-ae38dde92733.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/41d38200-9465-432d-8c50-ae38dde92733.vsidx deleted file mode 100644 index ddf1fcaa..00000000 Binary files a/源代码/.vs/StgSharpDevelop/FileContentIndex/41d38200-9465-432d-8c50-ae38dde92733.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/740aa9c3-058b-4fdd-a17d-7e6677dd8557.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/740aa9c3-058b-4fdd-a17d-7e6677dd8557.vsidx new file mode 100644 index 00000000..ed616de9 Binary files /dev/null and b/源代码/.vs/StgSharpDevelop/FileContentIndex/740aa9c3-058b-4fdd-a17d-7e6677dd8557.vsidx differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/83b3c829-9abf-4756-acdb-2cfa869786c4.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/83b3c829-9abf-4756-acdb-2cfa869786c4.vsidx deleted file mode 100644 index 3cd9ddc7..00000000 Binary files a/源代码/.vs/StgSharpDevelop/FileContentIndex/83b3c829-9abf-4756-acdb-2cfa869786c4.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/8dbec8cb-1bb1-4c9d-ab6b-de581c71510d.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/8dbec8cb-1bb1-4c9d-ab6b-de581c71510d.vsidx deleted file mode 100644 index 85a9f6ba..00000000 Binary files a/源代码/.vs/StgSharpDevelop/FileContentIndex/8dbec8cb-1bb1-4c9d-ab6b-de581c71510d.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/9ac62fe2-0d6c-4fe9-a38d-8b70f68768e2.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/9ac62fe2-0d6c-4fe9-a38d-8b70f68768e2.vsidx deleted file mode 100644 index da721279..00000000 Binary files a/源代码/.vs/StgSharpDevelop/FileContentIndex/9ac62fe2-0d6c-4fe9-a38d-8b70f68768e2.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/df1168c8-f339-4a86-907a-0aa6f7511e8e.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/df1168c8-f339-4a86-907a-0aa6f7511e8e.vsidx new file mode 100644 index 00000000..9f0c5ace Binary files /dev/null and b/源代码/.vs/StgSharpDevelop/FileContentIndex/df1168c8-f339-4a86-907a-0aa6f7511e8e.vsidx differ diff --git a/源代码/.vs/StgSharpDevelop/FileContentIndex/ebef942a-e810-48fe-a0a7-bb9afb41254a.vsidx b/源代码/.vs/StgSharpDevelop/FileContentIndex/ebef942a-e810-48fe-a0a7-bb9afb41254a.vsidx deleted file mode 100644 index 4323f3c5..00000000 Binary files a/源代码/.vs/StgSharpDevelop/FileContentIndex/ebef942a-e810-48fe-a0a7-bb9afb41254a.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharpDevelop/v17/.futdcache.v2 b/源代码/.vs/StgSharpDevelop/v17/.futdcache.v2 index f35181e0..baf5c1dd 100644 Binary files a/源代码/.vs/StgSharpDevelop/v17/.futdcache.v2 and b/源代码/.vs/StgSharpDevelop/v17/.futdcache.v2 differ diff --git a/源代码/.vs/StgSharpDevelop/v17/.suo b/源代码/.vs/StgSharpDevelop/v17/.suo index 2d2d06d9..f4cdd01c 100644 Binary files a/源代码/.vs/StgSharpDevelop/v17/.suo and b/源代码/.vs/StgSharpDevelop/v17/.suo differ diff --git a/源代码/.vs/StgSharpDevelop/v17/Browse.VC.db b/源代码/.vs/StgSharpDevelop/v17/Browse.VC.db index ce7ff338..8f4f2a98 100644 Binary files a/源代码/.vs/StgSharpDevelop/v17/Browse.VC.db and b/源代码/.vs/StgSharpDevelop/v17/Browse.VC.db differ diff --git a/源代码/.vs/StgSharpDevelop/v17/HierarchyCache.v1.txt b/源代码/.vs/StgSharpDevelop/v17/HierarchyCache.v1.txt index cf1e54cb..87059c35 100644 Binary files a/源代码/.vs/StgSharpDevelop/v17/HierarchyCache.v1.txt and b/源代码/.vs/StgSharpDevelop/v17/HierarchyCache.v1.txt differ diff --git a/源代码/.vs/StgSharpDevelop/v17/fileList.bin b/源代码/.vs/StgSharpDevelop/v17/fileList.bin index eece2b14..906fdabc 100644 Binary files a/源代码/.vs/StgSharpDevelop/v17/fileList.bin and b/源代码/.vs/StgSharpDevelop/v17/fileList.bin differ diff --git a/源代码/.vs/StgSharpDevelop/v17/ipch/AutoPCH/fd8fe869b9042dc6/STGSHARPC.ipch b/源代码/.vs/StgSharpDevelop/v17/ipch/AutoPCH/fd8fe869b9042dc6/STGSHARPC.ipch index 21612819..57a64dd2 100644 Binary files a/源代码/.vs/StgSharpDevelop/v17/ipch/AutoPCH/fd8fe869b9042dc6/STGSHARPC.ipch and b/源代码/.vs/StgSharpDevelop/v17/ipch/AutoPCH/fd8fe869b9042dc6/STGSHARPC.ipch differ diff --git a/源代码/StgSharp/Control/Add.cs b/源代码/StgSharp/Control/Add.cs index 6fb795cf..8719cb26 100644 --- a/源代码/StgSharp/Control/Add.cs +++ b/源代码/StgSharp/Control/Add.cs @@ -10,7 +10,7 @@ namespace StgSharp { internal static void RegistForm(Form form) { - TimeLine.allForm.Add(form); + } public static void LoadTimeline() diff --git a/源代码/StgSharp/Control/Change.cs b/源代码/StgSharp/Control/Change.cs index ae44c82c..3ee6fa21 100644 --- a/源代码/StgSharp/Control/Change.cs +++ b/源代码/StgSharp/Control/Change.cs @@ -4,7 +4,10 @@ public static partial class Operation { //method used for chaging the value of paameters will be listed here + internal static void RenderNextFrame() + { + } } } diff --git a/源代码/StgSharp/Control/RenderBuffer.cs b/源代码/StgSharp/Control/RenderBuffer.cs index 3a56e9ce..ea11f062 100644 --- a/源代码/StgSharp/Control/RenderBuffer.cs +++ b/源代码/StgSharp/Control/RenderBuffer.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace StgSharp.Controlling { - public static partial class TimeLine + internal static partial class TimeLine { } } diff --git a/源代码/StgSharp/Control/TimeLine.cs b/源代码/StgSharp/Control/TimeLine.cs index 83559375..3883b3ce 100644 --- a/源代码/StgSharp/Control/TimeLine.cs +++ b/源代码/StgSharp/Control/TimeLine.cs @@ -6,20 +6,18 @@ using System.Threading; namespace StgSharp.Controlling { - public static partial class TimeLine + internal static partial class TimeLine { - internal static LinkedList
allForm; - - private static LinkedList refreshList = new LinkedList(); - internal static LinkedListNode signalNode; - private static LinkedList allFormList = new LinkedList(); + internal static Queue formList = new Queue(); + private static bool renderChainStarted; internal static TimelineBlock currentOperation; private static bool isPaused = false; - static unsafe TimeLine() + + internal static bool RenderStarted { - allForm = new LinkedList(); + get { return renderChainStarted; } } public static TimelineBlock CurrentOperation @@ -35,14 +33,11 @@ namespace StgSharp.Controlling } } - internal static void UodateAllFrame() - { - foreach (Form item in allForm) - { - item.formThread.Start(); - } - } + internal static void RenderAll() + { + renderChainStarted = true; + } diff --git a/源代码/StgSharp/Graphics/Form.cs b/源代码/StgSharp/Graphics/Form.cs index 3311f2ce..6ff9ca22 100644 --- a/源代码/StgSharp/Graphics/Form.cs +++ b/源代码/StgSharp/Graphics/Form.cs @@ -15,14 +15,6 @@ using System.Threading; namespace StgSharp.Graphics { - [StructLayout(LayoutKind.Sequential)] - internal struct formInfo - { - public int width; - public int height; - public Vector4 color; - public string name; - } /// /// @@ -39,12 +31,15 @@ namespace StgSharp.Graphics internal int width; internal IntPtr windowID; - private GLonRender glRender; - private GLonUpdate glUpdate; + protected IglFunc GL; + internal FormUpdateBuffer UpdateBuffer; + internal FormRenderBuffer RenderBuffer; internal FrameUpdateTimer timer = new FrameUpdateTimer(); + private SemaphoreSlim ping = new SemaphoreSlim(1, 1); private SemaphoreSlim pong = new SemaphoreSlim(0, 1); + internal readonly SemaphoreSlim ouetrPong = new SemaphoreSlim(0, 1); private UpdateWhenRender updateWhenRender; private DynamicMethod updateWhenRenderDM; @@ -83,18 +78,18 @@ namespace StgSharp.Graphics unsafe ~Form() { Marshal.FreeHGlobal((IntPtr)contextID); - glRender.api = default; + RenderBuffer.GL.api = default; } #region form main - public abstract void Deinit(object[] args, IglFunc GL); + public abstract void Deinit(object[] args); - public abstract void Init(object[] args, IglFunc GL); + public abstract void Init(object[] args); - public abstract void OnRenderFrame(object[] args, IglFunc GL); + public abstract void OnRenderFrame(object[] args); - public abstract void OnUpdateFrame(object[] args, IglFunc GL); + public abstract void OnUpdateFrame(object[] args); /// /// Init this form and render it on screen, and respond with operation @@ -103,16 +98,20 @@ namespace StgSharp.Graphics { if (args == null) { - args = new object[3] { null, null, null }; + args = new object[4] { null, null, null, null }; } Operation.RegistForm(this); + if (!TimeLine.RenderStarted) + { + TimeLine.RenderAll(); + } try { Thread updateThread = new Thread(InternalUpdateFrame); Thread renderThread = new Thread(InternalRenderFrame); - updateThread.Start(); - renderThread.Start(); + updateThread.Start(args[1]); + renderThread.Start(args[2]); updateThread.Join(); renderThread.Join(); @@ -120,6 +119,8 @@ namespace StgSharp.Graphics ping.Dispose(); pong.Dispose(); + InternalDeinit(args[3]); + } catch (Exception) { @@ -127,7 +128,12 @@ namespace StgSharp.Graphics } } - internal void InternalInit(object[] args) + internal void InternalDeinit(object args) + { + Deinit((object[])args); + } + + internal void InternalInit(object args) { updateWhenRenderDM = new DynamicMethod( name: "updateWhenRender", @@ -137,7 +143,7 @@ namespace StgSharp.Graphics ); updateWhenRenderIL = updateWhenRenderDM.GetILGenerator(); - Init((object[])args, this.glRender); + Init((object[])args); } @@ -149,9 +155,9 @@ namespace StgSharp.Graphics ping.Wait(); try { - OnRenderFrame((object[])args, glRender); - timer.GoNextFrame(); - throw new Exception("Forget to reload GL apis"); + OnRenderFrame((object[])args); + timer.WaitNextFrame(); + pong.Release(); } catch (NullReferenceException) @@ -162,7 +168,6 @@ namespace StgSharp.Graphics } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] internal void InternalUpdateFrame(object args) { while (InternalIO.glfw.WindowShouldClose(windowID) != 0) @@ -170,8 +175,8 @@ namespace StgSharp.Graphics pong.Wait(); try { - OnUpdateFrame((object[])args, glUpdate); - timer.GoNextFrame(); + OnUpdateFrame((object[])args); + timer.WaitNextFrame(); throw new Exception("Forget to reload GL apis"); ping.Release(); } @@ -297,12 +302,5 @@ namespace StgSharp.Graphics } - /// - /// Bind this form to StgSharp platform. - /// - protected void BindToPlatform() - { - TimeLine.allForm.Add(this); - } } } diff --git a/源代码/StgSharp/Graphics/FrameTime.cs b/源代码/StgSharp/Graphics/FrameTime.cs index faa5344e..7210b366 100644 --- a/源代码/StgSharp/Graphics/FrameTime.cs +++ b/源代码/StgSharp/Graphics/FrameTime.cs @@ -1,4 +1,5 @@ using StgSharp; +using StgSharp.Logic; using System; using System.Runtime.CompilerServices; using System.Threading; @@ -6,13 +7,63 @@ using System.Threading.Tasks; namespace StgSharp.Graphics { + public partial class Form + { + + private bool isFullyRendered = false; + + internal class FrameUpdateTimer + { + internal Bool2 alignSign; + private float frameLength; + private double frameBegin; + private bool refreshed; + private Counter tickCounter; + + public double timeAfterFrame + { + get { return InternalIO.glfw.GetTime() - frameBegin; } + } + + public uint totalFrame + { + get { return tickCounter; } + } + internal void Refresh() + { + refreshed = false; + } + + internal bool WaitNextFrame() + { + try + { + while (refreshed) { } + refreshed = true; + return true; + } + catch (Exception ex) + { + InternalIO.InternalWriteLog(ex.Message, LogType.Error); + return false; + } + } + } + } + /// /// A timer counting frames after its construction. /// public class FrameTimer { - private Form timeProvider; internal readonly uint bornTick; + private Form timeProvider; + + public FrameTimer(Form provaider) + { + timeProvider = provaider; + bornTick = timeProvider.timer.totalFrame; + } /// /// Frames after this timer created. @@ -22,12 +73,6 @@ namespace StgSharp.Graphics get { return timeProvider.timer.totalFrame - bornTick; } } - public FrameTimer(Form provaider) - { - timeProvider = provaider; - bornTick = timeProvider.timer.totalFrame; - } - /// /// Convert a into uint value. /// this will get total frames since the timer was created. @@ -39,94 +84,4 @@ namespace StgSharp.Graphics return timer.Time; } } - - public partial class Form - { - - internal class FrameUpdateTimer - { - private Counter tickCounter; - private float frameLength; - private double frameTime; - private bool refreshed; - private SemaphoreSlim pong; - private bool isOnceFulFrame = false; - - public uint totalFrame - { - get { return tickCounter; } - } - - public double timeAfterFrame - { - get { return InternalIO.glfw.GetTime() - frameTime; } - } - - internal bool IsOnceFullFrame - { - get { return isOnceFulFrame; } - set - { - if (!isOnceFulFrame) - { - isOnceFulFrame = value; - } - } - } - - internal void Init(SemaphoreSlim semaphore) - { - pong = semaphore; - } - - internal void Refresh() - { - refreshed = false; - } - - internal bool GoNextFrame() - { - try - { - while (refreshed) { } - refreshed = true; - return refreshed; - } - catch (Exception ex) - { - InternalIO.InternalWriteLog(ex.Message, LogType.Error); - return false; - } - } - } - - private bool isFullyRendered = false; - - /// - /// Wait until the next frame of a certain started, - /// all GL function after this method will be blocked until the next frame started. - /// When a frame refreshed before - /// It should be noticed that do not use this method too often to avoid unexpected performance problem - /// - /// The that can provide a frame refresh benchmark - /// to be done and aligned. - /// - /// A bool value indicating if the successfully refresh the frame. - /// If the retur value is false, please set a new as benchmark. - /// - protected bool AlignFrame(Form form, Action action) - { - try - { - bool isAligned = form.timer.GoNextFrame(); - action(); - return isAligned; - } - catch (Exception) - { - return false; - } - } - - } } \ No newline at end of file diff --git a/源代码/StgSharp/Graphics/GL/Buffer/FormBuffer.cs b/源代码/StgSharp/Graphics/GL/Buffer/FormBuffer.cs new file mode 100644 index 00000000..a4dd84c9 --- /dev/null +++ b/源代码/StgSharp/Graphics/GL/Buffer/FormBuffer.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StgSharp.Graphics +{ + internal class FormRenderBuffer + { + internal GLonRender GL; + internal InternalFormBuffer data; + } + + internal class FormUpdateBuffer + { + internal GLonUpdate GL; + internal InternalFormBuffer data; + } + + internal class InternalFormBuffer + { + + } +} diff --git a/源代码/StgSharp/Graphics/GL/Buffer/FrameBuffer.cs b/源代码/StgSharp/Graphics/GL/Buffer/FrameBuffer.cs deleted file mode 100644 index e4f83eff..00000000 --- a/源代码/StgSharp/Graphics/GL/Buffer/FrameBuffer.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.Graphics -{ - internal class FrameBuffer - { - } -} diff --git a/源代码/StgSharp/Graphics/GL/Buffer/VAO.cs b/源代码/StgSharp/Graphics/GL/Buffer/VAO.cs index faf1ed93..c42e472d 100644 --- a/源代码/StgSharp/Graphics/GL/Buffer/VAO.cs +++ b/源代码/StgSharp/Graphics/GL/Buffer/VAO.cs @@ -11,7 +11,7 @@ namespace StgSharp.Graphics internal uint[] _bufferID; private IglFunc GL; - internal VertexArray(int n, IglFunc glFunc) + internal VertexArray(int n) { _bufferID = new uint[n]; GL = glFunc; diff --git a/源代码/StgSharp/Graphics/GL/GLonRender.cs b/源代码/StgSharp/Graphics/GL/GLonRender.cs index 0e5c8f0f..aac87092 100644 --- a/源代码/StgSharp/Graphics/GL/GLonRender.cs +++ b/源代码/StgSharp/Graphics/GL/GLonRender.cs @@ -18,6 +18,24 @@ namespace StgSharp.Graphics api.ActiveTexture(type); } + void IglFunc.AfterAlign(Form form, Action action) + { + throw new NotImplementedException(); + } + + void IglFunc.AlignFrame(Form form) + { + if (form.timer.alignSign.byte0 > 0) + { + throw new InvalidOperationException(); + } + form.timer.WaitNextFrame(); + form.timer.alignSign.byte0++; + if (form.timer.) + { + + } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] void IglFunc.AttachShader(uint program, uint shader) diff --git a/源代码/StgSharp/Graphics/GL/GLonTimeout.cs b/源代码/StgSharp/Graphics/GL/GLonTimeout.cs new file mode 100644 index 00000000..e023cf25 --- /dev/null +++ b/源代码/StgSharp/Graphics/GL/GLonTimeout.cs @@ -0,0 +1,223 @@ +using StgSharp.Logic; +using StgSharp.Math; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StgSharp.Graphics +{ + internal class GLonTimeout : IglFunc + { + private static readonly GLonTimeout singleInstance + = new GLonTimeout(); + + private GLonTimeout() { } + + internal static GLonTimeout Set() + { + return singleInstance; + } + + void IglFunc.ActiveTexture(uint type) + { + throw new FrameTimeoutException(); + } + + void IglFunc.AfterAlign(Form form, Action action) + { + throw new FrameTimeoutException(); + } + + void IglFunc.AlignFrame(Form form) + { + throw new FrameTimeoutException(); + } + + void IglFunc.AttachShader(uint program, uint shader) + { + throw new FrameTimeoutException(); + } + + void IglFunc.BindBuffer(BufferType bufferType, uint index) + { + throw new FrameTimeoutException(); + } + + void IglFunc.BindTexture(uint type, uint texture) + { + throw new FrameTimeoutException(); + } + + void IglFunc.BindVertexArray(uint index) + { + throw new FrameTimeoutException(); + } + + void IglFunc.Clear(MaskBufferBit mask) + { + throw new FrameTimeoutException(); + } + + void IglFunc.ClearColor(float R, float G, float B, float A) + { + throw new FrameTimeoutException(); + } + + void IglFunc.ClearGraphicError() + { + throw new FrameTimeoutException(); + } + + uint IglFunc.CompileShader(string shaderCode, ShaderType shaderType) + { + throw new FrameTimeoutException(); + } + + uint IglFunc.CreateProgram() + { + throw new FrameTimeoutException(); + } + + IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share) + { + throw new FrameTimeoutException(); + } + + uint IglFunc.CreatGraphicProgram() + { + throw new FrameTimeoutException(); + } + + unsafe void IglFunc.DeleteBuffers(int count, uint* ptr) + { + throw new FrameTimeoutException(); + } + + unsafe void IglFunc.DeleteVertexArrays(int count, uint* ptr) + { + throw new FrameTimeoutException(); + } + + void IglFunc.DrawElements(GepmetryType mode, int count, Type type, IntPtr ptr) + { + throw new FrameTimeoutException(); + } + + unsafe void IglFunc.GenBuffers(int count, uint* ptr) + { + throw new FrameTimeoutException(); + } + + unsafe void IglFunc.GenTextures(int count, uint* ptr) + { + throw new FrameTimeoutException(); + } + + unsafe void IglFunc.GenVertexArrays(int count, uint* ptr) + { + throw new FrameTimeoutException(); + } + + void IglFunc.GetGraphicError() + { + throw new FrameTimeoutException(); + } + + unsafe int IglFunc.GetUniformLocation(uint program, byte* ptr) + { + throw new FrameTimeoutException(); + } + + bool IglFunc.GetWindowShouldClose(Form form) + { + throw new FrameTimeoutException(); + } + + void IglFunc.MakeContexCurrent(Form form) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetBufferData(BufferType bufferType, T bufferData, BufferUsage usage) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetBufferData(BufferType bufferType, T[] bufferArray, BufferUsage usage) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetFrameBufferSizeCallback(IntPtr id, FrameBufferSizeHandler handler) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetValue(Uniform uniform, float v0, float v1, float v2, float v3) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetValue(Uniform uniform, Vec4d vec) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetValue(Uniform uniform, float v0, float v1, float v2) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetValue(Uniform uniform, float v0, float v1) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetValue(Uniform uniform, float v0) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetValue(Uniform uniform, int i0) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetValue(Uniform uniform, Vec4d vec) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SetVertexAttribute(uint index, int size, Type t, bool normalized, int stride, int pointer) + { + throw new FrameTimeoutException(); + } + + void IglFunc.SwapBuffers(Form form) + { + throw new FrameTimeoutException(); + } + + unsafe void IglFunc.TextureImage2d(uint target, int level, uint internalformat, int width, int height, uint format, uint type, void* pixels) + { + throw new FrameTimeoutException(); + } + + void IglFunc.TextureParameter(uint target, uint pname, int param) + { + throw new FrameTimeoutException(); + } + + void IglFunc.UseProgram(uint program) + { + throw new FrameTimeoutException(); + } + + void IglFunc.Viewport(int x, int y, int width, int height) + { + throw new FrameTimeoutException(); + } + } +} diff --git a/源代码/StgSharp/Graphics/GLonUpdate.cs b/源代码/StgSharp/Graphics/GL/GLonUpdate.cs similarity index 100% rename from 源代码/StgSharp/Graphics/GLonUpdate.cs rename to 源代码/StgSharp/Graphics/GL/GLonUpdate.cs diff --git a/源代码/StgSharp/Graphics/IglFunc.cs b/源代码/StgSharp/Graphics/IglFunc.cs index 235ad926..e6a0f96f 100644 --- a/源代码/StgSharp/Graphics/IglFunc.cs +++ b/源代码/StgSharp/Graphics/IglFunc.cs @@ -5,6 +5,28 @@ namespace StgSharp.Graphics { public interface IglFunc { + /// + /// Align a sets of code to frame update of a . + /// Usually, a call of is required. + /// This method is used as sigle thread method. If more than one + /// alignment is requested, a will throw. + /// + /// The form used as frame update benchmark. + /// More than one alingment attached to one form timer + void AlignFrame(Form form); + + /// + /// Operation after alignment by calling . + /// No calling of this method is acceptable, but it will bring the risk + /// of that relevant code will not run if it is interrupted by frame overtime. + /// Please call this method immediately after calling , + /// too early or sonner may cause . + /// + /// The form used as frame update benchmark. + /// Operation after frame update alignment. + /// The action binded to a wrong alignment. + void AfterAlign(Form form, Action action); + /// /// Same function as OpenGL api glActiveTexture /// diff --git a/源代码/StgSharp/Logic/Exception.cs b/源代码/StgSharp/Logic/Exception.cs new file mode 100644 index 00000000..2690422e --- /dev/null +++ b/源代码/StgSharp/Logic/Exception.cs @@ -0,0 +1,23 @@ +using StgSharp.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StgSharp.Logic +{ + [System.Serializable] + internal class FrameTimeoutException : Exception + { + internal FrameTimeoutException() { } + internal FrameTimeoutException(string message) : base(message) { } + internal FrameTimeoutException(Form form) : + base($"Form {nameof(form)} cannot accoplish all render work at frame {form.timer.totalFrame}") + { } + internal FrameTimeoutException(string message, Exception inner) : base(message, inner) { } + protected FrameTimeoutException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) : base(info, context) { } + } +} diff --git a/源代码/StgSharp/Logic/LinkedListNode.cs b/源代码/StgSharp/Logic/LinkedListNode.cs index 97c42ebc..e389a05d 100644 --- a/源代码/StgSharp/Logic/LinkedListNode.cs +++ b/源代码/StgSharp/Logic/LinkedListNode.cs @@ -6,9 +6,8 @@ namespace StgSharp { internal readonly T _value; - [AllowNull] + internal LinkedListNode _previous; - [AllowNull] internal LinkedListNode _next; internal LinkedList list; diff --git a/源代码/StgSharp/Logic/LogicValue.cs b/源代码/StgSharp/Logic/LogicValue.cs new file mode 100644 index 00000000..2c934bb5 --- /dev/null +++ b/源代码/StgSharp/Logic/LogicValue.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace StgSharp.Logic +{ + /// + /// A pair of value + /// + [StructLayout(LayoutKind.Explicit, Size = 2)] + public struct Bool2 + { + /// + /// A value. + /// The lower byte is , + /// and higher byte is . + /// + [FieldOffset(0)] public ushort Value; + + /// + /// The first value. + /// + [FieldOffset(0)] public bool bool0; + + [FieldOffset(0)] public byte byte0; + + /// + /// The second value. + /// + [FieldOffset(1)] public bool bool1; + + [FieldOffset(1)] public bool byte1; + } +} diff --git a/源代码/StgSharp/Math/IO/tlLinear.cs b/源代码/StgSharp/Math/IO/tlLinear.cs index 38f07c72..9c030da8 100644 --- a/源代码/StgSharp/Math/IO/tlLinear.cs +++ b/源代码/StgSharp/Math/IO/tlLinear.cs @@ -5,7 +5,7 @@ using System.Text; namespace StgSharp.Controlling { - public static unsafe partial class TimeLine + internal static unsafe partial class TimeLine { } } diff --git a/源代码/StgSharp/StgSharp.csproj b/源代码/StgSharp/StgSharp.csproj index aed5ebc3..ee8013d2 100644 --- a/源代码/StgSharp/StgSharp.csproj +++ b/源代码/StgSharp/StgSharp.csproj @@ -1,81 +1,79 @@  - - netstandard2.1 - True - preview - True - True - AnyCPU;x64 - False - True - MIT - True - preview-all - Library - enable - Debug;Release;NoOps;RealDebug - + + netstandard2.1 + True + preview + True + True + AnyCPU;x64 + False + True + MIT + True + preview-all + Library + enable + Debug;Release;NoOps;RealDebug + - - True - + + True + - - True - + + True + - - True - embedded - 1701;1702;0649;1591;0169 - + + True + embedded + 1701;1702;0649;1591;0169 + - - True - embedded - 1701;1702;0649;1591;0169 - + + True + embedded + 1701;1702;0649;1591;0169 + - - embedded - True - 1701;1702;0649;1591;0169 - + + embedded + True + 1701;1702;0649;1591;0169 + - - embedded - True - 1701;1702;0649;1591;0169 - + + embedded + True + 1701;1702;0649;1591;0169 + - - none - 1701;1702;0649;1591;0169 - + + none + 1701;1702;0649;1591;0169 + - - none - 1701;1702;0649;1591;0169 - + + none + 1701;1702;0649;1591;0169 + - - _WINDOWS - - - - - - - - - Always - - - - - + + + + + + + + Always + + + + + + diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.AssemblyInfo.cs b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.AssemblyInfo.cs index 187e3ba9..12d09350 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.AssemblyInfo.cs +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.AssemblyInfo.cs @@ -14,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")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f97fb137bab6d3951628058d311cdd6563088253")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.AssemblyInfoInputs.cache b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.AssemblyInfoInputs.cache index 99d159dc..0744088c 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.AssemblyInfoInputs.cache +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.AssemblyInfoInputs.cache @@ -1 +1 @@ -c037a45127bb9a5e3e153dd0686c8ec78e62d669 +04dfcfa786a1963af50078b294ac03205243553745bcaa6e3699fa1e9b6c1b95 diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.GeneratedMSBuildEditorConfig.editorconfig b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.GeneratedMSBuildEditorConfig.editorconfig index 774bffa1..b63d897e 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.GeneratedMSBuildEditorConfig.editorconfig +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.GeneratedMSBuildEditorConfig.editorconfig @@ -1,3 +1,13 @@ is_global = true +build_property.TargetFramework = netstandard2.0 +build_property.TargetPlatformMinVersion = 7.0 +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = StgSharp build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.assets.cache b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.assets.cache index 2ad1c90a..dbe4bb83 100644 Binary files a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.assets.cache and b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.assets.cache differ diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.AssemblyReference.cache b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.AssemblyReference.cache index 38484ac7..dfd733c7 100644 Binary files a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.AssemblyReference.cache and b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.AssemblyReference.cache differ diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.CoreCompileInputs.cache b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.CoreCompileInputs.cache index 01878582..c58df978 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.CoreCompileInputs.cache +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -e0508ef3df2648b89976ea207d573cd7d001b127 +8dddfab4563f7975c58d9882befd136094f47cb89b21d9aa34fabd362789c3a2 diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.FileListAbsolute.txt b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.FileListAbsolute.txt index 4727f387..41522e79 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.FileListAbsolute.txt +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.csproj.FileListAbsolute.txt @@ -12,3 +12,4 @@ D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.0\StgSharp.xml D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.0\StgSharp.pdb D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.0\ref\StgSharp.dll +D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.0\StgSharp.sourcelink.json diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.sourcelink.json b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.sourcelink.json new file mode 100644 index 00000000..8e4af823 --- /dev/null +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.0/StgSharp.sourcelink.json @@ -0,0 +1 @@ +{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/f97fb137bab6d3951628058d311cdd6563088253/*"}} \ No newline at end of file diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.AssemblyInfo.cs b/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.AssemblyInfo.cs index 2cdacfed..187e3ba9 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.AssemblyInfo.cs +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.AssemblyInfo.cs @@ -14,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+ab85c1a9fe556e53e39ce33690efdd1b4ad28484")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.AssemblyInfoInputs.cache b/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.AssemblyInfoInputs.cache index 09c1f665..3d933be5 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.AssemblyInfoInputs.cache +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.AssemblyInfoInputs.cache @@ -1 +1 @@ -b38880cab427ff4384d0fea3dec02c59d1d5ebab3deb9283cedea7e2be0c13d3 +e8b19b35bca753348ef94df4faf984102d2e81946d465d23132400b7d6c8fb6d diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache b/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache index 70587924..2f633a09 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -04fd394b76052c1382ce478d9e85878535f06255ce0da04c1bfa05a5caccc08c +dd6796f149809295555f79b84f32a9815cb39557dd7a5256658cce0f77660c44 diff --git a/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.sourcelink.json b/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.sourcelink.json index 1e1acfce..8e4af823 100644 --- a/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.sourcelink.json +++ b/源代码/StgSharp/obj/x64/Debug/netstandard2.1/StgSharp.sourcelink.json @@ -1 +1 @@ -{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/ab85c1a9fe556e53e39ce33690efdd1b4ad28484/*"}} \ No newline at end of file +{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/f97fb137bab6d3951628058d311cdd6563088253/*"}} \ No newline at end of file diff --git a/源代码/StgSharpDebug/Program.cs b/源代码/StgSharpDebug/Program.cs index a07b7e8a..dea90bf9 100644 --- a/源代码/StgSharpDebug/Program.cs +++ b/源代码/StgSharpDebug/Program.cs @@ -48,7 +48,7 @@ namespace StgSharp GL.Viewport(0, 0, width, height); } - public override void Init(object[] args, IglFunc GL) + public override void Init(object[] args) { InternalIO.InternalWriteLog("\n\n\n", "Program start", LogType.Info); diff --git a/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.AssemblyInfo.cs b/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.AssemblyInfo.cs index e2987da2..099f5edd 100644 --- a/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.AssemblyInfo.cs +++ b/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.AssemblyInfo.cs @@ -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+ab85c1a9fe556e53e39ce33690efdd1b4ad28484")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.AssemblyInfoInputs.cache b/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.AssemblyInfoInputs.cache index e59b521b..53232a0d 100644 --- a/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.AssemblyInfoInputs.cache +++ b/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.AssemblyInfoInputs.cache @@ -1 +1 @@ -f35c99a038520eddd465562a4bb0f828424836c18b6dc5bceb83e4b6d7f89467 +9f92006774b8dcbe7ff116213c08f7040b5d19f4b0a547971f9e00de3873288c diff --git a/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.sourcelink.json b/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.sourcelink.json index 1e1acfce..8e4af823 100644 --- a/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.sourcelink.json +++ b/源代码/StgSharpDebug/obj/x64/Debug/net6.0/StgSharpDebug.sourcelink.json @@ -1 +1 @@ -{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/ab85c1a9fe556e53e39ce33690efdd1b4ad28484/*"}} \ No newline at end of file +{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/f97fb137bab6d3951628058d311cdd6563088253/*"}} \ No newline at end of file diff --git a/源代码/StgsharpEnvDebug/StgsharpEnvDebug.csproj b/源代码/StgsharpEnvDebug/StgsharpEnvDebug.csproj index b4c8bfe8..02e76ae3 100644 --- a/源代码/StgsharpEnvDebug/StgsharpEnvDebug.csproj +++ b/源代码/StgsharpEnvDebug/StgsharpEnvDebug.csproj @@ -1,4 +1,4 @@ - + Exe