From aab6b4f77d408c523bd9335ffa48bcc552c00c62 Mon Sep 17 00:00:00 2001 From: Mika Salmela Date: Tue, 7 Oct 2014 00:04:03 +0300 Subject: Texture UVs for surface to follow data dimension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change texture UVs to be generated according to data dimension. Also utilise this change on texturesurface example. Change-Id: Ideacfba409dc2e7cf579fb38d897e08c9f9a1b71 Reviewed-by: Tomi Korpipää Reviewed-by: Miikka Heikkinen --- examples/datavisualization/texturesurface/topographicseries.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples') 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; -- cgit v1.2.3