1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

General code refactoring/improvements in server, treegen and connection

This commit is contained in:
sfan5 2024-03-12 14:13:24 +01:00
parent 24f2c38093
commit bc4ab8b99e
34 changed files with 330 additions and 439 deletions

View file

@ -250,6 +250,16 @@ int myrand_range(int min, int max);
float myrand_range(float min, float max);
float myrand_float();
// Implements a C++11 UniformRandomBitGenerator using the above functions
struct MyRandGenerator {
typedef u32 result_type;
static constexpr result_type min() { return 0; }
static constexpr result_type max() { return MYRAND_RANGE; }
inline result_type operator()() {
return myrand();
}
};
/*
Miscellaneous functions
*/
@ -448,18 +458,18 @@ inline void wrappedApproachShortest(T &current, const T target, const T stepsize
}
}
void setPitchYawRollRad(core::matrix4 &m, const v3f &rot);
void setPitchYawRollRad(core::matrix4 &m, v3f rot);
inline void setPitchYawRoll(core::matrix4 &m, const v3f &rot)
inline void setPitchYawRoll(core::matrix4 &m, v3f rot)
{
setPitchYawRollRad(m, rot * core::DEGTORAD64);
setPitchYawRollRad(m, rot * core::DEGTORAD);
}
v3f getPitchYawRollRad(const core::matrix4 &m);
inline v3f getPitchYawRoll(const core::matrix4 &m)
{
return getPitchYawRollRad(m) * core::RADTODEG64;
return getPitchYawRollRad(m) * core::RADTODEG;
}
// Muliply the RGB value of a color linearly, and clamp to black/white