daily update on 20230529 by nitload youmu

This commit is contained in:
Nitload
2023-05-29 04:36:01 +08:00
parent 9ca4a69a2a
commit 1874b32fb0
62 changed files with 1142 additions and 1250 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
View File
@@ -8,6 +8,17 @@ namespace StgSharp
{ {
public static partial class Instruction public static partial class Instruction
{ {
/// <summary>
/// Add a pool to timeline controller, and return the instance of the pool.
/// </summary>
/// <returns></returns>
public static Pool InitPool()
{
Pool pool = new Pool();
AddPool(pool);
return pool;
}
public static void AddPool(Pool pool) public static void AddPool(Pool pool)
{ {
ProgramTimeLine.allPool.Add(pool); ProgramTimeLine.allPool.Add(pool);
+11 -2
View File
@@ -8,7 +8,16 @@ namespace StgSharp
{ {
public static partial class internalIO public static partial class internalIO
{ {
[DllImport("StgSharpGraphics.dll", EntryPoint = "initWindow")] [DllImport("StgSharpGraphics.dll", EntryPoint = "InitWindow")]
public static extern void Window(Window win); public static extern unsafe IntPtr InitWindow(Window win);
[DllImport("StgSharpGraphics.dll", EntryPoint = "CompileShader")]
public static unsafe extern void CompileShader();
[DllImport("StgSharpGraphics.dll", EntryPoint = "RenderWindow")]
public static unsafe extern void RenderWindow(IntPtr window, Window info);
[DllImport("StgSharpGraphics.dll", EntryPoint = "TerminateWindow")]
public static unsafe extern void TerminateWindow();
} }
} }
+1 -1
View File
@@ -9,7 +9,7 @@ namespace StgSharp.Control
{ {
public static void Point(Point p) public static void Point(Point p)
{ {
ProgramTimeLine._currentPool.pointContainer.Remove(p); ProgramTimeLine._currentPool._pointContainer.Remove(p);
} }
@@ -13,18 +13,31 @@ namespace StgSharp.Geometries
public unsafe class Point : INode<Point>, INullable public unsafe class Point : INode<Point>, INullable
{ {
internal vec3d* positionPtr; internal vec3d* positionPtr;
internal readonly bool isVertex;
internal Point(vec3d* ptr) internal Point(vec3d* ptr)
{ {
positionPtr = ptr; positionPtr = ptr;
} }
public Point()
{
IntPtr ptr = Marshal.AllocHGlobal(sizeof(vec3d));
positionPtr = (vec3d*)ptr.ToPointer();
}
public vec3d Position public vec3d Position
{ {
get { return *positionPtr; } get { return *positionPtr; }
set { *positionPtr = value; } set { *positionPtr = value; }
} }
public vec3d* PositionPtr
{
get { return positionPtr; }
set { positionPtr = value; }
}
public float X public float X
{ {
get { return (*this.positionPtr).X; } get { return (*this.positionPtr).X; }
@@ -43,7 +56,6 @@ namespace StgSharp.Geometries
set { (*this.positionPtr).Z = value; } set { (*this.positionPtr).Z = value; }
} }
internal readonly bool isVertex;
public bool IsVertex => isVertex; public bool IsVertex => isVertex;
@@ -1,12 +1,20 @@
using System; using StgSharp.Math;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace StgSharp.Geometries namespace StgSharp.Geometries
{ {
/// <summary>
/// A square
/// </summary>
public class Square:Rectangle public class Square:Rectangle
{ {
public sealed override vec3d MovVertex02(uint tick)
{
return this.center.Position * 2 - this.vertex01.Position;
}
} }
} }
@@ -37,16 +37,23 @@ namespace StgSharp.Geometries
public Triangle() public Triangle()
{ {
this.vertexArray = internalIO.initTriangleVertex();
this.vertex1 = new Point(vertexArray.vertex1Ptr); this.vertex1 = new Point();
this.vertex2 = new Point(vertexArray.vertex2Ptr); this.vertex2 = new Point();
this.vertex3 = new Point(vertexArray.vertex3Ptr); this.vertex3 = new Point();
this.vertexArray = new triangleVertexArray();
vertexArray.vertex1Ptr = this.vertex1.positionPtr;
vertexArray.vertex2Ptr = this.vertex1.positionPtr;
vertexArray.vertex3Ptr = this.vertex1.positionPtr;
/**/ /**/
ProgramTimeLine._currentPool.pointContainer.Add(vertex1); ProgramTimeLine._currentPool._pointContainer.Add(vertex1);
ProgramTimeLine._currentPool.pointContainer.Add(vertex2); ProgramTimeLine._currentPool._pointContainer.Add(vertex2);
ProgramTimeLine._currentPool.pointContainer.Add(vertex3); ProgramTimeLine._currentPool._pointContainer.Add(vertex3);
/**/ /**/
} }
public Triangle( public Triangle(
+1 -1
View File
@@ -11,7 +11,7 @@ namespace StgSharp.Graphics
{ {
public int width; public int width;
public int height; public int height;
public vec4d windowColor; public vec4d color;
public string name; public string name;
} }
} }
+4 -63
View File
@@ -11,7 +11,7 @@ namespace StgSharp
{ {
public class Pool:INode<Pool> public class Pool:INode<Pool>
{ {
internal LinkedList<Point> pointContainer; internal LinkedList<Point> _pointContainer;
internal LinkedList<IPlainGeometry> geometryContainer; internal LinkedList<IPlainGeometry> geometryContainer;
internal LinkedList<IEntity> _bulletContainer; internal LinkedList<IEntity> _bulletContainer;
internal LinkedList<IEntity> _awardContainer; internal LinkedList<IEntity> _awardContainer;
@@ -27,78 +27,19 @@ namespace StgSharp
public Line TopBoarder => topBoader; public Line TopBoarder => topBoader;
public Line BottomBoarder => bottomBoader; public Line BottomBoarder => bottomBoader;
internal Sensor<EntityPartical> Sensor; internal Pool()
#if DEBUG
public Pool()
{ {
initContainers(); initContainers();
Console.WriteLine("Pool init OK!");
}
#endif
public Pool(Line left, Line right, Line top, Line bottom)
{
initContainers();
topBoader = top;
bottomBoader= bottom;
rightBoader = right;
leftBoader = left;
}
public Pool( Geometries.Rectangle area)
{
vec3d vec = area.vertex01.Position - area.vertex02.Position;
if ((vec.X==0||vec.Y==0)&&vec.Z==0)
{
Line[] barders = area.GetAllSides();
if (area.vertex01.X>0)
{
if (area.vertex01.Y>0)
{
topBoader = barders[3];
rightBoader = barders[0];
bottomBoader = barders[1];
leftBoader = barders[2];
}
else
{
topBoader = barders[2];
rightBoader = barders[3];
bottomBoader = barders[0];
leftBoader = barders[1];
}
}
else
{
if (area.vertex01.Y > 0)
{
topBoader = barders[3];
rightBoader = barders[0];
bottomBoader = barders[1];
leftBoader = barders[2];
}
else
{
topBoader = barders[2];
rightBoader = barders[3];
bottomBoader = barders[0];
leftBoader = barders[1];
}
}
}
initContainers();
} }
private void initContainers() private void initContainers()
{ {
_id = new ContainerNode<Pool>(this); _id = new ContainerNode<Pool>(this);
pointContainer = new LinkedList<Point>(); _pointContainer = new LinkedList<Point>();
_bulletContainer = new LinkedList<IEntity>(); _bulletContainer = new LinkedList<IEntity>();
_awardContainer = new LinkedList<IEntity>(); _awardContainer = new LinkedList<IEntity>();
_enemyContainer = new LinkedList<IEntity>(); _enemyContainer = new LinkedList<IEntity>();
geometryContainer = new LinkedList<IPlainGeometry>();
} }
public void OnRender() public void OnRender()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,12 @@
<name>StgSharp</name> <name>StgSharp</name>
</assembly> </assembly>
<members> <members>
<member name="M:StgSharp.Instruction.InitPool">
<summary>
Add a pool to timeline controller, and return the instance of the pool.
</summary>
<returns></returns>
</member>
<member name="F:StgSharp.Control.ProgramTimeLine.tickCounter"> <member name="F:StgSharp.Control.ProgramTimeLine.tickCounter">
<summary> <summary>
Tick counter count the frames passed since the program start. Tick counter count the frames passed since the program start.
@@ -69,6 +75,11 @@
<param name="tick">当前游戏刻</param> <param name="tick">当前游戏刻</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:StgSharp.Geometries.Square">
<summary>
A square
</summary>
</member>
<member name="M:StgSharp.LinkedList`1.Add(`0)"> <member name="M:StgSharp.LinkedList`1.Add(`0)">
<summary> <summary>
Add an item to the tail of linked list. Add an item to the tail of linked list.
@@ -4,6 +4,12 @@
<name>StgSharp</name> <name>StgSharp</name>
</assembly> </assembly>
<members> <members>
<member name="M:StgSharp.Instruction.InitPool">
<summary>
Add a pool to timeline controller, and return the instance of the pool.
</summary>
<returns></returns>
</member>
<member name="F:StgSharp.Control.ProgramTimeLine.tickCounter"> <member name="F:StgSharp.Control.ProgramTimeLine.tickCounter">
<summary> <summary>
Tick counter count the frames passed since the program start. Tick counter count the frames passed since the program start.
@@ -69,6 +75,11 @@
<param name="tick">当前游戏刻</param> <param name="tick">当前游戏刻</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:StgSharp.Geometries.Square">
<summary>
A square
</summary>
</member>
<member name="M:StgSharp.LinkedList`1.Add(`0)"> <member name="M:StgSharp.LinkedList`1.Add(`0)">
<summary> <summary>
Add an item to the tail of linked list. Add an item to the tail of linked list.
+22 -17
View File
@@ -12,32 +12,37 @@ internal class Program
#if DEBUG #if DEBUG
/**/ /**/
Pool p = new Pool();
Instruction.AddPool(p);
Triangle t = new Triangle(); Window window = new Window();
Console.WriteLine(t.RefPoint01.Position); window.width = 800;
window.height = 600;
window.name = "StgSharp";
window.color = new vec4d(0.1f,0.9f,0.2f,1.0f);
t.RefPoint01.Position = new vec3d(0,0.5f,0); IntPtr windowPtr = internalIO. InitWindow(window);
internalIO.RenderWindow(windowPtr,window);
Window w = new Window(); internalIO.TerminateWindow();
w.width = 800;
w.height = 600;
w.name = "StgSharp";
w.windowColor = new vec4d(0.1f,0.1f,0.1f,1.0f);
//internalIO.LoadTriangle(t);
internalIO.Window(w);
/**/ /**/
#endif #endif
} }
public static unsafe void GetPtr(int a) public unsafe class myClass
{ {
int* ap = &a; internal int* aPtr;
*ap = 100;
public int A
{
get { return *aPtr; }
private set { *aPtr = value; }
}
public myClass(int* ptr)
{
this.aPtr = ptr;
}
} }
@@ -4,6 +4,12 @@
<name>StgSharp</name> <name>StgSharp</name>
</assembly> </assembly>
<members> <members>
<member name="M:StgSharp.Instruction.InitPool">
<summary>
Add a pool to timeline controller, and return the instance of the pool.
</summary>
<returns></returns>
</member>
<member name="F:StgSharp.Control.ProgramTimeLine.tickCounter"> <member name="F:StgSharp.Control.ProgramTimeLine.tickCounter">
<summary> <summary>
Tick counter count the frames passed since the program start. Tick counter count the frames passed since the program start.
@@ -69,6 +75,11 @@
<param name="tick">当前游戏刻</param> <param name="tick">当前游戏刻</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:StgSharp.Geometries.Square">
<summary>
A square
</summary>
</member>
<member name="M:StgSharp.LinkedList`1.Add(`0)"> <member name="M:StgSharp.LinkedList`1.Add(`0)">
<summary> <summary>
Add an item to the tail of linked list. Add an item to the tail of linked list.
+20 -24
View File
@@ -41,22 +41,17 @@ STGSHARPGRAPHICS_API int* versionInfo = &version;
// 这是导出函数的一个示例。 // 这是导出函数的一个示例。
STGSHARPGRAPHICS_API int fnStgSharpGraphics(void)
{
return 0;
}
STGSHARPGRAPHICS_API IOpackage initPackage(void) STGSHARPGRAPHICS_API IOpackage initPackage(void)
{ {
IOpackage pack; IOpackage pack;
pack.InitWindow = initWindow; pack.InitWindow = InitWindow;
return pack; return pack;
} }
STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info) STGSHARPGRAPHICS_API basicWindowInfo* InitWindow(basicWindowInfo info)
{ {
glfwInit(); glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@@ -83,7 +78,11 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
} }
glfwSwapInterval(0); glfwSwapInterval(0);
return window;
}
STGSHARPGRAPHICS_API void ComppileShader(void)
{
//编译顶点着色器 //编译顶点着色器
unsigned int vertexShader; unsigned int vertexShader;
@@ -133,7 +132,10 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
glEnableVertexAttribArray(0); glEnableVertexAttribArray(0);
/**/ /**/
}
STGSHARPGRAPHICS_API void RenderWindow(GLFWwindow* window, basicWindowInfo info)
{
while (!glfwWindowShouldClose(window)) while (!glfwWindowShouldClose(window))
{ {
if (1) if (1)
@@ -145,12 +147,12 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
// render // render
// ------ // ------
/**/ /**/
glClearColor( glClearColor(
info.backgroundColor.x, info.backgroundColor.x,
info.backgroundColor.y, info.backgroundColor.y,
info.backgroundColor.Z, info.backgroundColor.Z,
info.backgroundColor.w info.backgroundColor.w
); );
/**/ /**/
@@ -158,9 +160,9 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
// draw our first triangle // draw our first triangle
/**/ /*
glUseProgram(shaderProgram); glUseProgram(shaderProgram);
glBindVertexArray(VAO); glBindVertexArray(VAO);
// seeing as we only have a single VAO there's no need to bind it every time, // seeing as we only have a single VAO there's no need to bind it every time,
// but we'll do so to keep things a bit more organized // but we'll do so to keep things a bit more organized
glDrawArrays(GL_TRIANGLES, 0, 3); glDrawArrays(GL_TRIANGLES, 0, 3);
@@ -172,26 +174,20 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
glfwSwapBuffers(window); glfwSwapBuffers(window);
glfwPollEvents(); glfwPollEvents();
} }
}
STGSHARPGRAPHICS_API void TerminateWindow(void)
{
// glfw: terminate, clearing all previously allocated GLFW resources. // glfw: terminate, clearing all previously allocated GLFW resources.
// ------------------------------------------------------------------ // ------------------------------------------------------------------
glfwTerminate(); glfwTerminate();
/**/ /*
//glDeleteVertexArrays(1, &VAO); //glDeleteVertexArrays(1, &VAO);
glDeleteBuffers(1, &VBO); glDeleteBuffers(1, &VBO);
//glDeleteBuffers(1, &EBO); //glDeleteBuffers(1, &EBO);
glDeleteProgram(shaderProgram); glDeleteProgram(shaderProgram);
/**/ /**/
return 0;
} }
void renderTriangle()
{
}
@@ -18,10 +18,15 @@
#endif #endif
/**/ /**/
/**/
extern STGSHARPGRAPHICS_API int* versionInfo; extern STGSHARPGRAPHICS_API int* versionInfo;
/**/
STGSHARPGRAPHICS_API basicWindowInfo* InitWindow(basicWindowInfo info);
STGSHARPGRAPHICS_API void ComppileShader(void);
STGSHARPGRAPHICS_API void RenderWindow(GLFWwindow* window, basicWindowInfo info);
STGSHARPGRAPHICS_API void TerminateWindow(void);
STGSHARPGRAPHICS_API int fnStgSharpGraphics(void);
STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info);
STGSHARPGRAPHICS_API IOpackage initPackage(void); STGSHARPGRAPHICS_API IOpackage initPackage(void);
STGSHARPGRAPHICS_API TriangleVertexHandler initTriangle(void); STGSHARPGRAPHICS_API TriangleVertexHandler initTriangle(void);
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.