summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/utils/scatterobjectbufferhelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualization/utils/scatterobjectbufferhelper.cpp')
-rw-r--r--src/datavisualization/utils/scatterobjectbufferhelper.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/datavisualization/utils/scatterobjectbufferhelper.cpp b/src/datavisualization/utils/scatterobjectbufferhelper.cpp
index 1639eb1f..9ecdffdd 100644
--- a/src/datavisualization/utils/scatterobjectbufferhelper.cpp
+++ b/src/datavisualization/utils/scatterobjectbufferhelper.cpp
@@ -114,23 +114,25 @@ void ScatterObjectBufferHelper::fullLoad(ScatterSeriesRenderCache *cache, qreal
int offset = pos * verticeCount;
if (item.rotation().isIdentity()) {
- for (int j = 0; j < verticeCount; j++)
+ for (int j = 0; j < verticeCount; j++) {
buffered_vertices[j + offset] = scaled_vertices[j] + item.translation();
+ buffered_normals[j + offset] = indexed_normals[j];
+ }
} else {
QMatrix4x4 matrix;
- matrix.rotate(seriesRotation * item.rotation());
- modelMatrix = matrix.transposed();
- modelMatrix.scale(modelScaler);
+ QQuaternion totalRotation = seriesRotation * item.rotation();
+ matrix.rotate(totalRotation);
+ matrix.scale(modelScaler);
+ QMatrix4x4 itModelMatrix = matrix.inverted();
+ modelMatrix = matrix.transposed(); // Because of row-column major difference
- for (int j = 0; j < verticeCount; j++)
+ for (int j = 0; j < verticeCount; j++) {
buffered_vertices[j + offset] = indexed_vertices[j] * modelMatrix
+ item.translation();
+ buffered_normals[j + offset] = indexed_normals[j] * itModelMatrix;
+ }
}
- offset = pos * normalsCount;
- for (int j = 0; j < normalsCount; j++)
- buffered_normals[j + offset] = indexed_normals[j];
-
if (cache->colorStyle() == Q3DTheme::ColorStyleUniform) {
offset = pos * uvsCount;
for (int j = 0; j < uvsCount; j++)