summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/engine/shaders/colorOnY_ES2.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualization/engine/shaders/colorOnY_ES2.frag')
-rw-r--r--src/datavisualization/engine/shaders/colorOnY_ES2.frag8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/datavisualization/engine/shaders/colorOnY_ES2.frag b/src/datavisualization/engine/shaders/colorOnY_ES2.frag
index aba52cfe..bb6e28c7 100644
--- a/src/datavisualization/engine/shaders/colorOnY_ES2.frag
+++ b/src/datavisualization/engine/shaders/colorOnY_ES2.frag
@@ -1,7 +1,9 @@
uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
uniform highp float lightStrength;
uniform highp float ambientStrength;
+uniform sampler2D textureSampler;
+uniform highp float gradMin;
+uniform highp float gradHeight;
varying highp vec3 position_wrld;
varying highp vec3 normal_cmr;
@@ -10,8 +12,8 @@ varying highp vec3 lightDirection_cmr;
varying highp vec2 coords_mdl;
void main() {
- highp float heightMod = (coords_mdl.y * 0.3) + 0.7; // Add 30% black to the bottom
- highp vec3 materialDiffuseColor = heightMod * color_mdl;
+ highp vec2 gradientUV = vec2(0.0, gradMin + ((coords_mdl.y + 1.0) * gradHeight));
+ highp vec3 materialDiffuseColor = texture2D(textureSampler, gradientUV).xyz;
highp vec3 materialAmbientColor = vec3(ambientStrength, ambientStrength, ambientStrength) * materialDiffuseColor;
highp vec3 materialSpecularColor = vec3(1.0, 1.0, 1.0);