summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-09-06 08:49:43 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-09-06 09:04:26 +0300
commit1ff7a47fe0f2a016e7b61adf3b99ca750347ec13 (patch)
tree2b19721d4dd520f5fc90a375b4629bb2a5cb78b0
parent8f1ad0ed8c88927fb44350de477200cf09c231fb (diff)
ES2 scene darkness issue fixed
Task-number: QTRD-2247 Change-Id: Idc62175ec46edaf3e4ac0017aeb9335772b865d4 Change-Id: Idc62175ec46edaf3e4ac0017aeb9335772b865d4 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
-rw-r--r--examples/qmlbarchart/qml/qmlbarchart/main.qml6
-rw-r--r--src/datavis3d/engine/shaders/colorOnY_ES2.frag7
-rw-r--r--src/datavis3d/engine/shaders/default_ES2.frag2
-rw-r--r--src/datavis3d/engine/shaders/texture_ES2.frag2
4 files changed, 9 insertions, 8 deletions
diff --git a/examples/qmlbarchart/qml/qmlbarchart/main.qml b/examples/qmlbarchart/qml/qmlbarchart/main.qml
index bcd614ba..ea28d90a 100644
--- a/examples/qmlbarchart/qml/qmlbarchart/main.qml
+++ b/examples/qmlbarchart/qml/qmlbarchart/main.qml
@@ -86,9 +86,9 @@ Item {
TableViewColumn{ role: "income" ; title: "Income" ; width: 60 }
model: chartData.model
- onClicked: {
- var rowIndex = testchart.mapping.rowCategoryIndex(chartData.model.get(row).year)
- var colIndex = testchart.mapping.columnCategoryIndex(chartData.model.get(row).month)
+ onCurrentRowChanged: {
+ var rowIndex = testchart.mapping.rowCategoryIndex(chartData.model.get(currentRow).year)
+ var colIndex = testchart.mapping.columnCategoryIndex(chartData.model.get(currentRow).month)
testchart.selectedBarPos = Qt.point(rowIndex, colIndex)
}
}
diff --git a/src/datavis3d/engine/shaders/colorOnY_ES2.frag b/src/datavis3d/engine/shaders/colorOnY_ES2.frag
index 68c8ac39..78c778d3 100644
--- a/src/datavis3d/engine/shaders/colorOnY_ES2.frag
+++ b/src/datavis3d/engine/shaders/colorOnY_ES2.frag
@@ -10,7 +10,8 @@ varying highp vec3 lightDirection_cmr;
varying highp vec2 coords_mdl;
void main() {
- highp vec3 materialDiffuseColor = vec3(coords_mdl.y * color_mdl.x, coords_mdl.y * color_mdl.y, coords_mdl.y * color_mdl.z);
+ 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);
@@ -29,8 +30,8 @@ void main() {
gl_FragColor.rgb =
materialAmbientColor +
- materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / (distance * distance) +
- materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / (distance * distance);
+ 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.frag b/src/datavis3d/engine/shaders/default_ES2.frag
index a70ed241..7d6214b2 100644
--- a/src/datavis3d/engine/shaders/default_ES2.frag
+++ b/src/datavis3d/engine/shaders/default_ES2.frag
@@ -32,7 +32,7 @@ void main() {
gl_FragColor.rgb =
materialAmbientColor +
materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
- materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;
+ materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;
gl_FragColor.a = 1.0;
}
diff --git a/src/datavis3d/engine/shaders/texture_ES2.frag b/src/datavis3d/engine/shaders/texture_ES2.frag
index 16161035..58097ba5 100644
--- a/src/datavis3d/engine/shaders/texture_ES2.frag
+++ b/src/datavis3d/engine/shaders/texture_ES2.frag
@@ -31,7 +31,7 @@ void main() {
gl_FragColor.rgb =
materialAmbientColor +
materialDiffuseColor * lightStrength * (cosTheta * cosTheta) / distance +
- materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;
+ materialSpecularColor * lightStrength * (cosAlpha * cosAlpha * cosAlpha * cosAlpha * cosAlpha) / distance;
gl_FragColor.a = texture2D(textureSampler, UV).a;
}