summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMika Salmela <mika.salmela@digia.com>2014-10-07 00:04:03 +0300
committerMika Salmela <mika.salmela@digia.com>2014-10-07 12:09:29 +0300
commitaab6b4f77d408c523bd9335ffa48bcc552c00c62 (patch)
tree940d1e136f2344ace8a2de058c1548f8e27f6e78 /examples
parent0e5b7fba379fe4e751bb2c609bb03d0c9bb01eaa (diff)
Texture UVs for surface to follow data dimension
Change texture UVs to be generated according to data dimension. Also utilise this change on texturesurface example. Change-Id: Ideacfba409dc2e7cf579fb38d897e08c9f9a1b71 Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/datavisualization/texturesurface/topographicseries.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/datavisualization/texturesurface/topographicseries.cpp b/examples/datavisualization/texturesurface/topographicseries.cpp
index 2fa29d35..530e56b4 100644
--- a/examples/datavisualization/texturesurface/topographicseries.cpp
+++ b/examples/datavisualization/texturesurface/topographicseries.cpp
@@ -49,7 +49,8 @@ void TopographicSeries::setTopographyFile(const QString file, float width, float
QSurfaceDataArray *dataArray = new QSurfaceDataArray;
dataArray->reserve(imageHeight);
for (int i = 0; i < imageHeight; i++) {
- int p = (imageHeight - 1 - i) * widthBits;
+ int p = i * widthBits;
+ float z = height - float(i) * stepZ;
QSurfaceDataRow *newRow = new QSurfaceDataRow(imageWidth);
for (int j = 0; j < imageWidth; j++) {
uchar aa = bits[p + 0];
@@ -57,7 +58,7 @@ void TopographicSeries::setTopographyFile(const QString file, float width, float
uchar gg = bits[p + 2];
uint color = uint((gg << 16) + (rr << 8) + aa);
float y = float(color) / packingFactor;
- (*newRow)[j].setPosition(QVector3D(float(j) * stepX, y, float(i) * stepZ));
+ (*newRow)[j].setPosition(QVector3D(float(j) * stepX, y, z));
p = p + 4;
}
*dataArray << newRow;