master #1

Merged
BRNSystems merged 55 commits from Mirrorlandia_minetest/minetest:master into master 2023-11-24 22:11:18 +01:00
Showing only changes of commit 7cb20dd6c2 - Show all commits

@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irr_aabb3d.h"
#include "SColor.h"
#include <matrix4.h>
#include <cmath>
#define rangelim(d, min, max) ((d) < (min) ? (min) : ((d) > (max) ? (max) : (d)))
#define myfloor(x) ((x) < 0.0 ? (int)(x) - 1 : (int)(x))
@ -195,30 +196,10 @@ struct MeshGrid {
*
* \note This is also used in cases where degrees wrapped to the range [0, 360]
* is innapropriate (e.g. pitch needs negative values)
*
* \internal functionally equivalent -- although precision may vary slightly --
* to fmodf((f), 360.0f) however empirical tests indicate that this approach is
* faster.
*/
inline float modulo360f(float f)
{
int sign;
int whole;
float fraction;
if (f < 0) {
f = -f;
sign = -1;
} else {
sign = 1;
}
whole = f;
fraction = f - whole;
whole %= 360;
return sign * (whole + fraction);
return fmodf(f, 360.0f);
}