OpenGL rebuild project start!

This commit is contained in:
Nitload
2023-04-29 03:06:32 +08:00
parent 7dba067146
commit 4dd3f4f6d1
263 changed files with 51374 additions and 1522 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x2Int:IEquatable<matrix2x2>
{
[FieldOffset(0)]
public vec2dInt row1;
[FieldOffset(8)]
public vec2dInt row2;
public matrix2x2Int(vec2d c0, vec2d c1)
{
row1 = c0;
row2 = c1;
}
public matrix2x2Int(
int a11,
int a12,
int a21,
int a22
)
{
row1 = new vec2dInt(a11, a12);
row2 = new vec2dInt(a21, a22);
}
bool IEquatable<matrix2x2>.Equals(matrix2x2 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix2x2))
{
return false;
}
else
{
return this.Equals((vec3d)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1,row2);
}
public override string ToString()
{
return $"{row1}\n{row2}";
}
public static matrix2x2Int operator +(matrix2x2Int matrix1 , matrix2x2Int matrix2)
{
return new matrix2x2Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
);
}
public static matrix2x2Int operator -(matrix2x2Int matrix1, matrix2x2Int matrix2)
{
return new matrix2x2Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2
);
}
}
}
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x3Int:IEquatable<matrix2x3Int>
{
[FieldOffset(0)]
public vec3d row1;
[FieldOffset(12)]
public vec3d row2;
public matrix2x3Int(vec3d r1, vec3d r2)
{
row1 = r1;
row2 = r2;
}
public matrix2x3Int(
int r11, int r12, int r13,
int r21, int r22, int r23
)
{
row1 = new vec3d(r11, r12, r13);
row2 = new vec3d(r21, r22, r23);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix2x3Int))
{
return false;
}
else
{
return this.Equals((vec3d)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2);
}
public override string ToString()
{
return $"{row1}\n{row2}";
}
bool IEquatable<matrix2x3Int>.Equals(matrix2x3Int other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2;
}
}
public static matrix2x3Int operator +(matrix2x3Int matrix1, matrix2x3Int matrix2)
{
return new matrix2x3Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
);
}
public static matrix2x3Int operator -(matrix2x3Int matrix1, matrix2x3Int matrix2)
{
return new matrix2x3Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2
);
}
public static matrix2x3Int operator *(matrix2x3Int array, int x)
{
return new matrix2x3Int(
array.row1 * x,
array.row2 * x
) ;
}
public static matrix2x3Int operator /(matrix2x3Int array, int x)
{
return new matrix2x3Int(
array.row1 / x,
array.row2 / x
);
}
}
}
@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x4 : IEquatable<matrix2x4>
{
[FieldOffset(0)]
public vec4d row1;
[FieldOffset(16)]
public vec4d row2;
public matrix2x4( vec4d r1, vec4d r2)
{
row1 = r1;
row2 = r2;
}
public matrix2x4(
float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24
)
{
row1 = new vec4d(a11,a12,a13,a14);
row2 = new vec4d(a21,a22,a23,a24);
}
public bool Equals(matrix2x4 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix2x4))
{
return false;
}
else
{
return this.Equals((matrix2x4)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(this.row1, this.row2);
}
public override string ToString()
{
return $"{this.row1}\n{this.row2}";
}
public static matrix2x4 operator +(matrix2x4 matrix1 ,matrix2x4 matrix2)
{
return new matrix2x4(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
) ;
}
public static matrix2x4 operator -(matrix2x4 matrix1, matrix2x4 matrix2)
{
return new matrix2x4(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2
);
}
public static matrix2x4 operator *(matrix2x4 array, float x)
{
return new matrix2x4(
array.row1 * x,
array.row2 * x
);
}
public static matrix2x4 operator /(matrix2x4 array, float x)
{
return new matrix2x4(
array.row1 / x,
array.row2 / x
);
}
}
}
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x2Int:IEquatable<matrix3x2Int>
{
[FieldOffset(0)]
public vec2d row1;
[FieldOffset(8)]
public vec2d row2;
[FieldOffset(16)]
public vec2d row3;
public matrix3x2Int(vec2d r1,vec2d r2,vec2d r3)
{
row1= r1;
row2= r2;
row3= r3;
}
public matrix3x2Int(
int a11, int a12,
int a21, int a22,
int a31, int a32
)
{
row1 = new vec2d(a11, a12);
row2 = new vec2d(a21, a22);
row3 = new vec2d(a31, a32);
}
bool IEquatable<matrix3x2Int>.Equals(matrix3x2Int other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix3x2Int))
{
return false;
}
else
{
return this.Equals((matrix3x2Int)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2, row3);
}
public override string ToString()
{
return $"{row1}\n{row2}\n{row3}";
}
public static matrix3x2Int operator +(matrix3x2Int matrix1, matrix3x2Int matrix2)
{
return new matrix3x2Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2,
matrix1.row3 + matrix2.row3
);
}
public static matrix3x2Int operator -(matrix3x2Int matrix1, matrix3x2Int matrix2)
{
return new matrix3x2Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2,
matrix1.row3 - matrix2.row3
);
}
}
}
@@ -0,0 +1,144 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x3:IEquatable<matrix3x3>
{
[FieldOffset(0)]
public vec3d row1;
[FieldOffset(12)]
public vec3d row2;
[FieldOffset(24)]
public vec3d row3;
public matrix3x3(vec3d r0,vec3d r1,vec3d r2)
{
row1 = r0;
row2 = r1;
row3 = r2;
}
public matrix3x3(
float a11,float a12,float a13,
float a21,float a22,float a23,
float a31,float a32,float a33
)
{
row1 = new vec3d(a11, a12, a13);
row2 = new vec3d(a21, a22, a23);
row3 = new vec3d(a31, a32, a33);
}
public override int GetHashCode()
{
return HashCode.Combine(row1,row2,row3);
}
bool IEquatable<matrix3x3>.Equals(matrix3x3 other)
{
if (this.GetHashCode()!=other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix3x3))
{
return false;
}
else
{
return this.Equals((matrix3x3)obj);
}
}
public override string ToString()
{
return $"{row1}\n{row2}\n{row3}";
}
public static bool operator ==(matrix3x3 matrix1, matrix3x3 matrix2)
{
return matrix1.Equals(matrix2);
}
public static bool operator !=(matrix3x3 matrix1, matrix3x3 matrix2)
{
return !matrix1.Equals(matrix2);
}
public static matrix3x3 operator +(matrix3x3 matrix1, matrix3x3 matrix2)
{
return new matrix3x3(
matrix1.row1.X + matrix2.row1.X,
matrix1.row1.Y + matrix2.row1.Y,
matrix1.row1.Z + matrix2.row1.Z,
matrix1.row2.X + matrix2.row2.X,
matrix1.row2.Y + matrix2.row2.Y,
matrix1.row2.Z + matrix2.row2.Z,
matrix1.row3.X + matrix2.row3.X,
matrix1.row3.Y + matrix2.row3.Y,
matrix1.row3.Z + matrix2.row3.Z
);
}
public static matrix3x3 operator -(matrix3x3 matrix1, matrix3x3 matrix2)
{
return new matrix3x3(
matrix1.row1.X - matrix2.row1.X,
matrix1.row1.Y - matrix2.row1.Y,
matrix1.row1.Z - matrix2.row1.Z,
matrix1.row2.X - matrix2.row2.X,
matrix1.row2.Y - matrix2.row2.Y,
matrix1.row2.Z - matrix2.row2.Z,
matrix1.row3.X - matrix2.row3.X,
matrix1.row3.Y - matrix2.row3.Y,
matrix1.row3.Z - matrix2.row3.Z
);
}
public static matrix3x3 operator *(matrix3x3 array, float x)
{
return new matrix3x3(
array.row1 * x,
array.row2 * x,
array.row3 * x
);
}
public static matrix3x3 operator /(matrix3x3 array, float x)
{
return new matrix3x3(
array.row1/x,
array.row2/x,
array.row3/x
);
}
}
}
@@ -0,0 +1,83 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x4:IEquatable<matrix3x4>
{
[FieldOffset(0)]
public vec4d row1;
[FieldOffset(16)]
public vec4d row2;
[FieldOffset(32)]
public vec4d row3;
public matrix3x4(
vec4d r1,vec4d r2,vec4d r3
)
{
this.row1 = r1;
this.row2 = r2;
this.row3 = r3;
}
public matrix3x4(
float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24,
float a31, float a32, float a33, float a34
)
{
row1 = new vec4d(a11,a12,a13,a14);
row2 = new vec4d(a21,a22,a23,a24);
row3 = new vec4d(a31,a32,a33,a34);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix3x4))
{
return false;
}
else
{
return this.Equals((matrix3x4)obj);
}
}
bool IEquatable<matrix3x4>.Equals(matrix3x4 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3;
}
}
public override int GetHashCode()
{
return HashCode.Combine(this.row1,this.row2,this.row3);
}
public override string ToString()
{
return $"{this.row1}\n{this.row2}\n{this.row3}";
}
}
}
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x2:IEquatable<matrix4x2>
{
[FieldOffset(0)]
public vec2d row1;
[FieldOffset(8)]
public vec2d row2;
[FieldOffset(16)]
public vec2d row3;
[FieldOffset(24)]
public vec2d row4;
public matrix4x2(vec2d r1, vec2d r2, vec2d r3, vec2d r4)
{
row1 = r1;
row2 = r2;
row3 = r3;
row4 = r4;
}
public matrix4x2(
float a11, float a12,
float a21, float a22,
float a31, float a32,
float a41, float a42
)
{
row1 = new vec2d(a11, a12);
row2 = new vec2d(a21, a22);
row3 = new vec2d(a31, a32);
row4 = new vec2d(a41, a42);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() == typeof(matrix4x2))
{
return false;
}
else
{
return this.Equals((matrix4x2)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2, row3, row4);
}
public override string ToString()
{
return $"{row1}\n{row2}\n{row3}\n{row4}";
}
bool IEquatable<matrix4x2>.Equals(matrix4x2 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
&& this.row4 == other.row4;
}
}
}
}
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x3:IEquatable<matrix4x3>
{
[FieldOffset(0)]
public vec3d row1;
[FieldOffset(12)]
public vec3d row2;
[FieldOffset(24)]
public vec3d row3;
[FieldOffset(36)]
public vec3d row4;
public matrix4x3(
float a11, float a12, float a13,
float a21, float a22, float a23,
float a31, float a32, float a33,
float a41, float a42, float a43
)
{
row1 = new vec3d(a11, a12, a13);
row2 = new vec3d(a21, a22, a23);
row3 = new vec3d(a31, a32, a33);
row4 = new vec3d(a41, a42, a43);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix4x3))
{
return false;
}
else
{
return this.Equals((matrix4x3)obj);
}
}
bool IEquatable<matrix4x3>.Equals(matrix4x3 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
&& this.row4 == other.row4;
}
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public override string ToString()
{
return base.ToString();
}
}
}
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x4:IEquatable<matrix4x4>
{
[FieldOffset(0)]
public vec4d row1;
[FieldOffset(16)]
public vec4d row2;
[FieldOffset(32)]
public vec4d row3;
[FieldOffset(48)]
public vec4d row4;
public matrix4x4( vec4d r1,vec4d r2,vec4d r3,vec4d r4)
{
row1 = r1;
row2 = r2;
row3 = r3;
row4 = r4;
}
public matrix4x4(
float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24,
float a31, float a32, float a33, float a34,
float a41, float a42, float a43, float a44
)
{
row1 = new vec4d(a11, a12, a13, a14);
row2 = new vec4d(a21, a22, a23, a24);
row3 = new vec4d(a31, a32, a33, a34);
row4 = new vec4d(a41, a42, a43, a44);
}
public override bool Equals(object obj)
{
return base.Equals(obj);
}
bool IEquatable<matrix4x4>.Equals(matrix4x4 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
&& this.row4 == other.row4;
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2, row3, row4);
}
public override string ToString()
{
return $"{this.row1}\n{this.row2}\n{this.row3}\n{this.row4}";
}
public static matrix4x4 operator +(matrix4x4 matrix1, matrix4x4 matrix2)
{
return new matrix4x4(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2,
matrix1.row3 + matrix2.row3,
matrix1.row4 + matrix2.row4
);
}
public static matrix4x4 operator -(matrix4x4 matrix1, matrix4x4 matrix2)
{
return new matrix4x4(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2,
matrix1.row3 - matrix2.row3,
matrix1.row4 - matrix2.row4
);
}
public static matrix4x4 operator *(matrix4x4 array, float x)
{
return new matrix4x4(
array.row1 * x,
array.row2 * x,
array.row3 * x,
array.row4 * x
);
}
}
}
@@ -0,0 +1,44 @@
using Steamworks;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size = 8)]
public unsafe struct vec2dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
public vec2dInt(int x, int y)
{
this.X = x;
this.Y = y;
}
public static implicit operator vec2d(vec2dInt vec)
{
return new vec2d(vec.X,vec.Y);
}
public static implicit operator vec2dInt(vec2d vec)
{
return new vec2dInt((int)vec.X, (int)vec.Y);
}
public static vec2dInt operator +(vec2dInt vec1, vec2dInt vec2)
{
return new vec2dInt(vec1.X + vec2.X, vec1.Y + vec2.Y);
}
public static vec2dInt operator -(vec2dInt vec1, vec2dInt vec2)
{
return new vec2dInt(vec1.X - vec2.X, vec1.Y - vec2.Y);
}
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size =12)]
public struct vec3dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
[FieldOffset(8)]
public int Z;
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size =16)]
public struct vec4dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
[FieldOffset(8)]
public int Z;
[FieldOffset(12)]
public int W;
}
}