daily uodate on 20231208 by nitload youmu, preparation for multi thread rendering

This commit is contained in:
Nitload
2023-12-08 05:36:04 +08:00
parent ae804553ce
commit ab85c1a9fe
297 changed files with 157896 additions and 5170 deletions
+24 -14
View File
@@ -6,12 +6,6 @@ using System.Runtime.InteropServices;
namespace StgSharp.Math
{
public static class Vec3d
{
public static vec3d Zero => new vec3d(0, 0, 0);
public static vec3d Unit => new vec3d(1, 1, 1);
}
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
public struct vec3d : IEquatable<vec3d>
{
@@ -31,9 +25,17 @@ namespace StgSharp.Math
public vec3d(
float x, float y, float z)
{
#if NET5_0_OR_GREATER
Unsafe.SkipInit(out vec);
#endif
X = x; Y = y; Z = z;
}
internal vec3d(Vector4 vector)
{
vec = vector;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float Dot(vec3d right)
{
@@ -53,22 +55,24 @@ namespace StgSharp.Math
);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal vec3d(Vector4 vector)
{
vec = vector;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static vec3d operator +(vec3d left, vec3d right)
{
return new vec3d(
left.X + right.X,
left.Y + right.Y,
left.Z + right.Z
left.vec + right.vec
);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float GetMaxValue()
{
float ret = X;
ret = ret > Y ? ret : Y;
ret = ret > Z ? ret : Z;
return ret;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static vec3d operator -(vec3d left, vec3d right)
{
@@ -157,4 +161,10 @@ namespace StgSharp.Math
return $"[{X},{Y},{Z}]";
}
}
public static class Vec3d
{
public static vec3d Unit { get => new vec3d(1, 1, 1); }
public static vec3d Zero { get => new vec3d(0, 0, 0); }
}
}