summaryrefslogtreecommitdiffstats
path: root/src/datavisualization
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualization')
-rw-r--r--src/datavisualization/engine/abstract3drenderer.cpp6
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp4
-rw-r--r--src/datavisualization/engine/engine.qrc11
-rw-r--r--src/datavisualization/engine/scatter3drenderer.cpp6
-rw-r--r--src/datavisualization/engine/selectionpointer.cpp2
-rw-r--r--src/datavisualization/engine/shaders/ambient.frag32
-rw-r--r--src/datavisualization/engine/shaders/default.vert2
-rw-r--r--src/datavisualization/engine/shaders/default_ES2.vert26
-rw-r--r--src/datavisualization/engine/shaders/plainColor.frag (renamed from src/datavisualization/engine/shaders/selection.frag)0
-rw-r--r--src/datavisualization/engine/shaders/plainColor.vert (renamed from src/datavisualization/engine/shaders/selection.vert)0
-rw-r--r--src/datavisualization/engine/shaders/surfaceGrid.frag6
-rw-r--r--src/datavisualization/engine/shaders/surfaceGrid.vert6
-rw-r--r--src/datavisualization/engine/shaders/texture.frag35
-rw-r--r--src/datavisualization/engine/shaders/texture.vert26
-rw-r--r--src/datavisualization/engine/shaders/texture_ES2.frag37
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp6
16 files changed, 14 insertions, 191 deletions
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp
index 3f49b67e..1b1143fa 100644
--- a/src/datavisualization/engine/abstract3drenderer.cpp
+++ b/src/datavisualization/engine/abstract3drenderer.cpp
@@ -217,13 +217,13 @@ void Abstract3DRenderer::reInitShaders()
}
#else
if (m_cachedColorStyle != QDataVis::ColorStyleUniform) {
- initShaders(QStringLiteral(":/shaders/vertexES2"),
+ initShaders(QStringLiteral(":/shaders/vertex"),
QStringLiteral(":/shaders/fragmentColorOnYES2"));
} else {
- initShaders(QStringLiteral(":/shaders/vertexES2"),
+ initShaders(QStringLiteral(":/shaders/vertex"),
QStringLiteral(":/shaders/fragmentES2"));
}
- initBackgroundShaders(QStringLiteral(":/shaders/vertexES2"),
+ initBackgroundShaders(QStringLiteral(":/shaders/vertex"),
QStringLiteral(":/shaders/fragmentES2"));
#endif
}
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index a11f3aa1..2a9a5090 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -2075,8 +2075,8 @@ void Bars3DRenderer::initSelectionShader()
{
if (m_selectionShader)
delete m_selectionShader;
- m_selectionShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexSelection"),
- QStringLiteral(":/shaders/fragmentSelection"));
+ m_selectionShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexPlainColor"),
+ QStringLiteral(":/shaders/fragmentPlainColor"));
m_selectionShader->initialize();
}
diff --git a/src/datavisualization/engine/engine.qrc b/src/datavisualization/engine/engine.qrc
index 7b1fb76b..ecf9e29b 100644
--- a/src/datavisualization/engine/engine.qrc
+++ b/src/datavisualization/engine/engine.qrc
@@ -31,12 +31,9 @@
<qresource prefix="/shaders">
<file alias="fragment">shaders/default.frag</file>
<file alias="vertex">shaders/default.vert</file>
- <file alias="fragmentAmbient">shaders/ambient.frag</file>
<file alias="fragmentColorOnY">shaders/colorOnY.frag</file>
- <file alias="fragmentSelection">shaders/selection.frag</file>
- <file alias="vertexSelection">shaders/selection.vert</file>
- <file alias="fragmentTexture">shaders/texture.frag</file>
- <file alias="vertexTexture">shaders/texture.vert</file>
+ <file alias="fragmentPlainColor">shaders/plainColor.frag</file>
+ <file alias="vertexPlainColor">shaders/plainColor.vert</file>
<file alias="fragmentLabel">shaders/label.frag</file>
<file alias="vertexLabel">shaders/label.vert</file>
<file alias="fragmentDepth">shaders/depth.frag</file>
@@ -47,11 +44,7 @@
<file alias="fragmentShadowNoTexColorOnY">shaders/shadowNoTexColorOnY.frag</file>
<file alias="fragmentColorOnYES2">shaders/colorOnY_ES2.frag</file>
<file alias="fragmentES2">shaders/default_ES2.frag</file>
- <file alias="vertexES2">shaders/default_ES2.vert</file>
- <file alias="fragmentTextureES2">shaders/texture_ES2.frag</file>
<file alias="fragmentSurface">shaders/surface.frag</file>
- <file alias="fragmentSurfaceGrid">shaders/surfaceGrid.frag</file>
- <file alias="vertexSurfaceGrid">shaders/surfaceGrid.vert</file>
<file alias="vertexSurfaceFlat">shaders/surfaceFlat.vert</file>
<file alias="fragmentSurfaceFlat">shaders/surfaceFlat.frag</file>
<file alias="fragmentSurfaceES2">shaders/surface_ES2.frag</file>
diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp
index f8cd2e6d..449809c8 100644
--- a/src/datavisualization/engine/scatter3drenderer.cpp
+++ b/src/datavisualization/engine/scatter3drenderer.cpp
@@ -1595,8 +1595,8 @@ void Scatter3DRenderer::initSelectionShader()
{
if (m_selectionShader)
delete m_selectionShader;
- m_selectionShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexSelection"),
- QStringLiteral(":/shaders/fragmentSelection"));
+ m_selectionShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexPlainColor"),
+ QStringLiteral(":/shaders/fragmentPlainColor"));
m_selectionShader->initialize();
}
@@ -1649,7 +1649,7 @@ void Scatter3DRenderer::initPointShader()
if (m_pointShader)
delete m_pointShader;
m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexPointES2"),
- QStringLiteral(":/shaders/fragmentSelection"));
+ QStringLiteral(":/shaders/fragmentPlainColor"));
m_pointShader->initialize();
}
#endif
diff --git a/src/datavisualization/engine/selectionpointer.cpp b/src/datavisualization/engine/selectionpointer.cpp
index 5aa1d3eb..fd24da4f 100644
--- a/src/datavisualization/engine/selectionpointer.cpp
+++ b/src/datavisualization/engine/selectionpointer.cpp
@@ -247,7 +247,7 @@ void SelectionPointer::initShaders()
m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertex"),
QStringLiteral(":/shaders/fragment"));
#else
- m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexES2"),
+ m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertex"),
QStringLiteral(":/shaders/fragmentES2"));
#endif
m_pointShader->initialize();
diff --git a/src/datavisualization/engine/shaders/ambient.frag b/src/datavisualization/engine/shaders/ambient.frag
deleted file mode 100644
index 88f850f3..00000000
--- a/src/datavisualization/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/datavisualization/engine/shaders/default.vert b/src/datavisualization/engine/shaders/default.vert
index 14f77773..efb40862 100644
--- a/src/datavisualization/engine/shaders/default.vert
+++ b/src/datavisualization/engine/shaders/default.vert
@@ -1,5 +1,3 @@
-#version 120
-
attribute highp vec3 vertexPosition_mdl;
attribute highp vec2 vertexUV;
attribute highp vec3 vertexNormal_mdl;
diff --git a/src/datavisualization/engine/shaders/default_ES2.vert b/src/datavisualization/engine/shaders/default_ES2.vert
deleted file mode 100644
index efb40862..00000000
--- a/src/datavisualization/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/datavisualization/engine/shaders/selection.frag b/src/datavisualization/engine/shaders/plainColor.frag
index 099c87a1..099c87a1 100644
--- a/src/datavisualization/engine/shaders/selection.frag
+++ b/src/datavisualization/engine/shaders/plainColor.frag
diff --git a/src/datavisualization/engine/shaders/selection.vert b/src/datavisualization/engine/shaders/plainColor.vert
index 64d17e15..64d17e15 100644
--- a/src/datavisualization/engine/shaders/selection.vert
+++ b/src/datavisualization/engine/shaders/plainColor.vert
diff --git a/src/datavisualization/engine/shaders/surfaceGrid.frag b/src/datavisualization/engine/shaders/surfaceGrid.frag
deleted file mode 100644
index 1658b316..00000000
--- a/src/datavisualization/engine/shaders/surfaceGrid.frag
+++ /dev/null
@@ -1,6 +0,0 @@
-uniform highp vec3 color_mdl;
-
-void main() {
- gl_FragColor.rgb = color_mdl;
-}
-
diff --git a/src/datavisualization/engine/shaders/surfaceGrid.vert b/src/datavisualization/engine/shaders/surfaceGrid.vert
deleted file mode 100644
index 5582d633..00000000
--- a/src/datavisualization/engine/shaders/surfaceGrid.vert
+++ /dev/null
@@ -1,6 +0,0 @@
-attribute highp vec3 vertexPosition_mdl;
-uniform highp mat4 MVP;
-
-void main() {
- gl_Position = MVP * vec4(vertexPosition_mdl, 1.0);
-}
diff --git a/src/datavisualization/engine/shaders/texture.frag b/src/datavisualization/engine/shaders/texture.frag
deleted file mode 100644
index a6d7b2eb..00000000
--- a/src/datavisualization/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/datavisualization/engine/shaders/texture.vert b/src/datavisualization/engine/shaders/texture.vert
deleted file mode 100644
index 01f922e0..00000000
--- a/src/datavisualization/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/datavisualization/engine/shaders/texture_ES2.frag b/src/datavisualization/engine/shaders/texture_ES2.frag
deleted file mode 100644
index 58097ba5..00000000
--- a/src/datavisualization/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;
-}
-
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp
index 0614e660..6ee12369 100644
--- a/src/datavisualization/engine/surface3drenderer.cpp
+++ b/src/datavisualization/engine/surface3drenderer.cpp
@@ -2048,7 +2048,7 @@ void Surface3DRenderer::initShaders(const QString &vertexShader, const QString &
}
}
#else
- m_surfaceShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexES2"),
+ m_surfaceShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertex"),
QStringLiteral(":/shaders/fragmentSurfaceES2"));
#endif
m_surfaceShader->initialize();
@@ -2077,8 +2077,8 @@ void Surface3DRenderer::initSurfaceShaders()
// Gridline shader
if (m_surfaceGridShader)
delete m_surfaceGridShader;
- m_surfaceGridShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexSurfaceGrid"),
- QStringLiteral(":/shaders/fragmentSurfaceGrid"));
+ m_surfaceGridShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexPlainColor"),
+ QStringLiteral(":/shaders/fragmentPlainColor"));
m_surfaceGridShader->initialize();
// Triggers surface shader selection by shadow setting