daily update on 20230415 by nitload youmu

This commit is contained in:
Nitload
2023-04-15 04:03:14 +08:00
parent 0995a1c501
commit a305aab094
84 changed files with 357 additions and 139 deletions
@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public static unsafe class GeometryCalc
{
}
}
@@ -6,6 +6,10 @@ using System.Text;
namespace StgSharp.Geometries
{
public delegate vec2d GetLocationHandler(vec2d vec, Counter<uint> tickCounter);
/// <summary>
/// 计算位移失量,需要手动输入游戏刻以提供时间数据
/// </summary>
/// <param name="tickCounter"></param>
/// <returns>表示位移量的三维矢量</returns>
public delegate vec3d GetLocationHandler(Counter<uint> tickCounter);
}
+3 -2
View File
@@ -1,5 +1,4 @@
using StgSharp;
using StgSharp.Math;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
@@ -26,6 +25,8 @@ namespace StgSharp.Geometries
bornTick = MainTimer.Value;
}
public IGeometry() { }
internal abstract void CalcVec01(uint tick);
internal abstract void CalcVec02(vec3d vec, uint tick);
internal abstract void CalcVec03(vec3d vec, uint tick);
+20 -7
View File
@@ -1,5 +1,6 @@
using Steamworks;
using StgSharp;
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
@@ -9,11 +10,11 @@ namespace StgSharp.Geometries
{
public class Line:IGeometry
{
internal Point _basePoint;
internal Point _beginPoint;
internal Point _endPoint;
internal GetLocationHandler _beginPointMov;
internal GetLocationHandler _endPointMov;
internal Point _basePoint = default ;
internal Point _beginPoint = default ;
internal Point _endPoint = default;
internal GetLocationHandler movBegin;
internal GetLocationHandler movEnd;
internal RenderMode _renderMode;
internal readonly uint bornTick;
@@ -35,6 +36,14 @@ namespace StgSharp.Geometries
bornTick = tickCounter._value;
}
public Line(Point begin, Point end)
{
this._beginPoint = begin;
this._endPoint = end;
}
public Line() { }
public override float SetArrayX()
{
throw new NotImplementedException();
@@ -60,9 +69,13 @@ namespace StgSharp.Geometries
throw new ArgumentException("Lines do not need the third parameter to define!");
}
public virtual vec3d MoveBeginPoint(uint tick) => default;
//计算线起点的方法,通过对线的派生的重写实现功能
public virtual vec3d MoveBeginPoint(uint tick)
=> movBegin.Invoke( GameTimeLine.tickCounter);
public virtual vec3d MoveEndPoint(uint tick) => default;
//计算线重点的方法,通过对线的派生的重写实现功能
public virtual vec3d MoveEndPoint(uint tick)
=> movEnd.Invoke( GameTimeLine.tickCounter);
internal override void OnRender(uint tick)
{
+57 -8
View File
@@ -1,4 +1,5 @@
using StgSharp.Math;
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
@@ -9,17 +10,17 @@ namespace StgSharp.Geometries
{
internal Point _basePoint;
internal Point _center;
internal Point _centerToCorner1;
internal Point _centerToCorner2;
internal Point _corner1;
internal Point _corner2;
internal RenderMode _renderMode;
internal readonly uint bornTick;
public override sealed Point BasePoint => _basePoint;
public override sealed Point RefPoint => _center;
public override sealed Point RefVec01 => _centerToCorner1;
public override sealed Point RefVec01 => _corner1;
public override sealed Point RefVec02 => _centerToCorner2;
public override sealed Point RefVec02 => _corner2;
public override RenderMode renderMode => _renderMode;
@@ -62,19 +63,22 @@ namespace StgSharp.Geometries
throw new NotImplementedException();
}
//计算参考中心点的位移
internal override void CalcVec01(uint tick)
{
_center._position = _basePoint._position + MovCenter(tick);
}
//计算第一个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
internal override void CalcVec02(vec3d vec, uint tick)
{
_centerToCorner1._position = vec + UpdateCTC1(tick);
_corner1._position = vec + UpdateCTC1(tick);
}
//计算第二个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
internal override void CalcVec03(vec3d vec, uint tick)
{
_centerToCorner2._position = vec + UpdateCTC2(tick);
_corner2._position = vec + UpdateCTC2(tick);
}
public virtual vec3d MovCenter(uint tick) => default(vec3d);
@@ -85,7 +89,52 @@ namespace StgSharp.Geometries
public override Line[] GetAllSides()
{
throw new NotImplementedException();
Line[] lines = new Line[4]
{
new Line(GameTimeLine.tickCounter),
new Line(GameTimeLine.tickCounter),
new Line(GameTimeLine.tickCounter),
new Line(GameTimeLine.tickCounter),
};
lines[0]._basePoint = this._corner1;
lines[0]._beginPoint = this._corner1;
lines[0]._endPoint = this._corner2;
lines[1]._basePoint = this._corner2;
lines[1]._beginPoint = this._corner2;
lines[1]._endPoint = new Point() { _position = getCorner3(GameTimeLine.tickCounter)};
lines[1].movEnd += this.getCorner3;
lines[2]._basePoint = lines[1]._endPoint;
lines[2]._beginPoint = lines[2]._basePoint;
lines[2]._endPoint = new Point() { _position = this.getCorner4(GameTimeLine.tickCounter) };
lines[2].movEnd+= this.getCorner4;
lines[3]._beginPoint = lines[2]._endPoint;
lines[3]._endPoint = this._corner1;
return lines;
}
protected vec3d getCorner1(Counter<uint> tick)
{
return this._corner1._position;
}
protected vec3d getCorner2(Counter<uint> tick)
{
return this._corner2._position;
}
protected vec3d getCorner3(Counter<uint> tick)
{
return 2 * this._center._position - this._corner1._position;
}
protected vec3d getCorner4(Counter<uint> tick)
{
return 2 * this._center._position - this._corner2._position;
}
}
}
+6
View File
@@ -26,5 +26,11 @@ namespace StgSharp.Geometries
public void Update() => new NotImplementedException();
public static void CoordsAdd(Point p1, Point p2)
{
}
}
}
+9
View File
@@ -112,6 +112,15 @@ namespace StgSharp.Math
);
}
public static vec3d operator *( float x, vec3d vec)
{
return new vec3d(
vec.X * x,
vec.Y * x,
vec.Z * x
);
}
public static vec3d operator /(vec3d vec, float x)
{
return new vec3d(
@@ -1 +1 @@
96b7e2fc11bda4a0584ab313be1a6838a308d265
314715e00ade86f2a7cd4e4d57040d6f16689d86