From 0470ca5b18432c340d435fcbc20802e184e48873 Mon Sep 17 00:00:00 2001
From: amandaghassaei <amandaghassaei@gmail.com>
Date: Mon, 3 Apr 2017 23:43:22 -0400
Subject: [PATCH] colors

---
 index.html | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/index.html b/index.html
index 4dede69..9e87d5c 100644
--- a/index.html
+++ b/index.html
@@ -64,21 +64,23 @@
             if (val > 1.0) val = 1.0;
             if (val < 0.0) val = 0.0;
 
+            float numColors = 3.0;
+
             vec3 color = vec3(0.0);
-            if (val < 0.25) {
-                val *= 4.0;
+            if (val <= 1.0/numColors) {
+                val *= numColors;
                 color = background*(1.0-val) + material1*val;
-            } else if (val < 0.5) {
-                val -= 0.25;
-                val *= 4.0;
+            } else if (val <= 2.0/numColors) {
+                val -= 1.0/numColors;
+                val *= numColors;
                 color = material1*(1.0-val) + material2*val;
-            } else if (val < 0.75) {
-                val -= 0.50;
-                val *= 4.0;
+            } else if (val <= 3.0/numColors) {
+                val -= 2.0/numColors;
+                val *= numColors;
                 color = material2*(1.0-val) + material3*val;
             } else {
-                val -= 0.75;
-                val *= 4.0;
+                val -= 3.0/numColors;
+                val *= numColors;
                 color = material3*(1.0-val) + material4*val;
             }
 
-- 
GitLab