diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-10-05 23:27:26 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-10-05 23:27:26 +0200 |
commit | fbe19c49c5965577856f7c4b40581a796275817e (patch) | |
tree | 4ce09bfba8c7a83839d6fe3583a88d0bb1a4fc76 /src/graphics/core/color.h | |
parent | b68c903747ebe54955e8141fc1d56091839c8fee (diff) | |
parent | 0c6b6fccd9a58be3301ddaaface5b48078a4d9fb (diff) | |
download | colobot-fbe19c49c5965577856f7c4b40581a796275817e.tar.gz colobot-fbe19c49c5965577856f7c4b40581a796275817e.tar.bz2 colobot-fbe19c49c5965577856f7c4b40581a796275817e.zip |
Merge branch 'dev-graphics' into dev
Diffstat (limited to 'src/graphics/core/color.h')
-rw-r--r-- | src/graphics/core/color.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/graphics/core/color.h b/src/graphics/core/color.h index 0bec7e9..7cbd175 100644 --- a/src/graphics/core/color.h +++ b/src/graphics/core/color.h @@ -107,6 +107,14 @@ inline IntColor ColorToIntColor(Color color) static_cast<unsigned char>(color.a * 255.0f)); } +inline Color IntensityToColor(float intensity) +{ + if (intensity <= 0.0f) return Color(0.0f, 0.0f, 0.0f, 0.0f); + if (intensity >= 1.0f) return Color(1.0f, 1.0f, 1.0f, 1.0f); + + return Color(intensity, intensity, intensity, intensity); +} + /** * \struct ColorHSV * \brief HSV color |