You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Bring that Whole New World to the Old Continent too
Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6.
This commit is contained in:
@@ -29,8 +29,8 @@
|
||||
#ifndef MATH_FUNCS_H
|
||||
#define MATH_FUNCS_H
|
||||
|
||||
#include "typedefs.h"
|
||||
#include "math_defs.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
#ifndef NO_MATH_H
|
||||
#include "math.h"
|
||||
@@ -38,13 +38,13 @@
|
||||
|
||||
class Math {
|
||||
|
||||
|
||||
static uint32_t default_seed;
|
||||
|
||||
public:
|
||||
Math() {}; // useless to instance
|
||||
Math(){}; // useless to instance
|
||||
|
||||
enum {
|
||||
RANDOM_MAX=2147483647L
|
||||
RANDOM_MAX = 2147483647L
|
||||
};
|
||||
|
||||
static double sin(double p_x);
|
||||
@@ -60,35 +60,32 @@ public:
|
||||
static double deg2rad(double p_y);
|
||||
static double rad2deg(double p_y);
|
||||
static double sqrt(double p_x);
|
||||
static double fmod(double p_x,double p_y);
|
||||
static double fposmod(double p_x,double p_y);
|
||||
static double fmod(double p_x, double p_y);
|
||||
static double fposmod(double p_x, double p_y);
|
||||
static uint32_t rand_from_seed(uint32_t *seed);
|
||||
static double floor(double p_x);
|
||||
static double ceil(double p_x);
|
||||
static double ease(double p_x, double p_c);
|
||||
static int step_decimals(double p_step);
|
||||
static double stepify(double p_value,double p_step);
|
||||
static void seed(uint32_t x=0);
|
||||
static double stepify(double p_value, double p_step);
|
||||
static void seed(uint32_t x = 0);
|
||||
static void randomize();
|
||||
static uint32_t larger_prime(uint32_t p_val);
|
||||
static double dectime(double p_value,double p_amount, double p_step);
|
||||
|
||||
static double dectime(double p_value, double p_amount, double p_step);
|
||||
|
||||
static inline double linear2db(double p_linear) {
|
||||
|
||||
return Math::log( p_linear ) * 8.6858896380650365530225783783321;
|
||||
return Math::log(p_linear) * 8.6858896380650365530225783783321;
|
||||
}
|
||||
|
||||
static inline double db2linear(double p_db) {
|
||||
|
||||
return Math::exp( p_db * 0.11512925464970228420089957273422 );
|
||||
return Math::exp(p_db * 0.11512925464970228420089957273422);
|
||||
}
|
||||
|
||||
static bool is_nan(double p_val);
|
||||
static bool is_inf(double p_val);
|
||||
|
||||
|
||||
|
||||
static uint32_t rand();
|
||||
static double randf();
|
||||
|
||||
@@ -96,7 +93,6 @@ public:
|
||||
|
||||
static double random(double from, double to);
|
||||
|
||||
|
||||
static _FORCE_INLINE_ real_t abs(real_t g) {
|
||||
|
||||
#ifdef REAL_T_IS_DOUBLE
|
||||
@@ -115,8 +111,8 @@ public:
|
||||
uint32_t i;
|
||||
} u;
|
||||
|
||||
u.f=g;
|
||||
u.i&=2147483647u;
|
||||
u.f = g;
|
||||
u.i &= 2147483647u;
|
||||
return u.f;
|
||||
}
|
||||
|
||||
@@ -126,8 +122,8 @@ public:
|
||||
double d;
|
||||
uint64_t i;
|
||||
} u;
|
||||
u.d=g;
|
||||
u.i&=(uint64_t)9223372036854775807ll;
|
||||
u.d = g;
|
||||
u.i &= (uint64_t)9223372036854775807ll;
|
||||
return u.d;
|
||||
}
|
||||
|
||||
@@ -137,11 +133,10 @@ public:
|
||||
static int b;
|
||||
|
||||
#if (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0603) || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP // windows 8 phone?
|
||||
b = (int)((a>0.0f) ? (a + 0.5f):(a -0.5f));
|
||||
b = (int)((a > 0.0f) ? (a + 0.5f) : (a - 0.5f));
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER < 1800
|
||||
__asm fld a
|
||||
__asm fistp b
|
||||
__asm fld a __asm fistp b
|
||||
/*#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
|
||||
// use AT&T inline assembly style, document that
|
||||
// we use memory as output (=m) and input (m)
|
||||
@@ -152,12 +147,11 @@ public:
|
||||
: "m" (a));*/
|
||||
|
||||
#else
|
||||
b=lrintf(a); //assuming everything but msvc 2012 or earlier has lrint
|
||||
b = lrintf(a); //assuming everything but msvc 2012 or earlier has lrint
|
||||
#endif
|
||||
return b;
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
static _FORCE_INLINE_ int64_t dtoll(double p_double) { return (int64_t)p_double; } ///@TODO OPTIMIZE
|
||||
@@ -168,16 +162,14 @@ public:
|
||||
|
||||
static _FORCE_INLINE_ float lerp(float a, float b, float c) {
|
||||
|
||||
return a+(b-a)*c;
|
||||
return a + (b - a) * c;
|
||||
}
|
||||
|
||||
static double pow(double x, double y);
|
||||
static double log(double x);
|
||||
static double exp(double x);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#define Math_PI 3.14159265358979323846
|
||||
#define Math_SQRT12 0.7071067811865475244008443621048490
|
||||
|
||||
|
||||
Reference in New Issue
Block a user