57 {
60
61
62
63
64
65
67 const int32_t* fade_lut =
state.fade_lut;
68
69 constexpr int GRID = 16;
70 constexpr float STEP_F = 0.05f;
71
72 constexpr int32_t STEP_I = static_cast<int32_t>(0.05f * 65536.0f);
73
74
75 {
76 float ax = 0.0f, ay = 0.0f;
77 int32_t sink = 0;
79 for (int it = 0; it < iters; it++) {
80
81
82
83 ax += 0.011f;
84 ay += 0.013f;
85 for (int row = 0; row < GRID; row++) {
86 float y = ay + row * STEP_F;
87 for (int col = 0; col < GRID; col++) {
88 float x = ax + col * STEP_F;
90
91
92 sink += static_cast<int32_t>(n * 127.0f);
93 }
94 }
95 }
99 }
100
101
102 {
104
105 constexpr int32_t DRIFT_X =
static_cast<int32_t>(0.011f * 65536.0f);
106 constexpr int32_t DRIFT_Y =
static_cast<int32_t>(0.013f * 65536.0f);
109 for (int it = 0; it < iters; it++) {
110 ax_i += DRIFT_X;
111 ay_i += DRIFT_Y;
112 for (int row = 0; row < GRID; row++) {
113 int32_t y_i = ay_i + row * STEP_I;
114 for (int col = 0; col < GRID; col++) {
115 int32_t x_i = ax_i + col * STEP_I;
116
117
118
120 x_i, y_i, fade_lut, fl::PERLIN_NOISE);
121 sink += n >> 9;
122
123 }
124 }
125 }
129 }
130
131 return r;
132}
PerlinBenchState & perlinBenchState()
FASTLED_FORCE_INLINE float pnoise(float x, float y, float z) FL_NO_EXCEPT
fl::u32 micros() FL_NO_EXCEPT
Universal microsecond timer - returns microseconds since system startup.
static fl::i32 pnoise2d_raw(fl::i32 fx_raw, fl::i32 fy_raw, const fl::i32 *fade_lut, const fl::u8 *perm) FL_NO_EXCEPT