rename ungenericed graphic vec usage to genericed
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -32,19 +32,19 @@ namespace Nitload.Geometries
|
|||||||
internal set => coordMat.column[3].XYZ = value.Coord;
|
internal set => coordMat.column[3].XYZ = value.Coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Vec3 LocalX
|
public virtual Vec3<float> LocalX
|
||||||
{
|
{
|
||||||
get => coordMat.column[3].XYZ;
|
get => coordMat.column[3].XYZ;
|
||||||
internal set => coordMat.column[3].XYZ = value;
|
internal set => coordMat.column[3].XYZ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Vec3 LocalY
|
public virtual Vec3<float> LocalY
|
||||||
{
|
{
|
||||||
get => coordMat.column[3].XYZ;
|
get => coordMat.column[3].XYZ;
|
||||||
internal set => coordMat.column[3].XYZ = value;
|
internal set => coordMat.column[3].XYZ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Vec3 LocalZ
|
public virtual Vec3<float> LocalZ
|
||||||
{
|
{
|
||||||
get => coordMat.column[3].XYZ;
|
get => coordMat.column[3].XYZ;
|
||||||
set => coordMat.column[3].XYZ = value;
|
set => coordMat.column[3].XYZ = value;
|
||||||
|
|||||||
@@ -21,24 +21,24 @@ namespace Nitload.Geometries
|
|||||||
public PlainCoordinate(
|
public PlainCoordinate(
|
||||||
CoordinationBase local,
|
CoordinationBase local,
|
||||||
Point origin,
|
Point origin,
|
||||||
Vec3 xAxis,
|
Vec3<float> xAxis,
|
||||||
Vec3 yAxis
|
Vec3<float> yAxis
|
||||||
)
|
)
|
||||||
: base(local)
|
: base(local)
|
||||||
{
|
{
|
||||||
CoordMat = GraphicsMatrix.Unit;
|
CoordMat = GraphicsMatrix.Unit;
|
||||||
|
|
||||||
CoordMat.column[0] = new Vec4(xAxis, 0);
|
CoordMat.column[0] = new Vec4<float>(xAxis, 0);
|
||||||
CoordMat.column[1] = new Vec4(yAxis, 0);
|
CoordMat.column[1] = new Vec4<float>(yAxis, 0);
|
||||||
CoordMat.column[2] = new Vec4(Linear.Normalize(Vec3.Cross(xAxis, yAxis)), 0);
|
CoordMat.column[2] = new Vec4<float>(Linear.Normalize(Vec3.Cross(xAxis, yAxis)), 0);
|
||||||
|
|
||||||
LocalOrigin = origin;
|
LocalOrigin = origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlainCoordinate StandardPlainCoordination { get; } = new(null,
|
public static PlainCoordinate StandardPlainCoordination { get; } = new(default,
|
||||||
new Point(0, 0, 0),
|
new Point(0, 0, 0),
|
||||||
new Vec3(1, 0, 0),
|
new Vec3<float>(1, 0, 0),
|
||||||
new Vec3(0, 1, 0));
|
new Vec3<float>(0, 1, 0));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ namespace Nitload.Geometries
|
|||||||
public SpaceCoordinate(
|
public SpaceCoordinate(
|
||||||
CoordinationBase localCoordination,
|
CoordinationBase localCoordination,
|
||||||
Point origin,
|
Point origin,
|
||||||
Vec3 xAxis,
|
Vec3<float> xAxis,
|
||||||
Vec3 yAxis,
|
Vec3<float> yAxis,
|
||||||
Vec3 zAxis
|
Vec3<float> zAxis
|
||||||
)
|
)
|
||||||
: base(localCoordination) { }
|
: base(localCoordination) { }
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Nitload.Geometries
|
|||||||
] { get; set; }
|
] { get; set; }
|
||||||
|
|
||||||
#pragma warning disable CA1819
|
#pragma warning disable CA1819
|
||||||
public Vec4[] VertexStream { get; }
|
public Vec3<float>[] VertexStream { get; }
|
||||||
#pragma warning restore CA1819
|
#pragma warning restore CA1819
|
||||||
|
|
||||||
public CoordinationBase Coordination { get; }
|
public CoordinationBase Coordination { get; }
|
||||||
|
|||||||
@@ -41,8 +41,13 @@ namespace Nitload.Geometries
|
|||||||
|
|
||||||
public Vec3<float> CenterPositionGlobal { get; internal set; }
|
public Vec3<float> CenterPositionGlobal { get; internal set; }
|
||||||
|
|
||||||
public Vec3<float> Coord { get => GlobalBuffer.CoordAndRotationList[BufferId].XYZ; set => GlobalBuffer.CoordAndRotationList[BufferId] =
|
public Vec3<float> Coord//
|
||||||
new Vec4<float>(value.reg); }
|
{ get => GlobalBuffer.CoordAndRotationList[BufferId].XYZ;//
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Vec4<float> v = new(value, 0);
|
||||||
|
GlobalBuffer.CoordAndRotationList[BufferId] = v;
|
||||||
|
} }
|
||||||
|
|
||||||
public void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ namespace Nitload.Geometries
|
|||||||
{
|
{
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static Vec3 DefaultMotion(
|
public static Vec3<float> DefaultMotion(
|
||||||
int tick
|
int tick
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return default(Vec3);
|
return Vec3<float>.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Nitload.Geometries
|
|||||||
public interface IPlainEntity
|
public interface IPlainEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
public Vec2 CenterPosition { get; set; }
|
public Vec2<float> CenterPosition { get; set; }
|
||||||
|
|
||||||
public bool CollideWith(
|
public bool CollideWith(
|
||||||
IPlainEntity entity
|
IPlainEntity entity
|
||||||
@@ -45,7 +45,7 @@ namespace Nitload.Geometries
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2 IPlainEntity.CenterPosition
|
Vec2<float> IPlainEntity.CenterPosition
|
||||||
{
|
{
|
||||||
get => _shape.Coordination.LocalOrigin.Coord.XY;
|
get => _shape.Coordination.LocalOrigin.Coord.XY;
|
||||||
set => throw new InvalidOperationException();
|
set => throw new InvalidOperationException();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Nitload.Geometries
|
|||||||
|
|
||||||
public int BufferId { get; set; }
|
public int BufferId { get; set; }
|
||||||
|
|
||||||
Vec3 IInstancing.CenterPositionGlobal { get; set; }
|
Vec3<float> IInstancing.CenterPositionGlobal { get; set; }
|
||||||
|
|
||||||
bool IPlainEntity.CollideWith(
|
bool IPlainEntity.CollideWith(
|
||||||
IPlainEntity entity
|
IPlainEntity entity
|
||||||
@@ -48,7 +48,7 @@ namespace Nitload.Geometries
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2 IPlainEntity.CenterPosition
|
Vec2<float> IPlainEntity.CenterPosition
|
||||||
{
|
{
|
||||||
get => GlobalBuffer.CoordAndRotationList[BufferId].XY;
|
get => GlobalBuffer.CoordAndRotationList[BufferId].XY;
|
||||||
set => throw new NotImplementedException();
|
set => throw new NotImplementedException();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Nitload.Geometries
|
|||||||
public abstract class PlainGeometry : IGeometry
|
public abstract class PlainGeometry : IGeometry
|
||||||
{
|
{
|
||||||
|
|
||||||
protected Vec4[] vertexMat;
|
protected Vec3<float>[] vertexMat;
|
||||||
internal CoordinationBase coordinate;
|
internal CoordinationBase coordinate;
|
||||||
|
|
||||||
internal PlainGeometry(
|
internal PlainGeometry(
|
||||||
@@ -34,8 +34,8 @@ namespace Nitload.Geometries
|
|||||||
int index
|
int index
|
||||||
]
|
]
|
||||||
{
|
{
|
||||||
get => new Point(vertexMat[index]);
|
get => new(vertexMat[index]);
|
||||||
set => vertexMat[index].vec = value.coordVec;
|
set => vertexMat[index] = value.Coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int VertexCount => this.vertexMat.Length;
|
public int VertexCount => this.vertexMat.Length;
|
||||||
@@ -43,9 +43,9 @@ namespace Nitload.Geometries
|
|||||||
public abstract ReadOnlySpan<int> VertexIndices { get; }
|
public abstract ReadOnlySpan<int> VertexIndices { get; }
|
||||||
|
|
||||||
#pragma warning disable CA1819
|
#pragma warning disable CA1819
|
||||||
public Vec4[] VertexStream => vertexMat;
|
public Vec3<float>[] VertexStream => vertexMat;
|
||||||
|
|
||||||
public CoordinationBase Coordination => this.coordinate;
|
public CoordinationBase Coordination => this.coordinate;
|
||||||
#pragma warning restore CA1819
|
#pragma warning restore CA1819
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,28 +31,28 @@ namespace Nitload.Geometries
|
|||||||
private bool disposedValue;
|
private bool disposedValue;
|
||||||
|
|
||||||
private CoordinatePlain globalCoordinate;
|
private CoordinatePlain globalCoordinate;
|
||||||
private List<Vec4> coordList;
|
private List<Vec4<float>> coordList;
|
||||||
private List<IInstancing> instanceList;
|
private List<IInstancing> instanceList;
|
||||||
private List<float> scalingList;
|
private List<float> scalingList;
|
||||||
private Mutex mutex;
|
private Mutex mutex;
|
||||||
|
|
||||||
public PlainInstancingBuffer()
|
public PlainInstancingBuffer()
|
||||||
{
|
{
|
||||||
coordList = new List<Vec4>(capacity:100);
|
coordList = new List<Vec4<float>>(capacity:100);
|
||||||
instanceList = new List<IInstancing>(capacity:100);
|
instanceList = new List<IInstancing>(capacity:100);
|
||||||
scalingList = new List<float>(capacity:100);
|
scalingList = new List<float>(capacity:100);
|
||||||
coordArray = Array.Empty<Vec4>();
|
coordArray = Array.Empty<Vec4<float>>();
|
||||||
scaleArray = Array.Empty<float>();
|
scaleArray = Array.Empty<float>();
|
||||||
mutex = new Mutex();
|
mutex = new Mutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IInstancing> InstanceList => instanceList;
|
public List<IInstancing> InstanceList => instanceList;
|
||||||
|
|
||||||
public List<Vec4> CoordAndRotationList => coordList;
|
public List<Vec4<float>> CoordAndRotationList => coordList;
|
||||||
|
|
||||||
public List<float> ScalingList => scalingList;
|
public List<float> ScalingList => scalingList;
|
||||||
|
|
||||||
public Span<Vec4> CoordAndRotationSpan => CollectionsMarshal.AsSpan(coordList);
|
public Span<Vec4<float>> CoordAndRotationSpan => CollectionsMarshal.AsSpan(coordList);
|
||||||
|
|
||||||
public Span<float> ScalingSpan => CollectionsMarshal.AsSpan(scalingList);
|
public Span<float> ScalingSpan => CollectionsMarshal.AsSpan(scalingList);
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ namespace Nitload.Geometries
|
|||||||
{
|
{
|
||||||
mutex.WaitOne();
|
mutex.WaitOne();
|
||||||
int ret = instanceList.Count;
|
int ret = instanceList.Count;
|
||||||
coordList.Add(new Vec4());
|
coordList.Add(new Vec4<float>());
|
||||||
scalingList.Add(0);
|
scalingList.Add(0);
|
||||||
mutex.ReleaseMutex();
|
mutex.ReleaseMutex();
|
||||||
return ret;
|
return ret;
|
||||||
@@ -143,7 +143,7 @@ namespace Nitload.Geometries
|
|||||||
|
|
||||||
#region field of mem opt
|
#region field of mem opt
|
||||||
|
|
||||||
private Vec4[] coordArray;
|
private Vec4<float>[] coordArray;
|
||||||
private float[] scaleArray;
|
private float[] scaleArray;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Nitload.Geometries
|
|||||||
public class Parallelogram : Polygon4
|
public class Parallelogram : Polygon4
|
||||||
{
|
{
|
||||||
|
|
||||||
internal readonly Func<int, Vec3> movCenterOperation = GeometryOperation.DefaultMotion;
|
internal readonly Func<int, Vec3<float>> movCenterOperation = GeometryOperation.DefaultMotion;
|
||||||
|
|
||||||
internal Point center;
|
internal Point center;
|
||||||
|
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ namespace Nitload.Geometries
|
|||||||
{
|
{
|
||||||
|
|
||||||
internal readonly float d = -1;
|
internal readonly float d = -1;
|
||||||
internal Vec3 _origin;
|
internal Vec3<float> _origin;
|
||||||
|
|
||||||
internal Vec3 plainParameter;
|
internal Vec3<float> plainParameter;
|
||||||
internal Vec3 vec1;
|
internal Vec3<float> vec1;
|
||||||
internal Vec3 vec2;
|
internal Vec3<float> vec2;
|
||||||
|
|
||||||
public Plain(
|
public Plain(
|
||||||
Vec3 o,
|
Vec3<float> o,
|
||||||
Vec3 v1,
|
Vec3<float> v1,
|
||||||
Vec3 v2
|
Vec3<float> v2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this._origin = o;
|
this._origin = o;
|
||||||
@@ -50,9 +50,9 @@ namespace Nitload.Geometries
|
|||||||
Point p3
|
Point p3
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Vec3 origin = p1.Coord;
|
Vec3<float> origin = p1.Coord;
|
||||||
Vec3 v1 = p2.Coord - origin;
|
Vec3<float> v1 = p2.Coord - origin;
|
||||||
Vec3 v2 = p3.Coord - origin;
|
Vec3<float> v2 = p3.Coord - origin;
|
||||||
|
|
||||||
|
|
||||||
vec1 = v1 - (v2 * (v1.Y / v2.Y)); //xz
|
vec1 = v1 - (v2 * (v1.Y / v2.Y)); //xz
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ namespace Nitload.Geometries
|
|||||||
internal Polygon4()
|
internal Polygon4()
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[4];
|
vertexMat = new Vec3<float>[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Polygon4(
|
internal Polygon4(
|
||||||
Vec4[] rawCoord
|
Vec3<float>[] rawCoord
|
||||||
)
|
)
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
@@ -84,7 +84,7 @@ namespace Nitload.Geometries
|
|||||||
)
|
)
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[4];
|
vertexMat = new Vec3<float>[4];
|
||||||
|
|
||||||
this[0] = new Point(v0x, v0y, 0);
|
this[0] = new Point(v0x, v0y, 0);
|
||||||
this[1] = new Point(v1x, v1y, 0);
|
this[1] = new Point(v1x, v1y, 0);
|
||||||
@@ -105,7 +105,7 @@ namespace Nitload.Geometries
|
|||||||
)
|
)
|
||||||
: base(coordination)
|
: base(coordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[4];
|
vertexMat = new Vec3<float>[4];
|
||||||
|
|
||||||
this[0] = new Point(v0x, v0y, 0);
|
this[0] = new Point(v0x, v0y, 0);
|
||||||
this[1] = new Point(v1x, v1y, 0);
|
this[1] = new Point(v1x, v1y, 0);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Nitload.Geometries
|
|||||||
public unsafe Polygon5()
|
public unsafe Polygon5()
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[5];
|
vertexMat = new Vec3<float>[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Polygon5(
|
public Polygon5(
|
||||||
@@ -48,7 +48,7 @@ namespace Nitload.Geometries
|
|||||||
)
|
)
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[5];
|
vertexMat = new Vec3<float>[5];
|
||||||
this[0] = new Point(v0x, v0y, 0);
|
this[0] = new Point(v0x, v0y, 0);
|
||||||
this[1] = new Point(v1x, v1y, 0);
|
this[1] = new Point(v1x, v1y, 0);
|
||||||
this[2] = new Point(v2x, v2y, 0);
|
this[2] = new Point(v2x, v2y, 0);
|
||||||
@@ -71,7 +71,7 @@ namespace Nitload.Geometries
|
|||||||
)
|
)
|
||||||
: base(coordination)
|
: base(coordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[5];
|
vertexMat = new Vec3<float>[5];
|
||||||
this[0] = new Point(v0x, v0y, 0);
|
this[0] = new Point(v0x, v0y, 0);
|
||||||
this[1] = new Point(v1x, v1y, 0);
|
this[1] = new Point(v1x, v1y, 0);
|
||||||
this[2] = new Point(v2x, v2y, 0);
|
this[2] = new Point(v2x, v2y, 0);
|
||||||
|
|||||||
@@ -34,32 +34,32 @@ namespace Nitload.Geometries
|
|||||||
public Polygon6()
|
public Polygon6()
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[6];
|
vertexMat = new Vec3<float>[6];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Polygon6(
|
public Polygon6(
|
||||||
PlainCoordinate coordination,
|
PlainCoordinate coordination,
|
||||||
Vec2 vert0,
|
Vec2<float> vert0,
|
||||||
Vec2 vert1,
|
Vec2<float> vert1,
|
||||||
Vec2 vert2,
|
Vec2<float> vert2,
|
||||||
Vec2 vert3,
|
Vec2<float> vert3,
|
||||||
Vec2 vert4,
|
Vec2<float> vert4,
|
||||||
Vec2 vert5,
|
Vec2<float> vert5,
|
||||||
Vec2 vert6
|
Vec2<float> vert6
|
||||||
)
|
)
|
||||||
: base(coordination)
|
: base(coordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[6];
|
vertexMat = new Vec3<float>[6];
|
||||||
vertexMat[0].reg = vert0.reg;
|
vertexMat[0].XY = vert0;
|
||||||
vertexMat[1].reg = vert1.reg;
|
vertexMat[1].XY = vert1;
|
||||||
vertexMat[2].reg = vert2.reg;
|
vertexMat[2].XY = vert2;
|
||||||
vertexMat[3].reg = vert3.reg;
|
vertexMat[3].XY = vert3;
|
||||||
vertexMat[4].reg = vert4.reg;
|
vertexMat[4].XY = vert4;
|
||||||
vertexMat[5].reg = vert5.reg;
|
vertexMat[5].XY = vert5;
|
||||||
vertexMat[6].reg = vert6.reg;
|
vertexMat[6].XY = vert6;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ReadOnlySpan<int> VertexIndices => Indices;
|
public override ReadOnlySpan<int> VertexIndices => Indices;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ namespace Nitload.Geometries
|
|||||||
: base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
|
: base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Vec2 side0 = (this[0].Coord - this[1].Coord).XY;
|
Vec2<float> side0 = (this[0].Coord - this[1].Coord).XY;
|
||||||
Vec2 side1 = (this[2].Coord - this[1].Coord).XY;
|
Vec2<float> side1 = (this[2].Coord - this[1].Coord).XY;
|
||||||
if (side0.Cross(side1) == 0) {
|
if (side0.Cross(side1) == 0) {
|
||||||
throw new ArgumentException();
|
throw new ArgumentException();
|
||||||
}
|
}
|
||||||
@@ -51,8 +51,8 @@ namespace Nitload.Geometries
|
|||||||
: base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
|
: base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Vec2 side0 = (this[0].Coord - this[1].Coord).XY;
|
Vec2<float> side0 = (this[0].Coord - this[1].Coord).XY;
|
||||||
Vec2 side1 = (this[2].Coord - this[1].Coord).XY;
|
Vec2<float> side1 = (this[2].Coord - this[1].Coord).XY;
|
||||||
if (side0.Cross(side1) == 0) {
|
if (side0.Cross(side1) == 0) {
|
||||||
throw new ArgumentException();
|
throw new ArgumentException();
|
||||||
}
|
}
|
||||||
@@ -68,11 +68,11 @@ namespace Nitload.Geometries
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
///
|
///
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public virtual Vec3 MovCenter(
|
public virtual Vec3<float> MovCenter(
|
||||||
uint tick
|
uint tick
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return default(Vec3);
|
return Vec3<float>.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Nitload.Geometries
|
|||||||
public Triangle()
|
public Triangle()
|
||||||
: base(PlainCoordinate.StandardPlainCoordination)
|
: base(PlainCoordinate.StandardPlainCoordination)
|
||||||
{
|
{
|
||||||
vertexMat = new Vec4[3];
|
vertexMat = new Vec3<float>[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Triangle(
|
public Triangle(
|
||||||
|
|||||||
@@ -19,23 +19,13 @@ namespace Nitload.Geometries
|
|||||||
public struct Point
|
public struct Point
|
||||||
{
|
{
|
||||||
|
|
||||||
[FieldOffset(0)] private Vec3 coord;
|
[FieldOffset(0)] private Vec3<float> coord;
|
||||||
[FieldOffset(0)] internal Vector4 coordVec;
|
|
||||||
|
|
||||||
internal Point(
|
|
||||||
Vec4 vector
|
|
||||||
)
|
|
||||||
{
|
|
||||||
coordVec = vector.vec;
|
|
||||||
coordVec.W = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Point(
|
public Point(
|
||||||
Vec3 coord
|
Vec3<float> vector
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Coord = coord;
|
coord = vector;
|
||||||
coordVec.W = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point(
|
public Point(
|
||||||
@@ -44,12 +34,12 @@ namespace Nitload.Geometries
|
|||||||
float z
|
float z
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
coordVec = new Vector4(x, y, z, 1);
|
coord = new Vec3<float>(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3 Coord
|
public Vec3<float> Coord
|
||||||
{
|
{
|
||||||
get => coord;
|
readonly get => coord;
|
||||||
set => coord = value;
|
set => coord = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,18 +26,18 @@ namespace Nitload.Geometries
|
|||||||
|
|
||||||
private List<List<int>> _sideIndices;
|
private List<List<int>> _sideIndices;
|
||||||
private List<int> _triangleIndices;
|
private List<int> _triangleIndices;
|
||||||
private List<Vec3> _vertices;
|
private List<Vec3<float>> _vertices;
|
||||||
|
|
||||||
public TriangulatedSurface()
|
public TriangulatedSurface()
|
||||||
{
|
{
|
||||||
_triangleIndices = new List<int>();
|
_triangleIndices = [];
|
||||||
_vertices = new List<Vec3>();
|
_vertices = [];
|
||||||
_sides = new HashSet<(int,int)>();
|
_sides = [];
|
||||||
_sideIndices = new List<List<int>>();
|
_sideIndices = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
public IEnumerable<List<int>> SideIndicesEnumeratble => _sideIndices;
|
public IEnumerable<List<int>> SideIndicesEnumerable => _sideIndices;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public Triangle GetTriangle( int index )
|
public Triangle GetTriangle( int index )
|
||||||
@@ -51,7 +51,7 @@ namespace Nitload.Geometries
|
|||||||
}
|
}
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
public Span<Vec3> VertexSpan => CollectionsMarshal.AsSpan(_vertices);
|
public Span<Vec3<float>> VertexSpan => CollectionsMarshal.AsSpan(_vertices);
|
||||||
|
|
||||||
public Span<int> TriangleIndicesSpan => CollectionsMarshal.AsSpan(_triangleIndices);
|
public Span<int> TriangleIndicesSpan => CollectionsMarshal.AsSpan(_triangleIndices);
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ namespace Nitload.Geometries
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void AddVertexByOrder(
|
public void AddVertexByOrder(
|
||||||
Vec3 vertex
|
Vec3<float> vertex
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_vertices.Add(vertex);
|
_vertices.Add(vertex);
|
||||||
|
|||||||
Reference in New Issue
Block a user