Skip to content

Commit

Permalink
Add clamp min and max colormap shader, solve #7
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoireHENRY committed Apr 20, 2024
1 parent 3a74e6b commit 0969a49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kalast"
version = "0.5.5"
version = "0.5.6"
authors = ["Grégoire Henry <[email protected]>"]
edition = "2021"
description = "Thermophysical Model for Binary Asteroids"
Expand Down
9 changes: 8 additions & 1 deletion shaders/body.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ vec3 colormap(int code, float t) {
}

float normalize_value(float value, vec2 bounds) {
return (value - bounds.x) / (bounds.y - bounds.x);
float v = (value - bounds.x) / (bounds.y - bounds.x);
if (v < bounds.x) {
v = bounds.x
}
else if (v > bounds.y) {
v = bounds.y
}
return v
}

float calculate_shadow(float cos_incidence) {
Expand Down

0 comments on commit 0969a49

Please sign in to comment.