daily update on 20240828 by nitload youmu, autotexture added
This commit is contained in:
@@ -1,4 +1,34 @@
|
||||
using StgSharp.Math;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="CoordinationBase.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,9 +40,10 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public abstract class CoordinationBase
|
||||
{
|
||||
|
||||
private bool globalCoordAvailable;
|
||||
private CoordinationBase localCoordination;
|
||||
private Matrix44 coordMat;
|
||||
private bool globalCoordAvailable;
|
||||
|
||||
|
||||
public CoordinationBase(
|
||||
@@ -24,7 +55,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
public virtual Point LocalOrigin
|
||||
{
|
||||
get => new Point( coordMat.colum3.XYZ);
|
||||
get => new Point(coordMat.colum3.XYZ);
|
||||
internal set => coordMat.colum3.XYZ = value.Coord;
|
||||
}
|
||||
|
||||
@@ -46,7 +77,7 @@ namespace StgSharp.Geometries
|
||||
set => coordMat.colum2.XYZ = value;
|
||||
}
|
||||
|
||||
protected ref Matrix44 CoordMat
|
||||
protected ref Matrix44 CoordMat
|
||||
{
|
||||
get => ref coordMat;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,13 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class PlainCoordinate : CoordinationBase
|
||||
{
|
||||
|
||||
private static PlainCoordinate statndardPlainCoordination = new PlainCoordinate(
|
||||
null, new Point(0, 0, 0),
|
||||
new vec3d(1, 0, 0),
|
||||
new vec3d(0, 1, 0)
|
||||
);
|
||||
|
||||
public PlainCoordinate(
|
||||
CoordinationBase local,
|
||||
Point origin,
|
||||
@@ -55,12 +62,7 @@ namespace StgSharp.Geometries
|
||||
LocalOrigin = origin;
|
||||
}
|
||||
|
||||
private static PlainCoordinate statndardPlainCoordination = new PlainCoordinate(
|
||||
null, new Point(0,0,0),
|
||||
new vec3d(1,0,0),
|
||||
new vec3d(0, 1, 0)
|
||||
);
|
||||
|
||||
public static PlainCoordinate StandardPlainCoordination => statndardPlainCoordination;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Class1.cs"
|
||||
// file="SpaceCoordinate.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
@@ -38,11 +38,13 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class SpaceCoordinate : CoordinationBase
|
||||
{
|
||||
|
||||
public SpaceCoordinate(
|
||||
CoordinationBase localCoordination, Point origin,
|
||||
vec3d xAxis, vec3d yAxis, vec3d zAxis
|
||||
) : base(localCoordination)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,34 @@
|
||||
using StgSharp.Math;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StreamLocalCoordinate.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,4 +1,35 @@
|
||||
using StgSharp.Math;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="GeometryOperation.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Timing;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -8,34 +39,17 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate vec3d GeometryMotionDelegate(TimeSpanProvider timeSource, out float rotation);
|
||||
|
||||
public class GeometryMotion
|
||||
{
|
||||
|
||||
private bool isIncrementMode;
|
||||
private bool sourceIsStatic;
|
||||
private TimeSpanProvider time;
|
||||
private GeometryMotionDelegate movement;
|
||||
private IntPtr handle;
|
||||
|
||||
public static GeometryMotion DefaultMotion
|
||||
{
|
||||
get
|
||||
{
|
||||
return new GeometryMotion
|
||||
(
|
||||
true,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static vec3d defaultMotion(TimeSpanProvider provider, out float rotation)
|
||||
{
|
||||
rotation = 0;
|
||||
return Vec3d.Zero;
|
||||
}
|
||||
private TimeSpanProvider time;
|
||||
|
||||
public unsafe GeometryMotion(
|
||||
bool isIncreament,
|
||||
@@ -53,35 +67,40 @@ namespace StgSharp.Geometries
|
||||
else if (motionDelegate.Method.IsStatic)
|
||||
{
|
||||
sourceIsStatic = true;
|
||||
handle = Marshal.GetFunctionPointerForDelegate(motionDelegate);
|
||||
handle = Marshal.GetFunctionPointerForDelegate(motionDelegate);
|
||||
movement = motionDelegate;
|
||||
}
|
||||
else
|
||||
{
|
||||
movement = motionDelegate;
|
||||
}
|
||||
sourceIsStatic = false;
|
||||
//sourceIsStatic = false;
|
||||
}
|
||||
|
||||
public bool IsIncrement
|
||||
{
|
||||
get => isIncrementMode;
|
||||
get => isIncrementMode;
|
||||
|
||||
}
|
||||
|
||||
public static GeometryMotion DefaultMotion
|
||||
{
|
||||
get => new GeometryMotion(true, null, null);
|
||||
}
|
||||
|
||||
public unsafe void RunMotion(ref vec3d coord, ref float rotation)
|
||||
{
|
||||
float rot = 0;
|
||||
float rot;
|
||||
vec3d vec;
|
||||
if (sourceIsStatic)
|
||||
if (sourceIsStatic)
|
||||
{
|
||||
vec = ((delegate*<TimeSpanProvider, out float, vec3d>)handle)(time, out rot);
|
||||
vec = ((delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, vec3d>)handle)(time, out rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
vec = movement(time, out rot);
|
||||
}
|
||||
|
||||
|
||||
if (isIncrementMode)
|
||||
{
|
||||
coord += vec;
|
||||
@@ -89,9 +108,16 @@ namespace StgSharp.Geometries
|
||||
}
|
||||
else
|
||||
{
|
||||
coord = vec.XYZ;
|
||||
coord = vec;
|
||||
rotation = rot;
|
||||
}
|
||||
}
|
||||
|
||||
private static vec3d defaultMotion(TimeSpanProvider provider, out float rotation)
|
||||
{
|
||||
rotation = 0;
|
||||
return Vec3d.Zero;
|
||||
}
|
||||
|
||||
}//------------------------------- End of Class -------------------------------
|
||||
}
|
||||
|
||||
@@ -1,4 +1,34 @@
|
||||
using System;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Angle.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -9,12 +39,19 @@ namespace StgSharp.Math
|
||||
{
|
||||
public static partial class GeometryScaler
|
||||
{
|
||||
|
||||
internal const float DegToRad = 180 / Scaler.Pi;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Degree ToDegree(float value)
|
||||
public static float Cos(Radius r)
|
||||
{
|
||||
return new Degree(value);
|
||||
return MathF.Cos(r._radius);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Cos(Degree r)
|
||||
{
|
||||
return MathF.Cos(r._degree / DegToRad);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -23,24 +60,18 @@ namespace StgSharp.Math
|
||||
return MathF.Sin(r._radius);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Sin(Degree r)
|
||||
{
|
||||
return MathF.Sin(r._degree / DegToRad);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Tan(Radius r)
|
||||
{
|
||||
return MathF.Tan(r._radius);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Cos(Radius r)
|
||||
{
|
||||
return MathF.Cos(r._radius);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Sin(Degree r)
|
||||
{
|
||||
return MathF.Sin(r._degree/DegToRad);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Tan(Degree r)
|
||||
{
|
||||
@@ -48,18 +79,19 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Cos(Degree r)
|
||||
public static Degree ToDegree(float value)
|
||||
{
|
||||
return MathF.Cos(r._degree / DegToRad);
|
||||
return new Degree(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public struct Degree
|
||||
{
|
||||
|
||||
internal float _degree;
|
||||
|
||||
internal Degree(float dgree)
|
||||
internal Degree(float dgree)
|
||||
{
|
||||
_degree = dgree;
|
||||
}
|
||||
@@ -68,28 +100,25 @@ namespace StgSharp.Math
|
||||
{
|
||||
return new Radius(d._degree / GeometryScaler.DegToRad);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public struct Radius
|
||||
{
|
||||
|
||||
internal float _radius;
|
||||
|
||||
[Obsolete("Unsafe, you may forget this is radius.", true)]
|
||||
public Radius() { }
|
||||
|
||||
public Radius(float radius)
|
||||
{
|
||||
_radius = radius;
|
||||
}
|
||||
|
||||
public static Radius Zero
|
||||
{
|
||||
get =>new Radius(0);
|
||||
}
|
||||
|
||||
public Radius(float radius)
|
||||
{
|
||||
_radius = radius;
|
||||
}
|
||||
|
||||
[Obsolete("Unsafe, you may forget this is radius.",true)]
|
||||
public Radius() { }
|
||||
|
||||
public static implicit operator Degree(Radius r)
|
||||
{
|
||||
return new Degree(r._radius * 180 / Scaler.Pi);
|
||||
get => new Radius(0);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -105,9 +134,9 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Radius operator +(Radius left, Radius Right)
|
||||
public static bool operator !=(Radius left, Radius right)
|
||||
{
|
||||
return new Radius(left._radius + Right._radius);
|
||||
return left._radius != right._radius;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -128,16 +157,21 @@ namespace StgSharp.Math
|
||||
return left._radius / right._radius;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Radius operator +(Radius left, Radius Right)
|
||||
{
|
||||
return new Radius(left._radius + Right._radius);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(Radius left, Radius right)
|
||||
{
|
||||
return left._radius == right._radius;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(Radius left, Radius right)
|
||||
public static implicit operator Degree(Radius r)
|
||||
{
|
||||
return left._radius != right._radius;
|
||||
return new Degree((r._radius * 180) / Scaler.Pi);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public interface IGeometry
|
||||
{
|
||||
public CoordinationBase Coordination { get; }
|
||||
|
||||
public Point this[int index]
|
||||
{
|
||||
@@ -49,19 +48,20 @@ namespace StgSharp.Geometries
|
||||
set;
|
||||
}
|
||||
|
||||
public int VertexCount
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
#pragma warning disable CA1819
|
||||
public vec4d[] VertexStream
|
||||
#pragma warning restore CA1819
|
||||
{
|
||||
get;
|
||||
}
|
||||
public CoordinationBase Coordination { get; }
|
||||
|
||||
public ReadOnlySpan<int> VertexIndices
|
||||
public int VertexCount
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<int> VertexIndices
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IGeomtryBuffer.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public interface IGeomtryBuffer
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -43,30 +43,6 @@ namespace StgSharp.Geometries
|
||||
public interface IInstancing
|
||||
{
|
||||
|
||||
public int BufferId
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public vec3d CenterPositionGlobal
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public vec3d Coord
|
||||
{
|
||||
get { return GlobalBuffer.CoordAndRotationList[BufferId].XYZ; }
|
||||
set { GlobalBuffer.CoordAndRotationList[BufferId] = new vec4d(value.vec); }
|
||||
}
|
||||
|
||||
public IInstancingBuffer GlobalBuffer
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public float Rotation
|
||||
{
|
||||
get { return GlobalBuffer.CoordAndRotationList[BufferId].W; }
|
||||
@@ -89,6 +65,30 @@ namespace StgSharp.Geometries
|
||||
get; set;
|
||||
}
|
||||
|
||||
public IInstancingBuffer GlobalBuffer
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public int BufferId
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public vec3d CenterPositionGlobal
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public vec3d Coord
|
||||
{
|
||||
get { return GlobalBuffer.CoordAndRotationList[BufferId].XYZ; }
|
||||
set { GlobalBuffer.CoordAndRotationList[BufferId] = new vec4d(value.vec); }
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
(vec3d coord, float rotation) = (Coord, Rotation);
|
||||
|
||||
@@ -1,4 +1,34 @@
|
||||
using StgSharp.Math;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IInstancingBuffer.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,6 +39,10 @@ namespace StgSharp.Geometries
|
||||
public interface IInstancingBuffer
|
||||
{
|
||||
|
||||
public Span<vec4d> CoordAndRotationSpan { get; }
|
||||
|
||||
public Span<float> ScalingSpan { get; }
|
||||
|
||||
internal IGeometry TypicalShape { get; }
|
||||
|
||||
internal List<IInstancing> InstanceList { get; }
|
||||
@@ -17,11 +51,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
internal List<float> ScalingList { get; }
|
||||
|
||||
public Span<vec4d> CoordAndRotationSpan { get; }
|
||||
|
||||
public Span<float> ScalingSpan { get; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
public static unsafe class GeometryOperation
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static vec3d DefaultMotion(int tick)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,34 @@
|
||||
using StgSharp.Math;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IPlainEntity.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,22 +41,19 @@ namespace StgSharp.Geometries
|
||||
|
||||
public interface IPlainEntity
|
||||
{
|
||||
|
||||
public vec2d CenterPosition { get; set; }
|
||||
|
||||
public bool CollideWith(IPlainEntity entity);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class PlainEntity:IPlainEntity
|
||||
public class PlainEntity : IPlainEntity
|
||||
{
|
||||
private PlainGeometry _shape;
|
||||
|
||||
vec2d IPlainEntity.CenterPosition
|
||||
{
|
||||
get => _shape.Coordination.LocalOrigin.Coord.XY;
|
||||
set => throw new InvalidOperationException();
|
||||
}
|
||||
private PlainGeometry _shape;
|
||||
|
||||
public PlainEntity(PlainGeometry shape)
|
||||
{
|
||||
@@ -37,6 +64,13 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
vec2d IPlainEntity.CenterPosition
|
||||
{
|
||||
get => _shape.Coordination.LocalOrigin.Coord.XY;
|
||||
set => throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IInstancing.cs"
|
||||
// file="ParticleOnPlain.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
@@ -54,7 +54,7 @@ namespace StgSharp.Geometries
|
||||
((IInstancingBuffer)buffer).InstanceList.Add(this);
|
||||
}
|
||||
|
||||
public int BufferId
|
||||
public GeometryMotion Motion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
@@ -65,9 +65,10 @@ namespace StgSharp.Geometries
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public GeometryMotion Motion
|
||||
{
|
||||
get;
|
||||
|
||||
public int BufferId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
@@ -77,16 +78,17 @@ namespace StgSharp.Geometries
|
||||
set;
|
||||
}
|
||||
|
||||
vec2d IPlainEntity.CenterPosition
|
||||
{
|
||||
get => GlobalBuffer.CoordAndRotationList[BufferId].XY;
|
||||
set => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
bool IPlainEntity.CollideWith(IPlainEntity entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
vec2d IPlainEntity.CenterPosition
|
||||
{
|
||||
get => GlobalBuffer.CoordAndRotationList[BufferId].XY;
|
||||
set => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,11 @@ namespace StgSharp.Geometries
|
||||
/// </summary>
|
||||
public abstract class PlainGeometry : IGeometry
|
||||
{
|
||||
|
||||
protected vec4d[] vertexMat;
|
||||
internal CoordinationBase coordinate;
|
||||
|
||||
|
||||
internal PlainGeometry(CoordinationBase coordination)
|
||||
{
|
||||
coordinate = coordination;
|
||||
|
||||
@@ -44,30 +44,24 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class PlainInstancingBuffer<T> :
|
||||
IDisposable,IEnumerable<T>, IInstancingBuffer
|
||||
where T :
|
||||
public class PlainInstancingBuffer<T> :
|
||||
IDisposable, IEnumerable<T>, IInstancingBuffer
|
||||
where T :
|
||||
IInstancing
|
||||
{
|
||||
|
||||
private bool disposedValue;
|
||||
|
||||
private CoordinatePlain globalCorrdinnate;
|
||||
private List<vec4d> coordList;
|
||||
private List<IInstancing> instanceList;
|
||||
private List<float> scalingList;
|
||||
private Mutex mutex;
|
||||
private bool disposedValue;
|
||||
|
||||
#region field of mem opt
|
||||
|
||||
vec4d[] coordArray;
|
||||
float[] scaleArray;
|
||||
|
||||
#endregion
|
||||
|
||||
public PlainInstancingBuffer()
|
||||
{
|
||||
coordList = new List<vec4d>(capacity: 100);
|
||||
instanceList = new List<IInstancing>(capacity:100);
|
||||
instanceList = new List<IInstancing>(capacity: 100);
|
||||
scalingList = new List<float>(capacity: 100);
|
||||
coordArray = Array.Empty<vec4d>();
|
||||
scaleArray = Array.Empty<float>();
|
||||
@@ -133,8 +127,6 @@ namespace StgSharp.Geometries
|
||||
}
|
||||
}
|
||||
|
||||
IGeometry IInstancingBuffer.TypicalShape => throw new NotImplementedException();
|
||||
|
||||
public int CreateInstanceID()
|
||||
{
|
||||
mutex.WaitOne();
|
||||
@@ -145,13 +137,32 @@ namespace StgSharp.Geometries
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ~PlainInstancingBuffer()
|
||||
// {
|
||||
// Dispose(disposing: false);
|
||||
// }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
foreach (IInstancing item in instanceList)
|
||||
{
|
||||
yield return (T)item;
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(T instance)
|
||||
{
|
||||
mutex.WaitOne();
|
||||
if (instance.GlobalBuffer != this)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
message:"instance does not belong to current Particle Buffer",
|
||||
message: "instance does not belong to current Particle Buffer",
|
||||
paramName: nameof(instance));
|
||||
}
|
||||
int index = instance.BufferId;
|
||||
@@ -170,7 +181,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
public void UpdateAllParticles()
|
||||
{
|
||||
foreach (var particle in instanceList)
|
||||
foreach (IInstancing particle in instanceList)
|
||||
{
|
||||
particle.Move();
|
||||
}
|
||||
@@ -192,31 +203,23 @@ namespace StgSharp.Geometries
|
||||
}
|
||||
}
|
||||
|
||||
// ~PlainInstancingBuffer()
|
||||
// {
|
||||
// Dispose(disposing: false);
|
||||
// }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
foreach (var item in instanceList)
|
||||
{
|
||||
yield return (T)item;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
foreach (var item in instanceList)
|
||||
foreach (IInstancing item in instanceList)
|
||||
{
|
||||
yield return (T)item;
|
||||
}
|
||||
}
|
||||
|
||||
IGeometry IInstancingBuffer.TypicalShape => throw new NotImplementedException();
|
||||
|
||||
#region field of mem opt
|
||||
|
||||
vec4d[] coordArray;
|
||||
float[] scaleArray;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,14 +38,15 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class Polygon4 : PlainGeometry
|
||||
{
|
||||
|
||||
protected static int[] Indices = [0, 1, 2, 0, 2, 3];
|
||||
|
||||
internal Polygon4():base(PlainCoordinate.StandardPlainCoordination)
|
||||
internal Polygon4() : base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
vertexMat = new vec4d[4];
|
||||
}
|
||||
|
||||
internal Polygon4(vec4d[] rawCoord):
|
||||
internal Polygon4(vec4d[] rawCoord) :
|
||||
base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
if (rawCoord.Length != 4)
|
||||
@@ -60,7 +61,7 @@ namespace StgSharp.Geometries
|
||||
Point topRight,
|
||||
Point bottomRight,
|
||||
Point bottomLeft
|
||||
):base(PlainCoordinate.StandardPlainCoordination)
|
||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
this[0] = topLeft;
|
||||
this[1] = topRight;
|
||||
@@ -69,21 +70,6 @@ namespace StgSharp.Geometries
|
||||
|
||||
}
|
||||
|
||||
public Polygon4(
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y
|
||||
):base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
vertexMat = new vec4d[4];
|
||||
|
||||
this[0] = new Point(v0x, v0y, 0);
|
||||
this[1] = new Point(v1x, v1y, 0);
|
||||
this[2] = new Point(v2x, v2y, 0);
|
||||
this[3] = new Point(v3x, v3y, 0);
|
||||
}
|
||||
|
||||
|
||||
public Polygon4(CoordinationBase coordinate,
|
||||
PlainCoordinate coordination,
|
||||
@@ -100,6 +86,21 @@ namespace StgSharp.Geometries
|
||||
|
||||
}
|
||||
|
||||
public Polygon4(
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y
|
||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
vertexMat = new vec4d[4];
|
||||
|
||||
this[0] = new Point(v0x, v0y, 0);
|
||||
this[1] = new Point(v1x, v1y, 0);
|
||||
this[2] = new Point(v2x, v2y, 0);
|
||||
this[3] = new Point(v3x, v3y, 0);
|
||||
}
|
||||
|
||||
public Polygon4(
|
||||
PlainCoordinate coordination,
|
||||
float v0x, float v0y,
|
||||
|
||||
@@ -39,7 +39,9 @@ namespace StgSharp.Geometries
|
||||
public unsafe class Polygon5 : PlainGeometry
|
||||
{
|
||||
|
||||
public unsafe Polygon5():base(PlainCoordinate.StandardPlainCoordination)
|
||||
internal static int[] Indices = [0, 1, 2, 0, 2, 3, 0, 3, 4];
|
||||
|
||||
public unsafe Polygon5() : base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
vertexMat = new vec4d[5];
|
||||
}
|
||||
@@ -50,7 +52,7 @@ namespace StgSharp.Geometries
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y,
|
||||
float v4x, float v4y
|
||||
):base(PlainCoordinate.StandardPlainCoordination)
|
||||
) : base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
vertexMat = new vec4d[5];
|
||||
this[0] = new Point(v0x, v0y, 0);
|
||||
@@ -67,7 +69,7 @@ namespace StgSharp.Geometries
|
||||
float v2x, float v2y,
|
||||
float v3x, float v3y,
|
||||
float v4x, float v4y
|
||||
):base(coordination)
|
||||
) : base(coordination)
|
||||
{
|
||||
vertexMat = new vec4d[5];
|
||||
this[0] = new Point(v0x, v0y, 0);
|
||||
@@ -77,8 +79,7 @@ namespace StgSharp.Geometries
|
||||
this[4] = new Point(v4x, v4y, 0);
|
||||
}
|
||||
|
||||
internal static int[] Indices = [ 0, 1, 2, 0, 2, 3, 0, 3, 4 ];
|
||||
|
||||
public override ReadOnlySpan<int> VertexIndices => Indices;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,10 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class Polygon6 : PlainGeometry
|
||||
{
|
||||
public Polygon6():base(PlainCoordinate.StandardPlainCoordination)
|
||||
|
||||
internal static int[] Indices = [0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5];
|
||||
|
||||
public Polygon6() : base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
vertexMat = new vec4d[6];
|
||||
}
|
||||
@@ -64,8 +67,7 @@ namespace StgSharp.Geometries
|
||||
vertexMat[6].vec = vert6.vec;
|
||||
}
|
||||
|
||||
internal static int[] Indices = [ 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5 ];
|
||||
|
||||
public override ReadOnlySpan<int> VertexIndices => Indices;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -86,14 +86,12 @@ namespace StgSharp.Geometries
|
||||
/// <summary>
|
||||
/// Calculate movement to center
|
||||
/// </summary>
|
||||
/// <param name="tick">Current time tick</param>
|
||||
/// <param name="tick">CurrentBlueprint time tick</param>
|
||||
/// <returns></returns>
|
||||
public virtual vec3d MovCenter(uint tick)
|
||||
{
|
||||
return default(vec3d);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ namespace StgSharp.Geometries
|
||||
public unsafe class Triangle : PlainGeometry
|
||||
{
|
||||
|
||||
public Triangle():base(PlainCoordinate.StandardPlainCoordination)
|
||||
internal static int[] Indices = [0, 1, 2];
|
||||
|
||||
public Triangle() : base(PlainCoordinate.StandardPlainCoordination)
|
||||
{
|
||||
vertexMat = new vec4d[3];
|
||||
}
|
||||
@@ -58,6 +60,17 @@ namespace StgSharp.Geometries
|
||||
this[2] = vertex03;
|
||||
}
|
||||
|
||||
public Triangle(PlainCoordinate coordination,
|
||||
Point vertex01,
|
||||
Point vertex02,
|
||||
Point vertex03
|
||||
) : base(coordination)
|
||||
{
|
||||
this[0] = vertex01;
|
||||
this[1] = vertex02;
|
||||
this[2] = vertex03;
|
||||
}
|
||||
|
||||
public Triangle(
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
@@ -69,17 +82,6 @@ namespace StgSharp.Geometries
|
||||
this[2] = new Point(v2x, v2y, 0);
|
||||
}
|
||||
|
||||
public Triangle(PlainCoordinate coordination,
|
||||
Point vertex01,
|
||||
Point vertex02,
|
||||
Point vertex03
|
||||
) : base(coordination)
|
||||
{
|
||||
this[0] = vertex01;
|
||||
this[1] = vertex02;
|
||||
this[2] = vertex03;
|
||||
}
|
||||
|
||||
public Triangle(PlainCoordinate coordination,
|
||||
float v0x, float v0y,
|
||||
float v1x, float v1y,
|
||||
@@ -90,7 +92,6 @@ namespace StgSharp.Geometries
|
||||
this[1] = new Point(v1x, v1y, 0);
|
||||
this[2] = new Point(v2x, v2y, 0);
|
||||
}
|
||||
internal static int[] Indices = [ 0, 1, 2 ];
|
||||
|
||||
public override ReadOnlySpan<int> VertexIndices => Indices;
|
||||
|
||||
|
||||
@@ -1,4 +1,34 @@
|
||||
using StgSharp.Math;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Point.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,12 +41,14 @@ namespace StgSharp.Geometries
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
||||
public struct Point
|
||||
{
|
||||
|
||||
[FieldOffset(0)] private vec3d coord;
|
||||
[FieldOffset(0)] internal Vector4 coordVec;
|
||||
|
||||
public Point(float x, float y, float z)
|
||||
internal Point(vec4d vector)
|
||||
{
|
||||
coordVec = new Vector4(x,y,z,1);
|
||||
coordVec = vector.vec;
|
||||
coordVec.W = 1;
|
||||
}
|
||||
|
||||
public Point(vec3d coord)
|
||||
@@ -25,10 +57,9 @@ namespace StgSharp.Geometries
|
||||
coordVec.W = 1;
|
||||
}
|
||||
|
||||
internal Point(vec4d vector)
|
||||
public Point(float x, float y, float z)
|
||||
{
|
||||
coordVec = vector.vec;
|
||||
coordVec.W = 1;
|
||||
coordVec = new Vector4(x, y, z, 1);
|
||||
}
|
||||
|
||||
public vec3d Coord
|
||||
|
||||
Reference in New Issue
Block a user