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

◆ VegasVisualizer()

void Painter::VegasVisualizer ( const KeyboardState & keyboard,
const int * led_column_table,
int led_column_table_length,
LedRopeInterface * led_rope )
staticprivate

Definition at line 361 of file Painter.cpp.

363 {
364
366
367 uint32_t skipped_lights = 0;
368 for (int i = 0; i < led_column_table_length; ++i) {
369 const Key& key = keyboard.mKeys[i];
370 uint32_t painted_lights = 0;
371
372 // % of lights that are active.
373 const float active_lights_factor = led_column_table[i] * fl::sqrt(key.mCurrColor.v_);
374 const float inactive_lights_factor = 1.0f - active_lights_factor;
375 const float taper_point_1 = inactive_lights_factor / 2.0f;
376 const float taper_point_2 = taper_point_1 + active_lights_factor;
377
378 const int taper_idx_1 = static_cast<int>(fl::floor(taper_point_1 * led_column_table[i]));
379 const int taper_idx_2 = static_cast<int>(fl::floor(taper_point_2 * led_column_table[i]));
380
381 const Color3i c = key.mCurrColor.ToRGB();
382
383 for (int i = 0; i < taper_idx_1 / 2; ++i) {
385 painted_lights++;
386 }
387
388 int length = taper_idx_2 - taper_idx_1;
389 for (int i = 0; i < fl::min(200, length); ++i) {
391 painted_lights++;
392 }
393
394 length = led_column_table[i] - taper_idx_2;
395 for (int i = 0; i < length; ++i) {
397 painted_lights++;
398 }
399 skipped_lights += fl::max(0, static_cast<int32_t>(led_column_table[i]) - static_cast<int32_t>(painted_lights));
400 }
401
402 for (uint32_t i = 0; i < skipped_lights; ++i) {
404 }
405
407}
LedRopeTCL led_rope(kNumKeys)
KeyboardState keyboard
Key mKeys[kNumKeys]
Definition Keyboard.h:103
void RawCommitDraw()
void RawDrawPixel(const Color3i &c)
void RawBeginDraw()
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
Definition math.h:71
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
Definition math.h:75
fl::u32 uint32_t
Definition s16x16x4.h:219
constexpr enable_if< is_fixed_point< T >::value, T >::type sqrt(T x) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type floor(T x) FL_NOEXCEPT
fl::i32 int32_t
Definition s16x16x4.h:220
static Color3i Black()
Definition color.h:7
float v_
Definition color.h:108
Color3i ToRGB() const
Definition color.cpp:129
ColorHSV mCurrColor
Definition Keyboard.h:48

References Color3i::Black(), fl::floor(), keyboard, led_rope, length(), fl::max(), Key::mCurrColor, fl::min(), fl::sqrt(), ColorHSV::ToRGB(), and ColorHSV::v_.

Referenced by Paint().

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