FastLED 3.9.15
Loading...
Searching...
No Matches

◆ drawNebulaDrift()

CRGB drawNebulaDrift ( const RingCoord & coord,
uint32_t time_ms,
ColorPaletteManager & palette )

Definition at line 367 of file FxNoiseRing.h.

367 {
368 float nebula_time = time_ms * 0.0003f;
369
370 float cloud1 = inoise16(coord.x * 800, coord.y * 800, nebula_time * 1000) / 65536.0f;
371 float cloud2 = inoise16(coord.x * 1600, coord.y * 1600, nebula_time * 700) / 65536.0f * 0.5f;
372 float cloud3 = inoise16(coord.x * 400, coord.y * 400, nebula_time * 1200) / 65536.0f * 0.25f;
373
374 float nebula_density = cloud1 + cloud2 + cloud3;
375
376 uint16_t star_noise = inoise16(coord.x * 4000, coord.y * 4000, nebula_time * 200);
377 bool is_star = (star_noise > 60000);
378
379 if (is_star) {
380 float star_intensity = (star_noise - 60000) / 5536.0f;
381 return palette.mapColor(0.0f, star_intensity, 1.0f); // Stars
382 } else {
383 float hue_drift = (nebula_density + 1.0f) * 0.5f;
384 float intensity = (nebula_density + 1.0f) * 0.4f;
385 return palette.mapColor(hue_drift, intensity);
386 }
387}
UINumberField palette("Palette", 0, 0, 2)
uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z, uint32_t t)
16-bit, fixed point implementation of Perlin's noise.
Definition noise.cpp:420

References inoise16(), palette(), RingCoord::x, and RingCoord::y.

Referenced by NoiseVariantManager::renderVariant().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: