You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
573B

  1. #include "app.hpp"
  2. #include "engine.hpp"
  3. namespace rack {
  4. void ColorLightWidget::addColor(NVGcolor c) {
  5. colors.push_back(c);
  6. }
  7. void ColorLightWidget::step() {
  8. assert(module);
  9. assert(module->lights.size() >= lightId + colors.size());
  10. color = nvgRGBf(0, 0, 0);
  11. for (int i = 0; i < (int)colors.size(); i++) {
  12. NVGcolor c = colors[i];
  13. float brightness = module->lights[lightId + i].getBrightness();
  14. brightness = clampf(brightness, 0.0, 1.0);
  15. color.r += c.r * brightness;
  16. color.g += c.g * brightness;
  17. color.b += c.b * brightness;
  18. }
  19. }
  20. } // namespace rack