Setup entry point + integrated moonworks stuff

This commit is contained in:
2024-07-05 14:32:58 +02:00
parent e7a4a862be
commit 8334a24fd1
116 changed files with 16988 additions and 3 deletions
+20
View File
@@ -0,0 +1,20 @@
namespace Nerfed.Runtime;
public static class MathEx
{
public static float ToNearestMultiple(float value, float multiple) {
return MathF.Round(value / multiple, MidpointRounding.AwayFromZero) * multiple;
}
public static float Normalize(float value, float oldMin, float oldMax) {
return Remap(value, oldMin, oldMax, 0f, 1f);
}
public static float Denormalize(float value, float newMin, float newMax) {
return Remap(value, 0f, 1f, newMin, newMax);
}
public static float Remap(float value, float oldMin, float oldMax, float newMin, float newMax) {
return (value - oldMin) / (oldMax - oldMin) * (newMax - newMin) + newMin;
}
}