From 72bc00fc628468d4d56c03f8aaf513fcf1d406bf Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Thu, 8 Jan 2015 14:27:32 +0100 Subject: [PATCH] fixed rainbow --- app/src/main/rs/stft.rsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/rs/stft.rsh b/app/src/main/rs/stft.rsh index 012c463..7b3c205 100644 --- a/app/src/main/rs/stft.rsh +++ b/app/src/main/rs/stft.rsh @@ -27,9 +27,9 @@ limitations under the License. static inline uchar4 rainbow(float v) { #if 1 - float r = 4.0f * v - 2.0f; - float g = 2.0f - 4.0f * fabs(v - 0.5f); - float b = 2.0f - 4.0f * v; + float r = clamp(4.0f * v - 2.0f, 0.0f, 1.0f); + float g = clamp(2.0f - 4.0f * fabs(v - 0.5f), 0.0f, 1.0f); + float b = clamp(2.0f - 4.0f * v, 0.0f, 1.0f); #else float r = v; float g = v;