const correctness stuff

This commit is contained in:
2026-03-11 13:32:25 -04:00
parent 06c2ca306a
commit d26c7ee348
31 changed files with 55 additions and 24 deletions

Binary file not shown.

View File

@ -14,7 +14,7 @@ public:
vec2(double _x, double _y); vec2(double _x, double _y);
vec2(const vec2 &rhs); vec2(const vec2 &rhs);
vec2& operator=(const vec2 &rhs); vec2& operator=(const vec2 &rhs);
bool operator==(vec2 rhs); bool operator==(const vec2 rhs) const;
vec2 operator+(vec2 rhs) const; vec2 operator+(vec2 rhs) const;
vec2 operator-(vec2 rhs) const; vec2 operator-(vec2 rhs) const;
@ -56,7 +56,7 @@ public:
mat2(const vec2 _col1, const vec2 _col2); mat2(const vec2 _col1, const vec2 _col2);
mat2& operator=(const mat2 rhs); mat2& operator=(const mat2 rhs);
bool operator==(const mat2 rhs); bool operator==(const mat2 rhs) const;
mat2 operator+(mat2 rhs) const; mat2 operator+(mat2 rhs) const;
mat2 operator-(mat2 rhs) const; mat2 operator-(mat2 rhs) const;

View File

@ -14,7 +14,7 @@ public:
vec2f(float _x, float _y); vec2f(float _x, float _y);
vec2f(const vec2f &rhs); vec2f(const vec2f &rhs);
vec2f& operator=(const vec2f &rhs); vec2f& operator=(const vec2f &rhs);
bool operator==(vec2f rhs); bool operator==(const vec2f rhs) const;
vec2f operator+(vec2f rhs) const; vec2f operator+(vec2f rhs) const;
vec2f operator-(vec2f rhs) const; vec2f operator-(vec2f rhs) const;
@ -56,7 +56,7 @@ public:
mat2f(const vec2f _col1, const vec2f _col2); mat2f(const vec2f _col1, const vec2f _col2);
mat2f& operator=(const mat2f rhs); mat2f& operator=(const mat2f rhs);
bool operator==(const mat2f rhs); bool operator==(const mat2f rhs) const;
mat2f operator+(mat2f rhs) const; mat2f operator+(mat2f rhs) const;
mat2f operator-(mat2f rhs) const; mat2f operator-(mat2f rhs) const;

View File

@ -0,0 +1,31 @@
#ifndef __AMSMATHUTIL25_VEC2I_HPP__
#define __AMSMATHUTIL25_VEC2I_HPP__
namespace ams
{
class vec2i
{
public:
int x;
int y;
vec2i();
vec2i(float _x, float _y);
vec2i(const vec2i &rhs);
vec2i& operator=(const vec2i &rhs);
bool operator==(const vec2i rhs) const;
vec2i operator+(vec2i rhs) const;
vec2i operator-(vec2i rhs) const;
vec2i operator*(float rhs) const;
vec2i operator/(float rhs) const;
friend vec2i operator-(vec2i rhs);
float& operator[](int ind);
const float& operator[](int ind) const;
};
};

View File

@ -19,7 +19,7 @@ public:
vec3(double _x, double _y, double _z); vec3(double _x, double _y, double _z);
vec3(const vec3 &rhs); vec3(const vec3 &rhs);
vec3& operator=(const vec3 &rhs); vec3& operator=(const vec3 &rhs);
bool operator==(vec3 rhs); bool operator==(const vec3 rhs) const;
vec3 operator+(vec3 rhs) const; vec3 operator+(vec3 rhs) const;
vec3 operator-(vec3 rhs) const; vec3 operator-(vec3 rhs) const;
@ -60,7 +60,7 @@ public:
mat3(const vec3 _col1, const vec3 _col2, const vec3 _col3); mat3(const vec3 _col1, const vec3 _col2, const vec3 _col3);
mat3& operator=(const mat3 rhs); mat3& operator=(const mat3 rhs);
bool operator==(const mat3 rhs); bool operator==(const mat3 rhs) const;
mat3 operator+(mat3 rhs) const; mat3 operator+(mat3 rhs) const;
mat3 operator-(mat3 rhs) const; mat3 operator-(mat3 rhs) const;

View File

@ -19,7 +19,7 @@ public:
vec3f(float _x, float _y, float _z); vec3f(float _x, float _y, float _z);
vec3f(const vec3f &rhs); vec3f(const vec3f &rhs);
vec3f& operator=(const vec3f &rhs); vec3f& operator=(const vec3f &rhs);
bool operator==(vec3f rhs); bool operator==(const vec3f rhs) const;
vec3f operator+(vec3f rhs) const; vec3f operator+(vec3f rhs) const;
vec3f operator-(vec3f rhs) const; vec3f operator-(vec3f rhs) const;
@ -60,7 +60,7 @@ public:
mat3f(const vec3f _col1, const vec3f _col2, const vec3f _col3); mat3f(const vec3f _col1, const vec3f _col2, const vec3f _col3);
mat3f& operator=(const mat3f rhs); mat3f& operator=(const mat3f rhs);
bool operator==(const mat3f rhs); bool operator==(const mat3f rhs) const;
mat3f operator+(mat3f rhs) const; mat3f operator+(mat3f rhs) const;
mat3f operator-(mat3f rhs) const; mat3f operator-(mat3f rhs) const;

View File

@ -19,7 +19,7 @@ public:
vec4(double _x, double _y, double _z, double _w); vec4(double _x, double _y, double _z, double _w);
vec4(const vec4 &rhs); vec4(const vec4 &rhs);
vec4& operator=(const vec4 &rhs); vec4& operator=(const vec4 &rhs);
bool operator==(vec4 rhs); bool operator==(const vec4 rhs) const;
vec4 operator+(vec4 rhs) const; vec4 operator+(vec4 rhs) const;
vec4 operator-(vec4 rhs) const; vec4 operator-(vec4 rhs) const;
@ -62,7 +62,7 @@ public:
mat4(const vec4 _col1, const vec4 _col2, const vec4 _col3, const vec4 _col4); mat4(const vec4 _col1, const vec4 _col2, const vec4 _col3, const vec4 _col4);
mat4& operator=(const mat4 rhs); mat4& operator=(const mat4 rhs);
bool operator==(const mat4 rhs); bool operator==(const mat4 rhs) const;
mat4 operator+(mat4 rhs) const; mat4 operator+(mat4 rhs) const;
mat4 operator-(mat4 rhs) const; mat4 operator-(mat4 rhs) const;

View File

@ -19,7 +19,7 @@ public:
vec4f(float _x, float _y, float _z, float _w); vec4f(float _x, float _y, float _z, float _w);
vec4f(const vec4f &rhs); vec4f(const vec4f &rhs);
vec4f& operator=(const vec4f &rhs); vec4f& operator=(const vec4f &rhs);
bool operator==(vec4f rhs); bool operator==(const vec4f rhs) const;
vec4f operator+(vec4f rhs) const; vec4f operator+(vec4f rhs) const;
vec4f operator-(vec4f rhs) const; vec4f operator-(vec4f rhs) const;
@ -62,7 +62,7 @@ public:
mat4f(const vec4f _col1, const vec4f _col2, const vec4f _col3, const vec4f _col4); mat4f(const vec4f _col1, const vec4f _col2, const vec4f _col3, const vec4f _col4);
mat4f& operator=(const mat4f rhs); mat4f& operator=(const mat4f rhs);
bool operator==(const mat4f rhs); bool operator==(const mat4f rhs) const;
mat4f operator+(mat4f rhs) const; mat4f operator+(mat4f rhs) const;
mat4f operator-(mat4f rhs) const; mat4f operator-(mat4f rhs) const;

View File

@ -27,7 +27,7 @@ vec2& vec2::operator=(const vec2 &rhs)
return *this; return *this;
} }
bool vec2::operator==(vec2 rhs) bool vec2::operator==(const vec2 rhs) const
{ {
bool ret = 1; bool ret = 1;
ret = ret & (rhs.x == x); ret = ret & (rhs.x == x);
@ -236,7 +236,7 @@ mat2& mat2::operator=(const mat2 rhs)
return *this; return *this;
} }
bool mat2::operator==(const mat2 rhs) bool mat2::operator==(const mat2 rhs) const
{ {
bool ret = 1; bool ret = 1;
int I; int I;

View File

@ -26,7 +26,7 @@ vec2f& vec2f::operator=(const vec2f &rhs)
return *this; return *this;
} }
bool vec2f::operator==(vec2f rhs) bool vec2f::operator==(const vec2f rhs) const
{ {
bool ret = 1; bool ret = 1;
ret = ret & (rhs.x == x); ret = ret & (rhs.x == x);
@ -233,7 +233,7 @@ mat2f& mat2f::operator=(const mat2f rhs)
return *this; return *this;
} }
bool mat2f::operator==(const mat2f rhs) bool mat2f::operator==(const mat2f rhs) const
{ {
bool ret = 1; bool ret = 1;
int I; int I;

View File

@ -35,7 +35,7 @@ vec3& vec3::operator=(const vec3 &rhs)
return *this; return *this;
} }
bool vec3::operator==(vec3 rhs) bool vec3::operator==(const vec3 rhs) const
{ {
return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z)); return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z));
} }
@ -266,7 +266,7 @@ mat3& mat3::operator=(const mat3 rhs)
return *this; return *this;
} }
bool mat3::operator==(const mat3 rhs) bool mat3::operator==(const mat3 rhs) const
{ {
bool ret = 1; bool ret = 1;
int I; int I;

View File

@ -35,7 +35,7 @@ vec3f& vec3f::operator=(const vec3f &rhs)
return *this; return *this;
} }
bool vec3f::operator==(vec3f rhs) bool vec3f::operator==(const vec3f rhs) const
{ {
return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z)); return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z));
} }
@ -266,7 +266,7 @@ mat3f& mat3f::operator=(const mat3f rhs)
return *this; return *this;
} }
bool mat3f::operator==(const mat3f rhs) bool mat3f::operator==(const mat3f rhs) const
{ {
bool ret = 1; bool ret = 1;
int I; int I;

View File

@ -41,7 +41,7 @@ vec4& vec4::operator=(const vec4 &rhs)
return *this; return *this;
} }
bool vec4::operator==(vec4 rhs) bool vec4::operator==(const vec4 rhs) const
{ {
return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z) && (this->w == rhs.w)); return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z) && (this->w == rhs.w));
} }
@ -268,7 +268,7 @@ mat4& mat4::operator=(const mat4 rhs)
return *this; return *this;
} }
bool mat4::operator==(const mat4 rhs) bool mat4::operator==(const mat4 rhs) const
{ {
bool ret = 1; bool ret = 1;
int I; int I;

View File

@ -41,7 +41,7 @@ vec4f& vec4f::operator=(const vec4f &rhs)
return *this; return *this;
} }
bool vec4f::operator==(vec4f rhs) bool vec4f::operator==(const vec4f rhs) const
{ {
return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z) && (this->w == rhs.w)); return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z) && (this->w == rhs.w));
} }
@ -268,7 +268,7 @@ mat4f& mat4f::operator=(const mat4f rhs)
return *this; return *this;
} }
bool mat4f::operator==(const mat4f rhs) bool mat4f::operator==(const mat4f rhs) const
{ {
bool ret = 1; bool ret = 1;
int I; int I;