mirror of https://github.com/qt/qtgraphs.git
Replace wavefront OBJ files with meshes in tests
Change-Id: I0533d7a420f7ab2b176f8124afc8c03960cfd66f
Reviewed-by: Sakaria Pouke <sakaria.pouke@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Niko Korkala <niko.korkala@qt.io>
(cherry picked from commit 54e9e7af27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
6822fc0460
commit
f72417979f
|
|
@ -159,7 +159,7 @@ void tst_series::initializeProperties()
|
|||
m_series->setName("name");
|
||||
m_series->setSingleHighlightColor(QColor(Qt::red));
|
||||
m_series->setSingleHighlightGradient(gradient3);
|
||||
m_series->setUserDefinedMesh(":/customitem.obj");
|
||||
m_series->setUserDefinedMesh(":/customitem.mesh");
|
||||
m_series->setVisible(false);
|
||||
m_series->setRowLabels(rowLabels);
|
||||
m_series->setColumnLabels(columnLabels);
|
||||
|
|
@ -179,7 +179,7 @@ void tst_series::initializeProperties()
|
|||
QCOMPARE(m_series->singleHighlightColor(), QColor(Qt::red));
|
||||
QCOMPARE(m_series->singleHighlightGradient(), gradient3);
|
||||
QCOMPARE(m_series->singleHighlightGradient().stops().at(0).second, QColor(Qt::white));
|
||||
QCOMPARE(m_series->userDefinedMesh(), QString(":/customitem.obj"));
|
||||
QCOMPARE(m_series->userDefinedMesh(), QString(":/customitem.mesh"));
|
||||
QCOMPARE(m_series->isVisible(), false);
|
||||
QCOMPARE(m_series->rowLabels(), rowLabels);
|
||||
QCOMPARE(m_series->columnLabels(), columnLabels);
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ void tst_custom::construct()
|
|||
QVERIFY(custom);
|
||||
delete custom;
|
||||
|
||||
custom = new QCustom3DItem(":/customitem.obj", QVector3D(1.0f, 1.0f, 1.0f),
|
||||
custom = new QCustom3DItem(":/customitem.mesh", QVector3D(1.0f, 1.0f, 1.0f),
|
||||
QVector3D(1.0f, 1.0f, 1.0f), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f),
|
||||
QImage(":/customtexture.jpg"));
|
||||
QVERIFY(custom);
|
||||
QCOMPARE(custom->meshFile(), QString(":/customitem.obj"));
|
||||
QCOMPARE(custom->meshFile(), QString(":/customitem.mesh"));
|
||||
QCOMPARE(custom->position(), QVector3D(1.0f, 1.0f, 1.0f));
|
||||
QCOMPARE(custom->isPositionAbsolute(), false);
|
||||
QCOMPARE(custom->rotation(), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f));
|
||||
|
|
@ -94,7 +94,7 @@ void tst_custom::initializeProperties()
|
|||
QSignalSpy scalingAbsoluteSpy(m_custom, &QCustom3DItem::scalingAbsoluteChanged);
|
||||
QSignalSpy updateSpy(m_custom, &QCustom3DItem::needUpdate);
|
||||
|
||||
m_custom->setMeshFile(":/customitem.obj");
|
||||
m_custom->setMeshFile(":/customitem.mesh");
|
||||
m_custom->setPosition(QVector3D(1.0f, 1.0f, 1.0f));
|
||||
m_custom->setPositionAbsolute(true);
|
||||
m_custom->setRotation(QQuaternion(1.0f, 1.0f, 10.0f, 100.0f));
|
||||
|
|
@ -104,7 +104,7 @@ void tst_custom::initializeProperties()
|
|||
m_custom->setTextureFile(":/customtexture.jpg");
|
||||
m_custom->setVisible(false);
|
||||
|
||||
QCOMPARE(m_custom->meshFile(), QString(":/customitem.obj"));
|
||||
QCOMPARE(m_custom->meshFile(), QString(":/customitem.mesh"));
|
||||
QCOMPARE(m_custom->position(), QVector3D(1.0f, 1.0f, 1.0f));
|
||||
QCOMPARE(m_custom->isPositionAbsolute(), true);
|
||||
QCOMPARE(m_custom->rotation(), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f));
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ qt_internal_add_test(tst_qgqmltest
|
|||
)
|
||||
|
||||
set(qmltest_resource_files
|
||||
"customitem.obj"
|
||||
"customitem.mesh"
|
||||
"customtexture.jpg"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Custom3DItem { id: item1; meshFile: ":/customitem.obj" }
|
||||
Custom3DItem { id: item2; meshFile: ":/customitem.obj" }
|
||||
Custom3DItem { id: item3; meshFile: ":/customitem.obj" }
|
||||
Custom3DItem { id: item4; meshFile: ":/customitem.obj"; position: Qt.vector3d(0.0, 1.0, 0.0) }
|
||||
Custom3DItem { id: item1; meshFile: ":/customitem.mesh" }
|
||||
Custom3DItem { id: item2; meshFile: ":/customitem.mesh" }
|
||||
Custom3DItem { id: item3; meshFile: ":/customitem.mesh" }
|
||||
Custom3DItem { id: item4; meshFile: ":/customitem.mesh"; position: Qt.vector3d(0.0, 1.0, 0.0) }
|
||||
|
||||
function constructBarsWithCustomItemList() {
|
||||
bars3d = Qt.createQmlObject("
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ Item {
|
|||
name: "series1"
|
||||
singleHighlightColor: "red"
|
||||
singleHighlightGradient: gradient3
|
||||
userDefinedMesh: ":/customitem.obj"
|
||||
userDefinedMesh: ":/customitem.mesh"
|
||||
visible: false
|
||||
rowColors: [rowColor1, rowColor2, rowColor3]
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ Item {
|
|||
compare(initialized.name, "series1")
|
||||
compare(initialized.singleHighlightColor, "#ff0000")
|
||||
compare(initialized.singleHighlightGradient, gradient3)
|
||||
compare(initialized.userDefinedMesh, ":/customitem.obj")
|
||||
compare(initialized.userDefinedMesh, ":/customitem.mesh")
|
||||
compare(initialized.visible, false)
|
||||
}
|
||||
}
|
||||
|
|
@ -238,7 +238,7 @@ Item {
|
|||
change.name = "series1"
|
||||
change.singleHighlightColor = "red"
|
||||
change.singleHighlightGradient = gradient3
|
||||
change.userDefinedMesh = ":/customitem.obj"
|
||||
change.userDefinedMesh = ":/customitem.mesh"
|
||||
change.visible = false
|
||||
|
||||
compare(change.baseColor, "#0000ff")
|
||||
|
|
@ -253,7 +253,7 @@ Item {
|
|||
compare(change.name, "series1")
|
||||
compare(change.singleHighlightColor, "#ff0000")
|
||||
compare(change.singleHighlightGradient, gradient3)
|
||||
compare(change.userDefinedMesh, ":/customitem.obj")
|
||||
compare(change.userDefinedMesh, ":/customitem.mesh")
|
||||
compare(change.visible, false)
|
||||
|
||||
compare(baseColorSpy.count, 1)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Item {
|
|||
|
||||
Custom3DItem {
|
||||
id: initialized
|
||||
meshFile: ":\customitem.obj"
|
||||
meshFile: ":\customitem.mesh"
|
||||
position: Qt.vector3d(1.0, 0.5, 1.0)
|
||||
positionAbsolute: true
|
||||
rotation: Qt.quaternion(1, 0.5, 0, 0)
|
||||
|
|
@ -51,7 +51,7 @@ Item {
|
|||
name: "Custom3DItem Initialized"
|
||||
|
||||
function test_initialized() {
|
||||
compare(initialized.meshFile, ":\customitem.obj")
|
||||
compare(initialized.meshFile, ":\customitem.mesh")
|
||||
compare(initialized.position, Qt.vector3d(1.0, 0.5, 1.0))
|
||||
compare(initialized.positionAbsolute, true)
|
||||
compare(initialized.rotation, Qt.quaternion(1, 0.5, 0, 0))
|
||||
|
|
@ -67,7 +67,7 @@ Item {
|
|||
name: "Custom3DItem Change"
|
||||
|
||||
function test_change() {
|
||||
change.meshFile = ":\customitem.obj"
|
||||
change.meshFile = ":\customitem.mesh"
|
||||
change.position = Qt.vector3d(1.0, 0.5, 1.0)
|
||||
change.positionAbsolute = true
|
||||
change.rotation = Qt.quaternion(1, 0.5, 0, 0)
|
||||
|
|
@ -77,7 +77,7 @@ Item {
|
|||
change.textureFile = ":\customtexture.jpg"
|
||||
change.visible = false
|
||||
|
||||
compare(change.meshFile, ":\customitem.obj")
|
||||
compare(change.meshFile, ":\customitem.mesh")
|
||||
compare(change.position, Qt.vector3d(1.0, 0.5, 1.0))
|
||||
compare(change.positionAbsolute, true)
|
||||
compare(change.rotation, Qt.quaternion(1, 0.5, 0, 0))
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,54 +0,0 @@
|
|||
# Blender v2.66 (sub 0) OBJ File: 'cube_filled.blend'
|
||||
# www.blender.org
|
||||
o Cube
|
||||
v -1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
v 1.000000 1.000000 -1.000000
|
||||
v 1.000000 1.000000 1.000000
|
||||
vt 0.666667 0.332314
|
||||
vt 0.334353 0.333333
|
||||
vt 0.665647 0.000000
|
||||
vt 0.001020 0.333333
|
||||
vt 0.000000 0.001020
|
||||
vt 0.333333 0.332314
|
||||
vt 0.333333 0.665647
|
||||
vt 0.001019 0.666667
|
||||
vt 0.000000 0.334353
|
||||
vt 0.334353 0.666667
|
||||
vt 0.333333 0.334353
|
||||
vt 0.665647 0.333333
|
||||
vt 0.333333 0.667686
|
||||
vt 0.665647 0.666667
|
||||
vt 0.666667 0.998980
|
||||
vt 0.667686 0.333333
|
||||
vt 0.666667 0.001019
|
||||
vt 0.998980 0.000000
|
||||
vt 0.333333 0.001019
|
||||
vt 0.332314 0.000000
|
||||
vt 0.332314 0.333333
|
||||
vt 0.666667 0.665647
|
||||
vt 0.334353 1.000000
|
||||
vt 1.000000 0.332314
|
||||
vn -1.000000 0.000000 0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 1.000000 -0.000000 0.000000
|
||||
vn 0.000000 0.000000 1.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn -0.000000 -1.000000 -0.000000
|
||||
s off
|
||||
f 5/1/1 6/2/1 1/3/1
|
||||
f 6/4/2 7/5/2 2/6/2
|
||||
f 7/7/3 8/8/3 4/9/3
|
||||
f 8/10/4 5/11/4 1/12/4
|
||||
f 8/13/5 7/14/5 6/15/5
|
||||
f 2/16/6 3/17/6 4/18/6
|
||||
f 6/2/1 2/19/1 1/3/1
|
||||
f 7/5/2 3/20/2 2/6/2
|
||||
f 3/21/3 7/7/3 4/9/3
|
||||
f 4/22/4 8/10/4 1/12/4
|
||||
f 5/23/5 8/13/5 6/15/5
|
||||
f 1/24/6 2/16/6 4/18/6
|
||||
|
|
@ -65,7 +65,7 @@ Item {
|
|||
name: "series1"
|
||||
singleHighlightColor: "red"
|
||||
singleHighlightGradient: gradient3
|
||||
userDefinedMesh: ":/customitem.obj"
|
||||
userDefinedMesh: ":/customitem.mesh"
|
||||
visible: false
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ Item {
|
|||
compare(initialized.name, "series1")
|
||||
compare(initialized.singleHighlightColor, "#ff0000")
|
||||
compare(initialized.singleHighlightGradient, gradient3)
|
||||
compare(initialized.userDefinedMesh, ":/customitem.obj")
|
||||
compare(initialized.userDefinedMesh, ":/customitem.mesh")
|
||||
compare(initialized.visible, false)
|
||||
}
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ Item {
|
|||
change.name = "series1"
|
||||
change.singleHighlightColor = "red"
|
||||
change.singleHighlightGradient = gradient3
|
||||
change.userDefinedMesh = ":/customitem.obj"
|
||||
change.userDefinedMesh = ":/customitem.mesh"
|
||||
change.visible = false
|
||||
|
||||
compare(change.baseColor, "#0000ff")
|
||||
|
|
@ -201,7 +201,7 @@ Item {
|
|||
compare(change.name, "series1")
|
||||
compare(change.singleHighlightColor, "#ff0000")
|
||||
compare(change.singleHighlightGradient, gradient3)
|
||||
compare(change.userDefinedMesh, ":/customitem.obj")
|
||||
compare(change.userDefinedMesh, ":/customitem.mesh")
|
||||
compare(change.visible, false)
|
||||
|
||||
// Signals
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ Item {
|
|||
name: "series1"
|
||||
singleHighlightColor: "red"
|
||||
singleHighlightGradient: gradient3
|
||||
userDefinedMesh: ":/customitem.obj"
|
||||
userDefinedMesh: ":/customitem.mesh"
|
||||
visible: false
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ Item {
|
|||
compare(initialized.name, "series1")
|
||||
compare(initialized.singleHighlightColor, "#ff0000")
|
||||
compare(initialized.singleHighlightGradient, gradient3)
|
||||
compare(initialized.userDefinedMesh, ":/customitem.obj")
|
||||
compare(initialized.userDefinedMesh, ":/customitem.mesh")
|
||||
compare(initialized.visible, false)
|
||||
}
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ Item {
|
|||
change.name = "series1"
|
||||
change.singleHighlightColor = "red"
|
||||
change.singleHighlightGradient = gradient3
|
||||
change.userDefinedMesh = ":/customitem.obj"
|
||||
change.userDefinedMesh = ":/customitem.mesh"
|
||||
change.visible = false
|
||||
|
||||
compare(change.baseColor, "#0000ff")
|
||||
|
|
@ -256,7 +256,7 @@ Item {
|
|||
compare(change.name, "series1")
|
||||
compare(change.singleHighlightColor, "#ff0000")
|
||||
compare(change.singleHighlightGradient, gradient3)
|
||||
compare(change.userDefinedMesh, ":/customitem.obj")
|
||||
compare(change.userDefinedMesh, ":/customitem.mesh")
|
||||
compare(change.visible, false)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ target_link_libraries(tst_barstest PUBLIC
|
|||
)
|
||||
|
||||
set(barstest_resource_files
|
||||
"shuttle.obj"
|
||||
"shuttle.mesh"
|
||||
"shuttle.png"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>shuttle.obj</file>
|
||||
<file>shuttle.mesh</file>
|
||||
<file>shuttle.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
|||
|
|
@ -1787,7 +1787,7 @@ void GraphModifier::toggleCustomItem()
|
|||
m_graph->removeCustomItemAt(positionTwo);
|
||||
} else if (state == 1) {
|
||||
QCustom3DItem *item = new QCustom3DItem();
|
||||
item->setMeshFile(":/shuttle.obj");
|
||||
item->setMeshFile(":/shuttle.mesh");
|
||||
item->setPosition(positionOne);
|
||||
item->setScaling(QVector3D(0.1f, 0.1f, 0.1f));
|
||||
item->setRotation(QQuaternion::fromAxisAndAngle(0.0f, 1.0f, 0.0f, QRandomGenerator::global()->generate()));
|
||||
|
|
@ -1796,7 +1796,7 @@ void GraphModifier::toggleCustomItem()
|
|||
} else {
|
||||
m_graph->removeCustomItemAt(positionOne);
|
||||
QCustom3DItem *item = new QCustom3DItem();
|
||||
item->setMeshFile(":/shuttle.obj");
|
||||
item->setMeshFile(":/shuttle.mesh");
|
||||
item->setPosition(positionTwo);
|
||||
item->setScaling(QVector3D(0.1f, 0.1f, 0.1f));
|
||||
item->setRotation(QQuaternion::fromAxisAndAngle(0.0f, 1.0f, 0.0f, QRandomGenerator::global()->generate()));
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -31,11 +31,10 @@ VolumetricModifier::VolumetricModifier(Q3DGraphsWidgetItem *scatter)
|
|||
m_sliceIndexZ(0)
|
||||
{
|
||||
m_graph->activeTheme()->setTheme(QGraphsTheme::Theme::QtGreen);
|
||||
//m_graph->activeTheme()->setType(Q3DTheme::Theme::Isabelle);
|
||||
m_graph->setShadowQuality(QtGraphs3D::ShadowQuality::None);
|
||||
m_graph->setCameraPreset(QtGraphs3D::CameraPreset::Front);
|
||||
m_graph->setOrthoProjection(true);
|
||||
//m_graph->scene()->activeCamera()->setTarget(QVector3D(-2.0f, 1.0f, 2.0f));
|
||||
m_graph->setCameraTargetPosition(QVector3D(-2.0f, 1.0f, 2.0f));
|
||||
m_scatterGraph = qobject_cast<Q3DScatterWidgetItem *>(m_graph);
|
||||
m_surfaceGraph = qobject_cast<Q3DSurfaceWidgetItem *>(m_graph);
|
||||
m_barGraph = qobject_cast<Q3DBarsWidgetItem *>(m_graph);
|
||||
|
|
@ -88,9 +87,9 @@ VolumetricModifier::VolumetricModifier(Q3DGraphsWidgetItem *scatter)
|
|||
createAnotherVolume();
|
||||
createYetAnotherVolume();
|
||||
|
||||
// m_volumeItem->setUseHighDefShader(false);
|
||||
// m_volumeItem2->setUseHighDefShader(false);
|
||||
// m_volumeItem3->setUseHighDefShader(false);
|
||||
m_volumeItem->setUseHighDefShader(false);
|
||||
m_volumeItem2->setUseHighDefShader(false);
|
||||
m_volumeItem3->setUseHighDefShader(false);
|
||||
|
||||
m_volumeItem->setScalingAbsolute(false);
|
||||
m_volumeItem2->setScalingAbsolute(false);
|
||||
|
|
@ -114,7 +113,7 @@ VolumetricModifier::VolumetricModifier(Q3DGraphsWidgetItem *scatter)
|
|||
m_graph->addCustomItem(m_volumeItem2);
|
||||
m_graph->addCustomItem(m_volumeItem3);
|
||||
m_graph->addCustomItem(m_plainItem);
|
||||
//m_graph->setMeasureFps(true);
|
||||
m_graph->setMeasureFps(true);
|
||||
|
||||
// Create label to cut through the volume 3
|
||||
QCustom3DLabel *label = new QCustom3DLabel;
|
||||
|
|
@ -130,10 +129,14 @@ VolumetricModifier::VolumetricModifier(Q3DGraphsWidgetItem *scatter)
|
|||
|
||||
m_graph->addCustomItem(label);
|
||||
|
||||
QObject::connect(m_graph, &Q3DGraphsWidgetItem::currentFpsChanged, this,
|
||||
QObject::connect(m_graph,
|
||||
&Q3DGraphsWidgetItem::currentFpsChanged,
|
||||
this,
|
||||
&VolumetricModifier::handleFpsChange);
|
||||
QObject::connect(m_graph->scene(),
|
||||
&Q3DScene::viewportChanged,
|
||||
this,
|
||||
&VolumetricModifier::handleFpsChange);
|
||||
// QObject::connect(m_graph->scene(), &Q3DScene::viewportChanged, this,
|
||||
// &VolumetricModifier::handleFpsChange);
|
||||
}
|
||||
|
||||
VolumetricModifier::~VolumetricModifier()
|
||||
|
|
@ -212,10 +215,9 @@ void VolumetricModifier::handleFpsChange()
|
|||
const QString fpsFormat = QStringLiteral("Fps: %1");
|
||||
int fps10 = int(m_graph->currentFps() * 10.0);
|
||||
m_fpsLabel->setText(fpsFormat.arg(QString::number(qreal(fps10) / 10.0)));
|
||||
// const QString sceneDimensionsFormat = QStringLiteral("%1 x %2");
|
||||
// m_fpsLabel->setText(sceneDimensionsFormat
|
||||
// .arg(m_graph->scene()->viewport().width())
|
||||
// .arg(m_graph->scene()->viewport().height()));
|
||||
// const QString sceneDimensionsFormat = QStringLiteral("%1 x %2");
|
||||
// m_fpsLabel->setText(sceneDimensionsFormat.arg(m_graph->scene()->viewport().width())
|
||||
// .arg(m_graph->scene()->viewport().height()));
|
||||
}
|
||||
|
||||
void VolumetricModifier::testSubtextureSetting()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>logo.png</file>
|
||||
<file alias="mesh">cubeFilledFlat.obj</file>
|
||||
<file alias="mesh">cubeFilledFlat.mesh</file>
|
||||
<file>logo_no_padding.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
|||
Loading…
Reference in New Issue