daily update on 20230724 by nitload youmu, bigM128map added

This commit is contained in:
Nitload
2023-07-24 22:50:19 +08:00
parent 80cdd610ce
commit e11c88b051
135 changed files with 1733 additions and 9965 deletions
+35 -121
View File
@@ -1,154 +1,68 @@
using System;
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Runtime.InteropServices;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct vec4d : IEquatable<vec4d>
public class Vec4d
{
[FieldOffset(0)]
public float X;
[FieldOffset(4)]
public float Y;
[FieldOffset(8)]
public float Z;
[FieldOffset(12)]
public float W;
internal readonly int mapID;
internal readonly long m128Ptr;
private M128 _value;
[FieldOffset(0)]
public vec2d Point1;
[FieldOffset(8)]
public vec2d Point2;
public vec4d(float a1, float a2, float a3, float a4)
public unsafe float X
{
Point1 = default(vec2d);
Point2 = default(vec2d);
X = a1;
Y = a2;
Z = a3;
W = a4;
get { return (*(M128*)mapID).single_0; }
set { (*(M128*)mapID).single_0 = value; }
}
public vec4d(double a1, double a2, double a3, double a4)
public float Y
{
Point1 = default(vec2d);
Point2 = default(vec2d);
X = (float)a1;
Y = (float)a2;
Z = (float)a3;
W = (float)a4;
get { return _value.single_1; }
set { _value.single_1 = value; }
}
public vec4d(vec2d p1, vec2d p2)
public float Z
{
X = 0;
Y = 0;
Z = 0;
W = 0;
Point1 = p1;
Point2 = p2;
get { return _value.single_2; }
set { _value.single_2 = value; }
}
public override bool Equals(object obj)
public float W
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(vec4d))
{
return false;
}
else
{
return this == (vec4d)obj;
}
get { return _value.single_3; }
set { _value.single_3 = value; }
}
bool IEquatable<vec4d>.Equals(vec4d other)
public Vec4d(float x, float y, float z, float w)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.X == other.X
&& this.Y == other.Y
&& this.Z == other.Z
&& this.W == other.Z;
}
X = x;
Y = y;
Z = z;
W = w;
}
public override int GetHashCode()
internal Vec4d()
{
return HashCode.Combine(X, Y, Z, W);
}
public override string ToString()
public static Vec4d operator +(Vec4d vec1,Vec4d vec2)
{
return $"{X}\t{Y}\t{Z}\t{W}";
Vec4d result = new Vec4d();
result._value = internalIO.VecAddVec(vec1._value,vec2._value);
return result;
}
public static bool operator ==(vec4d vec1, vec4d vec2)
public static Vec4d operator -(Vec4d vec1, Vec4d vec2)
{
return vec1.Equals(vec2);
Vec4d result = new Vec4d();
result._value = internalIO.VecAddVec(vec1._value, vec2._value);
return result;
}
public static bool operator !=(vec4d vec1, vec4d vec2)
{
return !vec1.Equals(vec2);
}
public static vec4d operator +(vec4d vec1, vec4d vec2)
{
return new vec4d(
vec1.X + vec2.X,
vec1.Y + vec2.Y,
vec1.Z + vec2.Z,
vec1.W + vec2.W
);
}
public static vec4d operator -(vec4d vec1, vec4d vec2)
{
return new vec4d(
vec1.X - vec2.X,
vec1.Y - vec2.Y,
vec1.Z - vec2.Z,
vec1.W - vec2.W
);
}
public static float operator *(vec4d vec1, vec4d vec2)
{
return
vec1.X * vec2.X
+ vec1.Y * vec2.Y
+ vec1.Z * vec2.Z
+ vec1.W * vec2.W;
}
public static vec4d operator *(vec4d vec, float x)
{
return new vec4d(vec.X * x, vec.Y * x, vec.Z * x, vec.W * x);
}
public static vec4d operator /(vec4d vec, float x)
{
return new vec4d(vec.X / x, vec.Y / x, vec.Z / x, vec.W / x);
}
public static implicit operator float[](vec4d vec)
{
return new float[] { vec.X, vec.Y, vec.Z, vec.W };
}
}
}