daily update on 20231016 by nitload youmu, vao,vbo,ebo struct added
This commit is contained in:
@@ -6,9 +6,9 @@ namespace StgSharp
|
||||
public static unsafe partial class Geometry
|
||||
{
|
||||
public static unsafe Triangle InitTriagnle<T>(
|
||||
Vec3d vertex1,
|
||||
Vec3d vertex2,
|
||||
Vec3d vertex3
|
||||
vec3d vertex1,
|
||||
vec3d vertex2,
|
||||
vec3d vertex3
|
||||
) where T : Triangle
|
||||
{
|
||||
Triangle t = new Triangle();
|
||||
|
||||
@@ -328,6 +328,11 @@ namespace StgSharp
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe GLFWframebuffersizefun glfwSetFramebufferSizeCallback(IntPtr window, GLFWframebuffersizefun callback);
|
||||
|
||||
//window is the pointer to a glfwwindow instance
|
||||
[DllImport(SSGC_libname, EntryPoint = "glfwSetFramebufferSizeCallback",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe GLFWframebuffersizefun glfwSetFramebufferSizeCallback(IntPtr window, FrameBufferSizeHadler callback);
|
||||
|
||||
[DllImport(SSGC_libname, EntryPoint = "glfwSetErrorCallback",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
|
||||
|
||||
@@ -1,20 +1,74 @@
|
||||
|
||||
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Geometries;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal enum LogType
|
||||
{
|
||||
Error,
|
||||
Warning,
|
||||
Info,
|
||||
InfoError,
|
||||
InfoWarning,
|
||||
}
|
||||
|
||||
internal static unsafe partial class internalIO
|
||||
{
|
||||
|
||||
internal const string SSGC_libname =
|
||||
"StgSharpGraphic";
|
||||
|
||||
internal const string SSG_errorlog =
|
||||
"SSG_errorlog.log";
|
||||
|
||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||
{
|
||||
if (!File.Exists(internalIO.SSG_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(internalIO.SSG_errorlog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
||||
{
|
||||
logStream.WriteLine(beforeTime);
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
logStream.WriteLine(logLine);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
||||
{
|
||||
if (!File.Exists(internalIO.SSG_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(internalIO.SSG_errorlog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
||||
{
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
|
||||
logStream.WriteLine(logLine);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalAppendLog(string log)
|
||||
{
|
||||
if (!File.Exists(internalIO.SSG_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(internalIO.SSG_errorlog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
||||
{
|
||||
logStream.WriteLine(log);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,15 @@ namespace StgSharp
|
||||
public abstract class IEntity
|
||||
{
|
||||
internal Point _pos;
|
||||
internal LinkedList<IPlainGeometry> _collisionBox;
|
||||
internal Sensor<IPlainGeometry> _collisionSensor;
|
||||
internal LinkedList<PlainGeometry> _collisionBox;
|
||||
internal Sensor<PlainGeometry> _collisionSensor;
|
||||
internal string _texture;
|
||||
internal Point _position;
|
||||
internal Point _basePoint;
|
||||
internal GetLocationHandler _movHandler;
|
||||
protected uint _bornTick;
|
||||
|
||||
public LinkedList<IPlainGeometry> CollisionBox
|
||||
public LinkedList<PlainGeometry> CollisionBox
|
||||
{
|
||||
get { return _collisionBox; }
|
||||
set { _collisionBox = value; }
|
||||
@@ -23,7 +23,7 @@ namespace StgSharp
|
||||
/// <summary>
|
||||
/// A sensor used for cheking out if a bullet hit a player or something else
|
||||
/// </summary>
|
||||
public Sensor<IPlainGeometry> CollisionSensor
|
||||
public Sensor<PlainGeometry> CollisionSensor
|
||||
{
|
||||
get { return _collisionSensor; }
|
||||
set { _collisionSensor = value; }
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class Arc : IPlainGeometry
|
||||
public class Arc : PlainGeometry
|
||||
{
|
||||
internal Point center;
|
||||
internal Point beginPoint;
|
||||
@@ -18,11 +18,13 @@ namespace StgSharp.Geometries
|
||||
|
||||
public override Point RefPoint2 => endPoint;
|
||||
|
||||
public virtual Vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
||||
internal override int[] Indices => throw new NotImplementedException();
|
||||
|
||||
public virtual Vec3d MovBegin(uint tick) => movBeginOperation.Invoke(tick);
|
||||
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
||||
|
||||
public virtual Vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
|
||||
public virtual vec3d MovBegin(uint tick) => movBeginOperation.Invoke(tick);
|
||||
|
||||
public virtual vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class Circle : IPlainGeometry
|
||||
public class Circle : PlainGeometry
|
||||
{
|
||||
internal Point center;
|
||||
internal Point pointOnCircle;
|
||||
@@ -19,11 +19,13 @@ namespace StgSharp.Geometries
|
||||
|
||||
public override Point RefPoint2 => pointOnPlain;
|
||||
|
||||
public virtual Vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
||||
internal override int[] Indices => throw new NotImplementedException();
|
||||
|
||||
public virtual Vec3d UpdateRadius(uint tick) => movBeginOperation.Invoke(tick);
|
||||
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
||||
|
||||
public virtual Vec3d UpdatePlain(uint tick) => movEndOperation.Invoke(tick);
|
||||
public virtual vec3d UpdateRadius(uint tick) => movBeginOperation.Invoke(tick);
|
||||
|
||||
public virtual vec3d UpdatePlain(uint tick) => movEndOperation.Invoke(tick);
|
||||
|
||||
public override Plain GetPlain()
|
||||
{
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
/// <summary>
|
||||
/// 计算位移失量,需要手动输入游戏刻以提供时间数据
|
||||
/// Caculate the movement of a point.
|
||||
/// </summary>
|
||||
/// <param name="tick"></param>
|
||||
/// <returns>表示位移量的三维矢量</returns>
|
||||
public delegate Vec3d GetLocationHandler(uint tick);
|
||||
/// <param name="tick">The game tick represent time passed by</param>
|
||||
/// <returns>A 3d vector representing movement</returns>
|
||||
public delegate vec3d GetLocationHandler(uint tick);
|
||||
|
||||
public static unsafe class GeometryOperation
|
||||
{
|
||||
public static Vec3d DefualtMotion(uint tick)
|
||||
public static vec3d DefualtMotion(uint tick)
|
||||
{
|
||||
return default(Vec3d);
|
||||
return default(vec3d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Numerics;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class Line : IPlainGeometry
|
||||
public class Line : PlainGeometry
|
||||
{
|
||||
internal Point basePoint;
|
||||
internal Point beginPoint;
|
||||
@@ -16,6 +16,11 @@ namespace StgSharp.Geometries
|
||||
public override Point RefPoint1 => endPoint;
|
||||
public override Point RefPoint2 => default;
|
||||
|
||||
internal override int[] Indices
|
||||
{
|
||||
get { throw new Exception(); }
|
||||
}
|
||||
|
||||
public Line(Point begin, Point end)
|
||||
{
|
||||
this.beginPoint = begin;
|
||||
@@ -31,11 +36,11 @@ namespace StgSharp.Geometries
|
||||
public Line() { }
|
||||
|
||||
//计算线起点的方法,通过对线的派生的重写实现功能
|
||||
public virtual Vec3d MoveBeginPoint(uint tick)
|
||||
public virtual vec3d MoveBeginPoint(uint tick)
|
||||
=> movBegin.Invoke(tick);
|
||||
|
||||
//计算线重点的方法,通过对线的派生的重写实现功能
|
||||
public virtual Vec3d MoveEndPoint(uint tick)
|
||||
public virtual vec3d MoveEndPoint(uint tick)
|
||||
=> movEnd.Invoke(tick);
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
|
||||
@@ -3,7 +3,7 @@ using StgSharp.Math;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
internal class Parallelogram : Polygon4
|
||||
public class Parallelogram : Polygon4
|
||||
{
|
||||
internal Point center;
|
||||
|
||||
@@ -11,13 +11,35 @@ namespace StgSharp.Geometries
|
||||
public sealed override Point RefPoint1 => new Point(vertexMat.mat.colum0);
|
||||
public sealed override Point RefPoint2 => new Point(vertexMat.mat.colum1);
|
||||
|
||||
internal readonly GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal readonly GetLocationHandler movCenterOperation =
|
||||
new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
public GetLocationHandler MovCenterOperation { get { return movCenterOperation; } }
|
||||
public GetLocationHandler MovVertex01Operation { get { return moveVertex0Operation; } }
|
||||
public GetLocationHandler MovVertex02Operation { get { return moveVertex1Operation; } }
|
||||
|
||||
public virtual Vec3d MovCenter(uint tick)
|
||||
public Parallelogram(
|
||||
float v0x, float v0y, float v0z,
|
||||
float v1x, float v1y, float v1z,
|
||||
float v2x, float v2y, float v2z,
|
||||
float v3x, float v3y, float v3z
|
||||
) : base(
|
||||
v0x, v0y, v0z,
|
||||
v1x, v1y, v1z,
|
||||
v2x, v2y, v2z,
|
||||
v3x, v2y, v3z
|
||||
)
|
||||
{
|
||||
if (
|
||||
vertexMat.Colum0 + vertexMat.Colum2 !=
|
||||
vertexMat.Colum1 + vertexMat.Colum3
|
||||
)
|
||||
{
|
||||
internalIO.InternalWriteLog("Init of geometry item failed, because four vertices cannot form a rectangle.", LogType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual vec3d MovCenter(uint tick)
|
||||
{
|
||||
return movCenterOperation.Invoke(tick);
|
||||
}
|
||||
@@ -28,7 +50,7 @@ namespace StgSharp.Geometries
|
||||
/// <param name="tick">Current time tick</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UnusedVertexException">Geometry overdefined</exception>
|
||||
public sealed override Vec3d MoveVertex2(uint tick)
|
||||
public sealed override vec3d MoveVertex2(uint tick)
|
||||
{
|
||||
throw new UnusedVertexException();
|
||||
}
|
||||
@@ -39,7 +61,7 @@ namespace StgSharp.Geometries
|
||||
/// <param name="tick">Current time tick</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UnusedVertexException">Geometry overdefined</exception>
|
||||
public sealed override Vec3d MoveVertex3(uint tick)
|
||||
public sealed override vec3d MoveVertex3(uint tick)
|
||||
{
|
||||
throw new UnusedVertexException();
|
||||
}
|
||||
|
||||
@@ -5,22 +5,22 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public unsafe class Plain
|
||||
{
|
||||
internal Vec3d origin;
|
||||
internal Vec3d vec1;
|
||||
internal Vec3d vec2;
|
||||
internal vec3d origin;
|
||||
internal vec3d vec1;
|
||||
internal vec3d vec2;
|
||||
|
||||
internal Vec3d plainParameter;
|
||||
internal vec3d plainParameter;
|
||||
internal readonly float d = -1;
|
||||
|
||||
internal Plain(Vector4 origin, Vector4 p1, Vector4 p2)
|
||||
{
|
||||
this.origin = new Vec3d(origin);
|
||||
this.origin = new vec3d(origin);
|
||||
|
||||
vec1 = new Vec3d(p1 - origin);
|
||||
vec2 = new Vec3d(p2 - origin);
|
||||
vec1 = new vec3d(p1 - origin);
|
||||
vec2 = new vec3d(p2 - origin);
|
||||
}
|
||||
|
||||
public Plain(Vec3d o, Vec3d v1, Vec3d v2)
|
||||
public Plain(vec3d o, vec3d v1, vec3d v2)
|
||||
{
|
||||
this.origin = o;
|
||||
this.vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
|
||||
@@ -39,9 +39,9 @@ namespace StgSharp.Geometries
|
||||
|
||||
public Plain(Point p1, Point p2, Point p3)
|
||||
{
|
||||
Vec3d origin = p1.Position;
|
||||
Vec3d v1 = p2.Position - origin;
|
||||
Vec3d v2 = p3.Position - origin;
|
||||
vec3d origin = p1.Position;
|
||||
vec3d v1 = p2.Position - origin;
|
||||
vec3d v2 = p3.Position - origin;
|
||||
|
||||
|
||||
vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
|
||||
|
||||
+10
-5
@@ -1,10 +1,12 @@
|
||||
namespace StgSharp.Geometries
|
||||
using StgSharp.Math;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
/// </summary>
|
||||
public abstract class IPlainGeometry
|
||||
public abstract class PlainGeometry
|
||||
{
|
||||
protected readonly uint bornTick;
|
||||
internal readonly Point refOrigin;
|
||||
@@ -14,19 +16,22 @@
|
||||
public abstract Point RefPoint0 { get; }
|
||||
public abstract Point RefPoint1 { get; }
|
||||
public abstract Point RefPoint2 { get; }
|
||||
|
||||
public uint BornTime => bornTick;
|
||||
|
||||
public IPlainGeometry(uint bornTime)
|
||||
internal abstract int[] Indices { get; }
|
||||
|
||||
public PlainGeometry(uint bornTime)
|
||||
{
|
||||
bornTick = bornTime;
|
||||
}
|
||||
|
||||
public IPlainGeometry(Counter<uint> MainTimer)
|
||||
public PlainGeometry(Counter<uint> MainTimer)
|
||||
{
|
||||
bornTick = MainTimer.Value;
|
||||
}
|
||||
|
||||
public IPlainGeometry() { }
|
||||
public PlainGeometry() { }
|
||||
|
||||
|
||||
internal abstract void OnRender(uint tick);
|
||||
@@ -8,27 +8,27 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public unsafe class Point
|
||||
{
|
||||
internal Vec3d position;
|
||||
internal vec3d position;
|
||||
internal readonly bool isVertex;
|
||||
|
||||
public Point() { }
|
||||
|
||||
internal Point(Vec3d p)
|
||||
internal Point(vec3d p)
|
||||
{
|
||||
position = p;
|
||||
}
|
||||
|
||||
internal Point(Vector4 vector)
|
||||
{
|
||||
position = new Vec3d(vector);
|
||||
position = new vec3d(vector);
|
||||
}
|
||||
|
||||
public Point(float x, float y, float z)
|
||||
{
|
||||
position = new Vec3d(x, y, z);
|
||||
position = new vec3d(x, y, z);
|
||||
}
|
||||
|
||||
public Vec3d Position
|
||||
public vec3d Position
|
||||
{
|
||||
get { return position; }
|
||||
set { position = value; }
|
||||
@@ -64,12 +64,12 @@ namespace StgSharp.Geometries
|
||||
/// <param name="tick">Time passes since the program begin, counted by frames</param>
|
||||
public virtual void Update(uint tick) { }
|
||||
|
||||
public bool IsInGeometry(IPlainGeometry geo)
|
||||
public bool IsInGeometry(PlainGeometry geo)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsOnPlain(IPlainGeometry geo)
|
||||
public bool IsOnPlain(PlainGeometry geo)
|
||||
{
|
||||
return position * geo.GetPlain().plainParameter == 1;
|
||||
}
|
||||
|
||||
@@ -1,54 +1,102 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Math;
|
||||
using System.Numerics;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class Polygon4 : IPlainGeometry
|
||||
public class Polygon4 : PlainGeometry
|
||||
{
|
||||
internal Matrix3x4 vertexMat;
|
||||
|
||||
internal Point vertex0 { get; set; }
|
||||
internal Point vertex1 { get; set; }
|
||||
internal Point vertex2 { get; set; }
|
||||
internal Point vertex3 { get; set; }
|
||||
|
||||
internal readonly GetLocationHandler moveVertex0Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal readonly GetLocationHandler moveVertex1Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal readonly GetLocationHandler moveVertex2Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal readonly GetLocationHandler moveVertex3Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
internal Matrix3x4 vertexMat;
|
||||
|
||||
internal Polygon4()
|
||||
{
|
||||
}
|
||||
|
||||
public Polygon4(
|
||||
float v0x, float v0y, float v0z,
|
||||
float v1x, float v1y, float v1z,
|
||||
float v2x, float v2y, float v2z,
|
||||
float v3x, float v3y, float v3z
|
||||
)
|
||||
{
|
||||
vertexMat.mat.colum0 = new Vector4(v0x, v0y, v0z, 0);
|
||||
vertexMat.mat.colum1 = new Vector4(v1x, v1y, v1z, 0);
|
||||
vertexMat.mat.colum2 = new Vector4(v2x, v2y, v2z, 0);
|
||||
vertexMat.mat.colum3 = new Vector4(v3x, v3y, v3z, 0);
|
||||
}
|
||||
|
||||
public GetLocationHandler MovVertex0Operaion { get { return moveVertex0Operation; } }
|
||||
public GetLocationHandler MovVertex1Operaion { get { return moveVertex1Operation; } }
|
||||
public GetLocationHandler MovVertex2Operaion { get { return moveVertex2Operation; } }
|
||||
public GetLocationHandler MovVertex3Operaion { get { return moveVertex3Operation; } }
|
||||
|
||||
public override Point RefPoint0
|
||||
{
|
||||
get { return new Point(vertexMat.transpose.colum0); }
|
||||
get { return new Point(vertexMat.mat.colum0); }
|
||||
}
|
||||
|
||||
public override Point RefPoint1
|
||||
{
|
||||
get { return new Point(vertexMat.transpose.colum1); }
|
||||
get { return new Point(vertexMat.mat.colum1); }
|
||||
}
|
||||
|
||||
public override Point RefPoint2
|
||||
{
|
||||
get { return new Point(vertexMat.transpose.colum2); }
|
||||
get { return new Point(vertexMat.mat.colum2); }
|
||||
}
|
||||
|
||||
public GetLocationHandler MovVertex01Operaion { get { return moveVertex0Operation; } }
|
||||
public GetLocationHandler MovVertex02Operaion { get { return moveVertex1Operation; } }
|
||||
public GetLocationHandler MovVertex03Operaion { get { return moveVertex2Operation; } }
|
||||
public GetLocationHandler MovVertex04Operaion { get { return moveVertex3Operation; } }
|
||||
|
||||
public unsafe Polygon4()
|
||||
internal sealed override int[] Indices
|
||||
{
|
||||
get
|
||||
{
|
||||
return new int[6] {
|
||||
0,1,2,
|
||||
0,2,3};
|
||||
}
|
||||
}
|
||||
|
||||
public Mat4 VertexBuffer
|
||||
{
|
||||
get { return vertexMat.mat; }
|
||||
}
|
||||
|
||||
public Point Vertex0
|
||||
{
|
||||
get => new Point(vertexMat.mat.colum0);
|
||||
set { vertexMat.mat.colum0 = value.position.vec; }
|
||||
}
|
||||
|
||||
public Point Vertex1
|
||||
{
|
||||
get => new Point(vertexMat.mat.colum1);
|
||||
set { vertexMat.mat.colum1 = value.position.vec; }
|
||||
}
|
||||
|
||||
public Point Vertex2
|
||||
{
|
||||
get => new Point(vertexMat.mat.colum2);
|
||||
set { vertexMat.mat.colum1 = value.position.vec; }
|
||||
}
|
||||
|
||||
internal Point Vertex3
|
||||
{
|
||||
get => new Point(vertexMat.mat.colum3);
|
||||
set { vertexMat.mat.colum1 = value.position.vec; }
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
{
|
||||
Line[] sides = new Line[4]
|
||||
{
|
||||
new Line(vertex0,vertex1),
|
||||
new Line(vertex1, vertex2),
|
||||
new Line(vertex2, vertex3),
|
||||
new Line(vertex3, vertex0)
|
||||
new Line(Vertex0, Vertex1),
|
||||
new Line(Vertex1, Vertex2),
|
||||
new Line(Vertex2, Vertex3),
|
||||
new Line(Vertex3, Vertex0)
|
||||
};
|
||||
|
||||
return sides;
|
||||
@@ -63,14 +111,17 @@ namespace StgSharp.Geometries
|
||||
vertexMat.mat.colum2);
|
||||
}
|
||||
|
||||
public virtual vec3d MoveVertex0(uint tick)
|
||||
=> moveVertex0Operation.Invoke(tick);
|
||||
|
||||
public virtual Vec3d MoveVertex0(uint tick) => moveVertex0Operation.Invoke(tick);
|
||||
public virtual vec3d MoveVertex1(uint tick)
|
||||
=> moveVertex1Operation.Invoke(tick);
|
||||
|
||||
public virtual Vec3d MoveVertex1(uint tick) => moveVertex1Operation.Invoke(tick);
|
||||
public virtual vec3d MoveVertex2(uint tick)
|
||||
=> moveVertex2Operation.Invoke(tick);
|
||||
|
||||
public virtual Vec3d MoveVertex2(uint tick) => moveVertex2Operation.Invoke(tick);
|
||||
|
||||
public virtual Vec3d MoveVertex3(uint tick) => moveVertex3Operation.Invoke(tick);
|
||||
public virtual vec3d MoveVertex3(uint tick)
|
||||
=> moveVertex3Operation.Invoke(tick);
|
||||
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
|
||||
@@ -1,30 +1,39 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Math.Linear;
|
||||
using System.Numerics;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public unsafe class Polygon5 : IPlainGeometry
|
||||
public unsafe class Polygon5 : PlainGeometry
|
||||
{
|
||||
|
||||
internal Point _refOrigin;
|
||||
internal readonly Point vertex1;
|
||||
internal readonly Point vertex2;
|
||||
internal readonly Point vertex3;
|
||||
internal readonly Point vertex4;
|
||||
internal readonly Point vertex5;
|
||||
internal readonly int _vertexCount;
|
||||
|
||||
public override Point RefPoint0 => vertex1;
|
||||
|
||||
public override Point RefPoint1 => vertex2;
|
||||
|
||||
public override Point RefPoint2 => vertex3;
|
||||
|
||||
internal GetLocationHandler movP01Operation = default;
|
||||
internal GetLocationHandler movP02Operation = default;
|
||||
internal GetLocationHandler movP03Operation = default;
|
||||
internal GetLocationHandler movP04Operation = default;
|
||||
internal GetLocationHandler movP05Operation = default;
|
||||
internal mat5 vertexMat;
|
||||
|
||||
public unsafe Polygon5()
|
||||
{
|
||||
}
|
||||
|
||||
public Polygon5(
|
||||
float v0x, float v0y, float v0z,
|
||||
float v1x, float v1y, float v1z,
|
||||
float v2x, float v2y, float v2z,
|
||||
float v3x, float v3y, float v3z,
|
||||
float v4x, float v4y, float v4z
|
||||
)
|
||||
{
|
||||
vertexMat.vec0 = new Vector4(v0x, v0y, v0z, 0);
|
||||
vertexMat.vec1 = new Vector4(v1x, v1y, v1z, 0);
|
||||
vertexMat.vec2 = new Vector4(v2x, v2y, v2z, 0);
|
||||
vertexMat.vec3 = new Vector4(v3x, v3y, v3z, 0);
|
||||
vertexMat.vec4 = new Vector4(v4x, v4y, v4z, 0);
|
||||
}
|
||||
|
||||
|
||||
public GetLocationHandler MovP01Operation { get => movP01Operation; }
|
||||
public GetLocationHandler MovP02Operation { get => movP02Operation; }
|
||||
@@ -32,46 +41,91 @@ namespace StgSharp.Geometries
|
||||
public GetLocationHandler MovP04Operation { get => movP04Operation; }
|
||||
public GetLocationHandler MovP05Operation { get => movP05Operation; }
|
||||
|
||||
public unsafe Polygon5()
|
||||
public override Point RefPoint0 => Vertex0;
|
||||
public override Point RefPoint1 => Vertex1;
|
||||
public override Point RefPoint2 => Vertex2;
|
||||
|
||||
public mat5 VertexBuffer
|
||||
{
|
||||
get { return vertexMat; }
|
||||
}
|
||||
|
||||
public virtual Vec3d movPoint01(uint tick) => movP01Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual Vec3d movPoint02(uint tick) => movP02Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual Vec3d movPoint03(uint tick) => movP03Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual Vec3d movPoint04(uint tick) => movP04Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual Vec3d movPoint05(uint tick) => movP05Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
public Point Vertex0
|
||||
{
|
||||
uint nowTick = tick - BornTime;
|
||||
vertex1.Position = RefOrigin.Position + movPoint01(nowTick);
|
||||
vertex2.Position = RefOrigin.Position + movPoint02(nowTick);
|
||||
vertex3.Position = RefOrigin.Position + movPoint03(nowTick);
|
||||
vertex4.Position = RefOrigin.Position + movPoint04(nowTick);
|
||||
vertex5.Position = RefOrigin.Position + movPoint05(nowTick);
|
||||
get => new Point(vertexMat.vec0);
|
||||
set { vertexMat.vec0 = value.position.vec; }
|
||||
}
|
||||
|
||||
public Point Vertex1
|
||||
{
|
||||
get => new Point(vertexMat.vec1);
|
||||
set { vertexMat.vec1 = value.position.vec; }
|
||||
}
|
||||
|
||||
public Point Vertex2
|
||||
{
|
||||
get => new Point(vertexMat.vec2);
|
||||
set { vertexMat.vec2 = value.position.vec; }
|
||||
}
|
||||
|
||||
public Point Vertex3
|
||||
{
|
||||
get => new Point(vertexMat.vec3);
|
||||
set { vertexMat.vec3 = value.position.vec; }
|
||||
}
|
||||
|
||||
public Point Vertex4
|
||||
{
|
||||
get => new Point(vertexMat.vec4);
|
||||
set { vertexMat.vec4 = value.position.vec; }
|
||||
}
|
||||
|
||||
internal override int[] Indices
|
||||
{
|
||||
get
|
||||
{
|
||||
return new int[9]{
|
||||
0,1,2,
|
||||
0,2,3,
|
||||
0,3,4};
|
||||
}
|
||||
}
|
||||
public override Line[] GetAllSides()
|
||||
{
|
||||
return new Line[5]
|
||||
{
|
||||
new Line(vertex1,vertex2),
|
||||
new Line(vertex2,vertex3),
|
||||
new Line(vertex3,vertex4),
|
||||
new Line(vertex4,vertex5),
|
||||
new Line(vertex5,vertex1)
|
||||
new Line(Vertex0,Vertex1),
|
||||
new Line(Vertex1,Vertex2),
|
||||
new Line(Vertex2,Vertex3),
|
||||
new Line(Vertex3,Vertex4),
|
||||
new Line(Vertex4,Vertex0)
|
||||
};
|
||||
}
|
||||
|
||||
public override Plain GetPlain()
|
||||
{
|
||||
return new Plain(vertex1, vertex2, vertex3);
|
||||
return new Plain(Vertex0, Vertex1, Vertex2);
|
||||
}
|
||||
|
||||
public virtual vec3d movVertex01(uint tick) => movP01Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual vec3d movVertex02(uint tick) => movP02Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual vec3d movVertex03(uint tick) => movP03Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual vec3d movVertex04(uint tick) => movP04Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual vec3d movVertex05(uint tick) => movP05Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
{
|
||||
uint nowTick = tick - BornTime;
|
||||
vertexMat.vec0 = (RefOrigin.Position + movVertex01(nowTick)).vec;
|
||||
vertexMat.vec1 = (RefOrigin.Position + movVertex02(nowTick)).vec;
|
||||
vertexMat.vec2 = (RefOrigin.Position + movVertex03(nowTick)).vec;
|
||||
vertexMat.vec3 = (RefOrigin.Position + movVertex04(nowTick)).vec;
|
||||
vertexMat.vec4 = (RefOrigin.Position + movVertex05(nowTick)).vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,97 +1,139 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Math.Linear;
|
||||
using System.Numerics;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class Polygon6 : IPlainGeometry
|
||||
public class Polygon6 : PlainGeometry
|
||||
{
|
||||
internal Point _refOrigin;
|
||||
internal Point vertex1;
|
||||
internal Point vertex2;
|
||||
internal Point vertex3;
|
||||
internal Point vertex4;
|
||||
internal Point vertex5;
|
||||
internal Point vertex6;
|
||||
internal readonly int _vertexCount;
|
||||
|
||||
public override Point RefPoint0 => vertex1;
|
||||
|
||||
public override Point RefPoint1 => vertex2;
|
||||
|
||||
public override Point RefPoint2 => vertex3;
|
||||
internal GetLocationHandler movVertex0Operation = default;
|
||||
internal GetLocationHandler movVertex1Operation = default;
|
||||
internal GetLocationHandler movVertex2Operation = default;
|
||||
internal GetLocationHandler movVertex3Operation = default;
|
||||
internal GetLocationHandler movVertex4Operation = default;
|
||||
internal GetLocationHandler movVertex5Operation = default;
|
||||
internal mat6 vertexMat;
|
||||
|
||||
|
||||
internal GetLocationHandler movP01Operation = default;
|
||||
internal GetLocationHandler movP02Operation = default;
|
||||
internal GetLocationHandler movP03Operation = default;
|
||||
internal GetLocationHandler movP04Operation = default;
|
||||
internal GetLocationHandler movP05Operation = default;
|
||||
internal GetLocationHandler movP06Operation = default;
|
||||
public GetLocationHandler MovVertex0Operation { get => movVertex0Operation; }
|
||||
public GetLocationHandler MovVertex1Operation { get => movVertex1Operation; }
|
||||
public GetLocationHandler MovVertex2Operation { get => movVertex2Operation; }
|
||||
public GetLocationHandler MovVertex3Operation { get => movVertex3Operation; }
|
||||
public GetLocationHandler MovVertex4Operation { get => movVertex4Operation; }
|
||||
public GetLocationHandler MovVertex5Operation { get => movVertex5Operation; }
|
||||
|
||||
public GetLocationHandler MovP01Operation { get => movP01Operation; }
|
||||
public GetLocationHandler MovP02Operation { get => movP02Operation; }
|
||||
public GetLocationHandler MovP03Operation { get => movP03Operation; }
|
||||
public GetLocationHandler MovP04Operation { get => movP04Operation; }
|
||||
public GetLocationHandler MovP05Operation { get => movP05Operation; }
|
||||
public GetLocationHandler MovP06Operation { get => movP06Operation; }
|
||||
public override Point RefPoint0 => Vertex0;
|
||||
public override Point RefPoint1 => Vertex1;
|
||||
public override Point RefPoint2 => Vertex2;
|
||||
|
||||
public virtual Vec3d movPoint01(uint tick)
|
||||
internal override int[] Indices
|
||||
{
|
||||
return movP01Operation.Invoke(TimeLine.tickCounter._value);
|
||||
get
|
||||
{
|
||||
return new int[12] {
|
||||
0,1,2,
|
||||
0,2,3,
|
||||
0,3,4,
|
||||
0,4,5};
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Vec3d movPoint02(uint tick)
|
||||
public Point Vertex0
|
||||
{
|
||||
return movP02Operation.Invoke(TimeLine.tickCounter._value);
|
||||
get => new Point(vertexMat.vec0);
|
||||
set { vertexMat.vec0 = value.position.vec; }
|
||||
}
|
||||
|
||||
public virtual Vec3d movPoint03(uint tick)
|
||||
public Point Vertex1
|
||||
{
|
||||
return movP03Operation.Invoke(TimeLine.tickCounter._value);
|
||||
get => new Point(vertexMat.vec1);
|
||||
set { vertexMat.vec1 = value.position.vec; }
|
||||
}
|
||||
|
||||
public virtual Vec3d movPoint04(uint tick)
|
||||
public Point Vertex2
|
||||
{
|
||||
return movP04Operation.Invoke(TimeLine.tickCounter._value);
|
||||
get => new Point(vertexMat.vec2);
|
||||
set { vertexMat.vec2 = value.position.vec; }
|
||||
}
|
||||
|
||||
public virtual Vec3d movPoint05(uint tick)
|
||||
public Point Vertex3
|
||||
{
|
||||
return movP05Operation.Invoke(TimeLine.tickCounter._value);
|
||||
get => new Point(vertexMat.vec3);
|
||||
set { vertexMat.vec3 = value.position.vec; }
|
||||
}
|
||||
|
||||
public virtual Vec3d movPoint06(uint tick)
|
||||
public Point Vertex4
|
||||
{
|
||||
return movP06Operation.Invoke(TimeLine.tickCounter._value);
|
||||
get => new Point(vertexMat.vec4);
|
||||
set { vertexMat.vec4 = value.position.vec; }
|
||||
}
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
public Point Vertex5
|
||||
{
|
||||
uint nowTick = tick - BornTime;
|
||||
vertex1.Position = RefOrigin.Position + movPoint01(nowTick);
|
||||
vertex2.Position = RefOrigin.Position + movPoint02(nowTick);
|
||||
vertex3.Position = RefOrigin.Position + movPoint03(nowTick);
|
||||
vertex4.Position = RefOrigin.Position + movPoint04(nowTick);
|
||||
vertex5.Position = RefOrigin.Position + movPoint05(nowTick);
|
||||
vertex6.Position = RefOrigin.Position + movPoint06(nowTick);
|
||||
get => new Point(vertexMat.vec5);
|
||||
set { vertexMat.vec5 = value.position.vec; }
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
{
|
||||
return new Line[6]
|
||||
{
|
||||
new Line(vertex1,vertex2),
|
||||
new Line(vertex2,vertex3),
|
||||
new Line(vertex3,vertex4),
|
||||
new Line(vertex4,vertex5),
|
||||
new Line(vertex5,vertex6),
|
||||
new Line(vertex6,vertex1)
|
||||
new Line(Vertex0,Vertex1),
|
||||
new Line(Vertex1,Vertex2),
|
||||
new Line(Vertex2,Vertex3),
|
||||
new Line(Vertex3,Vertex4),
|
||||
new Line(Vertex4,Vertex5),
|
||||
new Line(Vertex5,Vertex0)
|
||||
};
|
||||
}
|
||||
|
||||
public override Plain GetPlain()
|
||||
{
|
||||
return new Plain(vertex1, vertex2, vertex3);
|
||||
return new Plain(Vertex0, Vertex1, Vertex2);
|
||||
}
|
||||
|
||||
public virtual vec3d movVertex0(uint tick)
|
||||
{
|
||||
return movVertex0Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movVertex1(uint tick)
|
||||
{
|
||||
return movVertex1Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movVertex2(uint tick)
|
||||
{
|
||||
return movVertex2Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movVertex3(uint tick)
|
||||
{
|
||||
return movVertex3Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movVertex4(uint tick)
|
||||
{
|
||||
return movVertex4Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movVertex5(uint tick)
|
||||
{
|
||||
return movVertex5Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
{
|
||||
uint nowTick = tick - BornTime;
|
||||
Vector4 origin = RefOrigin.Position.vec;
|
||||
vertexMat.vec0 = origin + movVertex0(nowTick).vec;
|
||||
vertexMat.vec1 = origin + movVertex1(nowTick).vec;
|
||||
vertexMat.vec2 = origin + movVertex2(nowTick).vec;
|
||||
vertexMat.vec3 = origin + movVertex3(nowTick).vec;
|
||||
vertexMat.vec4 = origin + movVertex4(nowTick).vec;
|
||||
vertexMat.vec5 = origin + movVertex5(nowTick).vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,27 +3,28 @@ using System.Numerics;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class Rectangle : Polygon4
|
||||
public class Rectangle : Parallelogram
|
||||
{
|
||||
internal Point center;
|
||||
|
||||
public sealed override Point RefPoint0 => center;
|
||||
|
||||
public sealed override Point RefPoint1 => new Point(vertexMat.transpose.colum0);
|
||||
|
||||
public sealed override Point RefPoint2 => new Point(vertexMat.transpose.colum1);
|
||||
|
||||
public Rectangle(
|
||||
float v0x, float v0y, float v0z,
|
||||
float v1x, float v1y, float v1z,
|
||||
float v2x, float v2y, float v2z,
|
||||
float v3x, float v3y, float v3z
|
||||
)
|
||||
) : base(
|
||||
v0x, v0y, v0z,
|
||||
v1x, v1y, v1z,
|
||||
v2x, v2y, v2z,
|
||||
v3x, v2y, v3z
|
||||
)
|
||||
{
|
||||
vertexMat.mat.colum0 = new Vector4(v0x, v0y, v0z, 0);
|
||||
vertexMat.mat.colum1 = new Vector4(v1x, v1y, v1z, 0);
|
||||
vertexMat.mat.colum2 = new Vector4(v2x, v2y, v2z, 0);
|
||||
vertexMat.mat.colum3 = new Vector4(v3x, v3y, v3z, 0);
|
||||
vec3d side0 = vertexMat.Colum0 - vertexMat.Colum1;
|
||||
vec3d side1 = vertexMat.Colum2 - vertexMat.Colum1;
|
||||
if (side0.Cross(side1) == Vec3d.Zero)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,25 +34,9 @@ namespace StgSharp.Geometries
|
||||
/// </summary>
|
||||
/// <param name="tick">当前游戏刻</param>
|
||||
/// <returns></returns>
|
||||
public virtual Vec3d MovCenter(uint tick) => default(Vec3d);
|
||||
public virtual vec3d MovCenter(uint tick) => default(vec3d);
|
||||
|
||||
public sealed override Vec3d MoveVertex2(uint tick)
|
||||
{
|
||||
return
|
||||
new Vec3d(this.center.position.vec * 2 - vertexMat.mat.colum0);
|
||||
}
|
||||
|
||||
public sealed override Vec3d MoveVertex3(uint tick)
|
||||
{
|
||||
return
|
||||
new Vec3d(this.center.position.vec * 2 - vertexMat.mat.colum1);
|
||||
}
|
||||
|
||||
internal sealed override void OnRender(uint tick)
|
||||
{
|
||||
tick -= bornTick;
|
||||
this.MovCenter(tick);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override Vec3d MoveVertex1(uint tick)
|
||||
public sealed override vec3d MoveVertex1(uint tick)
|
||||
{
|
||||
return this.center.Position * 2 - this.vertexMat.Colum0;
|
||||
}
|
||||
|
||||
@@ -6,43 +6,29 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
|
||||
public unsafe class Triangle : IPlainGeometry
|
||||
public unsafe class Triangle : PlainGeometry
|
||||
{
|
||||
|
||||
internal Matrix3x3 vertexMap;
|
||||
|
||||
internal GetLocationHandler movVertex01Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movVertex02Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movVertex03Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
public sealed override Point RefPoint0 => new Point(vertexMap.mat.colum0);
|
||||
public sealed override Point RefPoint1 => new Point(vertexMap.mat.colum1);
|
||||
public sealed override Point RefPoint2 => new Point(vertexMap.mat.colum2);
|
||||
|
||||
public GetLocationHandler MovVertex01Operation => this.movVertex01Opearion;
|
||||
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
|
||||
public GetLocationHandler MovVertex03Operation => this.movVertex03Opearion;
|
||||
|
||||
public virtual Vec3d MovVertex01(uint tick) => movVertex01Opearion.Invoke(tick);
|
||||
|
||||
public virtual Vec3d MovVertex02(uint tick) => movVertex02Opearion.Invoke(tick);
|
||||
|
||||
public virtual Vec3d MovVertex03(uint tick) => movVertex03Opearion.Invoke(tick);
|
||||
internal Matrix3x3 vertexMat;
|
||||
|
||||
public Triangle()
|
||||
{
|
||||
vertexMap = new Matrix3x3();
|
||||
vertexMat = new Matrix3x3();
|
||||
}
|
||||
|
||||
public Triangle(
|
||||
Vec3d vertex01,
|
||||
Vec3d vertex02,
|
||||
Vec3d vertex03
|
||||
vec3d vertex01,
|
||||
vec3d vertex02,
|
||||
vec3d vertex03
|
||||
)
|
||||
{
|
||||
vertexMap.mat.colum0 = vertex01.vec;
|
||||
vertexMap.mat.colum1 = vertex02.vec;
|
||||
vertexMap.mat.colum2 = vertex03.vec;
|
||||
vertexMat.mat.colum0 = vertex01.vec;
|
||||
vertexMat.mat.colum1 = vertex02.vec;
|
||||
vertexMat.mat.colum2 = vertex03.vec;
|
||||
}
|
||||
|
||||
public Triangle(
|
||||
@@ -51,26 +37,35 @@ namespace StgSharp.Geometries
|
||||
float v2x, float v2y, float v2z
|
||||
)
|
||||
{
|
||||
vertexMap.mat.colum0 = new Vector4(v0x, v0y, v0z, 0);
|
||||
vertexMap.mat.colum1 = new Vector4(v1x, v1y, v1z, 0);
|
||||
vertexMap.mat.colum2 = new Vector4(v2x, v2y, v2z, 0);
|
||||
vertexMat.mat.colum0 = new Vector4(v0x, v0y, v0z, 0);
|
||||
vertexMat.mat.colum1 = new Vector4(v1x, v1y, v1z, 0);
|
||||
vertexMat.mat.colum2 = new Vector4(v2x, v2y, v2z, 0);
|
||||
}
|
||||
|
||||
internal sealed override void OnRender(uint tick)
|
||||
public GetLocationHandler MovVertex01Operation => this.movVertex01Opearion;
|
||||
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
|
||||
public GetLocationHandler MovVertex03Operation => this.movVertex03Opearion;
|
||||
public sealed override Point RefPoint0 => new Point(vertexMat.mat.colum0);
|
||||
public sealed override Point RefPoint1 => new Point(vertexMat.mat.colum1);
|
||||
public sealed override Point RefPoint2 => new Point(vertexMat.mat.colum2);
|
||||
|
||||
public Mat3 VertexBuffer
|
||||
{
|
||||
tick -= this.bornTick;
|
||||
vertexMap.mat.colum0 = RefOrigin.Position.vec + MovVertex01(tick).vec;
|
||||
vertexMap.mat.colum1 = RefOrigin.Position.vec + MovVertex02(tick).vec;
|
||||
vertexMap.mat.colum2 = RefOrigin.Position.vec + MovVertex03(tick).vec;
|
||||
get { return vertexMat.mat; }
|
||||
}
|
||||
|
||||
internal sealed override int[] Indices
|
||||
{
|
||||
get { return new int[3] { 0, 1, 2 }; }
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
{
|
||||
Line[] sides = new Line[3]
|
||||
{
|
||||
new Line(vertexMap.mat.colum0,vertexMap.mat.colum1),
|
||||
new Line(vertexMap.mat.colum1,vertexMap.mat.colum2),
|
||||
new Line(vertexMap.mat.colum2,vertexMap.mat.colum0)
|
||||
new Line(vertexMat.mat.colum0,vertexMat.mat.colum1),
|
||||
new Line(vertexMat.mat.colum1,vertexMat.mat.colum2),
|
||||
new Line(vertexMat.mat.colum2,vertexMat.mat.colum0)
|
||||
};
|
||||
|
||||
return sides;
|
||||
@@ -78,8 +73,20 @@ namespace StgSharp.Geometries
|
||||
|
||||
public override Plain GetPlain()
|
||||
{
|
||||
return new Plain(this.vertexMap.mat.colum0, this.vertexMap.mat.colum1, this.vertexMap.mat.colum2);
|
||||
return new Plain(this.vertexMat.mat.colum0, this.vertexMat.mat.colum1, this.vertexMat.mat.colum2);
|
||||
}
|
||||
|
||||
public virtual vec3d MovVertex01(uint tick) => movVertex01Opearion.Invoke(tick);
|
||||
|
||||
public virtual vec3d MovVertex02(uint tick) => movVertex02Opearion.Invoke(tick);
|
||||
|
||||
public virtual vec3d MovVertex03(uint tick) => movVertex03Opearion.Invoke(tick);
|
||||
internal sealed override void OnRender(uint tick)
|
||||
{
|
||||
tick -= this.bornTick;
|
||||
vertexMat.mat.colum0 = RefOrigin.Position.vec + MovVertex01(tick).vec;
|
||||
vertexMat.mat.colum1 = RefOrigin.Position.vec + MovVertex02(tick).vec;
|
||||
vertexMat.mat.colum2 = RefOrigin.Position.vec + MovVertex03(tick).vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal unsafe struct ElementBuffer : IDisposable
|
||||
{
|
||||
uint _bufferID;
|
||||
|
||||
public ElementBuffer(int n)
|
||||
{
|
||||
fixed (uint* id = &_bufferID)
|
||||
{
|
||||
Graphic.glGenBuffers(n, id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Bind()
|
||||
{
|
||||
Graphic.glBindBuffer(GLFW.GL_ELEMENT_ARRAY_BUFFER, _bufferID);
|
||||
}
|
||||
|
||||
public void SetData<T>(T bufferData, BufferReadType readType) where T : IMat
|
||||
{
|
||||
int size = Marshal.SizeOf(bufferData);
|
||||
Graphic.glBufferData(
|
||||
(int)BufferType.ELEMENT_ARRAY_BUFFER,
|
||||
size,
|
||||
&bufferData,
|
||||
(int)readType);
|
||||
}
|
||||
|
||||
public void SetData<T>(T[] bufferArray, BufferReadType readType) where T : struct, IConvertible
|
||||
{
|
||||
|
||||
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
||||
|
||||
fixed (void* bufferPtr = &bufferArray[0])
|
||||
Graphic.glBufferData(
|
||||
(int)BufferType.ELEMENT_ARRAY_BUFFER,
|
||||
size,
|
||||
bufferPtr,
|
||||
(int)readType);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = &_bufferID)
|
||||
{
|
||||
Graphic.glDeleteBuffers(1, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
using _glfw = _GLFWlibrary;
|
||||
|
||||
public static unsafe partial class GLFW
|
||||
internal static unsafe class GLFW
|
||||
{
|
||||
internal static _glfw glfw = new _glfw();
|
||||
|
||||
@@ -2045,4 +2045,31 @@ namespace StgSharp.Graphics
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public enum ShaderType : int
|
||||
{
|
||||
FRAGMENT = 0x8B30,
|
||||
VERTEX = 0x8B31
|
||||
}
|
||||
|
||||
public enum BufferType : int
|
||||
{
|
||||
ARRAY_BUFFER = 0x8892,
|
||||
ELEMENT_ARRAY_BUFFER = 0x8893,
|
||||
ARRAY_BUFFER_BINDING = 0x8894
|
||||
}
|
||||
|
||||
public enum BufferReadType : int
|
||||
{
|
||||
STREAM_DRAW = 0x88E0,
|
||||
STREAM_READ = 0x88E1,
|
||||
STREAM_COPY = 0x88E2,
|
||||
STATIC_DRAW = 0x88E4,
|
||||
STATIC_READ = 0x88E5,
|
||||
STATIC_COPY = 0x88E6,
|
||||
DYNAMIC_DRAW = 0x88E8,
|
||||
DYNAMIC_READ = 0x88E9,
|
||||
DYNAMIC_COPY = 0x88EA
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Graphics.GL
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct shaderObject
|
||||
{
|
||||
uint VBO;
|
||||
uint VAO;
|
||||
uint shaderProgram;
|
||||
}
|
||||
}
|
||||
+134
-62
@@ -1,16 +1,95 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public static unsafe partial class Graphic
|
||||
{
|
||||
/// <summary>
|
||||
/// sets the framebuffer resize callback of the specified <see cref="Form"/>,
|
||||
///which is called when the framebuffer of the specified <see cref="Form"/> is resized.
|
||||
/// </summary>
|
||||
/// <param name="form">The Form instance to be controlled</param>
|
||||
/// <param name="handler">Method hadler </param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void SetFrameBufferSizeCallback(Form form, FrameBufferSizeHadler handler)
|
||||
{
|
||||
internalIO.glfwSetFramebufferSizeCallback(form.windowID, handler);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Call glClearColor in OpenGL
|
||||
/// specifies the red, green, blue, and alpha values used by glClear to clear the color buffers.
|
||||
/// Values specified by glClearColor are clamped to the range [0,1]
|
||||
/// </summary>
|
||||
/// <param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void ClearColor(float R, float G, float B, float A)
|
||||
{
|
||||
glClearColor(R, G, B, A);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conpile the provided shader code in string form.
|
||||
/// </summary>
|
||||
/// <param name="shaderCode">A string represent the shader's code</param>
|
||||
/// <param name="shaderType">An <see cref="ShaderType"/> enum represent the type of the shader to
|
||||
/// conpile, including vertex shader and fragment shader.</param>
|
||||
/// <returns>An uint value as the only mark of conpiled shader</returns>
|
||||
public static unsafe uint CompileShader(string shaderCode, ShaderType shaderType)
|
||||
{
|
||||
uint shaderID;
|
||||
shaderCode += '\0';
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(shaderCode);
|
||||
fixed (byte* data = &buffer[0])
|
||||
{
|
||||
shaderID = internalIO.InternalLoadShaderCode(data, (int)shaderType);
|
||||
}
|
||||
if (shaderID == 0)
|
||||
{
|
||||
IntPtr logPtr = internalIO.InternalReadLog();
|
||||
string log;
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||
log = Encoding.UTF8.GetString(logByte);
|
||||
log = log.Replace("\0", "");
|
||||
|
||||
bool isUseful = false;
|
||||
foreach (char item in log)
|
||||
{
|
||||
if (!char.IsControl(item))
|
||||
{
|
||||
isUseful = true; break;
|
||||
}
|
||||
}
|
||||
if (!isUseful)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
log = "Failed to compile shader.\nFailed to get GLSL compiler log";
|
||||
|
||||
}
|
||||
|
||||
internalIO.InternalWriteLog(log, LogType.Error);
|
||||
|
||||
}
|
||||
return shaderID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a form and its associated context.
|
||||
@@ -22,7 +101,7 @@ namespace StgSharp
|
||||
/// <param name="share"></param>
|
||||
/// <returns>The instance of created form</returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static unsafe Form GLcreateWindow(
|
||||
public static unsafe Form CreateWindow(
|
||||
int width, int height, string tittle, IntPtr monitor, Form share)
|
||||
{
|
||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(tittle);
|
||||
@@ -30,7 +109,7 @@ namespace StgSharp
|
||||
if (share == null)
|
||||
{
|
||||
windowPtr = internalIO.glfwCreateWindow(
|
||||
800, 600, tittleBytes, monitor, IntPtr.Zero);
|
||||
width, height, tittleBytes, monitor, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -52,71 +131,64 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a window and its associated context.
|
||||
/// </summary>
|
||||
/// <param name="width">Required width</param>
|
||||
/// <param name="height">Required width</param>
|
||||
/// <param name="tittle">Tittle of the window </param>
|
||||
/// <param name="monitor"></param>
|
||||
/// <param name="share"></param>
|
||||
/// <returns>The handle of created window</returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static unsafe Form GLcreateWindow(int width, int height, string tittle, IntPtr monitor, IntPtr share)
|
||||
|
||||
public static unsafe uint CreatGraphicProgram()
|
||||
{
|
||||
byte[] tittleCharArray = System.Text.Encoding.UTF8.GetBytes(tittle);
|
||||
IntPtr windowPtr = internalIO.glfwCreateWindow
|
||||
(width, height, tittleCharArray, monitor, share);
|
||||
|
||||
if ((int)windowPtr == -1 || (int)windowPtr == -2)
|
||||
{
|
||||
throw new Exception("Cannot create the form!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Form form = new Form();
|
||||
form.Size = new Vec2d(width, height);
|
||||
form.windowID = windowPtr;
|
||||
return form;
|
||||
}
|
||||
return glCreateProgram();
|
||||
}
|
||||
|
||||
|
||||
public static unsafe void GLmakeContexCurrent(Form form)
|
||||
{
|
||||
internalIO.glfwMakeContextCurrent(form.windowID);
|
||||
}
|
||||
|
||||
|
||||
public static unsafe bool GLwindowShouldClose(Form form)
|
||||
{
|
||||
int a = internalIO.glfwWindowShouldClose(form.windowID);
|
||||
return a != 0;
|
||||
}
|
||||
|
||||
|
||||
public static unsafe void GLswapBuffers(Form form)
|
||||
{
|
||||
internalIO.glfwSwapBuffers(form.windowID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static IntPtr GetProcAddress(string name)
|
||||
{
|
||||
IntPtr ret = internalIO.glfwGetProcAddress(name);
|
||||
if (ret == IntPtr.Zero)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(name);
|
||||
#endif
|
||||
return internalIO.glfwGetProcAddress(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static unsafe bool GetWindowShouldClose(Form form)
|
||||
{
|
||||
return internalIO.glfwWindowShouldClose(form.windowID) != 0;
|
||||
}
|
||||
|
||||
public static unsafe void GLswapBuffers(Form form)
|
||||
{
|
||||
if (form.windowID == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
internalIO.glfwSwapBuffers(form.windowID);
|
||||
}
|
||||
|
||||
public static unsafe void MakeContexCurrent(Form form)
|
||||
{
|
||||
if (form.windowID == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
internalIO.glfwMakeContextCurrent(form.windowID);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void SetBufferData<T>(BufferType bufferType, T bufferData, BufferReadType readType) where T : IMat
|
||||
{
|
||||
int size = Marshal.SizeOf(bufferData);
|
||||
glBufferData(
|
||||
(int)bufferType,
|
||||
size,
|
||||
&bufferData,
|
||||
(int)readType);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferReadType readType) where T : struct, IConvertible
|
||||
{
|
||||
|
||||
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
||||
|
||||
fixed (void* bufferPtr = &bufferArray[0])
|
||||
glBufferData(
|
||||
(int)bufferType,
|
||||
size,
|
||||
bufferPtr,
|
||||
(int)readType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+731
-708
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,8 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Graphics;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public static unsafe partial class Graphic
|
||||
{
|
||||
@@ -39,7 +38,7 @@ namespace StgSharp
|
||||
/// and before other graphic method.
|
||||
/// </summary>
|
||||
/// <exception cref="Exception">The accident that program cannot attach GLFW to GLAD</exception>
|
||||
public static unsafe void InitGLAD(glLoader loader)
|
||||
public static unsafe void InitGLManager(glLoader loader)
|
||||
{
|
||||
|
||||
if (!isGLADset)
|
||||
@@ -63,13 +62,6 @@ namespace StgSharp
|
||||
throw new Exception("Do not init GLAD twice.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics.SSG
|
||||
{
|
||||
internal class Buffer
|
||||
{
|
||||
BufferType type;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal class Shader
|
||||
{
|
||||
public readonly uint programID;
|
||||
internal uint vertexShaderID;
|
||||
internal uint fragmentShaderID;
|
||||
|
||||
public Shader()
|
||||
{
|
||||
programID = Graphic.glCreateProgram();
|
||||
}
|
||||
|
||||
public void CompileVertexShader(string shaderCode)
|
||||
{
|
||||
vertexShaderID = Graphic.CompileShader(shaderCode, ShaderType.VERTEX);
|
||||
Graphic.glAttachShader(programID, vertexShaderID);
|
||||
}
|
||||
|
||||
public void CompileFragmentShader(string shaderCode)
|
||||
{
|
||||
fragmentShaderID = Graphic.CompileShader(shaderCode, ShaderType.FRAGMENT);
|
||||
Graphic.glAttachShader(programID, fragmentShaderID);
|
||||
}
|
||||
|
||||
public void Link()
|
||||
{
|
||||
if (internalIO.InternalLinkShaderProgram(programID) == 0)
|
||||
{
|
||||
IntPtr logPtr = internalIO.InternalReadLog();
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||
string log = Encoding.UTF8.GetString(logByte);
|
||||
log = log.Replace("\0", "");
|
||||
internalIO.InternalWriteLog(log, LogType.Error);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Use()
|
||||
{
|
||||
Graphic.glUseProgram(programID);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal unsafe struct VertexArray : IDisposable
|
||||
{
|
||||
internal uint _bufferID;
|
||||
|
||||
public VertexArray()
|
||||
{
|
||||
fixed (uint* id = &_bufferID)
|
||||
{
|
||||
Graphic.glGenVertexArrays(1, id);
|
||||
}
|
||||
Graphic.glBindBuffer(GLFW.GL_ARRAY_BUFFER, _bufferID);
|
||||
}
|
||||
|
||||
public VertexArray(int n)
|
||||
{
|
||||
fixed (uint* id = &_bufferID)
|
||||
{
|
||||
Graphic.glGenVertexArrays(n, id);
|
||||
}
|
||||
Graphic.glBindBuffer(GLFW.GL_ARRAY_BUFFER, _bufferID);
|
||||
}
|
||||
|
||||
public void Bind()
|
||||
{
|
||||
Graphic.glBindVertexArray(_bufferID);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = &_bufferID)
|
||||
{
|
||||
Graphic.glDeleteVertexArrays(1, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public unsafe struct VertexBuffer : IDisposable
|
||||
{
|
||||
internal uint _bufferID;
|
||||
|
||||
public VertexBuffer(int n)
|
||||
{
|
||||
fixed (uint* id = &_bufferID)
|
||||
{
|
||||
Graphic.glGenBuffers(n, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public uint BufferID
|
||||
{
|
||||
get { return _bufferID; }
|
||||
}
|
||||
public void Bind()
|
||||
{
|
||||
Graphic.glBindBuffer(GLFW.GL_ARRAY_BUFFER, _bufferID);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = &_bufferID)
|
||||
{
|
||||
Graphic.glDeleteBuffers(1, id);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetData<T>(T bufferData, BufferReadType readType) where T : IMat
|
||||
{
|
||||
int size = Marshal.SizeOf(bufferData);
|
||||
Graphic.glBufferData(
|
||||
(int)BufferType.ARRAY_BUFFER,
|
||||
size,
|
||||
&bufferData,
|
||||
(int)readType);
|
||||
}
|
||||
|
||||
public void SetData<T>(T[] bufferArray, BufferReadType readType) where T : struct, IConvertible
|
||||
{
|
||||
|
||||
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
||||
|
||||
fixed (void* bufferPtr = &bufferArray[0])
|
||||
Graphic.glBufferData(
|
||||
(int)BufferType.ARRAY_BUFFER,
|
||||
size,
|
||||
bufferPtr,
|
||||
(int)readType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace StgSharp
|
||||
public class Pool
|
||||
{
|
||||
internal LinkedList<Vector4Map> _Vector4mapContainer;
|
||||
internal LinkedList<IPlainGeometry> _geometryContainer;
|
||||
internal LinkedList<PlainGeometry> _geometryContainer;
|
||||
internal LinkedList<IEntity> _bulletContainer;
|
||||
internal LinkedList<IEntity> _awardContainer;
|
||||
internal LinkedList<IEntity> _enemyContainer;
|
||||
@@ -33,7 +33,7 @@ namespace StgSharp
|
||||
_bulletContainer = new LinkedList<IEntity>();
|
||||
_awardContainer = new LinkedList<IEntity>();
|
||||
_enemyContainer = new LinkedList<IEntity>();
|
||||
_geometryContainer = new LinkedList<IPlainGeometry>();
|
||||
_geometryContainer = new LinkedList<PlainGeometry>();
|
||||
}
|
||||
|
||||
public void OnRender()
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
public delegate bool SensorRuleHandler(IPlainGeometry target, IPlainGeometry boarder);
|
||||
public delegate bool SensorRuleHandler(PlainGeometry target, PlainGeometry boarder);
|
||||
|
||||
public class Sensor<T>
|
||||
{
|
||||
internal IPlainGeometry _boarder;
|
||||
internal IPlainGeometry _target;
|
||||
internal PlainGeometry _boarder;
|
||||
internal PlainGeometry _target;
|
||||
internal SensorRuleHandler _rule;
|
||||
|
||||
|
||||
public IPlainGeometry boarder
|
||||
public PlainGeometry boarder
|
||||
{
|
||||
get { return _boarder; }
|
||||
}
|
||||
|
||||
public IPlainGeometry target
|
||||
public PlainGeometry target
|
||||
{
|
||||
get { return _target; }
|
||||
set { _target = value; }
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public interface IMat
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,9 @@
|
||||
return vec1.X * vec2.Y - vec1.Y * vec2.X;
|
||||
}
|
||||
|
||||
public static Vec3d Cross(Vec3d vec1, Vec3d vec2)
|
||||
public static vec3d Cross(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
return new Vec3d(
|
||||
return new vec3d(
|
||||
vec1.Y * vec2.Z - vec1.Z * vec2.Y,
|
||||
vec1.X * vec2.Z - vec1.Z * vec2.X,
|
||||
vec1.X * vec2.Y - vec1.Y * vec2.X
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
/*
|
||||
public static float Det(Matrix2x2 array)
|
||||
{
|
||||
return Cross(array.row1, array.row2);
|
||||
}
|
||||
/**/
|
||||
|
||||
/*
|
||||
public static unsafe float Det(matrix3x3 array)
|
||||
{
|
||||
float* p = &array.row1.X;
|
||||
|
||||
matrix2x2 matrix1 = new matrix2x2(
|
||||
*(p + 4), *(p + 5),
|
||||
*(p + 7), *(p + 8)
|
||||
);
|
||||
matrix2x2 matrix2 = new matrix2x2(
|
||||
*(p + 3), *(p + 5),
|
||||
*(p + 6), *(p + 8)
|
||||
);
|
||||
matrix2x2 matrix3 = new matrix2x2(
|
||||
*(p + 3), *(p + 4),
|
||||
*(p + 6), *(p + 7)
|
||||
);
|
||||
|
||||
return
|
||||
*p * Det(matrix1)
|
||||
- *(p + 1) * Det(matrix2)
|
||||
+ *(p + 2) * Det(matrix3)
|
||||
;
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
);
|
||||
}
|
||||
|
||||
public static float GetAngle(Vec3d vec1, Vec3d vec2)
|
||||
public static float GetAngle(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
return Calc.ACos(
|
||||
vec1 * vec2
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
public static float GetLength(this Vec3d vec)
|
||||
public static float GetLength(this vec3d vec)
|
||||
{
|
||||
return Calc.Sqrt(
|
||||
vec.X * vec.X +
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace StgSharp.Math
|
||||
{
|
||||
/*
|
||||
|
||||
public static unsafe float Multiple(Vec3d vec1, Vec3d vec2)
|
||||
public static unsafe float Multiple(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
IntPtr retPtr = internalIO.mulps_internal(vec1._Vector4Ptr,vec2._Vector4Ptr);
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace StgSharp.Math
|
||||
Vector4.single_2;
|
||||
}
|
||||
|
||||
public static unsafe float Multiple(Vec4d vec1,Vec3d vec2)
|
||||
public static unsafe float Multiple(Vec4d vec1,vec3d vec2)
|
||||
{
|
||||
IntPtr retPtr = internalIO.mulps_internal(vec1._Vector4Ptr,vec2._Vector4Ptr);
|
||||
Vector4 Vector4 = *(Vector4*)retPtr;
|
||||
|
||||
@@ -5,12 +5,12 @@ namespace StgSharp.Math
|
||||
{
|
||||
public unsafe static partial class VectorCalc
|
||||
{
|
||||
public static Vec3d To3D(Vec2d vec)
|
||||
public static vec3d To3D(Vec2d vec)
|
||||
{
|
||||
return new Vec3d(vec.X, vec.Y, 0.0f);
|
||||
return new vec3d(vec.X, vec.Y, 0.0f);
|
||||
}
|
||||
|
||||
public static Vec2d To2D(Vec3d vec, CordinatePlain plain)
|
||||
public static Vec2d To2D(vec3d vec, CordinatePlain plain)
|
||||
{
|
||||
switch (plain)
|
||||
{
|
||||
@@ -30,9 +30,9 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static Vec3d To3D(Vector4 vector)
|
||||
internal static vec3d To3D(Vector4 vector)
|
||||
{
|
||||
return new Vec3d(vector);
|
||||
return new vec3d(vector);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace StgSharp
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 12 * sizeof(float), Pack = 16)]
|
||||
internal struct Mat3 : IEquatable<Mat3>
|
||||
public struct Mat3 : IEquatable<Mat3>
|
||||
{
|
||||
|
||||
[FieldOffset(0)] internal Vector4 colum0;
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace StgSharp.Math
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16 * sizeof(float))]
|
||||
internal struct Mat4 : IEquatable<Mat4>
|
||||
public struct Mat4 : IEquatable<Mat4>, IMat
|
||||
{
|
||||
[FieldOffset(0)] internal Vector4 colum0;
|
||||
[FieldOffset(16)] internal Vector4 colum1;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math.Linear
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 5 * 4 * sizeof(float))]
|
||||
public struct mat5 : IMat
|
||||
{
|
||||
[FieldOffset(0 * 4 * sizeof(float))] internal Vector4 vec0;
|
||||
[FieldOffset(1 * 4 * sizeof(float))] internal Vector4 vec1;
|
||||
[FieldOffset(2 * 4 * sizeof(float))] internal Vector4 vec2;
|
||||
[FieldOffset(3 * 4 * sizeof(float))] internal Vector4 vec3;
|
||||
[FieldOffset(4 * 4 * sizeof(float))] internal Vector4 vec4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math.Linear
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct mat6 : IMat
|
||||
{
|
||||
internal Vector4 vec0;
|
||||
internal Vector4 vec1;
|
||||
internal Vector4 vec2;
|
||||
internal Vector4 vec3;
|
||||
internal Vector4 vec4;
|
||||
internal Vector4 vec5;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 2 * 2 * 4 * sizeof(float) + sizeof(bool), Pack = 16)]
|
||||
public struct Matrix2x2
|
||||
public struct Matrix2x2 : IMat
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
internal Mat2 mat;
|
||||
@@ -17,16 +17,16 @@ namespace StgSharp.Math
|
||||
public Matrix2x2(
|
||||
float a00, float a01,
|
||||
float a10, float a11
|
||||
)
|
||||
)
|
||||
{
|
||||
mat.colum0 = new Vector4(a00,a10,0,0);
|
||||
mat.colum1 = new Vector4(a01,a11,0,0);
|
||||
mat.colum0 = new Vector4(a00, a10, 0, 0);
|
||||
mat.colum1 = new Vector4(a01, a11, 0, 0);
|
||||
}
|
||||
|
||||
internal Matrix2x2(
|
||||
Vector4 c0,
|
||||
Vector4 c1
|
||||
)
|
||||
)
|
||||
{
|
||||
mat.colum0 = c0;
|
||||
mat.colum1 = c1;
|
||||
@@ -41,7 +41,7 @@ namespace StgSharp.Math
|
||||
|
||||
public Matrix2x2 Transpose
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
InternalTranspose();
|
||||
return new Matrix2x2(this.transpose);
|
||||
@@ -104,11 +104,11 @@ namespace StgSharp.Math
|
||||
{
|
||||
left.InternalTranspose();
|
||||
return new Matrix2x2(
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum1),
|
||||
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum1)
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum1)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,13 +117,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
left.InternalTranspose();
|
||||
return new Matrix2x3(
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum1),
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum2),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum2),
|
||||
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum1),
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum2)
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum2)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -132,15 +132,15 @@ namespace StgSharp.Math
|
||||
{
|
||||
left.InternalTranspose();
|
||||
return new Matrix2x4(
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum1),
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum2),
|
||||
Vector4.Dot( left.transpose.colum0, right.mat.colum3),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum2),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum3),
|
||||
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum1),
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum2),
|
||||
Vector4.Dot( left.transpose.colum1, right.mat.colum3)
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum2),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum3)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ namespace StgSharp.Math
|
||||
[FieldOffset(0)] internal Mat3 mat;
|
||||
[FieldOffset(3 * 4 * sizeof(float))] internal Mat3 transpose;
|
||||
[FieldOffset(6 * 4 * sizeof(float))] internal bool isTransposed;
|
||||
[FieldOffset(0 * 4 * sizeof(float))] public Vec3d Colum0;
|
||||
[FieldOffset(1 * 4 * sizeof(float))] public Vec3d Colum1;
|
||||
[FieldOffset(2 * 4 * sizeof(float))] public Vec3d Colum2;
|
||||
[FieldOffset(0 * 4 * sizeof(float))] public vec3d Colum0;
|
||||
[FieldOffset(1 * 4 * sizeof(float))] public vec3d Colum1;
|
||||
[FieldOffset(2 * 4 * sizeof(float))] public vec3d Colum2;
|
||||
|
||||
public Matrix3x3(
|
||||
float a00, float a01, float a02,
|
||||
@@ -66,7 +66,10 @@ namespace StgSharp.Math
|
||||
}
|
||||
if (columNum > 2 || columNum < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(columNum));
|
||||
internalIO.InternalWriteLog(
|
||||
$"Attempt to write unused space in {GetType().Name} {nameof(mat)}",
|
||||
LogType.Error
|
||||
);
|
||||
}
|
||||
InternalTranspose();
|
||||
fixed (float* p = &this.transpose.m00)
|
||||
@@ -142,6 +145,17 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static vec3d operator *(Matrix3x3 left, vec3d right)
|
||||
{
|
||||
left.InternalTranspose();
|
||||
return new vec3d(
|
||||
Vector4.Dot(left.transpose.colum0, right.vec),
|
||||
Vector4.Dot(left.transpose.colum1, right.vec),
|
||||
Vector4.Dot(left.transpose.colum2, right.vec)
|
||||
);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Matrix3x2 operator *(Matrix3x3 left, Matrix3x2 right)
|
||||
{
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace StgSharp.Math
|
||||
[FieldOffset(4 * 4 * sizeof(float))] internal Mat3 transpose;
|
||||
[FieldOffset(7 * 4 * sizeof(float))] internal bool isTransposed;
|
||||
|
||||
[FieldOffset(0 * 4 * sizeof(float))] public Vec3d Colum0;
|
||||
[FieldOffset(1 * 4 * sizeof(float))] public Vec3d Colum1;
|
||||
[FieldOffset(2 * 4 * sizeof(float))] public Vec3d Colum2;
|
||||
[FieldOffset(3 * 4 * sizeof(float))] public Vec3d Colum3;
|
||||
[FieldOffset(0 * 4 * sizeof(float))] public vec3d Colum0;
|
||||
[FieldOffset(1 * 4 * sizeof(float))] public vec3d Colum1;
|
||||
[FieldOffset(2 * 4 * sizeof(float))] public vec3d Colum2;
|
||||
[FieldOffset(3 * 4 * sizeof(float))] public vec3d Colum3;
|
||||
|
||||
public Matrix3x4(
|
||||
float a00, float a01, float a02, float a03,
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
using StgSharp.Controlling;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static class Vec3d
|
||||
{
|
||||
public static vec3d Zero => new vec3d(0, 0, 0);
|
||||
public static vec3d Unit => new vec3d(1, 1, 1);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
||||
public struct Vec3d
|
||||
public struct vec3d : IEquatable<vec3d>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
internal Vector4 vec;
|
||||
@@ -16,42 +22,67 @@ namespace StgSharp.Math
|
||||
[FieldOffset(4)] public float Y;
|
||||
[FieldOffset(8)] public float Z;
|
||||
|
||||
public Vec3d(
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public vec3d Zero()
|
||||
{
|
||||
return new vec3d(0, 0, 0);
|
||||
}
|
||||
|
||||
public vec3d(
|
||||
float x, float y, float z)
|
||||
{
|
||||
X = x; Y = y; Z = z;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal Vec3d(Vector4 vector)
|
||||
public float Dot(vec3d right)
|
||||
{
|
||||
Vector4 vector4 = this.vec * right.vec;
|
||||
return vector4.X
|
||||
+ vector4.Y
|
||||
+ vector4.Z;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public vec3d Cross(vec3d right)
|
||||
{
|
||||
return new vec3d(
|
||||
this.Y * right.Z - this.Z * right.Y,
|
||||
this.X * right.Z - this.Z * right.X,
|
||||
this.X * right.Y - this.Y * right.X
|
||||
);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal vec3d(Vector4 vector)
|
||||
{
|
||||
vec = vector;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vec3d operator +(Vec3d vec1, Vec3d vec2)
|
||||
public static vec3d operator +(vec3d left, vec3d right)
|
||||
{
|
||||
return new Vec3d(
|
||||
vec1.X + vec2.X,
|
||||
vec1.Y + vec2.Y,
|
||||
vec1.Z + vec2.Z
|
||||
return new vec3d(
|
||||
left.X + right.X,
|
||||
left.Y + right.Y,
|
||||
left.Z + right.Z
|
||||
);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vec3d operator -(Vec3d vec1, Vec3d vec2)
|
||||
public static vec3d operator -(vec3d left, vec3d right)
|
||||
{
|
||||
return new Vec3d(
|
||||
vec1.X - vec2.X,
|
||||
vec1.Y - vec2.Y,
|
||||
vec1.Z - vec2.Z
|
||||
return new vec3d(
|
||||
left.X - right.X,
|
||||
left.Y - right.Y,
|
||||
left.Z - right.Z
|
||||
);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vec3d operator *(Vec3d vec, float value)
|
||||
public static vec3d operator *(vec3d vec, float value)
|
||||
{
|
||||
return new Vec3d(
|
||||
return new vec3d(
|
||||
vec.X * value,
|
||||
vec.Y * value,
|
||||
vec.Z * value
|
||||
@@ -59,9 +90,9 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vec3d operator /(Vec3d vec, float value)
|
||||
public static vec3d operator /(vec3d vec, float value)
|
||||
{
|
||||
return new Vec3d(
|
||||
return new vec3d(
|
||||
vec.X / value,
|
||||
vec.Y / value,
|
||||
vec.Z / value
|
||||
@@ -69,12 +100,28 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float operator *(Vec3d vec1, Vec3d vec2)
|
||||
public static float operator *(vec3d left, vec3d right)
|
||||
{
|
||||
return
|
||||
vec1.X * vec2.X +
|
||||
vec1.Y * vec2.Y +
|
||||
vec1.Z * vec2.Z;
|
||||
left.X * right.X +
|
||||
left.Y * right.Y +
|
||||
left.Z * right.Z;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(vec3d left, vec3d right)
|
||||
{
|
||||
return left.X == right.X
|
||||
&& left.Y == right.Y
|
||||
&& left.Z == right.Z;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(vec3d left, vec3d right)
|
||||
{
|
||||
return left.X != right.X
|
||||
&& left.Y != right.Y
|
||||
&& left.Z != right.Z;
|
||||
}
|
||||
|
||||
public string ToString(string sample)
|
||||
@@ -82,7 +129,32 @@ namespace StgSharp.Math
|
||||
return $"{this.X}\t{this.Y}\t{this.Z}\t";
|
||||
}
|
||||
|
||||
public bool Equals(vec3d other)
|
||||
{
|
||||
return this.vec == other.vec;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is vec3d)
|
||||
{
|
||||
return this == (vec3d)obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe override int GetHashCode()
|
||||
{
|
||||
fixed (float* add = &X)
|
||||
return HashCode.Combine(X, Y, Z, (ulong)add);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{X},{Y},{Z}]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -4,16 +4,21 @@
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:StgSharp.Instruction.InitPool">
|
||||
<member name="M:StgSharp.Control.InitPool">
|
||||
<summary>
|
||||
Add a pool to timeline controller, and return the instance of the pool.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Control.GLFWproc">
|
||||
|
||||
<member name="M:StgSharp.Control.GetKeyStatus(StgSharp.Graphics.Form,StgSharp.Control.Key)">
|
||||
<summary>
|
||||
Get the status of a certain key on the keyboard.
|
||||
</summary>
|
||||
<param name="form"></param>
|
||||
<param name="key"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:StgSharp.Control.TimeLine.tickCounter">
|
||||
<member name="F:StgSharp.Controlling.TimeLine.tickCounter">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
</summary>
|
||||
@@ -55,7 +60,7 @@
|
||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MovVertex03(System.UInt32)">
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex2(System.UInt32)">
|
||||
<summary>
|
||||
Move the third vertix. this is a useless method for Parallelograms.
|
||||
</summary>
|
||||
@@ -63,7 +68,7 @@
|
||||
<returns></returns>
|
||||
<exception cref="T:StgSharp.Geometries.UnusedVertexException">Geometry overdefined</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MovVertex04(System.UInt32)">
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex3(System.UInt32)">
|
||||
<summary>
|
||||
Move the third vertix. This method is useless for Parallelograms.
|
||||
</summary>
|
||||
@@ -103,7 +108,7 @@
|
||||
but only can be referred by pointers.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.GLcreateWindow(System.Int32,System.Int32,System.Byte[],System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<member name="M:StgSharp.Graphic.GLcreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Creates a form and its associated context.
|
||||
</summary>
|
||||
@@ -127,22 +132,14 @@
|
||||
<returns>The handle of created window</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.LoadGL">
|
||||
<summary>
|
||||
Load OpenGL API to StgSharp core programm,
|
||||
please call this method before call any other
|
||||
graphic APIs in StgSharp.
|
||||
</summary>
|
||||
<exception cref="T:System.Exception">If run this method twice, will throw exception</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.InitGL">
|
||||
<member name="M:StgSharp.Graphic.InitGL(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Init an instance of OpenGL program,
|
||||
This method should be called before other
|
||||
graphic methods, after LoadGL method.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.InitGLAD">
|
||||
<member name="M:StgSharp.Graphic.InitGLAD(StgSharp.glLoader)">
|
||||
<summary>
|
||||
Attach GLFW API to GLAD,
|
||||
this method should be called after LoadGL
|
||||
@@ -150,6 +147,13 @@
|
||||
</summary>
|
||||
<exception cref="T:System.Exception">The accident that program cannot attach GLFW to GLAD</exception>
|
||||
</member>
|
||||
<member name="T:StgSharp.glLoader">
|
||||
<summary>
|
||||
Function handler to load an opengl function by serching its name.
|
||||
</summary>
|
||||
<param name="funcname">the name of the Opengl function</param>
|
||||
<returns>An intptr value representing the pointer to the function</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.LinkedList`1.Add(`0)">
|
||||
<summary>
|
||||
Add an item to the tail of linked list.
|
||||
|
||||
Binary file not shown.
@@ -50,15 +50,10 @@
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.GetLocationHandler">
|
||||
<summary>
|
||||
计算位移失量,需要手动输入游戏刻以提供时间数据
|
||||
</summary>
|
||||
<param name="tick"></param>
|
||||
<returns>表示位移量的三维矢量</returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.IPlainGeometry">
|
||||
<summary>
|
||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
Caculate the movement of a point.
|
||||
</summary>
|
||||
<param name="tick">The game tick represent time passed by</param>
|
||||
<returns>A 3d vector representing movement</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex2(System.UInt32)">
|
||||
<summary>
|
||||
@@ -76,6 +71,11 @@
|
||||
<returns></returns>
|
||||
<exception cref="T:StgSharp.Geometries.UnusedVertexException">Geometry overdefined</exception>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.PlainGeometry">
|
||||
<summary>
|
||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
|
||||
<summary>
|
||||
Update the coordinate of the point. If this is a moving point,
|
||||
@@ -102,13 +102,35 @@
|
||||
initilize all the customizing operations.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.SSGwindow">
|
||||
<summary>
|
||||
A window struct that has nearly no differencr with GLFWwindow,
|
||||
but only can be referred by pointers.
|
||||
</summary>
|
||||
<member name="M:StgSharp.Graphics.Graphic.SetFrameBufferSizeCallback(StgSharp.Graphics.Form,StgSharp.Graphics.FrameBufferSizeHadler)">
|
||||
<summary>
|
||||
sets the framebuffer resize callback of the specified <see cref="T:StgSharp.Graphics.Form"/>,
|
||||
which is called when the framebuffer of the specified <see cref="T:StgSharp.Graphics.Form"/> is resized.
|
||||
</summary>
|
||||
<param name="form">The Form instance to be controlled</param>
|
||||
<param name="handler">Method hadler </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.GLcreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<member name="M:StgSharp.Graphics.Graphic.ClearColor(System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Call glClearColor in OpenGL
|
||||
specifies the red, green, blue, and alpha values used by glClear to clear the color buffers.
|
||||
Values specified by glClearColor are clamped to the range [0,1]
|
||||
</summary>
|
||||
<param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Graphic.CompileShader(System.String,StgSharp.Graphics.ShaderType)">
|
||||
<summary>
|
||||
Conpile the provided shader code in string form.
|
||||
</summary>
|
||||
<param name="shaderCode">A string represent the shader's code</param>
|
||||
<param name="shaderType">An <see cref="T:StgSharp.Graphics.ShaderType"/> enum represent the type of the shader to
|
||||
conpile, including vertex shader and fragment shader.</param>
|
||||
<returns>An uint value as the only mark of conpiled shader</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Graphic.CreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Creates a form and its associated context.
|
||||
</summary>
|
||||
@@ -120,26 +142,14 @@
|
||||
<returns>The instance of created form</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.GLcreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,System.IntPtr)">
|
||||
<summary>
|
||||
Creates a window and its associated context.
|
||||
</summary>
|
||||
<param name="width">Required width</param>
|
||||
<param name="height">Required width</param>
|
||||
<param name="tittle">Tittle of the window </param>
|
||||
<param name="monitor"></param>
|
||||
<param name="share"></param>
|
||||
<returns>The handle of created window</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.InitGL(System.Int32,System.Int32)">
|
||||
<member name="M:StgSharp.Graphics.Graphic.InitGL(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Init an instance of OpenGL program,
|
||||
This method should be called before other
|
||||
graphic methods, after LoadGL method.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.InitGLAD(StgSharp.glLoader)">
|
||||
<member name="M:StgSharp.Graphics.Graphic.InitGLManager(StgSharp.Graphics.glLoader)">
|
||||
<summary>
|
||||
Attach GLFW API to GLAD,
|
||||
this method should be called after LoadGL
|
||||
@@ -147,13 +157,19 @@
|
||||
</summary>
|
||||
<exception cref="T:System.Exception">The accident that program cannot attach GLFW to GLAD</exception>
|
||||
</member>
|
||||
<member name="T:StgSharp.glLoader">
|
||||
<member name="T:StgSharp.Graphics.glLoader">
|
||||
<summary>
|
||||
Function handler to load an opengl function by serching its name.
|
||||
</summary>
|
||||
<param name="funcname">the name of the Opengl function</param>
|
||||
<returns>An intptr value representing the pointer to the function</returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.SSGwindow">
|
||||
<summary>
|
||||
A window struct that has nearly no differencr with GLFWwindow,
|
||||
but only can be referred by pointers.
|
||||
</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.
@@ -1 +1 @@
|
||||
f6acdcb7485571fc33859ff7052c64de7abcc14b
|
||||
07a65f778769dfbe3a0d49a795a6ced1fb5f9aac
|
||||
|
||||
Binary file not shown.
@@ -4,16 +4,21 @@
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:StgSharp.Instruction.InitPool">
|
||||
<member name="M:StgSharp.Control.InitPool">
|
||||
<summary>
|
||||
Add a pool to timeline controller, and return the instance of the pool.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Control.GLFWproc">
|
||||
|
||||
<member name="M:StgSharp.Control.GetKeyStatus(StgSharp.Graphics.Form,StgSharp.Control.Key)">
|
||||
<summary>
|
||||
Get the status of a certain key on the keyboard.
|
||||
</summary>
|
||||
<param name="form"></param>
|
||||
<param name="key"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:StgSharp.Control.TimeLine.tickCounter">
|
||||
<member name="F:StgSharp.Controlling.TimeLine.tickCounter">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
</summary>
|
||||
@@ -55,7 +60,7 @@
|
||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MovVertex03(System.UInt32)">
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex2(System.UInt32)">
|
||||
<summary>
|
||||
Move the third vertix. this is a useless method for Parallelograms.
|
||||
</summary>
|
||||
@@ -63,7 +68,7 @@
|
||||
<returns></returns>
|
||||
<exception cref="T:StgSharp.Geometries.UnusedVertexException">Geometry overdefined</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MovVertex04(System.UInt32)">
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex3(System.UInt32)">
|
||||
<summary>
|
||||
Move the third vertix. This method is useless for Parallelograms.
|
||||
</summary>
|
||||
@@ -103,7 +108,7 @@
|
||||
but only can be referred by pointers.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.GLcreateWindow(System.Int32,System.Int32,System.Byte[],System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<member name="M:StgSharp.Graphic.GLcreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Creates a form and its associated context.
|
||||
</summary>
|
||||
@@ -127,22 +132,14 @@
|
||||
<returns>The handle of created window</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.LoadGL">
|
||||
<summary>
|
||||
Load OpenGL API to StgSharp core programm,
|
||||
please call this method before call any other
|
||||
graphic APIs in StgSharp.
|
||||
</summary>
|
||||
<exception cref="T:System.Exception">If run this method twice, will throw exception</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.InitGL">
|
||||
<member name="M:StgSharp.Graphic.InitGL(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Init an instance of OpenGL program,
|
||||
This method should be called before other
|
||||
graphic methods, after LoadGL method.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.InitGLAD">
|
||||
<member name="M:StgSharp.Graphic.InitGLAD(StgSharp.glLoader)">
|
||||
<summary>
|
||||
Attach GLFW API to GLAD,
|
||||
this method should be called after LoadGL
|
||||
@@ -150,6 +147,13 @@
|
||||
</summary>
|
||||
<exception cref="T:System.Exception">The accident that program cannot attach GLFW to GLAD</exception>
|
||||
</member>
|
||||
<member name="T:StgSharp.glLoader">
|
||||
<summary>
|
||||
Function handler to load an opengl function by serching its name.
|
||||
</summary>
|
||||
<param name="funcname">the name of the Opengl function</param>
|
||||
<returns>An intptr value representing the pointer to the function</returns>
|
||||
</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.
@@ -1 +1 @@
|
||||
a58e0bad75f945d384a0d1dfa8c31c469d253ee7
|
||||
b955a5d62f7daf5d0377cd19de08b0c75c3cfa93
|
||||
|
||||
Binary file not shown.
@@ -50,15 +50,10 @@
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.GetLocationHandler">
|
||||
<summary>
|
||||
计算位移失量,需要手动输入游戏刻以提供时间数据
|
||||
</summary>
|
||||
<param name="tick"></param>
|
||||
<returns>表示位移量的三维矢量</returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.IPlainGeometry">
|
||||
<summary>
|
||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
Caculate the movement of a point.
|
||||
</summary>
|
||||
<param name="tick">The game tick represent time passed by</param>
|
||||
<returns>A 3d vector representing movement</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex2(System.UInt32)">
|
||||
<summary>
|
||||
@@ -76,6 +71,11 @@
|
||||
<returns></returns>
|
||||
<exception cref="T:StgSharp.Geometries.UnusedVertexException">Geometry overdefined</exception>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.PlainGeometry">
|
||||
<summary>
|
||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
|
||||
<summary>
|
||||
Update the coordinate of the point. If this is a moving point,
|
||||
@@ -102,13 +102,35 @@
|
||||
initilize all the customizing operations.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.SSGwindow">
|
||||
<summary>
|
||||
A window struct that has nearly no differencr with GLFWwindow,
|
||||
but only can be referred by pointers.
|
||||
</summary>
|
||||
<member name="M:StgSharp.Graphics.Graphic.SetFrameBufferSizeCallback(StgSharp.Graphics.Form,StgSharp.Graphics.FrameBufferSizeHadler)">
|
||||
<summary>
|
||||
sets the framebuffer resize callback of the specified <see cref="T:StgSharp.Graphics.Form"/>,
|
||||
which is called when the framebuffer of the specified <see cref="T:StgSharp.Graphics.Form"/> is resized.
|
||||
</summary>
|
||||
<param name="form">The Form instance to be controlled</param>
|
||||
<param name="handler">Method hadler </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.GLcreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<member name="M:StgSharp.Graphics.Graphic.ClearColor(System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Call glClearColor in OpenGL
|
||||
specifies the red, green, blue, and alpha values used by glClear to clear the color buffers.
|
||||
Values specified by glClearColor are clamped to the range [0,1]
|
||||
</summary>
|
||||
<param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Graphic.CompileShader(System.String,StgSharp.Graphics.ShaderType)">
|
||||
<summary>
|
||||
Conpile the provided shader code in string form.
|
||||
</summary>
|
||||
<param name="shaderCode">A string represent the shader's code</param>
|
||||
<param name="shaderType">An <see cref="T:StgSharp.Graphics.ShaderType"/> enum represent the type of the shader to
|
||||
conpile, including vertex shader and fragment shader.</param>
|
||||
<returns>An uint value as the only mark of conpiled shader</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Graphic.CreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Creates a form and its associated context.
|
||||
</summary>
|
||||
@@ -120,26 +142,14 @@
|
||||
<returns>The instance of created form</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.GLcreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,System.IntPtr)">
|
||||
<summary>
|
||||
Creates a window and its associated context.
|
||||
</summary>
|
||||
<param name="width">Required width</param>
|
||||
<param name="height">Required width</param>
|
||||
<param name="tittle">Tittle of the window </param>
|
||||
<param name="monitor"></param>
|
||||
<param name="share"></param>
|
||||
<returns>The handle of created window</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.InitGL(System.Int32,System.Int32)">
|
||||
<member name="M:StgSharp.Graphics.Graphic.InitGL(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Init an instance of OpenGL program,
|
||||
This method should be called before other
|
||||
graphic methods, after LoadGL method.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphic.InitGLAD(StgSharp.glLoader)">
|
||||
<member name="M:StgSharp.Graphics.Graphic.InitGLManager(StgSharp.Graphics.glLoader)">
|
||||
<summary>
|
||||
Attach GLFW API to GLAD,
|
||||
this method should be called after LoadGL
|
||||
@@ -147,13 +157,19 @@
|
||||
</summary>
|
||||
<exception cref="T:System.Exception">The accident that program cannot attach GLFW to GLAD</exception>
|
||||
</member>
|
||||
<member name="T:StgSharp.glLoader">
|
||||
<member name="T:StgSharp.Graphics.glLoader">
|
||||
<summary>
|
||||
Function handler to load an opengl function by serching its name.
|
||||
</summary>
|
||||
<param name="funcname">the name of the Opengl function</param>
|
||||
<returns>An intptr value representing the pointer to the function</returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.SSGwindow">
|
||||
<summary>
|
||||
A window struct that has nearly no differencr with GLFWwindow,
|
||||
but only can be referred by pointers.
|
||||
</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.
Reference in New Issue
Block a user