New IO structure, unexpexted error in C code

This commit is contained in:
Nitload
2023-06-22 03:33:24 +08:00
parent 50b4965e54
commit ee8132c149
172 changed files with 1344 additions and 4023 deletions
+26 -31
View File
@@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct vec4d:IEquatable< vec4d>
public struct vec4d : IEquatable<vec4d>
{
[FieldOffset(0)]
public float X;
@@ -20,16 +15,16 @@ namespace StgSharp.Math
[FieldOffset(12)]
public float W;
[FieldOffset(0)]
public vec2d Point1;
[FieldOffset(8)]
public vec2d Point2;
public vec4d(float a1,float a2,float a3,float a4)
public vec4d(float a1, float a2, float a3, float a4)
{
Point1= default(vec2d);
Point2= default(vec2d);
Point1 = default(vec2d);
Point2 = default(vec2d);
X = a1;
Y = a2;
@@ -48,34 +43,34 @@ namespace StgSharp.Math
W = (float)a4;
}
public vec4d(vec2d p1,vec2d p2)
public vec4d(vec2d p1, vec2d p2)
{
X= 0;
Y= 0;
X = 0;
Y = 0;
Z = 0;
W = 0;
Point1= p1;
Point1 = p1;
Point2 = p2;
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if(obj.GetType() != typeof( vec4d))
else if (obj.GetType() != typeof(vec4d))
{
return false;
}
else
{
return this == ( vec4d)obj;
return this == (vec4d)obj;
}
}
bool IEquatable< vec4d>.Equals( vec4d other)
bool IEquatable<vec4d>.Equals(vec4d other)
{
if (this.GetHashCode() != other.GetHashCode())
{
@@ -100,19 +95,19 @@ namespace StgSharp.Math
return $"{X}\t{Y}\t{Z}\t{W}";
}
public static bool operator ==( vec4d vec1, vec4d vec2)
public static bool operator ==(vec4d vec1, vec4d vec2)
{
return vec1.Equals(vec2);
}
public static bool operator !=( vec4d vec1, vec4d vec2)
public static bool operator !=(vec4d vec1, vec4d vec2)
{
return !vec1.Equals(vec2);
}
public static vec4d operator +( vec4d vec1, vec4d vec2)
public static vec4d operator +(vec4d vec1, vec4d vec2)
{
return new vec4d(
return new vec4d(
vec1.X + vec2.X,
vec1.Y + vec2.Y,
vec1.Z + vec2.Z,
@@ -120,9 +115,9 @@ namespace StgSharp.Math
);
}
public static vec4d operator -( vec4d vec1, vec4d vec2)
public static vec4d operator -(vec4d vec1, vec4d vec2)
{
return new vec4d(
return new vec4d(
vec1.X - vec2.X,
vec1.Y - vec2.Y,
vec1.Z - vec2.Z,
@@ -130,7 +125,7 @@ namespace StgSharp.Math
);
}
public static float operator *( vec4d vec1, vec4d vec2)
public static float operator *(vec4d vec1, vec4d vec2)
{
return
vec1.X * vec2.X
@@ -139,14 +134,14 @@ namespace StgSharp.Math
+ vec1.W * vec2.W;
}
public static vec4d operator *( vec4d vec, float x)
public static vec4d operator *(vec4d vec, float x)
{
return new vec4d(vec.X * x, vec.Y * x, vec.Z * x, vec.W * x ) ;
return new vec4d(vec.X * x, vec.Y * x, vec.Z * x, vec.W * x);
}
public static vec4d operator /( vec4d vec, float x)
public static vec4d operator /(vec4d vec, float x)
{
return new vec4d(vec.X / x, vec.Y / x, vec.Z / x, vec.W / x);
return new vec4d(vec.X / x, vec.Y / x, vec.Z / x, vec.W / x);
}
public static implicit operator float[](vec4d vec)