From 98d0d6868ef47288f19ce41b4ce253adef9f7616 Mon Sep 17 00:00:00 2001 From: Scott Doxey Date: Tue, 15 Apr 2025 23:23:45 -0400 Subject: [PATCH] Removed Lerp / InverseLerp internal methods. --- RhythmGameUtilities/Scripts/Common.cs | 8 ++--- UnityPackage/Scripts/Common.cs | 8 ++--- .../RhythmGameUtilities/CommonInternal.hpp | 27 --------------- .../RhythmGameUtilities.cpp | 1 - tests/RhythmGameUtilities/CommonInternal.cpp | 34 ------------------- 5 files changed, 8 insertions(+), 70 deletions(-) delete mode 100644 include/RhythmGameUtilities/CommonInternal.hpp delete mode 100644 tests/RhythmGameUtilities/CommonInternal.cpp diff --git a/RhythmGameUtilities/Scripts/Common.cs b/RhythmGameUtilities/Scripts/Common.cs index 6a04ddf..fdb88cf 100644 --- a/RhythmGameUtilities/Scripts/Common.cs +++ b/RhythmGameUtilities/Scripts/Common.cs @@ -7,10 +7,10 @@ public static class CommonInternal { [DllImport("libRhythmGameUtilities", CallingConvention = CallingConvention.Cdecl)] - public static extern float LerpInternal(float a, float b, float t); + public static extern float Lerp(float a, float b, float t); [DllImport("libRhythmGameUtilities", CallingConvention = CallingConvention.Cdecl)] - public static extern float InverseLerpInternal(float a, float b, float v); + public static extern float InverseLerp(float a, float b, float v); } @@ -25,7 +25,7 @@ public static class Common /// The value used for interpolation. public static float Lerp(float a, float b, float t) { - return CommonInternal.LerpInternal(a, b, t); + return CommonInternal.Lerp(a, b, t); } /// @@ -36,7 +36,7 @@ public static float Lerp(float a, float b, float t) /// The value in the middle. public static float InverseLerp(float a, float b, float v) { - return CommonInternal.InverseLerpInternal(a, b, v); + return CommonInternal.InverseLerp(a, b, v); } } diff --git a/UnityPackage/Scripts/Common.cs b/UnityPackage/Scripts/Common.cs index 6a04ddf..fdb88cf 100644 --- a/UnityPackage/Scripts/Common.cs +++ b/UnityPackage/Scripts/Common.cs @@ -7,10 +7,10 @@ public static class CommonInternal { [DllImport("libRhythmGameUtilities", CallingConvention = CallingConvention.Cdecl)] - public static extern float LerpInternal(float a, float b, float t); + public static extern float Lerp(float a, float b, float t); [DllImport("libRhythmGameUtilities", CallingConvention = CallingConvention.Cdecl)] - public static extern float InverseLerpInternal(float a, float b, float v); + public static extern float InverseLerp(float a, float b, float v); } @@ -25,7 +25,7 @@ public static class Common /// The value used for interpolation. public static float Lerp(float a, float b, float t) { - return CommonInternal.LerpInternal(a, b, t); + return CommonInternal.Lerp(a, b, t); } /// @@ -36,7 +36,7 @@ public static float Lerp(float a, float b, float t) /// The value in the middle. public static float InverseLerp(float a, float b, float v) { - return CommonInternal.InverseLerpInternal(a, b, v); + return CommonInternal.InverseLerp(a, b, v); } } diff --git a/include/RhythmGameUtilities/CommonInternal.hpp b/include/RhythmGameUtilities/CommonInternal.hpp deleted file mode 100644 index 7549a44..0000000 --- a/include/RhythmGameUtilities/CommonInternal.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "Common.hpp" - -#ifdef _WIN32 -#define PACKAGE_API __declspec(dllexport) -#else -#define PACKAGE_API -#endif - -namespace RhythmGameUtilities -{ - -extern "C" -{ - PACKAGE_API float LerpInternal(float a, float b, float t) - { - return Lerp(a, b, t); - } - - PACKAGE_API float InverseLerpInternal(float a, float b, float v) - { - return InverseLerp(a, b, v); - } -} - -} // namespace RhythmGameUtilities diff --git a/include/RhythmGameUtilities/RhythmGameUtilities.cpp b/include/RhythmGameUtilities/RhythmGameUtilities.cpp index fab6483..ef3c4bd 100644 --- a/include/RhythmGameUtilities/RhythmGameUtilities.cpp +++ b/include/RhythmGameUtilities/RhythmGameUtilities.cpp @@ -2,7 +2,6 @@ #include "Audio.hpp" #include "Common.hpp" -#include "CommonInternal.hpp" #include "Parsers.hpp" #include "ParsersInternal.hpp" #include "Utilities.hpp" diff --git a/tests/RhythmGameUtilities/CommonInternal.cpp b/tests/RhythmGameUtilities/CommonInternal.cpp deleted file mode 100644 index ac9ffc1..0000000 --- a/tests/RhythmGameUtilities/CommonInternal.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "RhythmGameUtilities/CommonInternal.hpp" - -using namespace RhythmGameUtilities; - -void testInverseLerpInternal() -{ - auto value = InverseLerpInternal(0, 10, 5); - - assert(abs(0.5 - value) < 0.01); - - std::cout << "."; -} - -void testLerpInternal() -{ - auto value = LerpInternal(0, 10, 0.5f); - - assert(5 == value); - - std::cout << "."; -} - -int main() -{ - testInverseLerpInternal(); - testLerpInternal(); - - return 0; -}