From a3e187bd0175af0ac87a47dee7df00af7765334f Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Tue, 14 May 2024 21:31:59 -0400 Subject: [PATCH] constexpr on vector functions --- CMakeLists.txt | 2 +- include/blt/math/vectors.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e96e06e..62fa748 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.17.8) +set(BLT_VERSION 0.17.9) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/math/vectors.h b/include/blt/math/vectors.h index 793e5d8..d83d397 100644 --- a/include/blt/math/vectors.h +++ b/include/blt/math/vectors.h @@ -433,19 +433,19 @@ namespace blt using color4 = vec4; using color3 = vec3; - inline color4 interpolate(const color4& in, const color4& desired, float factor) + inline constexpr color4 interpolate(const color4& in, const color4& desired, float factor) { auto diff = desired - in; return in + (diff * factor); } - inline color4 make_color(float r, float g, float b) + inline constexpr color4 make_color(float r, float g, float b) { return color4{r, g, b, 1.0f}; } template - inline blt::vec make_vec2(const blt::vec& t, size_t fill = 0) + inline constexpr blt::vec make_vec2(const blt::vec& t, size_t fill = 0) { if constexpr (size >= 2) { @@ -457,7 +457,7 @@ namespace blt } template - inline blt::vec make_vec3(const blt::vec& t, size_t fill = 0) + inline constexpr blt::vec make_vec3(const blt::vec& t, size_t fill = 0) { if constexpr (size >= 3) { @@ -474,7 +474,7 @@ namespace blt } template - inline blt::vec make_vec4(const blt::vec& t, size_t fill = 0) + inline constexpr blt::vec make_vec4(const blt::vec& t, size_t fill = 0) { if constexpr (size >= 4) {