Compare commits

...

2 Commits

Author SHA1 Message Date
450d6b4ecc HF 2025-09-07 21:37:36 +05:30
77314b62b7 HF 2025-09-07 18:03:01 +05:30
4 changed files with 26 additions and 26 deletions

View File

@ -9,7 +9,5 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
project(IAMath) project(IAMath)
add_subdirectory(Dependencies/IACore)
add_subdirectory(Src/IAMath) add_subdirectory(Src/IAMath)
add_subdirectory(Src/IAMathTest) add_subdirectory(Src/IAMathTest)

View File

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#pragma once
#include <IAMath/Vec.hpp> #include <IAMath/Vec.hpp>
namespace ia::iam namespace ia::iam

View File

@ -14,7 +14,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <iacore/string.hpp> #pragma once
#include <IACore/String.hpp>
namespace ia::iam namespace ia::iam
{ {
@ -26,7 +28,7 @@ namespace ia::iam
_value_type Data[2]; _value_type Data[2];
}; };
struct { struct {
_value_type X{}, Y{}; _value_type X, Y;
}; };
struct { struct {
_value_type U, V; _value_type U, V;
@ -39,32 +41,32 @@ namespace ia::iam
}; };
}; };
Vec2 operator+(IN CONST Vec2<_value_type>& other) Vec2 operator+(IN CONST Vec2<_value_type>& other) CONST
{ {
return { X + other.X, Y + other.Y }; return { X + other.X, Y + other.Y };
} }
Vec2 operator-(IN CONST Vec2<_value_type>& other) Vec2 operator-(IN CONST Vec2<_value_type>& other) CONST
{ {
return { X - other.X, Y - other.Y }; return { X - other.X, Y - other.Y };
} }
Vec2 operator*(IN CONST Vec2<_value_type>& other) Vec2 operator*(IN CONST Vec2<_value_type>& other) CONST
{ {
return { X * other.X, Y * other.Y }; return { X * other.X, Y * other.Y };
} }
Vec2 operator/(IN CONST Vec2<_value_type>& other) Vec2 operator/(IN CONST Vec2<_value_type>& other) CONST
{ {
return { X / other.X, Y / other.Y }; return { X / other.X, Y / other.Y };
} }
Vec2 operator*(IN _value_type other) Vec2 operator*(IN _value_type other) CONST
{ {
return { X * other, Y * other }; return { X * other, Y * other };
} }
Vec2 operator/(IN _value_type other) Vec2 operator/(IN _value_type other) CONST
{ {
return { X / other, Y / other }; return { X / other, Y / other };
} }
@ -83,7 +85,7 @@ namespace ia::iam
_value_type Data[3]; _value_type Data[3];
}; };
struct { struct {
_value_type X{}, Y{}, Z{}; _value_type X, Y, Z;
}; };
struct { struct {
_value_type R, G, B; _value_type R, G, B;
@ -96,32 +98,32 @@ namespace ia::iam
}; };
}; };
Vec3 operator+(IN CONST Vec3<_value_type>& other) Vec3 operator+(IN CONST Vec3<_value_type>& other) CONST
{ {
return { X + other.X, Y + other.Y, Z + other.Z }; return { X + other.X, Y + other.Y, Z + other.Z };
} }
Vec3 operator-(IN CONST Vec3<_value_type>& other) Vec3 operator-(IN CONST Vec3<_value_type>& other) CONST
{ {
return { X - other.X, Y - other.Y, Z - other.Z }; return { X - other.X, Y - other.Y, Z - other.Z };
} }
Vec3 operator*(IN CONST Vec3<_value_type>& other) Vec3 operator*(IN CONST Vec3<_value_type>& other) CONST
{ {
return { X * other.X, Y * other.Y, Z * other.Z }; return { X * other.X, Y * other.Y, Z * other.Z };
} }
Vec3 operator/(IN CONST Vec3<_value_type>& other) Vec3 operator/(IN CONST Vec3<_value_type>& other) CONST
{ {
return { X / other.X, Y / other.Y, Z / other.Z }; return { X / other.X, Y / other.Y, Z / other.Z };
} }
Vec3 operator*(IN _value_type other) Vec3 operator*(IN _value_type other) CONST
{ {
return { X * other, Y * other, Z * other }; return { X * other, Y * other, Z * other };
} }
Vec3 operator/(IN _value_type other) Vec3 operator/(IN _value_type other) CONST
{ {
return { X / other, Y / other, Z / other }; return { X / other, Y / other, Z / other };
} }
@ -140,7 +142,7 @@ namespace ia::iam
_value_type Data[4]; _value_type Data[4];
}; };
struct { struct {
_value_type X{}, Y{}, Z{}, W{}; _value_type X, Y, Z, W;
}; };
struct { struct {
_value_type R, G, B, A; _value_type R, G, B, A;
@ -153,32 +155,32 @@ namespace ia::iam
}; };
}; };
Vec4 operator+(IN CONST Vec4<_value_type>& other) Vec4 operator+(IN CONST Vec4<_value_type>& other) CONST
{ {
return { X + other.X, Y + other.Y, Z + other.Z, W + other.W }; return { X + other.X, Y + other.Y, Z + other.Z, W + other.W };
} }
Vec4 operator-(IN CONST Vec4<_value_type>& other) Vec4 operator-(IN CONST Vec4<_value_type>& other) CONST
{ {
return { X - other.X, Y - other.Y, Z - other.Z, W - other.W }; return { X - other.X, Y - other.Y, Z - other.Z, W - other.W };
} }
Vec4 operator*(IN CONST Vec4<_value_type>& other) Vec4 operator*(IN CONST Vec4<_value_type>& other) CONST
{ {
return { X * other.X, Y * other.Y, Z * other.Z, W * other.W }; return { X * other.X, Y * other.Y, Z * other.Z, W * other.W };
} }
Vec4 operator/(IN CONST Vec4<_value_type>& other) Vec4 operator/(IN CONST Vec4<_value_type>& other) CONST
{ {
return { X / other.X, Y / other.Y, Z / other.Z, W / other.W }; return { X / other.X, Y / other.Y, Z / other.Z, W / other.W };
} }
Vec4 operator*(IN _value_type other) Vec4 operator*(IN _value_type other) CONST
{ {
return { X * other, Y * other, Z * other, W * other }; return { X * other, Y * other, Z * other, W * other };
} }
Vec4 operator/(IN _value_type other) Vec4 operator/(IN _value_type other) CONST
{ {
return { X / other, Y / other, Z / other, W / other }; return { X / other, Y / other, Z / other, W / other };
} }

View File

@ -1,8 +1,6 @@
add_executable(IAMathTest imp/cpp/Main.cpp) add_executable(IAMathTest imp/cpp/Main.cpp)
target_compile_options(IAMathTest PRIVATE target_compile_options(IAMathTest PRIVATE
"-g"
"-O0"
"-D__IA_DEBUG=1" "-D__IA_DEBUG=1"
) )