summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/engine/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualization/engine/shaders')
-rw-r--r--src/datavisualization/engine/shaders/surface.frag5
-rw-r--r--src/datavisualization/engine/shaders/surface.vert3
-rw-r--r--src/datavisualization/engine/shaders/surfaceFlat.frag4
-rw-r--r--src/datavisualization/engine/shaders/surfaceFlat.vert3
4 files changed, 2 insertions, 13 deletions
diff --git a/src/datavisualization/engine/shaders/surface.frag b/src/datavisualization/engine/shaders/surface.frag
index 9fe7f45b..4b1357b1 100644
--- a/src/datavisualization/engine/shaders/surface.frag
+++ b/src/datavisualization/engine/shaders/surface.frag
@@ -1,6 +1,5 @@
#version 120
-varying highp vec2 UV;
varying highp vec3 coords_mdl;
varying highp vec3 position_wrld;
varying highp vec3 normal_cmr;
@@ -13,7 +12,7 @@ uniform highp float lightStrength;
uniform highp float ambientStrength;
void main() {
- highp vec2 gradientUV = vec2(0.5, (coords_mdl.y + 1.0) / 2.0);
+ highp vec2 gradientUV = vec2(0.0, (coords_mdl.y + 1.001) / 2.0); // 1000 pixel texture, we need a margin for 1/1000 rounding error
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);
@@ -28,12 +27,10 @@ void main() {
highp vec3 R = reflect(-l, n);
highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-// gl_FragColor.rgb = materialDiffuseColor;
gl_FragColor.rgb =
materialAmbientColor +
materialDiffuseColor * lightStrength * pow(cosTheta, 2) / distance +
materialSpecularColor * lightStrength * pow(cosAlpha, 10) / distance;
gl_FragColor.a = 1.0;
-// gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
diff --git a/src/datavisualization/engine/shaders/surface.vert b/src/datavisualization/engine/shaders/surface.vert
index a44d413b..28152abc 100644
--- a/src/datavisualization/engine/shaders/surface.vert
+++ b/src/datavisualization/engine/shaders/surface.vert
@@ -1,5 +1,4 @@
attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
attribute highp vec3 vertexNormal_mdl;
uniform highp mat4 MVP;
@@ -8,7 +7,6 @@ uniform highp mat4 M;
uniform highp mat4 itM;
uniform highp vec3 lightPosition_wrld;
-varying highp vec2 UV;
varying highp vec3 position_wrld;
varying highp vec3 normal_cmr;
varying highp vec3 eyeDirection_cmr;
@@ -24,5 +22,4 @@ void main() {
vec3 lightPosition_cmr = (V * vec4(lightPosition_wrld, 1.0)).xyz;
lightDirection_cmr = lightPosition_cmr + eyeDirection_cmr;
normal_cmr = (V * itM * vec4(vertexNormal_mdl, 0.0)).xyz;
- UV = vertexUV;
}
diff --git a/src/datavisualization/engine/shaders/surfaceFlat.frag b/src/datavisualization/engine/shaders/surfaceFlat.frag
index eb398582..a8a3dbb1 100644
--- a/src/datavisualization/engine/shaders/surfaceFlat.frag
+++ b/src/datavisualization/engine/shaders/surfaceFlat.frag
@@ -1,6 +1,5 @@
#version 150
-varying highp vec2 UV;
varying highp vec3 coords_mdl;
varying highp vec3 position_wrld;
flat in highp vec3 normal_cmr;
@@ -13,7 +12,7 @@ uniform highp float lightStrength;
uniform highp float ambientStrength;
void main() {
- highp vec2 gradientUV = vec2(0.5, (coords_mdl.y + 1.0) / 2.0);
+ highp vec2 gradientUV = vec2(0.0, (coords_mdl.y + 1.001) / 2.0); // 1000 pixel texture, we need a margin for 1/1000 rounding error
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);
@@ -28,7 +27,6 @@ void main() {
highp vec3 R = reflect(-l, n);
highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-// gl_FragColor.rgb = materialDiffuseColor;
gl_FragColor.rgb =
materialAmbientColor +
materialDiffuseColor * lightStrength * pow(cosTheta, 2) / distance +
diff --git a/src/datavisualization/engine/shaders/surfaceFlat.vert b/src/datavisualization/engine/shaders/surfaceFlat.vert
index 24c9b9a3..7e248d02 100644
--- a/src/datavisualization/engine/shaders/surfaceFlat.vert
+++ b/src/datavisualization/engine/shaders/surfaceFlat.vert
@@ -1,7 +1,6 @@
#version 150
attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
attribute highp vec3 vertexNormal_mdl;
uniform highp mat4 MVP;
@@ -10,7 +9,6 @@ uniform highp mat4 M;
uniform highp mat4 itM;
uniform highp vec3 lightPosition_wrld;
-varying highp vec2 UV;
varying highp vec3 position_wrld;
flat out highp vec3 normal_cmr;
varying highp vec3 eyeDirection_cmr;
@@ -26,5 +24,4 @@ void main() {
vec3 lightPosition_cmr = (V * vec4(lightPosition_wrld, 1.0)).xyz;
lightDirection_cmr = lightPosition_cmr + eyeDirection_cmr;
normal_cmr = (V * itM * vec4(vertexNormal_mdl, 0.0)).xyz;
- UV = vertexUV;
}