summaryrefslogtreecommitdiffstats
path: root/src/datavis3d/engine/shaders/fragmentShaderTexture
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavis3d/engine/shaders/fragmentShaderTexture')
-rw-r--r--src/datavis3d/engine/shaders/fragmentShaderTexture40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/datavis3d/engine/shaders/fragmentShaderTexture b/src/datavis3d/engine/shaders/fragmentShaderTexture
index 9f2692f2..95c4f1a1 100644
--- a/src/datavis3d/engine/shaders/fragmentShaderTexture
+++ b/src/datavis3d/engine/shaders/fragmentShaderTexture
@@ -1,5 +1,4 @@
varying highp vec2 UV;
-varying highp vec2 coords_mdl;
varying highp vec3 position_wrld;
varying highp vec3 normal_cmr;
varying highp vec3 eyeDirection_cmr;
@@ -10,25 +9,24 @@ uniform highp float lightStrength;
uniform highp float ambientStrength;
uniform sampler2D textureSampler;
void main() {
- //highp vec3 materialDiffuseColor = texture2D(textureSampler, UV).rgb;
- //highp vec3 materialAmbientColor = vec3(ambientStrength, ambientStrength, ambientStrength) * materialDiffuseColor;
- //highp vec3 materialSpecularColor = vec3(1.0, 1.0, 1.0);
- //highp float distance = length(lightPosition_wrld - position_wrld);
- //highp vec3 n = normalize(normal_cmr);
- //highp vec3 l = normalize(lightDirection_cmr);
- //highp float cosTheta = dot(n, l);
- //if (cosTheta < 0.0) { cosTheta = 0.0; }
- //if (cosTheta > 1.0) { cosTheta = 1.0; }
- //highp vec3 E = normalize(eyeDirection_cmr);
- //highp vec3 R = reflect(-l, n);
- //highp float cosAlpha = dot(E, R);
- //if (cosAlpha < 0.0) { cosAlpha = 0.0; }
- //if (cosAlpha > 1.0) { cosAlpha = 1.0; }
- //gl_FragColor.rgb = //color_mdl + color_mdl * vec3(cosTheta * cosTheta) / (distance * distance) + vec3(cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / (distance * distance);
- // materialAmbientColor +
- // materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
- // materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;//(distance * distance);
- //gl_FragColor.a = 1.0;
- gl_FragColor = texture2D(textureSampler, UV);
+ highp vec3 materialDiffuseColor = texture2D(textureSampler, UV).rgb;
+ highp vec3 materialAmbientColor = vec3(ambientStrength, ambientStrength, ambientStrength) * materialDiffuseColor;
+ highp vec3 materialSpecularColor = vec3(1.0, 1.0, 1.0);
+ highp float distance = length(lightPosition_wrld - position_wrld);
+ highp vec3 n = normalize(normal_cmr);
+ highp vec3 l = normalize(lightDirection_cmr);
+ highp float cosTheta = dot(n, l);
+ if (cosTheta < 0.0) { cosTheta = 0.0; }
+ if (cosTheta > 1.0) { cosTheta = 1.0; }
+ highp vec3 E = normalize(eyeDirection_cmr);
+ highp vec3 R = reflect(-l, n);
+ highp float cosAlpha = dot(E, R);
+ if (cosAlpha < 0.0) { cosAlpha = 0.0; }
+ if (cosAlpha > 1.0) { cosAlpha = 1.0; }
+ gl_FragColor.rgb = //color_mdl + color_mdl * vec3(cosTheta * cosTheta) / (distance * distance) + vec3(cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / (distance * distance);
+ materialAmbientColor +
+ materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
+ materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;//(distance * distance);
+ gl_FragColor.a = 1.0;
}