From 6faf4ee0673ed5834eb624ce57e8521e1894f11c Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 13 Mar 2013 12:48:14 +0000 Subject: [PATCH] =?UTF-8?q?base:=20roll=20our=20own=20constants=20because?= =?UTF-8?q?=20it=E2=80=99s=20always=20a=20pain=20in=20the=20ass=20to=20get?= =?UTF-8?q?=20M=5FPI=20from=20the=20platform=20headers=20and=20cast=20it?= =?UTF-8?q?=20to=20float.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Makefile.am | 1 + src/easymesh/csgbsp.cpp | 13 ----------- src/easymesh/easymesh.cpp | 31 ++++++++----------------- src/gpu/lolfx.cpp | 13 ----------- src/image/color/cie1931.cpp | 14 +++++------ src/lol/math/all.h | 1 + src/lol/math/constants.h | 46 +++++++++++++++++++++++++++++++++++++ src/lolcore.vcxproj | 1 + src/lolcore.vcxproj.filters | 6 +++++ src/math/geometry.cpp | 13 ----------- src/math/real.cpp | 15 +----------- src/math/trig.cpp | 14 +++++------ src/math/vector.cpp | 27 ++++++---------------- test/benchmark/trig.cpp | 11 +-------- test/btphystest.cpp | 19 ++------------- tutorial/12_voronoi.cpp | 21 ++++------------- 16 files changed, 91 insertions(+), 155 deletions(-) create mode 100644 src/lol/math/constants.h diff --git a/src/Makefile.am b/src/Makefile.am index 6bd42829..38eba13b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,6 +38,7 @@ liblolcore_headers = \ lol/math/all.h \ lol/math/functions.h lol/math/vector.h lol/math/half.h lol/math/real.h \ lol/math/remez.h lol/math/geometry.h lol/math/interp.h lol/math/rand.h \ + lol/math/constants.h \ \ lol/sys/all.h \ lol/sys/init.h lol/sys/file.h lol/sys/thread.h lol/sys/atomic.h \ diff --git a/src/easymesh/csgbsp.cpp b/src/easymesh/csgbsp.cpp index 5066fe90..3d6276b3 100644 --- a/src/easymesh/csgbsp.cpp +++ b/src/easymesh/csgbsp.cpp @@ -18,19 +18,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#elif defined _WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#endif - #include "core.h" namespace lol diff --git a/src/easymesh/easymesh.cpp b/src/easymesh/easymesh.cpp index 7bba3a1b..ea0b2929 100644 --- a/src/easymesh/easymesh.cpp +++ b/src/easymesh/easymesh.cpp @@ -19,19 +19,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#elif defined _WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#endif - #include "core.h" #include "easymesh/easymesh-compiler.h" @@ -1460,7 +1447,7 @@ void EasyMesh::AppendCapsule(int ndivisions, float h, float d) /* Fill in the icosahedron vertices, rotating them so that there * is a vertex at [0 1 0] and [0 -1 0] after normalisation. */ float phi = 0.5f + 0.5f * sqrt(5.f); - mat3 mat = mat3::rotate(asin(1.f / sqrt(2.f + phi)) * (180.f / (float)M_PI), + mat3 mat = mat3::rotate(asin(1.f / sqrt(2.f + phi)) * (180.f / F_PI), vec3(0.f, 0.f, 1.f)); for (int i = 0; i < 4; i++) { @@ -1508,10 +1495,10 @@ void EasyMesh::AppendCapsule(int ndivisions, float h, float d) //keep normalized until the end of the UV calculations p[k] = normalize(p[k]); - uv[k].x = (lol::atan2(p[k].z, p[k].x) + (float)M_PI) / ((float)M_PI * 2.f); + uv[k].x = (lol::atan2(p[k].z, p[k].x) + F_PI) / (F_PI * 2.f); if (abs(p[k].y) >= 1.0f) uv[k].x = -1.f; - uv[k].y = lol::atan2(p[k].y, dot(p[k], normalize(p[k] * vec3(1.f,0.f,1.f)))) / (float)M_PI + 0.5f; + uv[k].y = lol::atan2(p[k].y, dot(p[k], normalize(p[k] * vec3(1.f,0.f,1.f)))) / F_PI + 0.5f; if (h) { if (uv[k].y > .5f) @@ -1602,13 +1589,13 @@ void EasyMesh::AppendTorus(int ndivisions, float d1, float d2) int j2 = (j + dj) % njdiv; //Location on the donut - float x = 0.5f * (r2 - r1) * (float)lol::cos(2.0 * M_PI * i2 / nidiv) + 0.5f * (r1 + r2); - float y = 0.5f * (r2 - r1) * (float)lol::sin(2.0 * M_PI * i2 / nidiv); + float x = 0.5f * (r2 - r1) * (float)lol::cos(2.f * F_PI * i2 / nidiv) + 0.5f * (r1 + r2); + float y = 0.5f * (r2 - r1) * (float)lol::sin(2.f * F_PI * i2 / nidiv); float z = 0.0f; //Center circle - float ca = (float)lol::cos(2.0 * M_PI * j2 / njdiv); - float sa = (float)lol::sin(2.0 * M_PI * j2 / njdiv); + float ca = (float)lol::cos(2.f * F_PI * j2 / njdiv); + float sa = (float)lol::sin(2.f * F_PI * j2 / njdiv); //Actual location float x2 = x * ca - z * sa; @@ -2382,8 +2369,8 @@ void EasyMesh::SmoothMesh(int main_pass, int split_per_main_pass, int smooth_per //Calculate new master vertex float n = (float)connected_vert.Count(); - //b(n) = 5/4 - pow(3 + 2 * cos(2 * M_PI / n), 2) / 32 - float beta = 3.f + 2.f * cos(2.f * (float)M_PI / n); + //b(n) = 5/4 - pow(3 + 2 * cos(2.f * F_PI / n), 2) / 32 + float beta = 3.f + 2.f * cos(2.f * F_PI / n); beta = 5.f / 4.f - beta * beta / 32.f; //a(n) = n * (1 - b(n)) / b(n) float alpha = (n * (1 - beta)) / beta; diff --git a/src/gpu/lolfx.cpp b/src/gpu/lolfx.cpp index 26de7852..8298c55d 100644 --- a/src/gpu/lolfx.cpp +++ b/src/gpu/lolfx.cpp @@ -17,19 +17,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#elif defined _WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#endif - #include "core.h" #include "gpu/lolfx-compiler.h" diff --git a/src/image/color/cie1931.cpp b/src/image/color/cie1931.cpp index 9b89f6a4..bc0660b3 100644 --- a/src/image/color/cie1931.cpp +++ b/src/image/color/cie1931.cpp @@ -26,8 +26,6 @@ namespace lol float Color::DistanceCIEDE2000(vec3 lab1, vec3 lab2) { - float const pi = 3.141592653589793f; - float C1 = length(lab1.yz); float C2 = length(lab2.yz); float C_ = 0.5f * (C1 + C2); @@ -48,20 +46,20 @@ float Color::DistanceCIEDE2000(vec3 lab1, vec3 lab2) float hp1 = atan2(lab1.z, ap1); float hp2 = atan2(lab2.z, ap2); - float dhp = fmod(hp2 - hp1 + 3.f * pi, 2.f * pi) - pi; /* -pi .. pi */ + float dhp = fmod(hp2 - hp1 + 3.f * F_PI, 2.f * F_PI) - F_PI; /* -pi .. pi */ float dHp = 2.f * sqrt(Cp1 * Cp2) * sin(0.5f * dhp); - float Hp_ = Cp1 * Cp2 ? fmod(hp1 + 0.5f * dhp + 2.f * pi, 2.f * pi) : hp1 + hp2; /* 0 .. 2pi */ + float Hp_ = Cp1 * Cp2 ? fmod(hp1 + 0.5f * dhp + 2.f * F_PI, 2.f * F_PI) : hp1 + hp2; /* 0 .. 2pi */ - float T = 1.f - 0.17f * cos(Hp_ - pi / 6.f) + float T = 1.f - 0.17f * cos(Hp_ - F_PI / 6.f) + 0.24f * cos(2.f * Hp_) - + 0.32f * cos(3.f * Hp_ + pi / 30.f) - - 0.20f * cos(4.f * Hp_ - 0.35f * pi); + + 0.32f * cos(3.f * Hp_ + F_PI / 30.f) + - 0.20f * cos(4.f * Hp_ - 0.35f * F_PI); float SL = 1.f + 0.015f * (L_ - 50) * (L_ - 50) / sqrt(20.f + (L_ - 50) * (L_ - 50)); float SC = 1.f + 0.045f * Cp_; float SH = 1.f + 0.015f * Cp_ * T; float RT = -2.f * sqrt(pow(Cp_, 7.f) / (pow(Cp_, 7.f) + pow(25.f, 7.f))) - * sin(pi / 3.f * exp(-pow((Hp_ * 180.f / pi - 275.f) / 25.f, 2.f))); + * sin(F_PI / 3.f * exp(-pow((Hp_ * 180.f / F_PI - 275.f) / 25.f, 2.f))); dLp /= SL; dCp /= SC; diff --git a/src/lol/math/all.h b/src/lol/math/all.h index e0c889d2..f33b8056 100644 --- a/src/lol/math/all.h +++ b/src/lol/math/all.h @@ -11,6 +11,7 @@ #if !defined __LOL_MATH_ALL_H__ #define __LOL_MATH_ALL_H__ +#include #include #include #include diff --git a/src/lol/math/constants.h b/src/lol/math/constants.h new file mode 100644 index 00000000..50d50a4f --- /dev/null +++ b/src/lol/math/constants.h @@ -0,0 +1,46 @@ +// +// Lol Engine +// +// Copyright: (c) 2010-2013 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://www.wtfpl.net/ for more details. +// + +// +// Various maths constants +// ----------------------- +// + +#if !defined __LOL_MATH_CONSTANTS_H__ +#define __LOL_MATH_CONSTANTS_H__ + +namespace lol +{ + +#define LOL_MATH_CONSTANT(name, value) \ + static ldouble const LD_##name = value; \ + static double const D_##name = (double)LD_##name; \ + static float const F_##name = (float)LD_##name; + +/* These values are truncated, not rounded, because I don’t care. */ + +LOL_MATH_CONSTANT(PI, 3.14159265358979323846264338327950288419716939937L) +LOL_MATH_CONSTANT(PI_2, 1.57079632679489661923132169163975144209858469968L) +LOL_MATH_CONSTANT(PI_3, 1.04719755119659774615421446109316762806572313312L) +LOL_MATH_CONSTANT(PI_4, 0.78539816339744830961566084581987572104929234984L) + +LOL_MATH_CONSTANT(1_PI, 0.31830988618379067153776752674502872406891929148L) +LOL_MATH_CONSTANT(2_PI, 0.63661977236758134307553505349005744813783858296L) + +LOL_MATH_CONSTANT(SQRT_2, 1.41421356237309504880168872420969807856967187537L) +LOL_MATH_CONSTANT(SQRT_3, 1.73205080756887729352744634150587236694280525381L) +LOL_MATH_CONSTANT(SQRT_1_2, 0.70710678118654752440084436210484903928483593768L) + +#undef LOL_MATH_CONSTANT + +} /* namespace lol */ + +#endif // __LOL_MATH_CONSTANTS_H__ + diff --git a/src/lolcore.vcxproj b/src/lolcore.vcxproj index bd1e4787..106b4549 100644 --- a/src/lolcore.vcxproj +++ b/src/lolcore.vcxproj @@ -216,6 +216,7 @@ + diff --git a/src/lolcore.vcxproj.filters b/src/lolcore.vcxproj.filters index c74dfd6c..59a26f57 100644 --- a/src/lolcore.vcxproj.filters +++ b/src/lolcore.vcxproj.filters @@ -530,6 +530,12 @@ lol\sys + + lol\math + + + lol\math + lol\math diff --git a/src/math/geometry.cpp b/src/math/geometry.cpp index 12d448bc..376b55f8 100644 --- a/src/math/geometry.cpp +++ b/src/math/geometry.cpp @@ -13,19 +13,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#elif defined _WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#endif - #include /* free() */ #include /* strdup() */ diff --git a/src/math/real.cpp b/src/math/real.cpp index c75f3af6..0e38ace5 100644 --- a/src/math/real.cpp +++ b/src/math/real.cpp @@ -12,19 +12,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#elif defined WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#endif - #include #include #include @@ -796,7 +783,7 @@ template<> real gamma(real const &x) * precision values in order to attain the desired accuracy. It might * also be useful to sort the ck values by decreasing absolute value * and do the addition in this order. */ - int a = ceilf(logf(2) / logf(2 * M_PI) * real::BIGITS * real::BIGIT_BITS); + int a = ceilf(logf(2) / logf(2 * F_PI) * real::BIGITS * real::BIGIT_BITS); real ret = sqrt(real::R_PI() * 2); real fact_k_1 = real::R_1(); diff --git a/src/math/trig.cpp b/src/math/trig.cpp index 05fa4710..0b4cba02 100644 --- a/src/math/trig.cpp +++ b/src/math/trig.cpp @@ -23,8 +23,6 @@ using namespace std; namespace lol { -static const double PI = 3.14159265358979323846264; -static const double NEG_PI = -3.14159265358979323846264; static const double PI_2 = 1.57079632679489661923132; static const double PI_4 = 0.785398163397448309615661; static const double INV_PI = 0.318309886183790671537768; @@ -255,7 +253,7 @@ double lol_sin(double x) * cycles required. If odd, we'll need to change the sign of the * result. */ #if defined __CELLOS_LV2__ - double sign = lol_fsel(x, PI, NEG_PI); + double sign = lol_fsel(x, D_PI, -D_PI); double num_cycles = lol_round(absx); double is_even = lol_trunc(num_cycles * HALF) - (num_cycles * HALF); sign = lol_fsel(is_even, sign, -sign); @@ -291,7 +289,7 @@ double lol_sin(double x) #endif #if !defined __CELLOS_LV2__ - sign *= (x >= 0.0) ? PI : NEG_PI; + sign *= (x >= 0.0) ? D_PI : -D_PI; #endif /* Compute a Tailor series for sin() and combine sign information. */ @@ -352,7 +350,7 @@ double lol_cos(double x) double sub2 = (SC[4] * x4 + SC[2]) * x4 + SC[0]; double taylor = sub2 * x2 + sub1; - return x1 * taylor * sign * PI; + return x1 * taylor * sign * D_PI; } #endif @@ -401,7 +399,7 @@ void lol_sincos(double x, double *sinx, double *cosx) double num_cycles = lol_round(absx); double is_even = lol_trunc(num_cycles * HALF) - (num_cycles * HALF); - double sin_sign = lol_fsel(x, PI, NEG_PI); + double sin_sign = lol_fsel(x, D_PI, -D_PI); sin_sign = lol_fsel(is_even, sin_sign, -sin_sign); double cos_sign = lol_fsel(is_even, ONE, NEG_ONE); #else @@ -436,14 +434,14 @@ void lol_sincos(double x, double *sinx, double *cosx) double subc1 = ((SC[5] * x4 + SC[3]) * x4 + SC[1]) * x4 + ONE; double subc2 = (SC[4] * x4 + SC[2]) * x4 + SC[0]; double taylorc = subc2 * x2 + subc1; - *cosx = x1 * taylorc * cos_sign * PI; + *cosx = x1 * taylorc * cos_sign * D_PI; return; } #endif #if !defined __CELLOS_LV2__ - sin_sign *= (x >= 0.0) ? PI : NEG_PI; + sin_sign *= (x >= 0.0) ? D_PI : -D_PI; #endif double x2 = absx * absx; diff --git a/src/math/vector.cpp b/src/math/vector.cpp index f0fd3856..fc356f64 100644 --- a/src/math/vector.cpp +++ b/src/math/vector.cpp @@ -12,19 +12,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#elif defined _WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#endif - #include /* free() */ #include /* strdup() */ @@ -348,7 +335,7 @@ template<> mat4 mat4::translate(vec3 v) template<> mat2 mat2::rotate(float degrees) { - degrees *= (M_PI / 180.0f); + degrees *= (F_PI / 180.0f); float st = sin(degrees); float ct = cos(degrees); @@ -366,7 +353,7 @@ template<> mat2 mat2::rotate(float degrees) template<> mat3 mat3::rotate(float degrees, float x, float y, float z) { - degrees *= (M_PI / 180.0f); + degrees *= (F_PI / 180.0f); float st = sin(degrees); float ct = cos(degrees); @@ -485,7 +472,7 @@ template<> quat::Quat(mat4 const &m) template<> quat quat::rotate(float degrees, vec3 const &v) { - degrees *= (M_PI / 360.0f); + degrees *= (F_PI / 360.0f); vec3 tmp = normalize(v) * sin(degrees); @@ -531,14 +518,14 @@ template<> vec3 vec3::toeuler(quat const &q) atan2(2.f * (q.w * q.z + q.y * q.x), 1.f - 2.f * (q.z * q.z + q.y * q.y))); - return (float)(180.0f / M_PI / n) * ret; + return (180.0f / F_PI / n) * ret; } static inline mat3 mat3_fromeuler_generic(vec3 const &v, int i, int j, int k) { mat3 ret; - vec3 radians = (float)(M_PI / 180.0f) * v; + vec3 radians = (F_PI / 180.0f) * v; float s0 = sin(radians[0]), c0 = cos(radians[0]); float s1 = sin(radians[1]), c1 = cos(radians[1]); float s2 = sin(radians[2]), c2 = cos(radians[2]); @@ -604,7 +591,7 @@ static inline mat3 mat3_fromeuler_generic(vec3 const &v, int i, int j, int k) static inline quat quat_fromeuler_generic(vec3 const &v, int i, int j, int k) { - vec3 half_angles = (float)(M_PI / 360.0f) * v; + vec3 half_angles = (F_PI / 360.0f) * v; float s0 = sin(half_angles[0]), c0 = cos(half_angles[0]); float s1 = sin(half_angles[1]), c1 = cos(half_angles[1]); float s2 = sin(half_angles[2]), c2 = cos(half_angles[2]); @@ -754,7 +741,7 @@ template<> mat4 mat4::frustum(float left, float right, float bottom, template<> mat4 mat4::perspective(float fov_y, float width, float height, float near, float far) { - fov_y *= (M_PI / 180.0f); + fov_y *= (F_PI / 180.0f); float t2 = tanf(fov_y * 0.5f); float t1 = t2 * width / height; diff --git a/test/benchmark/trig.cpp b/test/benchmark/trig.cpp index e388a725..33b27650 100644 --- a/test/benchmark/trig.cpp +++ b/test/benchmark/trig.cpp @@ -12,15 +12,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -#elif defined _WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -#endif - #include #if defined HAVE_FASTMATH_H @@ -55,7 +46,7 @@ void bench_trig(int mode) break; case 2: for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) - pf[i] = rand(-M_PI, M_PI); + pf[i] = rand(-F_PI, F_PI); break; case 3: for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) diff --git a/test/btphystest.cpp b/test/btphystest.cpp index 62f90d34..9ef7add6 100644 --- a/test/btphystest.cpp +++ b/test/btphystest.cpp @@ -9,21 +9,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#elif defined _WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#else -# include -#endif - #include "core.h" #include "loldebug.h" @@ -277,8 +262,8 @@ void BtPhysTest::TickGame(float seconds) Ticker::Shutdown(); m_loop_value += seconds; - if (m_loop_value > M_PI * 2.0f) - m_loop_value -= M_PI * 2.0f; + if (m_loop_value > F_PI * 2.0f) + m_loop_value -= F_PI * 2.0f; vec3 GroundBarycenter = vec3(.0f); vec3 PhysObjBarycenter = vec3(.0f); diff --git a/tutorial/12_voronoi.cpp b/tutorial/12_voronoi.cpp index 60e658eb..c81e4b39 100644 --- a/tutorial/12_voronoi.cpp +++ b/tutorial/12_voronoi.cpp @@ -12,19 +12,6 @@ # include "config.h" #endif -#if defined _XBOX -# define _USE_MATH_DEFINES /* for M_PI */ -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#elif defined _WIN32 -# define _USE_MATH_DEFINES /* for M_PI */ -# define WIN32_LEAN_AND_MEAN -# include -# undef near /* Fuck Microsoft */ -# undef far /* Fuck Microsoft again */ -#endif - #include "core.h" #include "loldebug.h" @@ -188,10 +175,10 @@ public: int maxi = 6; for (int i = 0; i < maxi; ++i) { - voronoi_points.Push(vec3(256.f) + 196.f * vec3((float)lol::cos(m_time + (double)i * 2.0 * M_PI / (double)maxi), (float)lol::sin(m_time + (double)i * 2.0 * M_PI / (double)maxi), .0f), vec2(.0f)); - voronoi_points.Push(vec3(256.f) + 128.f * vec3((float)lol::cos(-m_time + (double)i * 2.0 * M_PI / (double)maxi), (float)lol::sin(-m_time + (double)i * 2.0 * M_PI / (double)maxi), .0f), vec2(.0f)); - voronoi_points.Push(vec3(256.f) + 64.f * vec3((float)lol::cos(m_time + (double)i * 2.0 * M_PI / (double)maxi), (float)lol::sin(m_time + (double)i * 2.0 * M_PI / (double)maxi), .0f), vec2(.0f)); - voronoi_points.Push(vec3(256.f) + 32.f * vec3((float)lol::cos(-m_time + (double)i * 2.0 * M_PI / (double)maxi), (float)lol::sin(-m_time + (double)i * 2.0 * M_PI / (double)maxi), .0f), vec2(.0f)); + voronoi_points.Push(vec3(256.f) + 196.f * vec3(lol::cos(m_time + i * 2.f * F_PI / maxi), lol::sin(m_time + i * 2.f * F_PI / maxi), .0f), vec2(.0f)); + voronoi_points.Push(vec3(256.f) + 128.f * vec3(lol::cos(-m_time + i * 2.f * F_PI / maxi), lol::sin(-m_time + i * 2.f * F_PI / maxi), .0f), vec2(.0f)); + voronoi_points.Push(vec3(256.f) + 64.f * vec3(lol::cos(m_time + i * 2.f * F_PI / maxi), lol::sin(m_time + i * 2.f * F_PI / maxi), .0f), vec2(.0f)); + voronoi_points.Push(vec3(256.f) + 32.f * vec3(lol::cos(-m_time + i * 2.f * F_PI / maxi), lol::sin(-m_time + i * 2.f * F_PI / maxi), .0f), vec2(.0f)); } voronoi_points.Push(vec3(256.f), vec2(.0f)); }