Browse Source

Merge branch 'master' of https://github.com/VCVRack/Rack into 2017-10-bontric-midiCC-fix

tags/v0.5.0
ben 7 years ago
parent
commit
d5dd6392b6
5 changed files with 30 additions and 7 deletions
  1. +3
    -1
      README.md
  2. +17
    -4
      include/components.hpp
  3. +3
    -0
      src/app/ColorLightWidget.cpp
  4. +5
    -0
      src/app/LightWidget.cpp
  5. +2
    -2
      src/engine.cpp

+ 3
- 1
README.md View File

@@ -13,6 +13,8 @@ However, please search before posting to avoid duplicates, and limit to one issu

You may vote on feature requests by using the Thumbs Up/Down reaction on the first post.

I rarely accept Pull Requests, so please notify me in advance to plan your contribution before writing code.

## Setting up your development environment

Rack's dependencies (GLEW, glfw, etc) do not need to be installed on your system, since specific versions are compiled locally during the build process. However, you need proper tools to build these dependencies.
@@ -63,7 +65,7 @@ Run Rack.

Be sure to check out and build the version of Rack you wish to build your plugins against.

Clone your favorite plugin in the `plugins/` directory. e.g.:
You must clone the plugin in Rack's `plugins/` directory, e.g.

cd plugins
git clone https://github.com/VCVRack/Fundamental.git


+ 17
- 4
include/components.hpp View File

@@ -434,6 +434,19 @@ struct GreenLight : ColorLightWidget {
}
};

struct YellowLight : ColorLightWidget {
YellowLight() {
addColor(COLOR_YELLOW);
}
};

struct BlueLight : ColorLightWidget {
BlueLight() {
addColor(COLOR_BLUE);
}
};

/** Reads two adjacent lightIds, so `lightId` and `lightId + 1` must be defined */
struct GreenRedLight : ColorLightWidget {
GreenRedLight() {
addColor(COLOR_GREEN);
@@ -446,7 +459,7 @@ struct GreenRedLight : ColorLightWidget {
template <typename BASE>
struct LargeLight : BASE {
LargeLight() {
this->box.size = Vec(15, 15);
this->box.size = Vec(20, 20);
}
};

@@ -454,7 +467,7 @@ struct LargeLight : BASE {
template <typename BASE>
struct MediumLight : BASE {
MediumLight() {
this->box.size = Vec(9, 9);
this->box.size = Vec(12, 12);
}
};

@@ -462,7 +475,7 @@ struct MediumLight : BASE {
template <typename BASE>
struct SmallLight : BASE {
SmallLight() {
this->box.size = Vec(6, 6);
this->box.size = Vec(8, 8);
}
};

@@ -470,7 +483,7 @@ struct SmallLight : BASE {
template <typename BASE>
struct TinyLight : BASE {
TinyLight() {
this->box.size = Vec(3, 3);
this->box.size = Vec(5, 5);
}
};



+ 3
- 0
src/app/ColorLightWidget.cpp View File

@@ -10,10 +10,13 @@ void ColorLightWidget::addColor(NVGcolor c) {
}

void ColorLightWidget::step() {
assert(module);
assert(module->lights.size() >= lightId + colors.size());
color = nvgRGBf(0, 0, 0);
for (int i = 0; i < (int)colors.size(); i++) {
NVGcolor c = colors[i];
float brightness = module->lights[lightId + i].getBrightness();
brightness = clampf(brightness, 0.0, 1.0);
color.r += c.r * brightness;
color.g += c.g * brightness;
color.b += c.b * brightness;


+ 5
- 0
src/app/LightWidget.cpp View File

@@ -8,6 +8,11 @@ void LightWidget::draw(NVGcontext *vg) {
float radius = box.size.x / 2.0;
float oradius = radius + 20.0;

color.r = clampf(color.r, 0.0, 1.0);
color.g = clampf(color.g, 0.0, 1.0);
color.b = clampf(color.b, 0.0, 1.0);
color.a = clampf(color.a, 0.0, 1.0);

// Solid
nvgBeginPath(vg);
nvgCircle(vg, radius, radius, radius);


+ 2
- 2
src/engine.cpp View File

@@ -35,11 +35,11 @@ static float smoothValue;


float Light::getBrightness() {
return sqrtf(value);
return sqrtf(fmaxf(0.0, value));
}

void Light::setBrightnessSmooth(float brightness) {
value += (brightness * brightness - value) * sampleTime * 60.0;
value += (brightness * brightness - value) * sampleTime * (60.0 * 3.0);
}




Loading…
Cancel
Save