Browse Source

Add uniqueness assertion for plugin slugs, fix PolarityValueLight alpha

tags/v0.4.0
Andrew Belt 7 years ago
parent
commit
223719dcd9
2 changed files with 7 additions and 2 deletions
  1. +2
    -2
      include/components.hpp
  2. +5
    -0
      src/plugin.cpp

+ 2
- 2
include/components.hpp View File

@@ -402,7 +402,7 @@ struct ColorValueLight : ValueLight {
void setValue(float v) {
v = sqrtBipolar(v);
color = baseColor;
color.a = clampf(v * baseColor.a, 0.0, 1.0);
color.a *= clampf(v, 0.0, 1.0);
}
};

@@ -430,7 +430,7 @@ struct PolarityLight : ValueLight {
void setValue(float v) {
v = sqrtBipolar(v);
color = (v >= 0.0) ? posColor : negColor;
color.a = clampf(fabsf(v) * color.a, 0.0, 1.0);
color.a *= clampf(fabsf(v), 0.0, 1.0);
}
};



+ 5
- 0
src/plugin.cpp View File

@@ -89,6 +89,11 @@ static int loadPlugin(std::string path) {
plugin->handle = handle;
initCallback(plugin);

// Check that this is a unique slug
for (Plugin *otherPlugin : gPlugins) {
assert(plugin->slug != otherPlugin->slug);
}

// Add plugin to list
gPlugins.push_back(plugin);
fprintf(stderr, "Loaded plugin %s\n", libraryFilename.c_str());


Loading…
Cancel
Save