Browse Source

Add spotlightBrightness and spotlightRadius to settings.

tags/v2.6.6
Andrew Belt 3 months ago
parent
commit
651713de77
3 changed files with 21 additions and 3 deletions
  1. +2
    -0
      include/settings.hpp
  2. +5
    -3
      src/app/RackWidget.cpp
  3. +14
    -0
      src/settings.cpp

+ 2
- 0
include/settings.hpp View File

@@ -56,6 +56,8 @@ extern float cableOpacity;
/** Straightness of cables in the range [0, 1]. Unitless and arbitrary. */
extern float cableTension;
extern float rackBrightness;
extern float spotlightBrightness;
extern float spotlightRadius;
extern float haloBrightness;
/** Allows rack to hide and lock the cursor position when dragging knobs etc. */
extern bool allowCursorLock;


+ 5
- 3
src/app/RackWidget.cpp View File

@@ -149,12 +149,14 @@ void RackWidget::draw(const DrawArgs& args) {
float t[6];
nvgCurrentTransform(args.vg, t);
float zoom = t[3];
float radius = 300.0 / zoom;
float brightness = 0.2f;
// Draw mouse spotlight
nvgBeginPath(args.vg);
nvgRect(args.vg, 0.0, 0.0, VEC_ARGS(box.size));
nvgFillPaint(args.vg, nvgRadialGradient(args.vg, VEC_ARGS(internal->mousePos), 0.0, radius, nvgRGBAf(0, 0, 0, 1.f - b - brightness), nvgRGBAf(0, 0, 0, 1.f - b)));
nvgFillPaint(args.vg, nvgRadialGradient(args.vg,
VEC_ARGS(internal->mousePos), 0.0,
settings::spotlightRadius / zoom,
nvgRGBAf(0, 0, 0, 1.f - b - settings::spotlightBrightness),
nvgRGBAf(0, 0, 0, 1.f - b)));
nvgFill(args.vg);
}



+ 14
- 0
src/settings.cpp View File

@@ -34,6 +34,8 @@ std::string uiTheme = "dark";
float cableOpacity = 0.5;
float cableTension = 1.0;
float rackBrightness = 1.0;
float spotlightBrightness = 0.2;
float spotlightRadius = 300.0;
float haloBrightness = 0.25;
bool allowCursorLock = true;
KnobMode knobMode = KNOB_MODE_LINEAR;
@@ -159,6 +161,10 @@ json_t* toJson() {

json_object_set_new(rootJ, "rackBrightness", json_real(rackBrightness));

json_object_set_new(rootJ, "spotlightBrightness", json_real(spotlightBrightness));

json_object_set_new(rootJ, "spotlightRadius", json_real(spotlightRadius));

json_object_set_new(rootJ, "haloBrightness", json_real(haloBrightness));

json_object_set_new(rootJ, "allowCursorLock", json_boolean(allowCursorLock));
@@ -352,6 +358,14 @@ void fromJson(json_t* rootJ) {
if (rackBrightnessJ)
rackBrightness = json_number_value(rackBrightnessJ);

json_t* spotlightBrightnessJ = json_object_get(rootJ, "spotlightBrightness");
if (spotlightBrightnessJ)
spotlightBrightness = json_number_value(spotlightBrightnessJ);

json_t* spotlightRadiusJ = json_object_get(rootJ, "spotlightRadius");
if (spotlightRadiusJ)
spotlightRadius = json_number_value(spotlightRadiusJ);

json_t* haloBrightnessJ = json_object_get(rootJ, "haloBrightness");
if (haloBrightnessJ)
haloBrightness = json_number_value(haloBrightnessJ);


Loading…
Cancel
Save