Skip to content

Commit

Permalink
Removed distance.enable key
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Jul 14, 2023
1 parent 20b2058 commit 233e6db
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/ddrill/Driller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ Driller::drill()
log::cout << Options::perturbation.enable << log::endl;
log::cout << log::ralign("Series approximation: ");
log::cout << Options::approximation.enable << log::endl;
log::cout << log::ralign("Border detection: ");
log::cout << Options::distance.enable << log::endl;
// log::cout << log::ralign("Border detection: ");
// log::cout << (Options::distance.threshold() > 0.0) << log::endl;
log::cout << log::ralign("Area checking: ");
log::cout << Options::areacheck.enable << log::endl;
log::cout << log::ralign("Period checking: ");
Expand Down Expand Up @@ -432,13 +432,13 @@ Driller::drill(const Coord &point, std::vector<Coord> &glitchPoints)
while (++iteration < limit) {

auto two_xn_plus_dn = ref.xn[iteration - 1].extended2 + dn;
auto two_xn_plus_two_two_dn = two_xn_plus_dn + dn;
auto two_xn_plus_two_dn = two_xn_plus_dn + dn;

dercn *= two_xn_plus_two_two_dn;
dercn *= two_xn_plus_two_dn;
dercn += derc0;
dercn.reduce();

derzn *= two_xn_plus_two_two_dn;
derzn *= two_xn_plus_two_dn;
derzn.reduce();

dn *= two_xn_plus_dn;
Expand Down
3 changes: 2 additions & 1 deletion src/ddrill/MapAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ MapAnalyzer::analyze(const DrillMap &map)
auto i = y * width + x;

auto inBorder = [&]() {
return Options::distance.enable && map.distMap[i] < Options::distance.threshold();
// return Options::distance.enable && map.distMap[i] < Options::distance.threshold();
return map.distMap[i] < Options::distance.threshold();
};

bool optspot = !!map.firstIterationMap[i];
Expand Down
6 changes: 3 additions & 3 deletions src/shared/ImageMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ImageMaker::draw(DrillMap &map)
colorizer.setUniform("smooth", Options::palette.mode == ColoringMode::Smooth);
colorizer.setUniform("bgcolor", sf::Glsl::Vec4(rgba.r, rgba.g, rgba.b, rgba.a));
colorizer.setUniform("dist", map.distMapTex);
colorizer.setUniform("distThreshold", Options::distance.enable ? Options::distance.threshold() : 0.0);
colorizer.setUniform("distThreshold", Options::distance.threshold());
colorizer.setUniform("texture", textureMapTex);
colorizer.setUniform("textureOpacity", Options::texture.opacity());
colorizer.setUniform("textureScale", Options::texture.scale());
Expand Down Expand Up @@ -127,7 +127,7 @@ ImageMaker::draw(DrillMap &map1, DrillMap &map2, isize frame, float zoom)
colorizer.setUniform("smooth", Options::palette.mode == ColoringMode::Smooth);
colorizer.setUniform("bgcolor", sf::Glsl::Vec4(rgba.r, rgba.g, rgba.b, rgba.a));
colorizer.setUniform("dist", map1.distMapTex);
colorizer.setUniform("distThreshold", Options::distance.enable ? Options::distance.threshold(frame) : 0.0);
colorizer.setUniform("distThreshold", Options::distance.threshold(frame));
colorizer.setUniform("texture", textureMapTex);
colorizer.setUniform("textureOpacity", Options::texture.image == "" ? 0.0 : Options::texture.opacity(frame));
colorizer.setUniform("textureScale", Options::texture.scale(frame));
Expand All @@ -145,7 +145,7 @@ ImageMaker::draw(DrillMap &map1, DrillMap &map2, isize frame, float zoom)
colorizer2.setUniform("smooth", Options::palette.mode == ColoringMode::Smooth);
colorizer2.setUniform("bgcolor", sf::Glsl::Vec4(rgba.r, rgba.g, rgba.b, rgba.a));
colorizer2.setUniform("dist", map2.distMapTex);
colorizer2.setUniform("distThreshold", Options::distance.enable ? Options::distance.threshold(frame) : 0.0);
colorizer2.setUniform("distThreshold", Options::distance.threshold(frame));
colorizer2.setUniform("texture", textureMapTex);
colorizer2.setUniform("textureOpacity", Options::texture.image == "" ? 0.0 : Options::texture.opacity(frame));
colorizer2.setUniform("textureScale", Options::texture.scale(frame));
Expand Down
6 changes: 4 additions & 2 deletions src/shared/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ std::map<string,string> Options::defaults = [](){
defaults["palette.offset"] = "-0.15";

// Distance estimation keys
defaults["distance.enable"] = "no";
defaults["distance.threshold"] = "0.1";
// defaults["distance.enable"] = "no";
defaults["distance.threshold"] = "0.2";

// Texture keys
defaults["texture.image"] = "";
Expand Down Expand Up @@ -297,9 +297,11 @@ Options::parse(string key, string value)

Parser::parse(value, palette.offset);

/*
} else if (key == "distance.enable") {
Parser::parse(value, distance.enable);
*/

} else if (key == "distance.threshold") {

Expand Down
2 changes: 1 addition & 1 deletion src/shared/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ struct Options {
static struct Distance {

// Indicates if distance estimation should be applied
bool enable;
// bool enable;

// Thickness
DynamicFloat threshold;
Expand Down

0 comments on commit 233e6db

Please sign in to comment.