New IO structure, unexpexted error in C code

This commit is contained in:
Nitload
2023-06-22 03:33:24 +08:00
parent 50b4965e54
commit ee8132c149
172 changed files with 1344 additions and 4023 deletions
+2 -6
View File
@@ -1,8 +1,4 @@
using StgSharp.Control;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
@@ -21,8 +17,8 @@ namespace StgSharp
public static void AddPool(Pool pool)
{
ProgramTimeLine.allPool.Add(pool);
ProgramTimeLine._currentPool = pool;
TimeLine.allPool.Add(pool);
TimeLine._currentPool = pool;
}
}
}
+2 -8
View File
@@ -1,16 +1,10 @@
using System;
using StgSharp.Control;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp
namespace StgSharp
{
public static partial class Instruction
{
//method used for chaging the value of paameters will be listed here
}
}
+4 -7
View File
@@ -1,22 +1,19 @@
using StgSharp.Geometries;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public static unsafe partial class Geometry
public static unsafe partial class Geometry
{
public static unsafe Triangle InitTriagnle<T>(
vec3d vertex1,
vec3d vertex2,
vec3d vertex3
)where T:Triangle
) where T : Triangle
{
Triangle t = new Triangle();
return t;
}
+5 -8
View File
@@ -1,25 +1,22 @@
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp
{
internal static unsafe partial class internalIO
{
[DllImport("StgSharpGraphics.dll", EntryPoint = "initTriangle")]
internal static unsafe extern triangleVertexArray initTriangleVertex();
internal static extern unsafe triangleVertexArray initTriangleVertex();
[DllImport("StgSharpGraphics.dll", EntryPoint = "initPolygon4")]
internal static unsafe extern Polygon4VertexArray initPolygon4Vertex();
internal static extern unsafe Polygon4VertexArray initPolygon4Vertex();
[DllImport("StgSharpGraphics.dll", EntryPoint = "initPolygon5")]
internal static unsafe extern Polygon5VertexArray initPolygon5Vertex();
internal static extern unsafe Polygon5VertexArray initPolygon5Vertex();
[DllImport("StgSharpGraphics.dll", EntryPoint = "inputTriangle")]
internal static unsafe extern void internalLoadTriangle(triangleVertexArray triangle);
internal static extern unsafe void internalLoadTriangle(triangleVertexArray triangle);
}
}
+24 -12
View File
@@ -1,35 +1,47 @@
using StgSharp.Graphics;
using StgSharp.Control;
using StgSharp.Graphics;
using StgSharp.Graphics.GL;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp
{
internal static partial class internalIO
{
[DllImport("StgSharpGraphics.dll", EntryPoint = "InitGL")]
[DllImport("StgSharpGraphics.dll",
EntryPoint = "loadGLApi", CallingConvention = CallingConvention.Cdecl)]
internal static extern GraphicIOPack InternalInitGraphicApi();
[DllImport("StgSharpGraphics.dll",
EntryPoint = "InitGL", CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void InternalInitGL();
[DllImport("StgSharpGraphics.dll", EntryPoint = "InitWindow")]
[DllImport("StgSharpGraphics.dll",
EntryPoint = "InitWindow", CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe IntPtr InternalInitWindow(formInfo win);
[DllImport("StgSharpGraphics.dll", EntryPoint = "CompileShader")]
internal static unsafe extern void InternalCompileShader
[DllImport("StgSharpGraphics.dll",
EntryPoint = "CompileShader", CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void InternalCompileShader
(
shaderObject* shaderObj
);
[DllImport("StgSharpGraphics.dll", EntryPoint = "RenderWindow")]
internal static unsafe extern void InternalRenderWindow
[DllImport("StgSharpGraphics.dll", EntryPoint = "SSGraphicShouldWindowClose",
CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe int InternalShouldFormClose(IntPtr formPtr);
[DllImport("StgSharpGraphics.dll",
EntryPoint = "RenderWindow", CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void InternalRenderWindow
(
IntPtr window,
IntPtr window,
formInfo info,
shaderObject* shaderObj
);
[DllImport("StgSharpGraphics.dll", EntryPoint = "TerminateWindow")]
internal static unsafe extern void TerminateWindow(shaderObject* shaderObj);
[DllImport("StgSharpGraphics.dll", EntryPoint = "TerminateWindow"
, CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void TerminateWindow(shaderObject* shaderObj);
}
}
@@ -0,0 +1,24 @@
using System;
using System.Runtime.InteropServices;
namespace StgSharp.Control
{
internal delegate void InternalInitGLDelegate();
internal delegate IntPtr InternalGLcreateWindowDelegate
(int width, int height, char[] tittle, IntPtr monitor, IntPtr share);
internal delegate void InternalGLmakeContextCurrent(IntPtr window);
internal delegate void InternalGLswapInterval(int interval);
internal delegate void InternalGLclearColorDelegate
(float red, float green, float blue, float alpha);
[StructLayout(LayoutKind.Sequential)]
internal struct GraphicIOPack
{
internal InternalInitGLDelegate InternalLoadGL;
internal InternalGLcreateWindowDelegate InternalGLcreatWindow;
internal InternalGLmakeContextCurrent InternalGLmakeContextCurrent;
internal InternalGLswapInterval InternalGLswapInterval;
internal InternalGLclearColorDelegate InternalGLclearColor;
}
}
@@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Control
{
public delegate int InitWindow(int width, int height);
[StructLayout(LayoutKind.Sequential)]
public struct GraphicIOPack
{
public InitWindow initWindowPtr = default;
public GraphicIOPack()
{
}
}
}
+2 -5
View File
@@ -1,7 +1,4 @@
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Control
{
@@ -9,10 +6,10 @@ namespace StgSharp.Control
{
public static void Point(Point p)
{
ProgramTimeLine._currentPool._pointContainer.Remove(p);
TimeLine._currentPool._pointContainer.Remove(p);
}
}
}
@@ -1,12 +1,12 @@
using StgSharp.Entities;
using StgSharp.Graphics;
using StgSharp.Graphics.GL;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace StgSharp.Control
{
public static class ProgramTimeLine
public static class TimeLine
{
[AllowNull]
internal static Pool _currentPool = default;
@@ -16,18 +16,18 @@ namespace StgSharp.Control
/// <summary>
/// Tick counter count the frames passed since the program start.
/// </summary>
public readonly static Counter<uint> tickCounter = new Counter<uint>(0,1,1);
public static readonly Counter<uint> tickCounter = new Counter<uint>(0, 1, 1);
[AllowNull]
internal static TimelineBlock currentOperation ;
internal static TimelineBlock currentOperation;
private static bool isPaused = false;
static ProgramTimeLine()
static TimeLine()
{
allForm = new LinkedList<Form>();
allPool = new LinkedList<Pool>();
#if DEBUG
Console.WriteLine("Timeline init OK!") ;
Console.WriteLine("Timeline init OK!");
#endif
internalIO.InternalInitGL();
}
@@ -52,9 +52,22 @@ namespace StgSharp.Control
public static void InitProgram()
{
}
public static unsafe void StartProgram()
{
foreach (Form form in allForm)
{
if (Graphic.ShouldFormClose(form))
{
internalIO.InternalRenderWindow(
form.windowPtr,
form.info,
(shaderObject*)form.shader);
}
}
}
}
}
+2 -6
View File
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Control
namespace StgSharp.Control
{
public abstract class TimelineBlock : INode<TimelineBlock>
public abstract class TimelineBlock
{
public abstract void OnUpdating();