修改OpenGl渲染底层之前

This commit is contained in:
2025-10-20 20:50:12 +08:00
parent 1b011b9b68
commit 2b888aae5b
61 changed files with 1609 additions and 680 deletions

View File

@@ -84,6 +84,7 @@ typedef struct VecPos
y -= other.y;
return *this;
}
} VecPos;
// 浮点数坐标向量
@@ -120,6 +121,12 @@ typedef struct VecFPos
return VecFPos(x * other.x, y * other.y);
}
// 除法运算符重载:除以一个 float 值
VecFPos operator/(float value) const
{
return VecFPos(x / value, y / value);
}
// 等于运算符重载:判断两个 VecFPos 是否相等
// 注意:浮点数比较需要考虑精度问题
bool operator==(const VecFPos &other) const
@@ -212,38 +219,19 @@ typedef struct VecPos3
return x == other.x && y == other.y && z == other.z;
}
bool operator!=(const VecPos3 &other) const
{
return x != other.x || y != other.y || z != other.z;
}
} VecPos3;
typedef struct VecFPos3
{
float x;
float y;
float z;
VecFPos3(float x_ = 0, float y_ = 0, float z_ = 0) : x(x_), y(y_), z(z_) {}
VecFPos3 operator+(const VecFPos3 &other) const
{
return VecFPos3(x + other.x, y + other.y, z + other.z);
}
VecFPos3 operator-(const VecFPos3 &other) const
{
return VecFPos3(x - other.x, y - other.y, z - other.z);
}
bool operator==(const VecFPos3 &other) const
{
return x == other.x && y == other.y && z == other.z;
}
} VecFPos3;
typedef struct VecSpeed3
{
float x;
float y;
float z;
VecSpeed3(float x_ = 0, float y_ = 0, float z_ = 0) : x(x_), y(y_), z(z_) {}
int x;
int y;
int z;
VecSpeed3(int x_ = 0, int y_ = 0, int z_ = 0) : x(x_), y(y_), z(z_) {}
VecSpeed3 operator+(const VecSpeed3 &other) const
{