diff --git a/include/omath/color.h b/include/omath/Color.h similarity index 97% rename from include/omath/color.h rename to include/omath/Color.h index 6f574ae..e8da221 100644 --- a/include/omath/color.h +++ b/include/omath/Color.h @@ -9,7 +9,7 @@ #include "omath/Vector4.h" -namespace omath::color +namespace omath { struct HSV { @@ -27,8 +27,10 @@ namespace omath::color Clamp(0.f, 1.f); } - explicit Color() - ; + constexpr explicit Color() : Vector4() + { + + } [[nodiscard]] constexpr static Color FromRGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t a) { diff --git a/include/omath/Vector4.h b/include/omath/Vector4.h index 0daec48..46d61ae 100644 --- a/include/omath/Vector4.h +++ b/include/omath/Vector4.h @@ -14,7 +14,7 @@ namespace omath public: float w; - constexpr Vector4(float x = 0.f, float y = 0.f, float z = 0.f, float w = 0.f) : Vector3(x, y, z), w(w) {} + constexpr Vector4(float x, float y, float z, float w) : Vector3(x, y, z), w(w) {} constexpr Vector4() : Vector3(), w(0.f) {}; [[nodiscard]] diff --git a/source/color.cpp b/source/color.cpp index 1916733..1de3bfd 100644 --- a/source/color.cpp +++ b/source/color.cpp @@ -2,16 +2,12 @@ // Created by vlad on 2/4/24. // -#include "omath/color.h" +#include "omath/Color.h" #include #include -namespace omath::color +namespace omath { - Color::Color() : Vector4(0.f, 0.f, 0.f, 0.f) - { - - } } diff --git a/tests/UnitTestColor.cpp b/tests/UnitTestColor.cpp index a74de5c..a78276d 100644 --- a/tests/UnitTestColor.cpp +++ b/tests/UnitTestColor.cpp @@ -5,7 +5,7 @@ #include -using namespace omath::color; +using namespace omath; class UnitTestColor : public ::testing::Test { @@ -104,9 +104,9 @@ TEST_F(UnitTestColor, PredefinedColors) // Test non-member function: Blend for Vector3 TEST_F(UnitTestColor, BlendVector3) { - constexpr omath::color::Color v1(1.0f, 0.0f, 0.0f, 1.f); // Red - constexpr omath::color::Color v2(0.0f, 1.0f, 0.0f, 1.f); // Green - constexpr omath::color::Color blended = Blend(v1, v2, 0.5f); + constexpr Color v1(1.0f, 0.0f, 0.0f, 1.f); // Red + constexpr Color v2(0.0f, 1.0f, 0.0f, 1.f); // Green + constexpr Color blended = Blend(v1, v2, 0.5f); EXPECT_FLOAT_EQ(blended.x, 0.5f); EXPECT_FLOAT_EQ(blended.y, 0.5f); EXPECT_FLOAT_EQ(blended.z, 0.0f);