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.

36 lines
770B

  1. #include "scene.hpp"
  2. namespace rack {
  3. void Light::draw(NVGcontext *vg) {
  4. NVGcolor colorOutline = nvgLerpRGBA(color, nvgRGBf(0.0, 0.0, 0.0), 0.5);
  5. float radius = box.size.x / 2.0;
  6. nvgBeginPath(vg);
  7. nvgCircle(vg, radius, radius, radius);
  8. nvgFillColor(vg, color);
  9. nvgFill(vg);
  10. nvgStrokeWidth(vg, 1.0);
  11. nvgStrokeColor(vg, colorOutline);
  12. nvgStroke(vg);
  13. nvgGlobalCompositeOperation(vg, NVG_LIGHTER);
  14. NVGpaint paint;
  15. NVGcolor icol = color;
  16. icol.a = 0.1;
  17. NVGcolor ocol = color;
  18. ocol.a = 0.0;
  19. float oradius = radius + 30.0;
  20. paint = nvgRadialGradient(vg, radius, radius, radius, oradius, icol, ocol);
  21. nvgFillPaint(vg, paint);
  22. nvgBeginPath(vg);
  23. nvgRect(vg, radius - oradius, radius - oradius, 2*oradius, 2*oradius);
  24. nvgFill(vg);
  25. }
  26. } // namespace rack