daily update on 20231016 by nitload youmu, vao,vbo,ebo struct added
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user