feat: custom heightmap color scheme - add shceme on load

This commit is contained in:
Azgaar 2023-11-17 03:46:28 +04:00
parent 2ce83643a6
commit 1fe553532d
4 changed files with 29 additions and 13 deletions

View file

@ -297,11 +297,6 @@ function drawHeightmap() {
TIME && console.timeEnd("drawHeightmap");
}
function getColorScheme(scheme = "bright") {
if (scheme in heightmapColorSchemes) return heightmapColorSchemes[scheme];
throw new Error(`Unsupported color scheme: ${scheme}`);
}
function getColor(value, scheme = getColorScheme("bright")) {
return scheme(1 - (value < 20 ? value - 5 : value) / 100);
}