summaryrefslogtreecommitdiffstats
path: root/tests/qmlvolume/datasource.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2015-10-20 13:18:59 +0300
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2015-10-22 10:08:51 +0000
commit31f9c57bc50ae053cfaf039a1dfdb128e2494458 (patch)
tree316138cb73c49877f5a80a8496c2f1b737122fb5 /tests/qmlvolume/datasource.cpp
parent4162ddeb02ee41fd4217d7f3d93d45cab3313ba8 (diff)
Fix issues with COIN builds
-Fix miscellaneous compile errors -Move manual tests to manual folder and enable export of autotests -Added widgets requirement -Fixed autotests -Fixed renderer and controller synchronization in QML case -Treat fallback Mesa as ES2 similar to setting AA_UseSoftwareOpenGL Change-Id: If6619733725d079e339bef16262e5ea1450ab20f Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com>
Diffstat (limited to 'tests/qmlvolume/datasource.cpp')
-rw-r--r--tests/qmlvolume/datasource.cpp93
1 files changed, 0 insertions, 93 deletions
diff --git a/tests/qmlvolume/datasource.cpp b/tests/qmlvolume/datasource.cpp
deleted file mode 100644
index 74813f7d..00000000
--- a/tests/qmlvolume/datasource.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Data Visualization module.
-**
-** $QT_BEGIN_LICENSE:COMM$
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-#include "datasource.h"
-#include <QtCore/qmath.h>
-#include <QtGui/QRgb>
-#include <QtGui/QVector3D>
-
-using namespace QtDataVisualization;
-
-Q_DECLARE_METATYPE(QCustom3DVolume *)
-
-DataSource::DataSource(QObject *parent) :
- QObject(parent)
-{
- qRegisterMetaType<QCustom3DVolume *>();
-}
-
-DataSource::~DataSource()
-{
-}
-
-void DataSource::fillVolume(QCustom3DVolume *volumeItem)
-{
- // Generate example texture data for an half-ellipsoid with a section missing.
- // This can take a while if the dimensions are large, so we support incremental data generation.
-
- int index = 0;
- int textureSize = 256;
- QVector3D midPoint(float(textureSize) / 2.0f,
- float(textureSize) / 2.0f,
- float(textureSize) / 2.0f);
-
- QVector<uchar> *textureData = new QVector<uchar>(textureSize * textureSize * textureSize / 2);
- for (int i = 0; i < textureSize; i++) {
- for (int j = 0; j < textureSize / 2; j++) {
- for (int k = 0; k < textureSize; k++) {
- int colorIndex = 0;
- // Take a section out of the ellipsoid
- if (i >= textureSize / 2 || j >= textureSize / 4 || k >= textureSize / 2) {
- QVector3D distVec = QVector3D(float(k), float(j * 2), float(i)) - midPoint;
- float adjLen = qMin(255.0f, (distVec.length() * 512.0f / float(textureSize)));
- colorIndex = 255 - int(adjLen);
- }
-
- (*textureData)[index] = colorIndex;
- index++;
- }
- }
- }
-
- volumeItem->setScaling(QVector3D(2.0f, 1.0f, 2.0f));
- volumeItem->setTextureWidth(textureSize);
- volumeItem->setTextureHeight(textureSize / 2);
- volumeItem->setTextureDepth(textureSize);
- volumeItem->setTextureFormat(QImage::Format_Indexed8);
- volumeItem->setTextureData(textureData);
-
- QVector<QRgb> colorTable(256);
-
- for (int i = 1; i < 256; i++) {
- if (i < 15)
- colorTable[i] = qRgba(0, 0, 0, 0);
- else if (i < 60)
- colorTable[i] = qRgba((i * 2) + 120, 0, 0, 15);
- else if (i < 120)
- colorTable[i] = qRgba(0, ((i - 60) * 2) + 120, 0, 50);
- else if (i < 180)
- colorTable[i] = qRgba(0, 0, ((i - 120) * 2) + 120, 255);
- else
- colorTable[i] = qRgba(i, i, i, 255);
- }
-
- volumeItem->setColorTable(colorTable);
-}