daily update on 20230529 by nitload youmu
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,6 +8,17 @@ namespace StgSharp
|
||||
{
|
||||
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)
|
||||
{
|
||||
ProgramTimeLine.allPool.Add(pool);
|
||||
|
||||
@@ -8,7 +8,16 @@ namespace StgSharp
|
||||
{
|
||||
public static partial class internalIO
|
||||
{
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "initWindow")]
|
||||
public static extern void Window(Window win);
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "InitWindow")]
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace StgSharp.Control
|
||||
{
|
||||
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
|
||||
{
|
||||
internal vec3d* positionPtr;
|
||||
internal readonly bool isVertex;
|
||||
|
||||
internal Point(vec3d* ptr)
|
||||
{
|
||||
positionPtr = ptr;
|
||||
}
|
||||
|
||||
public Point()
|
||||
{
|
||||
IntPtr ptr = Marshal.AllocHGlobal(sizeof(vec3d));
|
||||
positionPtr = (vec3d*)ptr.ToPointer();
|
||||
}
|
||||
|
||||
public vec3d Position
|
||||
{
|
||||
get { return *positionPtr; }
|
||||
set { *positionPtr = value; }
|
||||
}
|
||||
|
||||
public vec3d* PositionPtr
|
||||
{
|
||||
get { return positionPtr; }
|
||||
set { positionPtr = value; }
|
||||
}
|
||||
|
||||
public float X
|
||||
{
|
||||
get { return (*this.positionPtr).X; }
|
||||
@@ -43,7 +56,6 @@ namespace StgSharp.Geometries
|
||||
set { (*this.positionPtr).Z = value; }
|
||||
}
|
||||
|
||||
internal readonly bool isVertex;
|
||||
|
||||
public bool IsVertex => isVertex;
|
||||
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
using System;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A square
|
||||
/// </summary>
|
||||
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()
|
||||
{
|
||||
this.vertexArray = internalIO.initTriangleVertex();
|
||||
this.vertex1 = new Point(vertexArray.vertex1Ptr);
|
||||
this.vertex2 = new Point(vertexArray.vertex2Ptr);
|
||||
this.vertex3 = new Point(vertexArray.vertex3Ptr);
|
||||
|
||||
this.vertex1 = new Point();
|
||||
this.vertex2 = new Point();
|
||||
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(vertex2);
|
||||
ProgramTimeLine._currentPool.pointContainer.Add(vertex3);
|
||||
ProgramTimeLine._currentPool._pointContainer.Add(vertex1);
|
||||
ProgramTimeLine._currentPool._pointContainer.Add(vertex2);
|
||||
ProgramTimeLine._currentPool._pointContainer.Add(vertex3);
|
||||
/**/
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Triangle(
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public int width;
|
||||
public int height;
|
||||
public vec4d windowColor;
|
||||
public vec4d color;
|
||||
public string name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace StgSharp
|
||||
{
|
||||
public class Pool:INode<Pool>
|
||||
{
|
||||
internal LinkedList<Point> pointContainer;
|
||||
internal LinkedList<Point> _pointContainer;
|
||||
internal LinkedList<IPlainGeometry> geometryContainer;
|
||||
internal LinkedList<IEntity> _bulletContainer;
|
||||
internal LinkedList<IEntity> _awardContainer;
|
||||
@@ -27,78 +27,19 @@ namespace StgSharp
|
||||
public Line TopBoarder => topBoader;
|
||||
public Line BottomBoarder => bottomBoader;
|
||||
|
||||
internal Sensor<EntityPartical> Sensor;
|
||||
|
||||
#if DEBUG
|
||||
public Pool()
|
||||
internal Pool()
|
||||
{
|
||||
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()
|
||||
{
|
||||
_id = new ContainerNode<Pool>(this);
|
||||
pointContainer = new LinkedList<Point>();
|
||||
_pointContainer = new LinkedList<Point>();
|
||||
_bulletContainer = new LinkedList<IEntity>();
|
||||
_awardContainer = new LinkedList<IEntity>();
|
||||
_enemyContainer = new LinkedList<IEntity>();
|
||||
|
||||
geometryContainer = new LinkedList<IPlainGeometry>();
|
||||
}
|
||||
|
||||
public void OnRender()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,12 @@
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<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">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
@@ -69,6 +75,11 @@
|
||||
<param name="tick">当前游戏刻</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.Square">
|
||||
<summary>
|
||||
A square
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.LinkedList`1.Add(`0)">
|
||||
<summary>
|
||||
Add an item to the tail of linked list.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,12 @@
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<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">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
@@ -69,6 +75,11 @@
|
||||
<param name="tick">当前游戏刻</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.Square">
|
||||
<summary>
|
||||
A square
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.LinkedList`1.Add(`0)">
|
||||
<summary>
|
||||
Add an item to the tail of linked list.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -12,32 +12,37 @@ internal class Program
|
||||
#if DEBUG
|
||||
|
||||
/**/
|
||||
Pool p = new Pool();
|
||||
Instruction.AddPool(p);
|
||||
|
||||
Triangle t = new Triangle();
|
||||
Console.WriteLine(t.RefPoint01.Position);
|
||||
Window window = new Window();
|
||||
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);
|
||||
|
||||
Window w = new Window();
|
||||
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);
|
||||
IntPtr windowPtr = internalIO. InitWindow(window);
|
||||
internalIO.RenderWindow(windowPtr,window);
|
||||
internalIO.TerminateWindow();
|
||||
|
||||
/**/
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
public static unsafe void GetPtr(int a)
|
||||
public unsafe class myClass
|
||||
{
|
||||
int* ap = &a;
|
||||
*ap = 100;
|
||||
internal int* aPtr;
|
||||
|
||||
public int A
|
||||
{
|
||||
get { return *aPtr; }
|
||||
private set { *aPtr = value; }
|
||||
}
|
||||
|
||||
public myClass(int* ptr)
|
||||
{
|
||||
this.aPtr = ptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -4,6 +4,12 @@
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<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">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
@@ -69,6 +75,11 @@
|
||||
<param name="tick">当前游戏刻</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.Square">
|
||||
<summary>
|
||||
A square
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.LinkedList`1.Add(`0)">
|
||||
<summary>
|
||||
Add an item to the tail of linked list.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,22 +41,17 @@ STGSHARPGRAPHICS_API int* versionInfo = &version;
|
||||
|
||||
|
||||
// 这是导出函数的一个示例。
|
||||
STGSHARPGRAPHICS_API int fnStgSharpGraphics(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
STGSHARPGRAPHICS_API IOpackage initPackage(void)
|
||||
{
|
||||
IOpackage pack;
|
||||
pack.InitWindow = initWindow;
|
||||
pack.InitWindow = InitWindow;
|
||||
return pack;
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
STGSHARPGRAPHICS_API basicWindowInfo* InitWindow(basicWindowInfo info)
|
||||
{
|
||||
|
||||
|
||||
|
||||
glfwInit();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
@@ -83,7 +78,11 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
}
|
||||
|
||||
glfwSwapInterval(0);
|
||||
return window;
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API void ComppileShader(void)
|
||||
{
|
||||
//编译顶点着色器
|
||||
|
||||
unsigned int vertexShader;
|
||||
@@ -133,7 +132,10 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
/**/
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API void RenderWindow(GLFWwindow* window, basicWindowInfo info)
|
||||
{
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
if (1)
|
||||
@@ -145,12 +147,12 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
|
||||
// render
|
||||
// ------
|
||||
|
||||
|
||||
/**/
|
||||
glClearColor(
|
||||
info.backgroundColor.x,
|
||||
info.backgroundColor.y,
|
||||
info.backgroundColor.Z,
|
||||
info.backgroundColor.x,
|
||||
info.backgroundColor.y,
|
||||
info.backgroundColor.Z,
|
||||
info.backgroundColor.w
|
||||
);
|
||||
/**/
|
||||
@@ -158,9 +160,9 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// draw our first triangle
|
||||
/**/
|
||||
/*
|
||||
glUseProgram(shaderProgram);
|
||||
glBindVertexArray(VAO);
|
||||
glBindVertexArray(VAO);
|
||||
// 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
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
@@ -172,26 +174,20 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API void TerminateWindow(void)
|
||||
{
|
||||
// glfw: terminate, clearing all previously allocated GLFW resources.
|
||||
// ------------------------------------------------------------------
|
||||
glfwTerminate();
|
||||
|
||||
/**/
|
||||
/*
|
||||
//glDeleteVertexArrays(1, &VAO);
|
||||
glDeleteBuffers(1, &VBO);
|
||||
//glDeleteBuffers(1, &EBO);
|
||||
glDeleteProgram(shaderProgram);
|
||||
/**/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void renderTriangle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,10 +18,15 @@
|
||||
#endif
|
||||
/**/
|
||||
|
||||
/**/
|
||||
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 TriangleVertexHandler initTriangle(void);
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user