summaryrefslogtreecommitdiffstats
path: root/src/datavis3d/engine/shaders
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-09-10 11:42:13 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-09-10 12:04:24 +0300
commita28cdb72a4ea768a898ca07f0df0fa3c17c073a8 (patch)
tree0bafdcfa99fc783e9f5204539a8242bf6128d795 /src/datavis3d/engine/shaders
parentf3e38983d77c72f3121c33a149a58fdf9c64158c (diff)
Module renamed
Task-number: QTRD-2224 Change-Id: Iec18b6121809300b11d85445281d3c626c434f35 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavis3d/engine/shaders')
-rw-r--r--src/datavis3d/engine/shaders/ambient.frag32
-rw-r--r--src/datavis3d/engine/shaders/colorOnY.frag36
-rw-r--r--src/datavis3d/engine/shaders/colorOnY_ES2.frag37
-rw-r--r--src/datavis3d/engine/shaders/default.frag36
-rw-r--r--src/datavis3d/engine/shaders/default.vert28
-rw-r--r--src/datavis3d/engine/shaders/default_ES2.frag38
-rw-r--r--src/datavis3d/engine/shaders/default_ES2.vert26
-rw-r--r--src/datavis3d/engine/shaders/depth.frag3
-rw-r--r--src/datavis3d/engine/shaders/depth.vert8
-rw-r--r--src/datavis3d/engine/shaders/label.frag8
-rw-r--r--src/datavis3d/engine/shaders/label.vert11
-rw-r--r--src/datavis3d/engine/shaders/selection.frag7
-rw-r--r--src/datavis3d/engine/shaders/selection.vert7
-rw-r--r--src/datavis3d/engine/shaders/shadow.frag82
-rw-r--r--src/datavis3d/engine/shaders/shadow.vert37
-rw-r--r--src/datavis3d/engine/shaders/shadowNoTex.frag98
-rw-r--r--src/datavis3d/engine/shaders/shadowNoTexColorOnY.frag82
-rw-r--r--src/datavis3d/engine/shaders/surface.frag39
-rw-r--r--src/datavis3d/engine/shaders/surface.vert30
-rw-r--r--src/datavis3d/engine/shaders/surfaceFlat.frag38
-rw-r--r--src/datavis3d/engine/shaders/surfaceFlat.vert30
-rw-r--r--src/datavis3d/engine/shaders/surfaceGrid.frag16
-rw-r--r--src/datavis3d/engine/shaders/surfaceGrid.vert26
-rw-r--r--src/datavis3d/engine/shaders/texture.frag35
-rw-r--r--src/datavis3d/engine/shaders/texture.vert26
-rw-r--r--src/datavis3d/engine/shaders/texture_ES2.frag37
26 files changed, 0 insertions, 853 deletions
diff --git a/src/datavis3d/engine/shaders/ambient.frag b/src/datavis3d/engine/shaders/ambient.frag
deleted file mode 100644
index 88f850f3..00000000
--- a/src/datavis3d/engine/shaders/ambient.frag
+++ /dev/null
@@ -1,32 +0,0 @@
-#version 120
-
-uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
-
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-void main() {
- highp vec3 lightColor = vec3(1.0, 1.0, 1.0);
- highp float lightPower = 10.0;
- highp vec3 materialAmbientColor = vec3(0.5, 0.5, 0.5) * color_mdl;
- highp vec3 materialSpecularColor = vec3(0.3, 0.3, 0.3) * color_mdl;
-
- highp float distance = length(lightPosition_wrld - position_wrld);
-
- highp vec3 n = normalize(normal_cmr);
- highp vec3 l = normalize(lightDirection_cmr);
- highp float cosTheta = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- highp vec3 R = reflect(-l, n);
- highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-
- gl_FragColor.rgb =
- materialAmbientColor +
- materialSpecularColor * lightColor * lightPower * pow(cosAlpha, 5) / (distance * distance);
- gl_FragColor.a = 1.0;
-}
-
diff --git a/src/datavis3d/engine/shaders/colorOnY.frag b/src/datavis3d/engine/shaders/colorOnY.frag
deleted file mode 100644
index 61a210c9..00000000
--- a/src/datavis3d/engine/shaders/colorOnY.frag
+++ /dev/null
@@ -1,36 +0,0 @@
-#version 120
-
-uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-varying highp vec2 coords_mdl;
-
-void main() {
- highp float heightMod = coords_mdl.y + (1.0 - ambientStrength);
- highp vec3 materialDiffuseColor = heightMod * color_mdl;
- 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 = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- highp vec3 R = reflect(-l, n);
- highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-
- gl_FragColor.rgb =
- materialAmbientColor +
- materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
- materialSpecularColor * lightStrength * pow(cosAlpha, 5) / distance;
- gl_FragColor.rgb = clamp(gl_FragColor.rgb, 0.0, 1.0);
- gl_FragColor.a = 1.0;
-}
-
diff --git a/src/datavis3d/engine/shaders/colorOnY_ES2.frag b/src/datavis3d/engine/shaders/colorOnY_ES2.frag
deleted file mode 100644
index 78c778d3..00000000
--- a/src/datavis3d/engine/shaders/colorOnY_ES2.frag
+++ /dev/null
@@ -1,37 +0,0 @@
-uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-varying highp vec2 coords_mdl;
-
-void main() {
- highp float heightMod = coords_mdl.y + (1.0 - ambientStrength);
- highp vec3 materialDiffuseColor = heightMod * color_mdl;
- 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;
- else 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;
- else if (cosAlpha > 1.0) cosAlpha = 1.0;
-
- gl_FragColor.rgb =
- materialAmbientColor +
- materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
- materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;
- gl_FragColor.a = 1.0;
-}
-
diff --git a/src/datavis3d/engine/shaders/default.frag b/src/datavis3d/engine/shaders/default.frag
deleted file mode 100644
index fba1ce4a..00000000
--- a/src/datavis3d/engine/shaders/default.frag
+++ /dev/null
@@ -1,36 +0,0 @@
-#version 120
-
-varying highp vec2 UV;
-varying highp vec2 coords_mdl;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-
-void main() {
- highp vec3 materialDiffuseColor = color_mdl.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 = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- highp vec3 R = reflect(-l, n);
- highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-
- gl_FragColor.rgb =
- materialAmbientColor +
- materialDiffuseColor * lightStrength * pow(cosTheta, 2) / distance +
- materialSpecularColor * lightStrength * pow(cosAlpha, 5) / distance;
- gl_FragColor.a = 1.0;
-}
-
diff --git a/src/datavis3d/engine/shaders/default.vert b/src/datavis3d/engine/shaders/default.vert
deleted file mode 100644
index 14f77773..00000000
--- a/src/datavis3d/engine/shaders/default.vert
+++ /dev/null
@@ -1,28 +0,0 @@
-#version 120
-
-attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
-attribute highp vec3 vertexNormal_mdl;
-
-uniform highp mat4 MVP;
-uniform highp mat4 V;
-uniform highp mat4 M;
-uniform highp mat4 itM;
-uniform highp vec3 lightPosition_wrld;
-
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-varying highp vec2 coords_mdl;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
- coords_mdl = vertexPosition_mdl.xy;
- position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz;
- vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz;
- eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr;
- 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;
-}
diff --git a/src/datavis3d/engine/shaders/default_ES2.frag b/src/datavis3d/engine/shaders/default_ES2.frag
deleted file mode 100644
index 7d6214b2..00000000
--- a/src/datavis3d/engine/shaders/default_ES2.frag
+++ /dev/null
@@ -1,38 +0,0 @@
-varying highp vec2 UV;
-varying highp vec2 coords_mdl;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-
-void main() {
- highp vec3 materialDiffuseColor = color_mdl.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;
- else 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;
- else if (cosAlpha > 1.0) cosAlpha = 1.0;
-
- gl_FragColor.rgb =
- materialAmbientColor +
- materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
- materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;
- gl_FragColor.a = 1.0;
-}
-
diff --git a/src/datavis3d/engine/shaders/default_ES2.vert b/src/datavis3d/engine/shaders/default_ES2.vert
deleted file mode 100644
index efb40862..00000000
--- a/src/datavis3d/engine/shaders/default_ES2.vert
+++ /dev/null
@@ -1,26 +0,0 @@
-attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
-attribute highp vec3 vertexNormal_mdl;
-
-uniform highp mat4 MVP;
-uniform highp mat4 V;
-uniform highp mat4 M;
-uniform highp mat4 itM;
-uniform highp vec3 lightPosition_wrld;
-
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-varying highp vec2 coords_mdl;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
- coords_mdl = vertexPosition_mdl.xy;
- position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz;
- vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz;
- eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr;
- 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;
-}
diff --git a/src/datavis3d/engine/shaders/depth.frag b/src/datavis3d/engine/shaders/depth.frag
deleted file mode 100644
index 5cfd4b10..00000000
--- a/src/datavis3d/engine/shaders/depth.frag
+++ /dev/null
@@ -1,3 +0,0 @@
-void main() {
- gl_FragDepth = gl_FragCoord.z;
-}
diff --git a/src/datavis3d/engine/shaders/depth.vert b/src/datavis3d/engine/shaders/depth.vert
deleted file mode 100644
index 9fe5a193..00000000
--- a/src/datavis3d/engine/shaders/depth.vert
+++ /dev/null
@@ -1,8 +0,0 @@
-uniform highp mat4 MVP;
-
-attribute highp vec3 vertexPosition_mdl;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
-}
-
diff --git a/src/datavis3d/engine/shaders/label.frag b/src/datavis3d/engine/shaders/label.frag
deleted file mode 100644
index 86021410..00000000
--- a/src/datavis3d/engine/shaders/label.frag
+++ /dev/null
@@ -1,8 +0,0 @@
-uniform sampler2D textureSampler;
-
-varying highp vec2 UV;
-
-void main() {
- gl_FragColor = texture2D(textureSampler, UV);
-}
-
diff --git a/src/datavis3d/engine/shaders/label.vert b/src/datavis3d/engine/shaders/label.vert
deleted file mode 100644
index b4debe53..00000000
--- a/src/datavis3d/engine/shaders/label.vert
+++ /dev/null
@@ -1,11 +0,0 @@
-uniform highp mat4 MVP;
-
-attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
-
-varying highp vec2 UV;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
- UV = vertexUV;
-}
diff --git a/src/datavis3d/engine/shaders/selection.frag b/src/datavis3d/engine/shaders/selection.frag
deleted file mode 100644
index 099c87a1..00000000
--- a/src/datavis3d/engine/shaders/selection.frag
+++ /dev/null
@@ -1,7 +0,0 @@
-uniform highp vec3 color_mdl;
-
-void main() {
- gl_FragColor.rgb = color_mdl;
- gl_FragColor.a = 1.0;
-}
-
diff --git a/src/datavis3d/engine/shaders/selection.vert b/src/datavis3d/engine/shaders/selection.vert
deleted file mode 100644
index 64d17e15..00000000
--- a/src/datavis3d/engine/shaders/selection.vert
+++ /dev/null
@@ -1,7 +0,0 @@
-uniform highp mat4 MVP;
-
-attribute highp vec3 vertexPosition_mdl;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
-}
diff --git a/src/datavis3d/engine/shaders/shadow.frag b/src/datavis3d/engine/shaders/shadow.frag
deleted file mode 100644
index 5309b5bb..00000000
--- a/src/datavis3d/engine/shaders/shadow.frag
+++ /dev/null
@@ -1,82 +0,0 @@
-#version 120
-
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-uniform highp float shadowQuality;
-uniform highp sampler2D textureSampler;
-uniform highp sampler2DShadow shadowMap;
-
-varying highp vec4 shadowCoord;
-varying highp vec2 UV;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-highp vec2 poissonDisk[16] = vec2[16](vec2(-0.94201624, -0.39906216),
- vec2(0.94558609, -0.76890725),
- vec2(-0.094184101, -0.92938870),
- vec2(0.34495938, 0.29387760),
- vec2(-0.91588581, 0.45771432),
- vec2(-0.81544232, -0.87912464),
- vec2(-0.38277543, 0.27676845),
- vec2(0.97484398, 0.75648379),
- vec2(0.44323325, -0.97511554),
- vec2(0.53742981, -0.47373420),
- vec2(-0.26496911, -0.41893023),
- vec2(0.79197514, 0.19090188),
- vec2(-0.24188840, 0.99706507),
- vec2(-0.81409955, 0.91437590),
- vec2(0.19984126, 0.78641367),
- vec2(0.14383161, -0.14100790));
-
-/*float random(vec3 seed, int i) {
- vec4 seed4 = vec4(seed, i);
- float dot_product = dot(seed4, vec4(12.9898, 78.233, 45.164, 94.673));
- return fract(sin(dot_product) * 43758.5453);
-}*/
-
-void main() {
- highp vec3 materialDiffuseColor = texture2D(textureSampler, UV).rgb;
- highp vec3 materialAmbientColor = vec3(ambientStrength, ambientStrength, ambientStrength) * materialDiffuseColor;
- highp vec3 materialSpecularColor = vec3(0.2, 0.2, 0.2);
-
- highp vec3 n = normalize(normal_cmr);
- highp vec3 l = normalize(lightDirection_cmr);
- highp float cosTheta = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- highp vec3 R = reflect(-l, n);
- highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-
- highp float bias = 0.005 * tan(acos(cosTheta));
- bias = clamp(bias, 0.0, 0.01);
-
- vec4 shadCoords = shadowCoord;
- shadCoords.z -= bias;
- // adjust shadow strength by increasing the multiplier and lowering the addition (their sum must be 1)
- // direct method; needs large shadow texture to look good
- //highp float visibility = 0.75 * shadow2DProj(shadowMap, shadCoords).r + 0.25;
- // poisson disk sampling; smoothes edges
- highp float visibility = 0.6;
- for (int i = 0; i < 15; i++) {
- vec4 shadCoordsPD = shadCoords;
- shadCoordsPD.x += cos(poissonDisk[i].x) / shadowQuality;
- shadCoordsPD.y += sin(poissonDisk[i].y) / shadowQuality;
- visibility += 0.025 * shadow2DProj(shadowMap, shadCoordsPD).r;
- }
- // stratified poisson; produces noise but hides pixel edges well
- /*for (int i = 0; i < 15; i++) {
- vec4 shadCoordsPD = shadCoords;
- int index = int(16.0 * random(gl_FragCoord.xyy, i));
- shadCoordsPD.xy += poissonDisk[index] / 150.0;
- visibility += 0.05 * shadow2DProj(shadowMap, shadCoordsPD).r;
- }
- */
-
- gl_FragColor.rgb =
- visibility * (materialAmbientColor +
- materialDiffuseColor * lightStrength * cosTheta +
- materialSpecularColor * lightStrength * pow(cosAlpha, 10));
- gl_FragColor.a = texture2D(textureSampler, UV).a;
-}
diff --git a/src/datavis3d/engine/shaders/shadow.vert b/src/datavis3d/engine/shaders/shadow.vert
deleted file mode 100644
index e29a8a30..00000000
--- a/src/datavis3d/engine/shaders/shadow.vert
+++ /dev/null
@@ -1,37 +0,0 @@
-#version 120
-
-uniform highp mat4 MVP;
-uniform highp mat4 V;
-uniform highp mat4 M;
-uniform highp mat4 itM;
-uniform highp mat4 depthMVP;
-uniform highp vec3 lightPosition_wrld;
-
-attribute highp vec3 vertexPosition_mdl;
-attribute highp vec3 vertexNormal_mdl;
-attribute highp vec2 vertexUV;
-
-varying highp vec2 UV;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-varying highp vec4 shadowCoord;
-varying highp vec2 coords_mdl;
-
-const highp mat4 bias = mat4(0.5, 0.0, 0.0, 0.0,
- 0.0, 0.5, 0.0, 0.0,
- 0.0, 0.0, 0.5, 0.0,
- 0.5, 0.5, 0.5, 1.0);
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
- coords_mdl = vertexPosition_mdl.xy;
- shadowCoord = bias * depthMVP * vec4(vertexPosition_mdl, 1.0);
- position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz;
- vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz;
- eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr;
- lightDirection_cmr = (V * vec4(lightPosition_wrld, 0.0)).xyz;
- normal_cmr = (V * itM * vec4(vertexNormal_mdl, 0.0)).xyz;
- UV = vertexUV;
-}
diff --git a/src/datavis3d/engine/shaders/shadowNoTex.frag b/src/datavis3d/engine/shaders/shadowNoTex.frag
deleted file mode 100644
index 0252ba49..00000000
--- a/src/datavis3d/engine/shaders/shadowNoTex.frag
+++ /dev/null
@@ -1,98 +0,0 @@
-#version 120
-
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-uniform highp float shadowQuality;
-uniform highp vec3 color_mdl;
-uniform highp sampler2DShadow shadowMap;
-
-varying highp vec4 shadowCoord;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-highp vec2 poissonDisk[16] = vec2[16](vec2(-0.94201624, -0.39906216),
- vec2(0.94558609, -0.76890725),
- vec2(-0.094184101, -0.92938870),
- vec2(0.34495938, 0.29387760),
- vec2(-0.91588581, 0.45771432),
- vec2(-0.81544232, -0.87912464),
- vec2(-0.38277543, 0.27676845),
- vec2(0.97484398, 0.75648379),
- vec2(0.44323325, -0.97511554),
- vec2(0.53742981, -0.47373420),
- vec2(-0.26496911, -0.41893023),
- vec2(0.79197514, 0.19090188),
- vec2(-0.24188840, 0.99706507),
- vec2(-0.81409955, 0.91437590),
- vec2(0.19984126, 0.78641367),
- vec2(0.14383161, -0.14100790));
-
-/*highp vec2 poissonDisk[16] = vec2[16](vec2(-0.25, -0.25),
- vec2(0.25, -0.25),
- vec2(-0.25, 0.25),
- vec2(0.25, 0.25),
- vec2(-0.5, -0.5),
- vec2(0.5, -0.5),
- vec2(-0.5, 0.5),
- vec2(0.5, 0.5),
- vec2(-0.75, -0.75),
- vec2(0.75, -0.75),
- vec2(-0.75, 0.75),
- vec2(0.75, 0.75),
- vec2(-1.0, -1.0),
- vec2(1.0, -1.0),
- vec2(-1.0, 1.0),
- vec2(1.0, 1.0));*/
-
-/*float random(vec3 seed, int i) {
- vec4 seed4 = vec4(seed, i);
- float dot_product = dot(seed4, vec4(12.9898, 78.233, 45.164, 94.673));
- return fract(sin(dot_product) * 43758.5453);
-}*/
-
-void main() {
- highp vec3 materialDiffuseColor = color_mdl.rgb;
- highp vec3 materialAmbientColor = vec3(ambientStrength, ambientStrength, ambientStrength) * materialDiffuseColor;
- highp vec3 materialSpecularColor = vec3(1.0, 1.0, 1.0);
-
- highp vec3 n = normalize(normal_cmr);
- highp vec3 l = normalize(lightDirection_cmr);
- highp float cosTheta = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- highp vec3 R = reflect(-l, n);
- highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-
- highp float bias = 0.005 * tan(acos(cosTheta));
- bias = clamp(bias, 0.0, 0.01);
-
- vec4 shadCoords = shadowCoord;
- shadCoords.z -= bias;
- // adjust shadow strength by increasing the multiplier and lowering the addition (their sum must be 1)
- // direct method; needs large shadow texture to look good
- //highp float visibility = 0.75 * shadow2DProj(shadowMap, shadCoords).r + 0.25;
- // poisson disk sampling; smoothes edges
- highp float visibility = 0.6;
- for (int i = 0; i < 15; i++) {
- vec4 shadCoordsPD = shadCoords;
- shadCoordsPD.x += cos(poissonDisk[i].x) / shadowQuality;
- shadCoordsPD.y += sin(poissonDisk[i].y) / shadowQuality;
- visibility += 0.025 * shadow2DProj(shadowMap, shadCoordsPD).r;
- }
- // stratified poisson; produces noise but hides pixel edges well
- /*for (int i = 0; i < 15; i++) {
- vec4 shadCoordsPD = shadCoords;
- int index = int(16.0 * random(gl_FragCoord.xyy, i));
- shadCoordsPD.xy += poissonDisk[index] / 150.0;
- visibility += 0.05 * shadow2DProj(shadowMap, shadCoordsPD).r;
- }
- */
-
- gl_FragColor.rgb =
- visibility * (materialAmbientColor +
- materialDiffuseColor * lightStrength * cosTheta +
- materialSpecularColor * lightStrength * pow(cosAlpha, 10));
- gl_FragColor.a = 1.0;
-}
diff --git a/src/datavis3d/engine/shaders/shadowNoTexColorOnY.frag b/src/datavis3d/engine/shaders/shadowNoTexColorOnY.frag
deleted file mode 100644
index 515bf271..00000000
--- a/src/datavis3d/engine/shaders/shadowNoTexColorOnY.frag
+++ /dev/null
@@ -1,82 +0,0 @@
-#version 120
-
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-uniform highp float shadowQuality;
-uniform highp vec3 color_mdl;
-uniform highp sampler2DShadow shadowMap;
-
-varying highp vec4 shadowCoord;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-varying highp vec2 coords_mdl;
-
-highp vec2 poissonDisk[16] = vec2[16](vec2(-0.94201624, -0.39906216),
- vec2(0.94558609, -0.76890725),
- vec2(-0.094184101, -0.92938870),
- vec2(0.34495938, 0.29387760),
- vec2(-0.91588581, 0.45771432),
- vec2(-0.81544232, -0.87912464),
- vec2(-0.38277543, 0.27676845),
- vec2(0.97484398, 0.75648379),
- vec2(0.44323325, -0.97511554),
- vec2(0.53742981, -0.47373420),
- vec2(-0.26496911, -0.41893023),
- vec2(0.79197514, 0.19090188),
- vec2(-0.24188840, 0.99706507),
- vec2(-0.81409955, 0.91437590),
- vec2(0.19984126, 0.78641367),
- vec2(0.14383161, -0.14100790));
-
-/*float random(vec3 seed, int i) {
- vec4 seed4 = vec4(seed, i);
- float dot_product = dot(seed4, vec4(12.9898, 78.233, 45.164, 94.673));
- return fract(sin(dot_product) * 43758.5453);
-}*/
-
-void main() {
- highp float heightMod = coords_mdl.y + (1.0 - ambientStrength);
- highp vec3 materialDiffuseColor = heightMod * color_mdl;
- highp vec3 materialAmbientColor = vec3(ambientStrength, ambientStrength, ambientStrength) * materialDiffuseColor;
- highp vec3 materialSpecularColor = vec3(1.0, 1.0, 1.0);
-
- highp vec3 n = normalize(normal_cmr);
- highp vec3 l = normalize(lightDirection_cmr);
- highp float cosTheta = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- highp vec3 R = reflect(-l, n);
- highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-
- highp float bias = 0.005 * tan(acos(cosTheta));
- bias = clamp(bias, 0.0, 0.01);
-
- vec4 shadCoords = shadowCoord;
- shadCoords.z -= bias;
- // adjust shadow strength by increasing the multiplier and lowering the addition (their sum must be 1)
- // direct method; needs large shadow texture to look good
- //highp float visibility = 0.75 * shadow2DProj(shadowMap, shadCoords).r + 0.25;
- // poisson disk sampling; smoothes edges
- highp float visibility = 0.6;
- for (int i = 0; i < 15; i++) {
- vec4 shadCoordsPD = shadCoords;
- shadCoordsPD.x += cos(poissonDisk[i].x) / shadowQuality;
- shadCoordsPD.y += sin(poissonDisk[i].y) / shadowQuality;
- visibility += 0.025 * shadow2DProj(shadowMap, shadCoordsPD).r;
- }
- /*for (int i = 0; i < 15; i++) {
- vec4 shadCoordsPD = shadCoords;
- int index = int(16.0 * random(gl_FragCoord.xyy, i));
- shadCoordsPD.xy += poissonDisk[index] / 150.0;
- visibility += 0.05 * shadow2DProj(shadowMap, shadCoordsPD).r;
- }*/
-
- gl_FragColor.rgb =
- visibility * (materialAmbientColor +
- materialDiffuseColor * lightStrength * cosTheta +
- materialSpecularColor * lightStrength * pow(cosAlpha, 10));
- gl_FragColor.rgb = clamp(gl_FragColor.rgb, 0.0, 1.0);
- gl_FragColor.a = 1.0;
-}
diff --git a/src/datavis3d/engine/shaders/surface.frag b/src/datavis3d/engine/shaders/surface.frag
deleted file mode 100644
index 9fe7f45b..00000000
--- a/src/datavis3d/engine/shaders/surface.frag
+++ /dev/null
@@ -1,39 +0,0 @@
-#version 120
-
-varying highp vec2 UV;
-varying highp vec3 coords_mdl;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-uniform sampler2D textureSampler;
-uniform highp vec3 lightPosition_wrld;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-
-void main() {
- highp vec2 gradientUV = vec2(0.5, (coords_mdl.y + 1.0) / 2.0);
- 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);
-
- highp float distance = length(lightPosition_wrld - position_wrld);
-
- highp vec3 n = normalize(normal_cmr);
- highp vec3 l = normalize(lightDirection_cmr);
- highp float cosTheta = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- 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/datavis3d/engine/shaders/surface.vert b/src/datavis3d/engine/shaders/surface.vert
deleted file mode 100644
index cbfb7569..00000000
--- a/src/datavis3d/engine/shaders/surface.vert
+++ /dev/null
@@ -1,30 +0,0 @@
-#version 120
-
-attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
-attribute highp vec3 vertexNormal_mdl;
-
-uniform highp mat4 MVP;
-uniform highp mat4 V;
-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;
-varying highp vec3 lightDirection_cmr;
-varying highp vec3 coords_mdl;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
- coords_mdl = vertexPosition_mdl;
- position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz;
- vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz;
- eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr;
- 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/datavis3d/engine/shaders/surfaceFlat.frag b/src/datavis3d/engine/shaders/surfaceFlat.frag
deleted file mode 100644
index eb398582..00000000
--- a/src/datavis3d/engine/shaders/surfaceFlat.frag
+++ /dev/null
@@ -1,38 +0,0 @@
-#version 150
-
-varying highp vec2 UV;
-varying highp vec3 coords_mdl;
-varying highp vec3 position_wrld;
-flat in highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-uniform sampler2D textureSampler;
-uniform highp vec3 lightPosition_wrld;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-
-void main() {
- highp vec2 gradientUV = vec2(0.5, (coords_mdl.y + 1.0) / 2.0);
- 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);
-
- highp float distance = length(lightPosition_wrld - position_wrld);
-
- highp vec3 n = normalize(normal_cmr);
- highp vec3 l = normalize(lightDirection_cmr);
- highp float cosTheta = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- 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;
-}
-
diff --git a/src/datavis3d/engine/shaders/surfaceFlat.vert b/src/datavis3d/engine/shaders/surfaceFlat.vert
deleted file mode 100644
index 24c9b9a3..00000000
--- a/src/datavis3d/engine/shaders/surfaceFlat.vert
+++ /dev/null
@@ -1,30 +0,0 @@
-#version 150
-
-attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
-attribute highp vec3 vertexNormal_mdl;
-
-uniform highp mat4 MVP;
-uniform highp mat4 V;
-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;
-varying highp vec3 lightDirection_cmr;
-varying highp vec3 coords_mdl;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
- coords_mdl = vertexPosition_mdl;
- position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz;
- vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz;
- eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr;
- 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/datavis3d/engine/shaders/surfaceGrid.frag b/src/datavis3d/engine/shaders/surfaceGrid.frag
deleted file mode 100644
index 20b923fb..00000000
--- a/src/datavis3d/engine/shaders/surfaceGrid.frag
+++ /dev/null
@@ -1,16 +0,0 @@
-varying highp vec2 UV;
-varying highp vec2 coords_mdl;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-
-void main() {
- gl_FragColor.rgb = color_mdl;
-}
-
diff --git a/src/datavis3d/engine/shaders/surfaceGrid.vert b/src/datavis3d/engine/shaders/surfaceGrid.vert
deleted file mode 100644
index efb40862..00000000
--- a/src/datavis3d/engine/shaders/surfaceGrid.vert
+++ /dev/null
@@ -1,26 +0,0 @@
-attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
-attribute highp vec3 vertexNormal_mdl;
-
-uniform highp mat4 MVP;
-uniform highp mat4 V;
-uniform highp mat4 M;
-uniform highp mat4 itM;
-uniform highp vec3 lightPosition_wrld;
-
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-varying highp vec2 coords_mdl;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
- coords_mdl = vertexPosition_mdl.xy;
- position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz;
- vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz;
- eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr;
- 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;
-}
diff --git a/src/datavis3d/engine/shaders/texture.frag b/src/datavis3d/engine/shaders/texture.frag
deleted file mode 100644
index a6d7b2eb..00000000
--- a/src/datavis3d/engine/shaders/texture.frag
+++ /dev/null
@@ -1,35 +0,0 @@
-#version 120
-
-uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-uniform sampler2D textureSampler;
-
-varying highp vec2 UV;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-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 = clamp(dot(n, l), 0.0, 1.0);
-
- highp vec3 E = normalize(eyeDirection_cmr);
- highp vec3 R = reflect(-l, n);
- highp float cosAlpha = clamp(dot(E, R), 0.0, 1.0);
-
- gl_FragColor.rgb =
- materialAmbientColor +
- materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
- materialSpecularColor * lightStrength * pow(cosAlpha, 10) / distance;
- gl_FragColor.a = texture2D(textureSampler, UV).a;
-}
-
diff --git a/src/datavis3d/engine/shaders/texture.vert b/src/datavis3d/engine/shaders/texture.vert
deleted file mode 100644
index 01f922e0..00000000
--- a/src/datavis3d/engine/shaders/texture.vert
+++ /dev/null
@@ -1,26 +0,0 @@
-uniform highp mat4 MVP;
-uniform highp mat4 V;
-uniform highp mat4 M;
-uniform highp mat4 itM;
-uniform highp vec3 lightPosition_wrld;
-
-attribute highp vec3 vertexPosition_mdl;
-attribute highp vec2 vertexUV;
-attribute highp vec3 vertexNormal_mdl;
-
-varying highp vec2 UV;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
- position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz;
- vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz;
- eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr;
- 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/datavis3d/engine/shaders/texture_ES2.frag b/src/datavis3d/engine/shaders/texture_ES2.frag
deleted file mode 100644
index 58097ba5..00000000
--- a/src/datavis3d/engine/shaders/texture_ES2.frag
+++ /dev/null
@@ -1,37 +0,0 @@
-uniform highp vec3 lightPosition_wrld;
-uniform highp vec3 color_mdl;
-uniform highp float lightStrength;
-uniform highp float ambientStrength;
-uniform sampler2D textureSampler;
-
-varying highp vec2 UV;
-varying highp vec3 position_wrld;
-varying highp vec3 normal_cmr;
-varying highp vec3 eyeDirection_cmr;
-varying highp vec3 lightDirection_cmr;
-
-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;
- else 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;
- else if (cosAlpha > 1.0) cosAlpha = 1.0;
-
- gl_FragColor.rgb =
- materialAmbientColor +
- materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
- materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;
- gl_FragColor.a = texture2D(textureSampler, UV).a;
-}
-