daily update on 20240508 by nitload youmu, partical added

This commit is contained in:
YoumuLiu
2024-05-09 04:14:36 +08:00
parent fc19ab3298
commit 56459deec5
58 changed files with 1507 additions and 431 deletions
@@ -31,6 +31,7 @@
using StgSharp.Controlling;
using StgSharp.Math;
using System;
using System.Numerics;
namespace StgSharp.Geometries
@@ -38,12 +39,12 @@ namespace StgSharp.Geometries
public class Polygon4 : PlainGeometry
{
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 readonly Func<int,vec3d> moveVertex0Operation = GeometryOperation.DefaultMotion;
internal readonly Func<int,vec3d> moveVertex1Operation = GeometryOperation.DefaultMotion;
internal readonly Func<int,vec3d> moveVertex2Operation = GeometryOperation.DefaultMotion;
internal readonly Func<int,vec3d> moveVertex3Operation = GeometryOperation.DefaultMotion;
internal Matrix24 vertexMat;
internal Mat4 vertexMat;
internal Polygon4()
{
@@ -53,31 +54,25 @@ namespace StgSharp.Geometries
vec2d topLeft,
vec2d topRight,
vec2d bottomRight,
vec2d bottomLeft,
bool Orth
vec2d bottomLeft
)
{
this.coordinate = coordinate;
vertexMat.Colum0 = topLeft;
vertexMat.Colum1 = topRight;
vertexMat.Colum2 = bottomRight;
vertexMat.Colum3 = bottomLeft;
vertexMat.colum0 = topLeft.vec;
vertexMat.colum1 = topRight.vec;
vertexMat.colum2 = bottomRight.vec;
vertexMat.colum3 = bottomLeft.vec;
Vector4 maxCoord = vertexMat.mat.colum0;
Vector4 minCoord = vertexMat.mat.colum0;
Vector4 maxCoord = vertexMat.colum0;
Vector4 minCoord = vertexMat.colum0;
maxCoord = Vector4.Max(maxCoord, vertexMat.mat.colum1);
maxCoord = Vector4.Max(maxCoord, vertexMat.mat.colum2);
maxCoord = Vector4.Max(maxCoord, vertexMat.mat.colum3);
maxCoord = Vector4.Max(maxCoord, vertexMat.colum1);
maxCoord = Vector4.Max(maxCoord, vertexMat.colum2);
maxCoord = Vector4.Max(maxCoord, vertexMat.colum3);
minCoord = Vector4.Min(minCoord, vertexMat.mat.colum1);
minCoord = Vector4.Min(minCoord, vertexMat.mat.colum2);
minCoord = Vector4.Min(minCoord, vertexMat.mat.colum3);
textureFrame.mat.colum1 = maxCoord;
textureFrame.mat.colum3 = minCoord;
textureFrame.Colum0 = new vec2d(minCoord.X, maxCoord.Y);
textureFrame.Colum2 = new vec2d(maxCoord.X, minCoord.Y);
minCoord = Vector4.Min(minCoord, vertexMat.colum1);
minCoord = Vector4.Min(minCoord, vertexMat.colum2);
minCoord = Vector4.Min(minCoord, vertexMat.colum3);
}
public Polygon4(
@@ -87,36 +82,36 @@ namespace StgSharp.Geometries
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);
vertexMat.colum0 = new Vector4(v0x, v0y, v0z, 0);
vertexMat.colum1 = new Vector4(v1x, v1y, v1z, 0);
vertexMat.colum2 = new Vector4(v2x, v2y, v2z, 0);
vertexMat.colum3 = new Vector4(v3x, v3y, v3z, 0);
}
public GetLocationHandler MovVertex0Operation => moveVertex0Operation;
public GetLocationHandler MovVertex1Operation => moveVertex1Operation;
public GetLocationHandler MovVertex2Operation => moveVertex2Operation;
public GetLocationHandler MovVertex3Operation => moveVertex3Operation;
public Func<int,vec3d> MovVertex0Operation => moveVertex0Operation;
public Func<int,vec3d> MovVertex1Operation => moveVertex1Operation;
public Func<int,vec3d> MovVertex2Operation => moveVertex2Operation;
public Func<int,vec3d> MovVertex3Operation => moveVertex3Operation;
public Point Vertex0
{
get => new Point(vertexMat.mat.colum0);
set => vertexMat.mat.colum0 = value.position.vec;
get => new Point(vertexMat.colum0);
set => vertexMat.colum0 = value.position.vec;
}
public Point Vertex1
{
get => new Point(vertexMat.mat.colum1);
set => vertexMat.mat.colum1 = value.position.vec;
get => new Point(vertexMat.colum1);
set => vertexMat.colum1 = value.position.vec;
}
public Point Vertex2
{
get => new Point(vertexMat.mat.colum2);
set => vertexMat.mat.colum1 = value.position.vec;
get => new Point(vertexMat.colum2);
set => vertexMat.colum1 = value.position.vec;
}
public Mat4 VertexBuffer => vertexMat.mat;
public Mat4 VertexBuffer => vertexMat;
@@ -124,31 +119,30 @@ namespace StgSharp.Geometries
internal Point Vertex3
{
get => new Point(vertexMat.mat.colum3);
set => vertexMat.mat.colum1 = value.position.vec;
get => new Point(vertexMat.colum3);
set => vertexMat.colum1 = value.position.vec;
}
public override Line[] GetAllSides()
{
Line[] sides = new Line[4]
{
Line[] sides =
[
new Line(Vertex0, Vertex1),
new Line(Vertex1, Vertex2),
new Line(Vertex2, Vertex3),
new Line(Vertex3, Vertex0)
};
];
return sides;
}
public override Plain GetPlain()
{
vertexMat.InternalTranspose();
return new Plain(
vertexMat.mat.colum0,
vertexMat.mat.colum1,
vertexMat.mat.colum2);
vertexMat.colum0,
vertexMat.colum1,
vertexMat.colum2);
}
public virtual vec3d MoveVertex0(int tick)
@@ -171,8 +165,6 @@ namespace StgSharp.Geometries
return moveVertex3Operation(tick);
}
internal override void UpdateCoordinate(int tick)
{
}