New IO structure, unexpexted error in C code

This commit is contained in:
Nitload
2023-06-22 03:33:24 +08:00
parent 50b4965e54
commit ee8132c149
172 changed files with 1344 additions and 4023 deletions
-5
View File
@@ -21,8 +21,3 @@
\end{document}
其中,example.bib文件的内容如下:
@article{ref1, author = {作者1}, title = {标题1}, journal = {期刊1}, year = {年份1}, volume = {卷号1}, number = {期号1}, pages = {页码1}, }
@book{ref2, author = {作者2}, title = {标题2}, publisher = {出版社2}, year = {年份2}, }
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3 -3
View File
@@ -66,14 +66,14 @@
<Position X="19.75" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AgAAAAAAAAAAogAAAABAAAAAAACAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Logic\ContainerNode.cs</FileName>
<FileName>Logic\LinkedListNode.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="StgSharp.ContainerNode&lt;T&gt;" Collapsed="true" BaseTypeListCollapsed="true">
<Class Name="StgSharp.LinkedListNode&lt;T&gt;" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="44.75" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>BhAAAAAAAAAAAgAAAAAABAAAAAAAAAAoAAAgAAAAAAA=</HashCode>
<FileName>Logic\ContainerNode.cs</FileName>
<FileName>Logic\LinkedListNode.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" Collapsed="true" />
</Class>
+2 -6
View File
@@ -1,8 +1,4 @@
using StgSharp.Control;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
@@ -21,8 +17,8 @@ namespace StgSharp
public static void AddPool(Pool pool)
{
ProgramTimeLine.allPool.Add(pool);
ProgramTimeLine._currentPool = pool;
TimeLine.allPool.Add(pool);
TimeLine._currentPool = pool;
}
}
}
+2 -8
View File
@@ -1,16 +1,10 @@
using System;
using StgSharp.Control;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp
namespace StgSharp
{
public static partial class Instruction
{
//method used for chaging the value of paameters will be listed here
}
}
+4 -7
View File
@@ -1,22 +1,19 @@
using StgSharp.Geometries;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public static unsafe partial class Geometry
public static unsafe partial class Geometry
{
public static unsafe Triangle InitTriagnle<T>(
vec3d vertex1,
vec3d vertex2,
vec3d vertex3
)where T:Triangle
) where T : Triangle
{
Triangle t = new Triangle();
return t;
}
+5 -8
View File
@@ -1,25 +1,22 @@
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp
{
internal static unsafe partial class internalIO
{
[DllImport("StgSharpGraphics.dll", EntryPoint = "initTriangle")]
internal static unsafe extern triangleVertexArray initTriangleVertex();
internal static extern unsafe triangleVertexArray initTriangleVertex();
[DllImport("StgSharpGraphics.dll", EntryPoint = "initPolygon4")]
internal static unsafe extern Polygon4VertexArray initPolygon4Vertex();
internal static extern unsafe Polygon4VertexArray initPolygon4Vertex();
[DllImport("StgSharpGraphics.dll", EntryPoint = "initPolygon5")]
internal static unsafe extern Polygon5VertexArray initPolygon5Vertex();
internal static extern unsafe Polygon5VertexArray initPolygon5Vertex();
[DllImport("StgSharpGraphics.dll", EntryPoint = "inputTriangle")]
internal static unsafe extern void internalLoadTriangle(triangleVertexArray triangle);
internal static extern unsafe void internalLoadTriangle(triangleVertexArray triangle);
}
}
+24 -12
View File
@@ -1,35 +1,47 @@
using StgSharp.Graphics;
using StgSharp.Control;
using StgSharp.Graphics;
using StgSharp.Graphics.GL;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp
{
internal static partial class internalIO
{
[DllImport("StgSharpGraphics.dll", EntryPoint = "InitGL")]
[DllImport("StgSharpGraphics.dll",
EntryPoint = "loadGLApi", CallingConvention = CallingConvention.Cdecl)]
internal static extern GraphicIOPack InternalInitGraphicApi();
[DllImport("StgSharpGraphics.dll",
EntryPoint = "InitGL", CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void InternalInitGL();
[DllImport("StgSharpGraphics.dll", EntryPoint = "InitWindow")]
[DllImport("StgSharpGraphics.dll",
EntryPoint = "InitWindow", CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe IntPtr InternalInitWindow(formInfo win);
[DllImport("StgSharpGraphics.dll", EntryPoint = "CompileShader")]
internal static unsafe extern void InternalCompileShader
[DllImport("StgSharpGraphics.dll",
EntryPoint = "CompileShader", CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void InternalCompileShader
(
shaderObject* shaderObj
);
[DllImport("StgSharpGraphics.dll", EntryPoint = "RenderWindow")]
internal static unsafe extern void InternalRenderWindow
[DllImport("StgSharpGraphics.dll", EntryPoint = "SSGraphicShouldWindowClose",
CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe int InternalShouldFormClose(IntPtr formPtr);
[DllImport("StgSharpGraphics.dll",
EntryPoint = "RenderWindow", CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void InternalRenderWindow
(
IntPtr window,
IntPtr window,
formInfo info,
shaderObject* shaderObj
);
[DllImport("StgSharpGraphics.dll", EntryPoint = "TerminateWindow")]
internal static unsafe extern void TerminateWindow(shaderObject* shaderObj);
[DllImport("StgSharpGraphics.dll", EntryPoint = "TerminateWindow"
, CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void TerminateWindow(shaderObject* shaderObj);
}
}
@@ -0,0 +1,24 @@
using System;
using System.Runtime.InteropServices;
namespace StgSharp.Control
{
internal delegate void InternalInitGLDelegate();
internal delegate IntPtr InternalGLcreateWindowDelegate
(int width, int height, char[] tittle, IntPtr monitor, IntPtr share);
internal delegate void InternalGLmakeContextCurrent(IntPtr window);
internal delegate void InternalGLswapInterval(int interval);
internal delegate void InternalGLclearColorDelegate
(float red, float green, float blue, float alpha);
[StructLayout(LayoutKind.Sequential)]
internal struct GraphicIOPack
{
internal InternalInitGLDelegate InternalLoadGL;
internal InternalGLcreateWindowDelegate InternalGLcreatWindow;
internal InternalGLmakeContextCurrent InternalGLmakeContextCurrent;
internal InternalGLswapInterval InternalGLswapInterval;
internal InternalGLclearColorDelegate InternalGLclearColor;
}
}
@@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Control
{
public delegate int InitWindow(int width, int height);
[StructLayout(LayoutKind.Sequential)]
public struct GraphicIOPack
{
public InitWindow initWindowPtr = default;
public GraphicIOPack()
{
}
}
}
+2 -5
View File
@@ -1,7 +1,4 @@
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Control
{
@@ -9,10 +6,10 @@ namespace StgSharp.Control
{
public static void Point(Point p)
{
ProgramTimeLine._currentPool._pointContainer.Remove(p);
TimeLine._currentPool._pointContainer.Remove(p);
}
}
}
@@ -1,12 +1,12 @@
using StgSharp.Entities;
using StgSharp.Graphics;
using StgSharp.Graphics.GL;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace StgSharp.Control
{
public static class ProgramTimeLine
public static class TimeLine
{
[AllowNull]
internal static Pool _currentPool = default;
@@ -16,18 +16,18 @@ namespace StgSharp.Control
/// <summary>
/// Tick counter count the frames passed since the program start.
/// </summary>
public readonly static Counter<uint> tickCounter = new Counter<uint>(0,1,1);
public static readonly Counter<uint> tickCounter = new Counter<uint>(0, 1, 1);
[AllowNull]
internal static TimelineBlock currentOperation ;
internal static TimelineBlock currentOperation;
private static bool isPaused = false;
static ProgramTimeLine()
static TimeLine()
{
allForm = new LinkedList<Form>();
allPool = new LinkedList<Pool>();
#if DEBUG
Console.WriteLine("Timeline init OK!") ;
Console.WriteLine("Timeline init OK!");
#endif
internalIO.InternalInitGL();
}
@@ -52,9 +52,22 @@ namespace StgSharp.Control
public static void InitProgram()
{
}
public static unsafe void StartProgram()
{
foreach (Form form in allForm)
{
if (Graphic.ShouldFormClose(form))
{
internalIO.InternalRenderWindow(
form.windowPtr,
form.info,
(shaderObject*)form.shader);
}
}
}
}
}
+2 -6
View File
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Control
namespace StgSharp.Control
{
public abstract class TimelineBlock : INode<TimelineBlock>
public abstract class TimelineBlock
{
public abstract void OnUpdating();
+1 -5
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Entities
namespace StgSharp.Entities
{
public abstract class BehaviorArgs
{
+4 -5
View File
@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using StgSharp.Control;
using System;
namespace StgSharp.Entities
{
public class EliteEnemy:IEntity
public class EliteEnemy : IEntity
{
public bool _selectalbe;
@@ -20,7 +19,7 @@ namespace StgSharp.Entities
{
_dieBulletLauncher.Launch();
_awardLauncher.Launch();
this._id.Remove();
TimeLine._currentPool._enemyContainer.Remove(this);
}
internal override void OnRenderFrame()
+2 -4
View File
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using StgSharp.Control;
namespace StgSharp.Entities
{
@@ -20,7 +18,7 @@ namespace StgSharp.Entities
{
_dieBulletLauncher.Launch();
_awardLauncher.Launch();
this._id.Remove();
TimeLine._currentPool._enemyContainer.Remove(this);
}
internal override void OnRenderFrame()
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Entities
namespace StgSharp.Entities
{
public abstract class EntityPartical : IEntity
{
}
}
+6 -9
View File
@@ -1,12 +1,9 @@
using StgSharp.Math;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Text;
using StgSharp.Geometries;
using StgSharp.Math;
namespace StgSharp
{
public abstract class IEntity:INode<IEntity>
public abstract class IEntity
{
internal Point _pos;
internal LinkedList<IPlainGeometry> _collisionBox;
@@ -17,7 +14,7 @@ namespace StgSharp
internal GetLocationHandler _movHandler;
protected uint _bornTick;
public LinkedList<IPlainGeometry> CollisionBox
public LinkedList<IPlainGeometry> CollisionBox
{
get { return _collisionBox; }
set { _collisionBox = value; }
@@ -26,10 +23,10 @@ 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<IPlainGeometry> CollisionSensor
{
get { return _collisionSensor; }
set { _collisionSensor = value; }
set { _collisionSensor = value; }
}
public string Texture { get; set; }
+4 -7
View File
@@ -1,12 +1,9 @@
using StgSharp.Entities;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public class Launcher<T>:INode<Launcher<T>> where T : IEntity
public class Launcher<T> where T : IEntity
{
/*
*用于发射其他的实体,主要是子弹 和 掉落物
@@ -23,12 +20,12 @@ namespace StgSharp
set { _bulletSample = value; }
}
internal virtual void Launch( )
internal virtual void Launch()
{
}
}
}
+1 -4
View File
@@ -1,7 +1,4 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
using System;
namespace StgSharp
{
+1 -7
View File
@@ -1,10 +1,4 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp
namespace StgSharp
{
public abstract class Player : IEntity
{
@@ -1,8 +1,5 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Geometries
{
@@ -1,8 +1,5 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Geometries
{
@@ -1,8 +1,5 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Geometries
{
@@ -1,9 +1,5 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Geometries
{
@@ -30,7 +26,7 @@ namespace StgSharp.Geometries
internal override void OnRender(uint tick)
{
tick-= bornTick;
tick -= bornTick;
center.Position = refOrigin.Position + MoveCenter(tick);
beginPoint.Position = refOrigin.Position + MovBegin(tick);
endPoint.Position = refOrigin.Position + MovEnd(tick);
@@ -40,7 +36,7 @@ namespace StgSharp.Geometries
public override Plain GetPlain()
{
return new Plain(this.center,this.beginPoint,this.endPoint);
return new Plain(this.center, this.beginPoint, this.endPoint);
}
}
}
@@ -1,7 +1,5 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
@@ -34,7 +32,7 @@ namespace StgSharp.Geometries
internal override void OnRender(uint tick)
{
tick-=bornTick;
tick -= bornTick;
center.Position = refOrigin.Position + MoveCenter(tick);
pointOnCircle.Position = refOrigin.Position + UpdateRadius(tick);
pointOnPlain.Position = refOrigin.Position + UpdatePlain(tick);
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
namespace StgSharp.Geometries
{
public delegate float ExpressionHandler
(
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
namespace StgSharp.Geometries
{
@@ -1,8 +1,4 @@
using StgSharp;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
using StgSharp.Math;
namespace StgSharp.Geometries
{
@@ -1,15 +1,10 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
namespace StgSharp.Geometries
{
/// <summary>
/// 平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
/// </summary>
public abstract class IPlainGeometry:INode<IPlainGeometry>
public abstract class IPlainGeometry
{
protected readonly uint bornTick;
internal readonly Point refOrigin;
@@ -17,16 +12,16 @@ namespace StgSharp.Geometries
public Point RefOrigin { get { return refOrigin; } }
public abstract Point RefPoint01
{
{
get;
}
public abstract Point RefPoint02{ get; }
public abstract Point RefPoint03{ get; }
public abstract Point RefPoint02 { get; }
public abstract Point RefPoint03 { get; }
public uint BornTime => bornTick;
public IPlainGeometry(uint bornTime)
{
bornTick=bornTime;
bornTick = bornTime;
}
public IPlainGeometry(Counter<uint> MainTimer)
@@ -1,17 +1,12 @@
using Steamworks;
using StgSharp;
using StgSharp.Control;
using StgSharp.Math;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public class Line:IPlainGeometry
public class Line : IPlainGeometry
{
internal Point basePoint = default ;
internal Point beginPoint = default ;
internal Point basePoint = default;
internal Point beginPoint = default;
internal Point endPoint = default;
internal GetLocationHandler movBegin;
internal GetLocationHandler movEnd;
@@ -29,11 +24,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)
@@ -1,8 +1,5 @@
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
@@ -10,7 +7,7 @@ namespace StgSharp.Geometries
{
internal Point center;
public override sealed Point RefPoint01 => center;
public sealed override Point RefPoint01 => center;
public sealed override Point RefPoint02 => vertex01;
public sealed override Point RefPoint03 => vertex02;
@@ -41,9 +38,9 @@ namespace StgSharp.Geometries
throw new UnusedVertexException();
}
internal override sealed void OnRender(uint tick)
internal sealed override void OnRender(uint tick)
{
uint nowTick = ProgramTimeLine.tickCounter._value;
uint nowTick = TimeLine.tickCounter._value;
this.vertex01.Position = RefOrigin.Position + movVertex01Operation(nowTick);
this.vertex02.Position = RefOrigin.Position + movVertex02Operation(nowTick);
this.vertex03.Position = 2 * center.Position - vertex01.Position;
@@ -1,7 +1,4 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
@@ -52,4 +49,5 @@ namespace StgSharp.Geometries
plainParameter.Z = 1 / plainParameter.Z;
}
}}
}
}
@@ -1,16 +1,11 @@
using StgSharp;
using StgSharp.Math;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Geometries
{
public unsafe class Point : INode<Point>, INullable
public unsafe class Point
{
internal vec3d* positionPtr;
internal readonly bool isVertex;
@@ -59,7 +54,6 @@ namespace StgSharp.Geometries
public bool IsVertex => isVertex;
bool INullable.IsNull { get; }
/// <summary>
/// Update the coordinate of the point. If this is a moving point,
@@ -67,7 +61,7 @@ namespace StgSharp.Geometries
/// please do not define any motion here, codes will be ignored by program
/// </summary>
/// <param name="tick">Time passes since the program begin, counted by frames</param>
public virtual void Update(uint tick) {}
public virtual void Update(uint tick) { }
public bool IsInGeometry(IPlainGeometry geo)
{
@@ -1,8 +1,5 @@
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
@@ -58,7 +55,7 @@ namespace StgSharp.Geometries
return new Plain(this.RefPoint01, this.RefPoint02, this.RefPoint03);
}
public virtual vec3d MovVertex01(uint tick) => movVertex01Operation.Invoke(tick);
public virtual vec3d MovVertex02(uint tick) => movVertex01Operation.Invoke(tick);
@@ -70,7 +67,7 @@ namespace StgSharp.Geometries
internal override void OnRender(uint tick)
{
uint nowTick = ProgramTimeLine.tickCounter._value;
uint nowTick = TimeLine.tickCounter._value;
this.vertex01.Position = RefOrigin.Position + movVertex01Operation(nowTick);
this.vertex02.Position = RefOrigin.Position + movVertex02Operation(nowTick);
this.vertex03.Position = RefOrigin.Position + movVertex03Operation(nowTick);
@@ -1 +1,12 @@
using Steamworks;
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Text;

namespace StgSharp.Geometries
{
 public unsafe class Polygon5 : IPlainGeometry
 {
 internal Polygon5VertexArray vertexPtrAyyar;

 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 RefPoint01 => vertex1;

 public override Point RefPoint02 => vertex2;

 public override Point RefPoint03 => vertex3;

 internal GetLocationHandler movP01Operation = default;
 internal GetLocationHandler movP02Operation = default;
 internal GetLocationHandler movP03Operation = default;
 internal GetLocationHandler movP04Operation = default;
 internal GetLocationHandler movP05Operation = default;

 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 unsafe Polygon5()
 {
 vertexPtrAyyar = internalIO.initPolygon5Vertex();
 vertex1 = new Point(vertexPtrAyyar.vertex1);
 vertex2 = new Point(vertexPtrAyyar.vertex2);
 vertex3 = new Point(vertexPtrAyyar.vertex3);
 vertex4 = new Point(vertexPtrAyyar.vertex4);
 vertex5 = new Point(vertexPtrAyyar.vertex5);
 }

 public virtual vec3d movPoint01(uint tick)=> movP01Operation.Invoke(ProgramTimeLine.tickCounter._value);
 
 public virtual vec3d movPoint02(uint tick)=> movP02Operation.Invoke(ProgramTimeLine.tickCounter._value);
 
 public virtual vec3d movPoint03(uint tick)=> movP03Operation.Invoke(ProgramTimeLine.tickCounter._value);
 
 public virtual vec3d movPoint04(uint tick)=> movP04Operation.Invoke(ProgramTimeLine.tickCounter._value);
 
 public virtual vec3d movPoint05(uint tick)=> movP05Operation.Invoke(ProgramTimeLine.tickCounter._value);
 

 internal override void OnRender(uint tick)
 {
 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);
 }

 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)
 };
 }

 public override Plain GetPlain()
 {
 return new Plain(vertex1,vertex2,vertex3);
 }
 }
}

using StgSharp.Control;
using StgSharp.Math;

namespace StgSharp.Geometries
{
 public unsafe class Polygon5 : IPlainGeometry
 {
 internal Polygon5VertexArray vertexPtrAyyar;

 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 RefPoint01 => vertex1;

 public override Point RefPoint02 => vertex2;

 public override Point RefPoint03 => vertex3;

 internal GetLocationHandler movP01Operation = default;
 internal GetLocationHandler movP02Operation = default;
 internal GetLocationHandler movP03Operation = default;
 internal GetLocationHandler movP04Operation = default;
 internal GetLocationHandler movP05Operation = default;

 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 unsafe Polygon5()
 {
 vertexPtrAyyar = internalIO.initPolygon5Vertex();
 vertex1 = new Point(vertexPtrAyyar.vertex1);
 vertex2 = new Point(vertexPtrAyyar.vertex2);
 vertex3 = new Point(vertexPtrAyyar.vertex3);
 vertex4 = new Point(vertexPtrAyyar.vertex4);
 vertex5 = new Point(vertexPtrAyyar.vertex5);
 }

 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)
 {
 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);
 }

 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)
 };
 }

 public override Plain GetPlain()
 {
 return new Plain(vertex1, vertex2, vertex3);
 }
 }
}

@@ -1,10 +1,5 @@
using Steamworks;
using StgSharp.Control;
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
namespace StgSharp.Geometries
{
@@ -42,32 +37,32 @@ namespace StgSharp.Geometries
public virtual vec3d movPoint01(uint tick)
{
return movP01Operation.Invoke(ProgramTimeLine.tickCounter._value);
return movP01Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint02(uint tick)
{
return movP02Operation.Invoke(ProgramTimeLine.tickCounter._value);
return movP02Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint03(uint tick)
{
return movP03Operation.Invoke(ProgramTimeLine.tickCounter._value);
return movP03Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint04(uint tick)
{
return movP04Operation.Invoke(ProgramTimeLine.tickCounter._value);
return movP04Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint05(uint tick)
{
return movP05Operation.Invoke(ProgramTimeLine.tickCounter._value);
return movP05Operation.Invoke(TimeLine.tickCounter._value);
}
public virtual vec3d movPoint06(uint tick)
{
return movP06Operation.Invoke(ProgramTimeLine.tickCounter._value);
return movP06Operation.Invoke(TimeLine.tickCounter._value);
}
internal override void OnRender(uint tick)
@@ -96,7 +91,7 @@ namespace StgSharp.Geometries
public override Plain GetPlain()
{
return new Plain(vertex1,vertex2,vertex3);
return new Plain(vertex1, vertex2, vertex3);
}
}
}
@@ -1,8 +1,4 @@
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
using StgSharp.Math;
namespace StgSharp.Geometries
{
@@ -10,13 +6,13 @@ namespace StgSharp.Geometries
{
internal Point center;
public override sealed Point RefPoint01=>center;
public sealed override Point RefPoint01 => center;
public override sealed Point RefPoint02 => vertex01;
public sealed override Point RefPoint02 => vertex01;
public sealed override Point RefPoint03 => vertex02;
public override sealed Point RefPoint03 => vertex02;
/// <summary>
/// 计算中心点相对于参考原点的位移
@@ -35,9 +31,9 @@ namespace StgSharp.Geometries
return this.center.Position * 2 - this.vertex02.Position;
}
internal override sealed void OnRender(uint tick)
internal sealed override void OnRender(uint tick)
{
tick-=bornTick;
tick -= bornTick;
this.MovCenter(tick);
}
@@ -1,7 +1,4 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
@@ -9,7 +6,7 @@ namespace StgSharp.Geometries
/// <summary>
/// A square
/// </summary>
public class Square:Rectangle
public class Square : Rectangle
{
public sealed override vec3d MovVertex02(uint tick)
{
@@ -1,16 +1,11 @@
using StgSharp;
using StgSharp.Control;
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Geometries
{
public unsafe class Triangle :IPlainGeometry
public unsafe class Triangle : IPlainGeometry
{
internal triangleVertexArray vertexArray;
@@ -21,9 +16,9 @@ namespace StgSharp.Geometries
internal GetLocationHandler movVertex02Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movVertex03Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
public override sealed Point RefPoint01 => vertex1;
public override sealed Point RefPoint02 => vertex2;
public override sealed Point RefPoint03 => vertex3;
public sealed override Point RefPoint01 => vertex1;
public sealed override Point RefPoint02 => vertex2;
public sealed override Point RefPoint03 => vertex3;
public GetLocationHandler MovVertex01Operation => this.movVertex01Opearion;
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
@@ -48,9 +43,9 @@ namespace StgSharp.Geometries
vertexArray.vertex3Ptr = this.vertex1.positionPtr;
/**/
ProgramTimeLine._currentPool._pointContainer.Add(vertex1);
ProgramTimeLine._currentPool._pointContainer.Add(vertex2);
ProgramTimeLine._currentPool._pointContainer.Add(vertex3);
TimeLine._currentPool._pointContainer.Add(vertex1);
TimeLine._currentPool._pointContainer.Add(vertex2);
TimeLine._currentPool._pointContainer.Add(vertex3);
/**/
@@ -67,7 +62,7 @@ namespace StgSharp.Geometries
vertex1.Position = vertex01;
}
internal override sealed void OnRender(uint tick)
internal sealed override void OnRender(uint tick)
{
tick -= this.bornTick;
vertex1.Position = RefOrigin.Position + MovVertex01(tick);
@@ -89,7 +84,7 @@ namespace StgSharp.Geometries
public override Plain GetPlain()
{
return new Plain(this.vertex1,this.vertex2,this.vertex3);
return new Plain(this.vertex1, this.vertex2, this.vertex3);
}
}
+15 -24
View File
@@ -1,11 +1,7 @@
using StgSharp.Graphics.GL;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace StgSharp.Graphics
{
@@ -18,18 +14,18 @@ namespace StgSharp.Graphics
public string name;
}
public unsafe class Form:INode<Form>
public unsafe class Form
{
internal IntPtr windowPtr;
internal formInfo info;
internal shaderObject shader;
internal IntPtr shader;
internal LinkedList<Pool> allControl;
public vec2d Size
{
get { return new vec2d(info.width,info.height); }
set
{
get { return new vec2d(info.width, info.height); }
set
{
info.width = (int)value.X;
info.height = (int)value.Y;
}
@@ -41,7 +37,7 @@ namespace StgSharp.Graphics
set => info.width = value;
}
public int Height
public int Height
{
get => info.height;
set => info.height = value;
@@ -69,18 +65,16 @@ namespace StgSharp.Graphics
//used for internal control purpose
internal Form(int instruction)
{
}
internal unsafe void defualtInit()
{
fixed (shaderObject* shaderObj = &this.shader)
{
IntPtr windowPtr = Graphic.InitWindow(this);
internalIO.InternalCompileShader(shaderObj);
internalIO.InternalRenderWindow(windowPtr, this.info, shaderObj);
internalIO.TerminateWindow(shaderObj);
}
IntPtr windowPtr = Graphic.InitWindow(this);
internalIO.InternalCompileShader((shaderObject*)this.shader);
internalIO.InternalRenderWindow(windowPtr, this.info, (shaderObject*)this.shader);
internalIO.TerminateWindow((shaderObject*)shader);
}
public virtual void Init()
@@ -93,12 +87,9 @@ namespace StgSharp.Graphics
public void Show()
{
fixed (shaderObject* shaderObj = &this.shader)
{
internalIO.InternalCompileShader(shaderObj);
internalIO.InternalRenderWindow(this.windowPtr, this.info, shaderObj);
internalIO.TerminateWindow(shaderObj);
}
internalIO.InternalCompileShader((shaderObject*)shader);
internalIO.InternalRenderWindow(this.windowPtr, this.info, (shaderObject*)shader);
internalIO.TerminateWindow((shaderObject*)shader);
}
+1 -5
View File
@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Graphics
{
//rename types in style of GLFW
using GLFWbool = Boolean;
using _glfw = _GLFWlibrary;
public unsafe static partial class GLFW
public static unsafe partial class GLFW
{
internal static _glfw glfw = new _glfw();
+2 -6
View File
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphics
namespace StgSharp.Graphics
{
internal enum VkStructureType:uint
internal enum VkStructureType : uint
{
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
+7 -11
View File
@@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics
{
//rename types in style of GLFW
using GLFWbool = Boolean;
using _glfw = _GLFWlibrary;
//strucs defined in glfw3.h
@@ -96,7 +92,7 @@ namespace StgSharp.Graphics
int refreshRate;
}
public unsafe struct GLFWgammaramp
public unsafe struct GLFWgammaramp
{
/*! An array of value describing the response of the red channel.
@@ -113,7 +109,7 @@ namespace StgSharp.Graphics
uint size;
}
public unsafe struct GLFWimage
public unsafe struct GLFWimage
{
/*! The width, in pixels, of this image.
@@ -127,7 +123,7 @@ namespace StgSharp.Graphics
byte* pixels;
}
public struct GLFWgamepadstate
public struct GLFWgamepadstate
{
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
@@ -144,7 +140,7 @@ namespace StgSharp.Graphics
}
}
public unsafe struct GLFWallocator
public unsafe struct GLFWallocator
{
//GLFWallocatefun allocate;
IntPtr allocate;
@@ -233,7 +229,7 @@ namespace StgSharp.Graphics
// GLFW_PLATFORM_CURSOR_STATE;
}
public unsafe struct GLFWerror
public unsafe struct GLFWerror
{
//_GLFWerror* next;
@@ -356,7 +352,7 @@ namespace StgSharp.Graphics
}
}
public unsafe struct GLFWfbconfig
public unsafe struct GLFWfbconfig
{
int redBits;
@@ -767,7 +763,7 @@ namespace StgSharp.Graphics
}
[StructLayout(LayoutKind.Explicit,Size = 16)]
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct uintptr_t
{
[FieldOffset(0)]
+1 -4
View File
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics.GL
{
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public static unsafe partial class Graphic
{
public static void InitGL()
{
InternalInitGL();
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using StgSharp.Control;
namespace StgSharp
{
public static unsafe partial class Graphic
{
internal static InternalInitGLDelegate InternalInitGL;
internal static InternalGLcreateWindowDelegate InternalGLcreatWindow;
internal static InternalGLmakeContextCurrent InternalGLmakeContextCurrent;
internal static InternalGLswapInterval InternalGLswapInterval;
internal static InternalGLclearColorDelegate InternalGLclearColor;
}
}
+28 -9
View File
@@ -1,17 +1,31 @@
using StgSharp.Control;
using StgSharp.Graphics;
using StgSharp.Graphics.GL;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp
{
public static unsafe class Graphic
public static unsafe partial class Graphic
{
public static unsafe void LoadGL()
{
GraphicIOPack GLpack = internalIO.InternalInitGraphicApi();
}
internal static byte[] loadShaderCodeStr(string str)
{
byte[] cahrStr;
try
{
cahrStr = System.Text.Encoding.ASCII.GetBytes(str);
return cahrStr;
}
catch (Exception)
{
throw;
}
}
/// <summary>
/// Init a form, attach its data to GLFW program,
/// and return the pointer of the GLFW package of the form.
@@ -22,7 +36,7 @@ namespace StgSharp
/// or GLAD program fail to init</exception>
public static unsafe IntPtr InitWindow(Form form)
{
IntPtr a= internalIO.InternalInitWindow(form.info);
IntPtr a = internalIO.InternalInitWindow(form.info);
if ((long)a == -1)
{
throw new Exception("Failed to init form.");
@@ -39,9 +53,14 @@ namespace StgSharp
public static unsafe void LoadForm(Form form)
{
ProgramTimeLine.allForm.Add(form);
TimeLine.allForm.Add(form);
}
public static unsafe bool ShouldFormClose(Form form)
{
int a = internalIO.InternalShouldFormClose(form.windowPtr);
return a != 0;
}
}
}
-107
View File
@@ -1,107 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.SqlTypes;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace StgSharp
{
public abstract class INode<T> where T : INode<T>
{
[NotNull]
protected ContainerNode<T> _id;
internal ContainerNode<T> ID
{
get { return _id; }
}
internal ContainerNode<T> Previous
{
get { return _id._previous; }
set { _id._previous = value; }
}
internal ContainerNode<T> Next
{
get { return _id._next; }
set { _id._next = value; }
}
public INode()
{
_id = new ContainerNode<T>(this as T);
}
internal void SetId(ContainerNode<T> tContainer)
{
_id = tContainer;
}
internal void SelfDestrcut()
{
_id._previous._next = _id._next;
_id._next._previous = _id._previous;
_id._next = null;
_id._previous = null;
GC.Collect();
}
}
public class ContainerNode<T> : INullable where T : INode<T>
{
internal readonly T _value;
[AllowNull]
internal ContainerNode<T> _previous;
[AllowNull]
internal ContainerNode<T> _next;
internal ContainerNode()
{
}
public ContainerNode(T t)
{
_value = t;
_previous = new ContainerNode<T>();
_next = new ContainerNode<T>();
}
public virtual ContainerNode<T> Previous
{
get { return _previous; }
set { _previous = value; }
}
public ContainerNode<T> Next
{
get { return _next; }
set { _next = value; }
}
public T Value
{
get { return _value; }
}
public bool IsNull
{
get;
}
public void Remove()
{
_previous.Next = _next;
_next.Previous = _previous;
_next = default(ContainerNode<T>);
_previous = default(ContainerNode<T>);
}
}
}
+16 -7
View File
@@ -1,11 +1,8 @@
using Microsoft.CSharp;
using System;
using System.Collections.Generic;
using System.Text;
using System;
namespace StgSharp
{
public class Counter<T> where T:struct, IConvertible, IFormattable, IComparable
public class Counter<T> where T : struct, IConvertible, IFormattable, IComparable
{
internal readonly dynamic _defualtValue;
internal readonly dynamic _defualtAddValue;
@@ -19,7 +16,7 @@ namespace StgSharp
set { _value = value; }
}
public Counter(T defualtValue,T defualtAddValue,T defualtSubValue)
public Counter(T defualtValue, T defualtAddValue, T defualtSubValue)
{
var type = Type.GetTypeCode(defualtValue.GetType());
switch (type)
@@ -53,7 +50,7 @@ namespace StgSharp
_defualtSubValue = defualtSubValue;
}
public void Add(T value)
{
_value += value;
@@ -78,5 +75,17 @@ namespace StgSharp
{
_value = _defualtValue;
}
public static Counter<T> operator ++(Counter<T> counter)
{
counter.QuickAdd();
return counter;
}
public static Counter<T> operator --(Counter<T> counter)
{
counter.QuickSub();
return counter;
}
}
}
+88 -34
View File
@@ -1,34 +1,41 @@
using StgSharp.Graphics;
using StgSharp.Logic;
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public class LinkedList<T>:INode<LinkedList<T>>,IEnumerable where T: INode<T>
public class LinkedList<T> : IEnumerable
{
internal readonly ContainerNode<T> _heading;
private ContainerNode<T> _cache;
internal readonly LinkedListNode<T> _heading;
private LinkedListNode<T> _cache;
private bool isEmpty;
public Counter<uint> count = new Counter<uint>(0, 1, 1);
public LinkedList()
{
_heading = new ContainerNode<T>(null);
_heading = new LinkedListNode<T>();
isEmpty = true;
}
public T First
{
get { return _heading._next._value; }
private set { _heading._next = value.ID; }
/*
* This setter is ued to reset the First node,
* be careful when use this setter to avoid
* unexpected risk of this List lose all nodes.
*/
private set { _heading._next = default; }
}
public T Tail
{
get { return _heading._previous._value; }
private set { _heading._previous = value.ID; }
/*
* This setter is ued to reset the Last node,
* be careful when use this setter to avoid
* unexpected risk of this List lose all nodes.
*/
private set { _heading._previous = default; }
}
/// <summary>
@@ -40,54 +47,101 @@ namespace StgSharp
//checkout if the linkedlist is null
if (isEmpty)
{
_heading._next = t.ID;
_heading._previous = t.ID;
t.Next = _heading;
t.Previous = _heading;
LinkedListNode<T> node = new LinkedListNode<T>(t);
_heading._next = node;
_heading._previous = node;
node.Next = _heading;
node.Previous = _heading;
isEmpty = false;
}
else
{
t.Next = _heading;
t.Previous = _heading.Previous;
_heading._previous._next = t.ID;
_heading._previous = t.ID;
LinkedListNode<T> node = new LinkedListNode<T>(t);
node.Next = _heading;
node.Previous = _heading.Previous;
_heading._previous._next = node;
_heading._previous = node;
}
count++;
}
public void Remove(T node)
public void Remove(T value)
{
foreach (INode<T> item in this)
{
if (item == node)
{
node.SelfDestrcut();
break;
}
}
LinkedListNode<T> node = Find(value);
node._next._previous = node._previous;
node._previous._next = node._next;
node._previous = null;
node._next = null;
count--;
}
public void RemoveTail()
{
//check out if the list has only one member
if (Tail == First)
if (count._value == 1)
{
First = default;
isEmpty = true;
}
else
{
Tail.Previous.Next = _heading;
Tail.Next = null;
_heading.Previous.Next = _heading;
}
count--;
}
internal LinkedListNode<T> Find(T value)
{
foreach (LinkedListNode<T> node in this)
{
if (node._value.Equals(value))
{
return node;
}
}
throw new Exception("Value not found in this LinkedList");
}
public void Clear()
{
_heading._previous = null;
_heading._next = null;
count.Reset();
}
IEnumerator IEnumerable.GetEnumerator()
{
return new LinkedListEnumrator<T>(this);
}
internal struct LinkedListEnumrator<T> : IEnumerator
{
private LinkedList<T> _target;
LinkedListNode<T> enumrator;
public LinkedListEnumrator(LinkedList<T> target)
{
_target = target;
enumrator = target._heading;
}
object IEnumerator.Current
{
get { return enumrator._value; }
}
bool IEnumerator.MoveNext()
{
enumrator = enumrator._next;
return enumrator == default(LinkedListNode<T>);
}
void IEnumerator.Reset()
{
enumrator = _target._heading;
}
}
}
}
@@ -1,35 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
internal class LinkedListEnumrator<T> : IEnumerator where T : INode<T>
{
private LinkedList<T> _target;
ContainerNode<T> enumrator;
public LinkedListEnumrator(LinkedList<T> target)
{
_target = target;
enumrator = target._heading;
}
object IEnumerator.Current
{
get { return enumrator._value; }
}
bool IEnumerator.MoveNext()
{
enumrator = enumrator._next;
return enumrator == default(ContainerNode<T>);
}
void IEnumerator.Reset()
{
enumrator = _target._heading;
}
}
}
@@ -0,0 +1,53 @@
using System.Diagnostics.CodeAnalysis;
namespace StgSharp
{
internal class LinkedListNode<T>
{
internal readonly T _value;
[AllowNull]
internal LinkedListNode<T> _previous;
[AllowNull]
internal LinkedListNode<T> _next;
internal LinkedList<T> list;
internal LinkedListNode()
{
}
public LinkedListNode(T t)
{
_value = t;
_previous = new LinkedListNode<T>();
_next = new LinkedListNode<T>();
}
public virtual LinkedListNode<T> Previous
{
get { return _previous; }
set { _previous = value; }
}
public LinkedListNode<T> Next
{
get { return _next; }
set { _next = value; }
}
public T Value
{
get { return _value; }
}
public void Remove()
{
_previous.Next = _next;
_next.Previous = _previous;
_next = default(LinkedListNode<T>);
_previous = default(LinkedListNode<T>);
}
}
}
+5 -12
View File
@@ -1,15 +1,9 @@
using Steamworks;
using StgSharp.Math;
using StgSharp.Entities;
using StgSharp.Entities;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Text;
namespace StgSharp
{
public class Pool:INode<Pool>
public class Pool
{
internal LinkedList<Point> _pointContainer;
internal LinkedList<IPlainGeometry> geometryContainer;
@@ -27,14 +21,13 @@ namespace StgSharp
public Line TopBoarder => topBoader;
public Line BottomBoarder => bottomBoader;
internal Pool()
internal Pool()
{
initContainers();
}
private void initContainers()
{
_id = new ContainerNode<Pool>(this);
_pointContainer = new LinkedList<Point>();
_bulletContainer = new LinkedList<IEntity>();
_awardContainer = new LinkedList<IEntity>();
@@ -46,11 +39,11 @@ namespace StgSharp
{
foreach (Enemy e in _enemyContainer)
{
}
}
}
}
@@ -0,0 +1,23 @@
namespace StgSharp.Logic
{
public abstract class QuickClearNode<T> where T : QuickClearNode<T>
{
internal LinkedList<LinkedListNode<T>> _idList
= new LinkedList<LinkedListNode<T>>();
internal void QuickDestruct(LinkedList<T> list)
{
foreach (LinkedListNode<T> id in _idList)
{
if (id.list == list)
{
RecycleBin.Add(id);
break;
}
}
}
internal static LinkedList<LinkedListNode<T>> RecycleBin
= new LinkedList<LinkedListNode<T>>();
}
}
+2 -7
View File
@@ -1,21 +1,16 @@
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
namespace StgSharp
{
public delegate bool SensorRuleHandler(IPlainGeometry target, IPlainGeometry boarder);
public class Sensor<T>
public class Sensor<T>
{
internal IPlainGeometry _boarder;
internal IPlainGeometry _target;
internal SensorRuleHandler _rule;
public IPlainGeometry boarder
{
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Math
namespace StgSharp.Math
{
internal class Cordination
+3 -7
View File
@@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Math
namespace StgSharp.Math
{
public static unsafe partial class Vector
{
public static float Det(matrix2x2 array)
{
return Cross(array.row1,array.row2);
return Cross(array.row1, array.row2);
}
public static unsafe float Det(matrix3x3 array)
@@ -29,7 +25,7 @@ namespace StgSharp.Math
*(p + 6), *(p + 7)
);
return
return
*p * Det(matrix1)
- *(p + 1) * Det(matrix2)
+ *(p + 2) * Det(matrix3)
@@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Math
namespace StgSharp.Math
{
public static unsafe partial class Vector
{
public static float GetAngle(vec2d vec1, vec2d vec2)
{
return Calc.ACos(
vec1 .multiple(vec2)
vec1.multiple(vec2)
/ (vec1.GetLength() * vec2.GetLength())
);
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Math
namespace StgSharp.Math
{
public static unsafe partial class Vector
{
@@ -18,7 +14,7 @@ namespace StgSharp.Math
public static float GetLength(this vec2d vec)
{
return Calc.Sqrt(
vec.X * vec.X +
vec.X * vec.X +
vec.Y * vec.Y
);
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Math
namespace StgSharp.Math
{
public static unsafe partial class Vector
{
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
namespace StgSharp.Math
{
public static unsafe partial class VectorCalc
{
@@ -131,7 +126,7 @@ namespace StgSharp.Math
*(p1 + 2) * *(p2 + 0) + *(p1 + 3) * *(p2 + 1)
);
}
/// <summary>
///
/// </summary>
@@ -373,8 +368,8 @@ namespace StgSharp.Math
var c2 = a1.multiple(b12) + a2.multiple(b22);
return new matrix2x4(
new vec4d(c1.row1,c2.row1),
new vec4d(c1.row2,c2.row2)
new vec4d(c1.row1, c2.row1),
new vec4d(c1.row2, c2.row2)
);
}
@@ -448,11 +443,11 @@ namespace StgSharp.Math
float* p2 = &matrix2.row1.X;
return new matrix2x3(
getMatrixMember(p1,p2), getMatrixMember(p1, p2+1), getMatrixMember(p1, p2+2),
getMatrixMember(p1+4, p2), getMatrixMember(p1+4, p2+1), getMatrixMember(p1+4, p2 + 2)
getMatrixMember(p1, p2), getMatrixMember(p1, p2 + 1), getMatrixMember(p1, p2 + 2),
getMatrixMember(p1 + 4, p2), getMatrixMember(p1 + 4, p2 + 1), getMatrixMember(p1 + 4, p2 + 2)
);
}
/// <summary>
@@ -464,19 +459,19 @@ namespace StgSharp.Math
public static unsafe matrix2x4 multiple(this matrix2x4 matrix1, matrix4x4 matrix2)
{
matrix2x2 a1 = new matrix2x2(matrix1.row1.Point1,matrix1.row2.Point1);
matrix2x2 a1 = new matrix2x2(matrix1.row1.Point1, matrix1.row2.Point1);
matrix2x2 a2 = new matrix2x2(matrix1.row1.Point2, matrix1.row2.Point2);
matrix2x2 b11 = new matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
matrix2x2 b12 = new matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
matrix2x2 b21 = new matrix2x2(matrix2.row3.Point1, matrix2.row4.Point1);
matrix2x2 b22 = new matrix2x2(matrix2.row3.Point2, matrix2.row4.Point2);
var c1 = a1.multiple(b11) + a2.multiple(b21);
var c2 = a1.multiple(b12) + a2.multiple(b22);
return new matrix2x4(
new vec4d(c1.row1, c2.row1),
new vec4d(c1.row1, c2.row1),
new vec4d(c1.row2, c2.row2));
}
@@ -533,9 +528,9 @@ namespace StgSharp.Math
float* p3 = &m11.row1.X;
return new matrix3x3(
*(p3 + 0), *(p3 + 1),m12.X,
*(p3 + 2), *(p3 + 3),m12.Y,
m21.X, m21.Y, m22
*(p3 + 0), *(p3 + 1), m12.X,
*(p3 + 2), *(p3 + 3), m12.Y,
m21.X, m21.Y, m22
);
}
@@ -547,7 +542,7 @@ namespace StgSharp.Math
/// <returns></returns>
public static unsafe matrix3x4 multiple(this matrix3x2 matrix1, matrix2x4 matrix2)
{
var a1 = new matrix2x2(matrix1.row1,matrix1.row2);
var a1 = new matrix2x2(matrix1.row1, matrix1.row2);
var a2 = matrix1.row3;
var b1 = new matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
@@ -589,13 +584,13 @@ namespace StgSharp.Math
var a21 = new vec2d(*(p1 + 6), *(p1 + 7));
var a22 = *(p1 + 8);
var b1 = new matrix2x2(matrix2.row1,matrix2.row2);
var b1 = new matrix2x2(matrix2.row1, matrix2.row2);
var b2 = matrix2.row3;
var c1 = a11.multiple(b1) + a12.multiple(b2);
var c2 = a21.multiple(b1) + b2 * a22;
return new matrix3x2(c1.row1,c1.row2,c2);
return new matrix3x2(c1.row1, c1.row2, c2);
}
/// <summary>
@@ -655,9 +650,9 @@ namespace StgSharp.Math
return new matrix3x4(
new vec4d(c11.row1,c12.row1),
new vec4d(c11.row2,c12.row2),
new vec4d(c21,c22)
new vec4d(c11.row1, c12.row1),
new vec4d(c11.row2, c12.row2),
new vec4d(c21, c22)
);
}
@@ -693,7 +688,7 @@ namespace StgSharp.Math
var c1 = a11.multiple(b1) + a12.multiple(b2);
var c2 = a21.multiple(b1) + a22.multiple(b2);
return new matrix3x2(c1.row1,c1.row2,c2);
return new matrix3x2(c1.row1, c1.row2, c2);
}
/// <summary>
@@ -750,8 +745,8 @@ namespace StgSharp.Math
float* p1 = &matrix1.row1.X;
float* p2 = &matrix2.row1.X;
var a11 = new matrix2x2(matrix1.row1.Point1,matrix1.row2.Point1);
var a12 = new matrix2x2(matrix1.row1.Point2,matrix1.row2.Point2);
var a11 = new matrix2x2(matrix1.row1.Point1, matrix1.row2.Point1);
var a12 = new matrix2x2(matrix1.row1.Point2, matrix1.row2.Point2);
var a21 = matrix1.row3.Point1;
var a22 = matrix1.row3.Point2;
@@ -766,10 +761,10 @@ namespace StgSharp.Math
var c4 = a21.multiple(b12) + a22.multiple(b22);
return new matrix3x4(
new vec4d(c1.row1,c2.row1),
new vec4d(c1.row2,c2.row2),
new vec4d(c3,c4)
) ;
new vec4d(c1.row1, c2.row1),
new vec4d(c1.row2, c2.row2),
new vec4d(c3, c4)
);
}
@@ -813,10 +808,10 @@ namespace StgSharp.Math
var u7 = u3 + m5;
return new matrix4x2(
new vec2d(u1.X,u5.X),
new vec2d(u1.Y,u5.Y),
new vec2d(u6.X,u7.X),
new vec2d(u6.Y,u7.Y)
new vec2d(u1.X, u5.X),
new vec2d(u1.Y, u5.Y),
new vec2d(u6.X, u7.X),
new vec2d(u6.Y, u7.Y)
);
}
@@ -839,10 +834,10 @@ namespace StgSharp.Math
float* pc2 = &c21.row1.X;
return new matrix4x3(
*(pc1 + 0), *(pc1 + 1),c12.X,
*(pc1 + 2), *(pc1 + 3),c12.Y,
*(pc2 + 0), *(pc2 + 1),c22.X,
*(pc2 + 2), *(pc2 + 3),c22.Y
*(pc1 + 0), *(pc1 + 1), c12.X,
*(pc1 + 2), *(pc1 + 3), c12.Y,
*(pc2 + 0), *(pc2 + 1), c22.X,
*(pc2 + 2), *(pc2 + 3), c22.Y
);
}
@@ -917,7 +912,7 @@ namespace StgSharp.Math
var c1 = a11.multiple(b1) + a12.multiple(b2);
var c2 = a21.multiple(b1) + a22.multiple(b2);
return new matrix4x2(c1.row1,c1.row2,c2.row1,c2.row2);
return new matrix4x2(c1.row1, c1.row2, c2.row1, c2.row2);
}
@@ -945,10 +940,10 @@ namespace StgSharp.Math
float* p4 = &c21.row1.X;
return new matrix4x3(
*(p3 + 0), *(p3 + 1),c12.X,
*(p3 + 2), *(p3 + 3),c12.Y,
*(p4 + 0), *(p4 + 1),c22.X,
*(p4 + 2), *(p4 + 3),c22.Y
*(p3 + 0), *(p3 + 1), c12.X,
*(p3 + 2), *(p3 + 3), c12.Y,
*(p4 + 0), *(p4 + 1), c22.X,
*(p4 + 2), *(p4 + 3), c22.Y
);
}
@@ -962,7 +957,7 @@ namespace StgSharp.Math
var a21 = new matrix2x2(*(p1 + 6), *(p1 + 7), *(p1 + 9), *(p1 + 10));
var a22 = new colum2(*(p1 + 8), *(p1 + 11));
var b11 = new matrix2x2 (*(p2 + 0), *(p2 + 1), *(p2 + 4), *(p2 + 5));
var b11 = new matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 4), *(p2 + 5));
var b12 = new matrix2x2(*(p2 + 2), *(p2 + 3), *(p2 + 6), *(p2 + 7));
var b21 = matrix2.row3.Point1;
var b22 = matrix2.row3.Point2;
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Math
namespace StgSharp.Math
{
public static unsafe partial class Vector
{
@@ -12,14 +7,14 @@ namespace StgSharp.Math
return new vec3d(vec.X, vec.Y, 0.0f);
}
public static vec4d To4D(this vec2d Vec)
public static vec4d To4D(this vec2d Vec)
{
return new vec4d(Vec.X, Vec.Y, 0, 0);
return new vec4d(Vec.X, Vec.Y, 0, 0);
}
public static vec4d To4D(this vec3d vec)
public static vec4d To4D(this vec3d vec)
{
return new vec4d(vec.X, vec.Y, vec.Z, 0);
return new vec4d(vec.X, vec.Y, vec.Z, 0);
}
public static vec2d To2D(vec3d vec, CordinatePlain plain)
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Math
namespace StgSharp.Math
{
public static unsafe partial class Vector
{
+7 -9
View File
@@ -1,22 +1,20 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct colum2:IEquatable<colum2>
public struct colum2 : IEquatable<colum2>
{
[FieldOffset(0)]
public float X;
[FieldOffset(4)]
public float Y;
public colum2(float x,float y)
public colum2(float x, float y)
{
X= x;
Y= y;
X = x;
Y = y;
}
public override bool Equals(object obj)
@@ -49,7 +47,7 @@ namespace StgSharp.Math
public override int GetHashCode()
{
return HashCode.Combine(X,Y);
return HashCode.Combine(X, Y);
}
public override string ToString()
@@ -57,7 +55,7 @@ namespace StgSharp.Math
return $"{X}\n{Y}";
}
public static colum2 operator +(colum2 c1,colum2 c2)
public static colum2 operator +(colum2 c1, colum2 c2)
{
return new colum2(
c1.X + c2.X,
@@ -75,7 +73,7 @@ namespace StgSharp.Math
public static colum2 operator *(colum2 colum, float x)
{
return new colum2(colum.X * x,colum.Y * x);
return new colum2(colum.X * x, colum.Y * x);
}
public static colum2 operator /(colum2 colum, float x)
-2
View File
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
+1 -4
View File
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct colum4:IEquatable<colum4>
public struct colum4 : IEquatable<colum4>
{
[FieldOffset(0)]
public float X;
+6 -9
View File
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x2:IEquatable<matrix2x2>
public struct matrix2x2 : IEquatable<matrix2x2>
{
[FieldOffset(0)]
public vec2d row1;
@@ -64,7 +61,7 @@ namespace StgSharp.Math
public override int GetHashCode()
{
return HashCode.Combine(row1,row2);
return HashCode.Combine(row1, row2);
}
public override string ToString()
@@ -72,7 +69,7 @@ namespace StgSharp.Math
return $"{row1}\n{row2}";
}
public static matrix2x2 operator +(matrix2x2 matrix1 , matrix2x2 matrix2)
public static matrix2x2 operator +(matrix2x2 matrix1, matrix2x2 matrix2)
{
return new matrix2x2(
matrix1.row1 + matrix2.row1,
@@ -88,9 +85,9 @@ namespace StgSharp.Math
);
}
}
}
+4 -7
View File
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x3:IEquatable<matrix2x3>
public struct matrix2x3 : IEquatable<matrix2x3>
{
[FieldOffset(0)]
public vec3d row1;
@@ -63,7 +60,7 @@ namespace StgSharp.Math
}
else
{
return
return
this.row1 == other.row1
&& this.row2 == other.row2;
}
@@ -90,7 +87,7 @@ namespace StgSharp.Math
return new matrix2x3(
array.row1 * x,
array.row2 * x
) ;
);
}
public static matrix2x3 operator /(matrix2x3 array, float x)
@@ -101,7 +98,7 @@ namespace StgSharp.Math
);
}
}
}
+6 -8
View File
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
@@ -14,7 +12,7 @@ namespace StgSharp.Math
[FieldOffset(16)]
public vec4d row2;
public matrix2x4( vec4d r1, vec4d r2)
public matrix2x4(vec4d r1, vec4d r2)
{
row1 = r1;
row2 = r2;
@@ -25,8 +23,8 @@ namespace StgSharp.Math
float a21, float a22, float a23, float a24
)
{
row1 = new vec4d(a11,a12,a13,a14);
row2 = new vec4d(a21,a22,a23,a24);
row1 = new vec4d(a11, a12, a13, a14);
row2 = new vec4d(a21, a22, a23, a24);
}
public bool Equals(matrix2x4 other)
@@ -68,12 +66,12 @@ namespace StgSharp.Math
return $"{this.row1}\n{this.row2}";
}
public static matrix2x4 operator +(matrix2x4 matrix1 ,matrix2x4 matrix2)
public static matrix2x4 operator +(matrix2x4 matrix1, matrix2x4 matrix2)
{
return new matrix2x4(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
) ;
);
}
public static matrix2x4 operator -(matrix2x4 matrix1, matrix2x4 matrix2)
@@ -100,6 +98,6 @@ namespace StgSharp.Math
);
}
}
}
+5 -7
View File
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x2:IEquatable<matrix3x2>
public struct matrix3x2 : IEquatable<matrix3x2>
{
[FieldOffset(0)]
public vec2d row1;
@@ -15,11 +13,11 @@ namespace StgSharp.Math
[FieldOffset(16)]
public vec2d row3;
public matrix3x2(vec2d r1,vec2d r2,vec2d r3)
public matrix3x2(vec2d r1, vec2d r2, vec2d r3)
{
row1= r1;
row2= r2;
row3= r3;
row1 = r1;
row2 = r2;
row3 = r3;
}
public matrix3x2(
+19 -22
View File
@@ -1,13 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x3:IEquatable<matrix3x3>
public struct matrix3x3 : IEquatable<matrix3x3>
{
[FieldOffset(0)]
public vec3d row1;
@@ -16,7 +13,7 @@ namespace StgSharp.Math
[FieldOffset(24)]
public vec3d row3;
public matrix3x3(vec3d r0,vec3d r1,vec3d r2)
public matrix3x3(vec3d r0, vec3d r1, vec3d r2)
{
row1 = r0;
row2 = r1;
@@ -24,9 +21,9 @@ namespace StgSharp.Math
}
public matrix3x3(
float a11,float a12,float a13,
float a21,float a22,float a23,
float a31,float a32,float a33
float a11, float a12, float a13,
float a21, float a22, float a23,
float a31, float a32, float a33
)
{
row1 = new vec3d(a11, a12, a13);
@@ -36,12 +33,12 @@ namespace StgSharp.Math
public override int GetHashCode()
{
return HashCode.Combine(row1,row2,row3);
return HashCode.Combine(row1, row2, row3);
}
bool IEquatable<matrix3x3>.Equals(matrix3x3 other)
{
if (this.GetHashCode()!=other.GetHashCode())
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
@@ -75,7 +72,7 @@ namespace StgSharp.Math
return $"{row1}\n{row2}\n{row3}";
}
public static bool operator ==(matrix3x3 matrix1, matrix3x3 matrix2)
{
@@ -90,16 +87,16 @@ namespace StgSharp.Math
public static matrix3x3 operator +(matrix3x3 matrix1, matrix3x3 matrix2)
{
return new matrix3x3(
matrix1.row1.X + matrix2.row1.X,
matrix1.row1.Y + matrix2.row1.Y,
matrix1.row1.X + matrix2.row1.X,
matrix1.row1.Y + matrix2.row1.Y,
matrix1.row1.Z + matrix2.row1.Z,
matrix1.row2.X + matrix2.row2.X,
matrix1.row2.Y + matrix2.row2.Y,
matrix1.row2.X + matrix2.row2.X,
matrix1.row2.Y + matrix2.row2.Y,
matrix1.row2.Z + matrix2.row2.Z,
matrix1.row3.X + matrix2.row3.X,
matrix1.row3.Y + matrix2.row3.Y,
matrix1.row3.X + matrix2.row3.X,
matrix1.row3.Y + matrix2.row3.Y,
matrix1.row3.Z + matrix2.row3.Z
);
}
@@ -121,7 +118,7 @@ namespace StgSharp.Math
);
}
public static matrix3x3 operator *(matrix3x3 array, float x)
{
@@ -129,15 +126,15 @@ namespace StgSharp.Math
array.row1 * x,
array.row2 * x,
array.row3 * x
);
);
}
public static matrix3x3 operator /(matrix3x3 array, float x)
{
return new matrix3x3(
array.row1/x,
array.row2/x,
array.row3/x
array.row1 / x,
array.row2 / x,
array.row3 / x
);
}
}
+8 -12
View File
@@ -1,14 +1,10 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x4:IEquatable<matrix3x4>
public struct matrix3x4 : IEquatable<matrix3x4>
{
[FieldOffset(0)]
public vec4d row1;
@@ -18,7 +14,7 @@ namespace StgSharp.Math
public vec4d row3;
public matrix3x4(
vec4d r1,vec4d r2,vec4d r3
vec4d r1, vec4d r2, vec4d r3
)
{
this.row1 = r1;
@@ -32,9 +28,9 @@ namespace StgSharp.Math
float a31, float a32, float a33, float a34
)
{
row1 = new vec4d(a11,a12,a13,a14);
row2 = new vec4d(a21,a22,a23,a24);
row3 = new vec4d(a31,a32,a33,a34);
row1 = new vec4d(a11, a12, a13, a14);
row2 = new vec4d(a21, a22, a23, a24);
row3 = new vec4d(a31, a32, a33, a34);
}
public override bool Equals(object obj)
@@ -69,7 +65,7 @@ namespace StgSharp.Math
public override int GetHashCode()
{
return HashCode.Combine(this.row1,this.row2,this.row3);
return HashCode.Combine(this.row1, this.row2, this.row3);
}
public override string ToString()
@@ -77,7 +73,7 @@ namespace StgSharp.Math
return $"{this.row1}\n{this.row2}\n{this.row3}";
}
}
}
+2 -4
View File
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x2:IEquatable<matrix4x2>
public struct matrix4x2 : IEquatable<matrix4x2>
{
[FieldOffset(0)]
public vec2d row1;
@@ -79,6 +77,6 @@ namespace StgSharp.Math
}
}
}
}
+3 -5
View File
@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x3:IEquatable<matrix4x3>
public struct matrix4x3 : IEquatable<matrix4x3>
{
[FieldOffset(0)]
public vec3d row1;
@@ -41,7 +39,7 @@ namespace StgSharp.Math
{
return false;
}
else
else
{
return this.Equals((matrix4x3)obj);
}
@@ -72,6 +70,6 @@ namespace StgSharp.Math
return base.ToString();
}
}
}
+5 -7
View File
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x4:IEquatable<matrix4x4>
public struct matrix4x4 : IEquatable<matrix4x4>
{
[FieldOffset(0)]
public vec4d row1;
@@ -17,7 +15,7 @@ namespace StgSharp.Math
[FieldOffset(48)]
public vec4d row4;
public matrix4x4( vec4d r1,vec4d r2,vec4d r3,vec4d r4)
public matrix4x4(vec4d r1, vec4d r2, vec4d r3, vec4d r4)
{
row1 = r1;
row2 = r2;
@@ -98,10 +96,10 @@ namespace StgSharp.Math
);
}
}
}
+6 -10
View File
@@ -1,22 +1,18 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct vec2d:IEquatable<vec2d>
public struct vec2d : IEquatable<vec2d>
{
[FieldOffset(0)]
public float X;
[FieldOffset(sizeof(float))]
public float Y;
public vec2d(float x,float y)
public vec2d(float x, float y)
{
X = x;
Y = y;
@@ -62,7 +58,7 @@ namespace StgSharp.Math
public static bool operator ==(vec2d vec1, vec2d vec2)
{
return vec1.X==vec2.X && vec1.Y==vec2.Y;
return vec1.X == vec2.X && vec1.Y == vec2.Y;
}
public static bool operator !=(vec2d vec1, vec2d vec2)
@@ -87,13 +83,13 @@ namespace StgSharp.Math
public static vec2d operator /(vec2d vec, float x)
{
return new vec2d(vec.X/x, vec.Y/x);
return new vec2d(vec.X / x, vec.Y / x);
}
public static implicit operator float[](vec2d vec)
{
return new float[2] {vec.X,vec.Y };
return new float[2] { vec.X, vec.Y };
}
}
}

Some files were not shown because too many files have changed in this diff Show More