daily update on 20230927 by nitload youmu, all polygon4 display available, optimizing on C/C# interoperation

This commit is contained in:
Nitload
2023-09-28 01:43:27 +08:00
parent 5d701bce0c
commit 6c3349f5a2
130 changed files with 3280 additions and 25074 deletions
@@ -5,27 +5,37 @@ namespace StgSharp.Geometries
{
public class Polygon4 : IPlainGeometry
{
internal Matrix3x4 vertexMat;
internal readonly Point vertex01;
internal readonly Point vertex02;
internal readonly Point vertex03;
internal readonly Point vertex04;
internal Point vertex0 { get; set; }
internal Point vertex1 { get; set; }
internal Point vertex2 { get; set; }
internal Point vertex3 { get; set; }
internal readonly GetLocationHandler movVertex01Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal readonly GetLocationHandler movVertex02Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal readonly GetLocationHandler movVertex03Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal readonly GetLocationHandler movVertex04Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
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);
public override Point RefPoint01 => vertex01;
public override Point RefPoint0
{
get { return new Point(vertexMat.transpose.colum0); }
}
public override Point RefPoint02 => vertex02;
public override Point RefPoint1
{
get { return new Point(vertexMat.transpose.colum1); }
}
public override Point RefPoint03 => vertex03;
public override Point RefPoint2
{
get { return new Point(vertexMat.transpose.colum2); }
}
public GetLocationHandler MovVertex01Operaion { get { return movVertex01Operation; } }
public GetLocationHandler MovVertex02Operaion { get { return movVertex02Operation; } }
public GetLocationHandler MovVertex03Operaion { get { return movVertex03Operation; } }
public GetLocationHandler MovVertex04Operaion { get { return movVertex04Operation; } }
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()
{
@@ -35,10 +45,10 @@ namespace StgSharp.Geometries
{
Line[] sides = new Line[4]
{
new Line(vertex01,vertex02),
new Line(vertex02, vertex03),
new Line(vertex03, vertex04),
new Line(vertex04, vertex01)
new Line(vertex0,vertex1),
new Line(vertex1, vertex2),
new Line(vertex2, vertex3),
new Line(vertex3, vertex0)
};
return sides;
@@ -46,26 +56,30 @@ namespace StgSharp.Geometries
public override Plain GetPlain()
{
return new Plain(this.RefPoint01, this.RefPoint02, this.RefPoint03);
vertexMat.InternalTranspose();
return new Plain(
vertexMat.mat.colum0,
vertexMat.mat.colum1,
vertexMat.mat.colum2);
}
public virtual Vec3d MovVertex01(uint tick) => movVertex01Operation.Invoke(tick);
public virtual Vec3d MoveVertex0(uint tick) => moveVertex0Operation.Invoke(tick);
public virtual Vec3d MovVertex02(uint tick) => movVertex01Operation.Invoke(tick);
public virtual Vec3d MoveVertex1(uint tick) => moveVertex1Operation.Invoke(tick);
public virtual Vec3d MovVertex03(uint tick) => movVertex01Operation.Invoke(tick);
public virtual Vec3d MoveVertex2(uint tick) => moveVertex2Operation.Invoke(tick);
public virtual Vec3d MovVertex04(uint tick) => movVertex01Operation.Invoke(tick);
public virtual Vec3d MoveVertex3(uint tick) => moveVertex3Operation.Invoke(tick);
internal override void OnRender(uint tick)
{
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);
this.vertex04.Position = RefOrigin.Position + movVertex04Operation(nowTick);
this.vertexMat.Colum0 = RefOrigin.position + moveVertex1Operation(nowTick);
this.vertexMat.Colum1 = RefOrigin.position + moveVertex1Operation(nowTick);
this.vertexMat.Colum2 = RefOrigin.position + moveVertex2Operation(nowTick);
this.vertexMat.Colum3 = RefOrigin.position + moveVertex3Operation(nowTick);
}
}
}