From 3da9e8d6714da3d9d6aec6932e4edae0a2135065 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 26 Apr 2016 08:38:15 +0200 Subject: Move last remaining pieces of examples-common to Qt3DExtras Also created a Quick3DExtras for QML related extras (Qt3DQuickWindow) Change-Id: I1b95ea841e07ac8d68a07a1911d783b722e6fe03 Reviewed-by: Sean Harmer --- .../qt3d/anaglyph-rendering/anaglyph-rendering.pro | 2 +- examples/qt3d/anaglyph-rendering/main.cpp | 4 +- examples/qt3d/assimp-cpp/main.cpp | 8 +- examples/qt3d/assimp/assimp.pro | 2 +- examples/qt3d/assimp/main.cpp | 4 +- examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro | 2 +- examples/qt3d/basicshapes-cpp/main.cpp | 8 +- examples/qt3d/bigmodel-qml/bigmodel-qml.pro | 2 +- examples/qt3d/bigmodel-qml/main.cpp | 4 +- examples/qt3d/bigscene-cpp/bigscene-cpp.pro | 2 +- examples/qt3d/bigscene-cpp/main.cpp | 8 +- .../bigscene-instanced-qml.pro | 2 +- examples/qt3d/bigscene-instanced-qml/main.cpp | 4 +- examples/qt3d/clip-planes-qml/clip-planes-qml.pro | 2 +- examples/qt3d/clip-planes-qml/main.cpp | 4 +- .../qt3d/component-changes/component-changes.pro | 2 +- examples/qt3d/component-changes/main.cpp | 8 +- .../qt3d/compute-particles/compute-particles.pro | 2 +- examples/qt3d/cpp_example/main.cpp | 8 +- examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro | 2 +- examples/qt3d/custom-mesh-cpp/main.cpp | 8 +- examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro | 2 +- examples/qt3d/custom-mesh-qml/main.cpp | 4 +- examples/qt3d/cylinder-cpp/cylinder-cpp.pro | 2 +- examples/qt3d/cylinder-cpp/main.cpp | 8 +- examples/qt3d/cylinder-qml/cylinder-qml.pro | 2 +- examples/qt3d/cylinder-qml/main.cpp | 4 +- examples/qt3d/deferred-renderer-cpp/main.cpp | 8 +- .../deferred-renderer-qml.pro | 2 +- examples/qt3d/deferred-renderer-qml/main.cpp | 5 +- .../qt3d/dynamicscene-cpp/dynamicscene-cpp.pro | 2 +- examples/qt3d/dynamicscene-cpp/main.cpp | 8 +- examples/qt3d/enabled-qml/enabled-qml.pro | 2 +- examples/qt3d/enabled-qml/main.cpp | 4 +- .../FirstPersonCameraController.qml | 176 ------------ examples/qt3d/examples-common/OrbitController.qml | 235 --------------- examples/qt3d/examples-common/examples-common.pri | 20 -- examples/qt3d/examples-common/examples-common.pro | 48 ---- .../qfirstpersoncameracontroller.cpp | 253 ---------------- .../examples-common/qfirstpersoncameracontroller.h | 99 ------- .../qfirstpersoncameracontroller_p.h | 129 --------- examples/qt3d/examples-common/qorbitcontrol.cpp | 320 --------------------- examples/qt3d/examples-common/qorbitcontrol.h | 90 ------ examples/qt3d/examples-common/qorbitcontrol_p.h | 131 --------- examples/qt3d/examples-common/qt3dquickwindow.cpp | 246 ---------------- examples/qt3d/examples-common/qt3dquickwindow.h | 131 --------- examples/qt3d/examples-common/qt3dwindow.cpp | 175 ----------- examples/qt3d/examples-common/qt3dwindow.h | 137 --------- examples/qt3d/examples.pri | 6 +- examples/qt3d/gltf/gltf.pro | 2 +- examples/qt3d/gltf/main.cpp | 4 +- examples/qt3d/gooch-qml/gooch-qml.pro | 2 +- examples/qt3d/gooch-qml/main.cpp | 4 +- .../instanced-arrays-qml/instanced-arrays-qml.pro | 2 +- examples/qt3d/instanced-arrays-qml/main.cpp | 4 +- .../qt3d/keyboardinput-qml/keyboardinput-qml.pro | 2 +- examples/qt3d/keyboardinput-qml/main.cpp | 4 +- examples/qt3d/lights/lights.pro | 2 +- examples/qt3d/lights/main.cpp | 4 +- examples/qt3d/loader-qml/loader-qml.pro | 2 +- examples/qt3d/loader-qml/main.cpp | 4 +- examples/qt3d/materials-cpp/main.cpp | 8 +- examples/qt3d/materials-cpp/materials-cpp.pro | 2 +- examples/qt3d/materials/main.cpp | 4 +- examples/qt3d/materials/materials.pro | 2 +- examples/qt3d/mouseinput-qml/main.cpp | 4 +- examples/qt3d/mouseinput-qml/mouseinput-qml.pro | 2 +- examples/qt3d/multiviewport/main.cpp | 4 +- examples/qt3d/multiviewport/multiviewport.pro | 2 +- examples/qt3d/picking-qml/main.cpp | 4 +- examples/qt3d/picking-qml/picking-qml.pro | 2 +- examples/qt3d/plasma/main.cpp | 4 +- examples/qt3d/plasma/plasma.pro | 2 +- examples/qt3d/playground-qml/main.cpp | 4 +- examples/qt3d/playground-qml/playground-qml.pro | 2 +- examples/qt3d/qt3d.pro | 7 - examples/qt3d/shadow-map-qml/main.cpp | 4 +- examples/qt3d/shadow-map-qml/shadow-map-qml.pro | 2 +- examples/qt3d/simple-cpp/main.cpp | 4 +- examples/qt3d/simple-cpp/simple-cpp.pro | 2 +- examples/qt3d/simple-qml/main.cpp | 4 +- examples/qt3d/simple-qml/simple-qml.pro | 2 +- examples/qt3d/simple-shaders-qml/main.cpp | 4 +- .../qt3d/simple-shaders-qml/simple-shaders-qml.pro | 2 +- examples/qt3d/skybox/main.cpp | 4 +- examples/qt3d/skybox/skybox.pro | 2 +- examples/qt3d/tessellation-modes/main.cpp | 4 +- .../qt3d/tessellation-modes/tessellation-modes.pro | 2 +- examples/qt3d/torus-qml/main.cpp | 4 +- examples/qt3d/torus-qml/torus-qml.pro | 2 +- examples/qt3d/transforms-qml/main.cpp | 4 +- examples/qt3d/transforms-qml/transforms-qml.pro | 2 +- examples/qt3d/transparency-qml/main.cpp | 4 +- .../qt3d/transparency-qml/transparency-qml.pro | 2 +- examples/qt3d/wave/main.cpp | 4 +- examples/qt3d/wave/wave.pro | 2 +- examples/qt3d/wireframe/main.cpp | 4 +- examples/qt3d/wireframe/wireframe.pro | 2 +- 98 files changed, 145 insertions(+), 2347 deletions(-) delete mode 100644 examples/qt3d/examples-common/FirstPersonCameraController.qml delete mode 100644 examples/qt3d/examples-common/OrbitController.qml delete mode 100644 examples/qt3d/examples-common/examples-common.pri delete mode 100644 examples/qt3d/examples-common/examples-common.pro delete mode 100644 examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp delete mode 100644 examples/qt3d/examples-common/qfirstpersoncameracontroller.h delete mode 100644 examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h delete mode 100644 examples/qt3d/examples-common/qorbitcontrol.cpp delete mode 100644 examples/qt3d/examples-common/qorbitcontrol.h delete mode 100644 examples/qt3d/examples-common/qorbitcontrol_p.h delete mode 100644 examples/qt3d/examples-common/qt3dquickwindow.cpp delete mode 100644 examples/qt3d/examples-common/qt3dquickwindow.h delete mode 100644 examples/qt3d/examples-common/qt3dwindow.cpp delete mode 100644 examples/qt3d/examples-common/qt3dwindow.h (limited to 'examples/qt3d') diff --git a/examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro b/examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro index d31b21924..c49f8374d 100644 --- a/examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro +++ b/examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro @@ -4,7 +4,7 @@ SOURCE += main.cpp -QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras +QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras 3dquickextras OTHER_FILES += *.qml diff --git a/examples/qt3d/anaglyph-rendering/main.cpp b/examples/qt3d/anaglyph-rendering/main.cpp index 441a58ea5..dfda2f05d 100644 --- a/examples/qt3d/anaglyph-rendering/main.cpp +++ b/examples/qt3d/anaglyph-rendering/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include #include @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); view.setSource(QUrl("qrc:/main.qml")); diff --git a/examples/qt3d/assimp-cpp/main.cpp b/examples/qt3d/assimp-cpp/main.cpp index 11e58a5f8..9701cb66a 100644 --- a/examples/qt3d/assimp-cpp/main.cpp +++ b/examples/qt3d/assimp-cpp/main.cpp @@ -58,8 +58,8 @@ #include #include #include -#include "qt3dwindow.h" -#include "qfirstpersoncameracontroller.h" +#include +#include class SceneWalker : public QObject { @@ -117,7 +117,7 @@ void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth) int main(int ac, char **av) { QApplication app(ac, av); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; view.defaultFramegraph()->setClearColor(Qt::black); // Root entity @@ -132,7 +132,7 @@ int main(int ac, char **av) camera->setFarPlane(10000.0f); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(sceneRoot); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot); camController->setCamera(camera); // Scene loader diff --git a/examples/qt3d/assimp/assimp.pro b/examples/qt3d/assimp/assimp.pro index 798a22b67..97f502bc7 100644 --- a/examples/qt3d/assimp/assimp.pro +++ b/examples/qt3d/assimp/assimp.pro @@ -4,7 +4,7 @@ SOURCE += main.cpp -QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras +QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras 3dquickextras OTHER_FILES += main.qml diff --git a/examples/qt3d/assimp/main.cpp b/examples/qt3d/assimp/main.cpp index e0e62acb8..78d2035d9 100644 --- a/examples/qt3d/assimp/main.cpp +++ b/examples/qt3d/assimp/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include +#include #include #include @@ -105,7 +105,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; qmlRegisterType("Qt3D.Examples", 2, 0, "SceneHelper"); view.setSource(QUrl("qrc:/main.qml")); diff --git a/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro b/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro index 4e8152895..15eef0271 100644 --- a/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro +++ b/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro @@ -6,7 +6,7 @@ android|ios|tvos|winrt { error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput +QT += 3dcore 3drender 3dinput 3dextras QT += widgets SOURCES += main.cpp \ diff --git a/examples/qt3d/basicshapes-cpp/main.cpp b/examples/qt3d/basicshapes-cpp/main.cpp index e01c0feeb..301aabb66 100644 --- a/examples/qt3d/basicshapes-cpp/main.cpp +++ b/examples/qt3d/basicshapes-cpp/main.cpp @@ -80,13 +80,13 @@ #include #include -#include "qt3dwindow.h" -#include "qfirstpersoncameracontroller.h" +#include +#include int main(int argc, char **argv) { QApplication app(argc, argv); - Qt3DWindow *view = new Qt3DWindow(); + Qt3DExtras::Qt3DWindow *view = new Qt3DExtras::Qt3DWindow(); view->defaultFramegraph()->setClearColor(QColor(QRgb(0x4d4d4f))); QWidget *container = QWidget::createWindowContainer(view); QSize screenSize = view->screen()->size(); @@ -117,7 +117,7 @@ int main(int argc, char **argv) cameraEntity->setViewCenter(QVector3D(0, 0, 0)); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(rootEntity); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(rootEntity); camController->setCamera(cameraEntity); // Scenemodifier diff --git a/examples/qt3d/bigmodel-qml/bigmodel-qml.pro b/examples/qt3d/bigmodel-qml/bigmodel-qml.pro index 063a27b01..cb590374a 100644 --- a/examples/qt3d/bigmodel-qml/bigmodel-qml.pro +++ b/examples/qt3d/bigmodel-qml/bigmodel-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick 3dextras +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dextras 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/bigmodel-qml/main.cpp b/examples/qt3d/bigmodel-qml/main.cpp index 0542429cf..c004e2a45 100644 --- a/examples/qt3d/bigmodel-qml/main.cpp +++ b/examples/qt3d/bigmodel-qml/main.cpp @@ -48,14 +48,14 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/bigscene-cpp/bigscene-cpp.pro b/examples/qt3d/bigscene-cpp/bigscene-cpp.pro index 5dcaf3d0f..a61fcd9a1 100644 --- a/examples/qt3d/bigscene-cpp/bigscene-cpp.pro +++ b/examples/qt3d/bigscene-cpp/bigscene-cpp.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput +QT += 3dcore 3drender 3dinput 3dextras SOURCES += \ main.cpp \ diff --git a/examples/qt3d/bigscene-cpp/main.cpp b/examples/qt3d/bigscene-cpp/main.cpp index 4c5d0a115..95b198f58 100644 --- a/examples/qt3d/bigscene-cpp/main.cpp +++ b/examples/qt3d/bigscene-cpp/main.cpp @@ -67,8 +67,8 @@ #include #include #include -#include "qt3dwindow.h" -#include "qfirstpersoncameracontroller.h" +#include +#include using namespace Qt3DCore; using namespace Qt3DRender; @@ -76,7 +76,7 @@ using namespace Qt3DRender; int main(int ac, char **av) { QGuiApplication app(ac, av); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; view.defaultFramegraph()->setClearColor(Qt::black); QEntity *root = new QEntity(); @@ -89,7 +89,7 @@ int main(int ac, char **av) cameraEntity->setViewCenter(QVector3D(0, 0, 0)); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(root); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(root); camController->setCamera(cameraEntity); const float radius = 100.0f; diff --git a/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.pro b/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.pro index d2c5166ee..166b79e73 100644 --- a/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.pro +++ b/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras +QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/bigscene-instanced-qml/main.cpp b/examples/qt3d/bigscene-instanced-qml/main.cpp index 0a8b739d9..70a8ec467 100644 --- a/examples/qt3d/bigscene-instanced-qml/main.cpp +++ b/examples/qt3d/bigscene-instanced-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/clip-planes-qml/clip-planes-qml.pro b/examples/qt3d/clip-planes-qml/clip-planes-qml.pro index 81500e4ce..2c83b2e63 100644 --- a/examples/qt3d/clip-planes-qml/clip-planes-qml.pro +++ b/examples/qt3d/clip-planes-qml/clip-planes-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras +QT += qml quick 3dcore 3drender 3dinput 3dquick 3dquickextras SOURCES += main.cpp diff --git a/examples/qt3d/clip-planes-qml/main.cpp b/examples/qt3d/clip-planes-qml/main.cpp index 422257337..aa7e240fd 100644 --- a/examples/qt3d/clip-planes-qml/main.cpp +++ b/examples/qt3d/clip-planes-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/component-changes/component-changes.pro b/examples/qt3d/component-changes/component-changes.pro index ef2da4ed6..a1a935145 100644 --- a/examples/qt3d/component-changes/component-changes.pro +++ b/examples/qt3d/component-changes/component-changes.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput +QT += 3dcore 3drender 3dinput 3dextras SOURCES += main.cpp diff --git a/examples/qt3d/component-changes/main.cpp b/examples/qt3d/component-changes/main.cpp index 93ae52d4d..e4e46a0d5 100644 --- a/examples/qt3d/component-changes/main.cpp +++ b/examples/qt3d/component-changes/main.cpp @@ -58,8 +58,8 @@ #include #include -#include "qt3dwindow.h" -#include "qorbitcontrol.h" +#include +#include #include @@ -106,7 +106,7 @@ private: int main(int argc, char **argv) { QGuiApplication app(argc, argv); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; // Root entity Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity(); @@ -117,7 +117,7 @@ int main(int argc, char **argv) camera->setViewCenter(QVector3D(0, 0, 0)); // For camera controls - Qt3DInput::QOrbitControl *cameraController = new Qt3DInput::QOrbitControl(rootEntity); + Qt3DExtras::QOrbitControl *cameraController = new Qt3DExtras::QOrbitControl(rootEntity); cameraController->setCamera(camera); // Cylinder mesh data diff --git a/examples/qt3d/compute-particles/compute-particles.pro b/examples/qt3d/compute-particles/compute-particles.pro index 96b1a6b5d..c25cc0c30 100644 --- a/examples/qt3d/compute-particles/compute-particles.pro +++ b/examples/qt3d/compute-particles/compute-particles.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dquick 3dinput quick qml 3dextras +QT += 3dcore 3drender 3dquick 3dinput quick qml HEADERS += \ diff --git a/examples/qt3d/cpp_example/main.cpp b/examples/qt3d/cpp_example/main.cpp index 68e657670..b53760022 100644 --- a/examples/qt3d/cpp_example/main.cpp +++ b/examples/qt3d/cpp_example/main.cpp @@ -72,14 +72,14 @@ #include #include #include -#include "qt3dwindow.h" -#include "qfirstpersoncameracontroller.h" +#include +#include int main(int ac, char **av) { QGuiApplication app(ac, av); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; // Root entity Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity(); @@ -119,7 +119,7 @@ int main(int ac, char **av) cameraEntity->setUpVector(QVector3D(0, 1, 0)); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(rootEntity); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(rootEntity); camController->setCamera(cameraEntity); // Set root object of the scene diff --git a/examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro b/examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro index e562663bd..abbb3b771 100644 --- a/examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro +++ b/examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput +QT += 3dcore 3drender 3dinput 3dextras SOURCES += \ main.cpp diff --git a/examples/qt3d/custom-mesh-cpp/main.cpp b/examples/qt3d/custom-mesh-cpp/main.cpp index d4652839c..6809e62aa 100644 --- a/examples/qt3d/custom-mesh-cpp/main.cpp +++ b/examples/qt3d/custom-mesh-cpp/main.cpp @@ -69,13 +69,13 @@ #include #include -#include "qt3dwindow.h" -#include "qfirstpersoncameracontroller.h" +#include +#include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; view.defaultFramegraph()->setClearColor(QColor::fromRgbF(0.0, 0.5, 1.0, 1.0)); // Root entity @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) cameraEntity->setViewCenter(QVector3D(0, 0, 0)); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(rootEntity); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(rootEntity); camController->setCamera(cameraEntity); // Material diff --git a/examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro b/examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro index 111d0ef40..228cc8ed0 100644 --- a/examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro +++ b/examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick quick +QT += 3dcore 3drender 3dinput 3dquick quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/custom-mesh-qml/main.cpp b/examples/qt3d/custom-mesh-qml/main.cpp index 196eefe05..41d2f08a5 100644 --- a/examples/qt3d/custom-mesh-qml/main.cpp +++ b/examples/qt3d/custom-mesh-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/cylinder-cpp/cylinder-cpp.pro b/examples/qt3d/cylinder-cpp/cylinder-cpp.pro index ef2da4ed6..a1a935145 100644 --- a/examples/qt3d/cylinder-cpp/cylinder-cpp.pro +++ b/examples/qt3d/cylinder-cpp/cylinder-cpp.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput +QT += 3dcore 3drender 3dinput 3dextras SOURCES += main.cpp diff --git a/examples/qt3d/cylinder-cpp/main.cpp b/examples/qt3d/cylinder-cpp/main.cpp index 725d373fe..2fbb31c6f 100644 --- a/examples/qt3d/cylinder-cpp/main.cpp +++ b/examples/qt3d/cylinder-cpp/main.cpp @@ -68,13 +68,13 @@ #include #include -#include "qt3dwindow.h" -#include "qorbitcontrol.h" +#include +#include int main(int argc, char **argv) { QGuiApplication app(argc, argv); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; // Root entity Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity(); @@ -87,7 +87,7 @@ int main(int argc, char **argv) camera->setViewCenter(QVector3D(0, 0, 0)); // For camera controls - Qt3DInput::QOrbitControl *cameraController = new Qt3DInput::QOrbitControl(rootEntity); + Qt3DExtras::QOrbitControl *cameraController = new Qt3DExtras::QOrbitControl(rootEntity); cameraController->setCamera(camera); // Cylinder shape data diff --git a/examples/qt3d/cylinder-qml/cylinder-qml.pro b/examples/qt3d/cylinder-qml/cylinder-qml.pro index ed5b093b3..b73085a8e 100644 --- a/examples/qt3d/cylinder-qml/cylinder-qml.pro +++ b/examples/qt3d/cylinder-qml/cylinder-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick 3dextras +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/cylinder-qml/main.cpp b/examples/qt3d/cylinder-qml/main.cpp index 0a8b739d9..70a8ec467 100644 --- a/examples/qt3d/cylinder-qml/main.cpp +++ b/examples/qt3d/cylinder-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/deferred-renderer-cpp/main.cpp b/examples/qt3d/deferred-renderer-cpp/main.cpp index 868158e49..be8a5f403 100644 --- a/examples/qt3d/deferred-renderer-cpp/main.cpp +++ b/examples/qt3d/deferred-renderer-cpp/main.cpp @@ -68,15 +68,15 @@ #include "finaleffect.h" #include "sceneeffect.h" #include "pointlightblock.h" -#include "qt3dwindow.h" -#include "qfirstpersoncameracontroller.h" +#include +#include int main(int ac, char **av) { QGuiApplication app(ac, av); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; // Root entity Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity(); @@ -121,7 +121,7 @@ int main(int ac, char **av) camera->setViewCenter(QVector3D(0.0f, 0.0f, 10.0f)); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(rootEntity); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(rootEntity); camController->setCamera(camera); // FrameGraph diff --git a/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.pro b/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.pro index b16b57d7f..40b2f555c 100644 --- a/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.pro +++ b/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras HEADERS += \ diff --git a/examples/qt3d/deferred-renderer-qml/main.cpp b/examples/qt3d/deferred-renderer-qml/main.cpp index a7dcf9bb6..55bbe91ee 100644 --- a/examples/qt3d/deferred-renderer-qml/main.cpp +++ b/examples/qt3d/deferred-renderer-qml/main.cpp @@ -49,14 +49,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; - + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/dynamicscene-cpp/dynamicscene-cpp.pro b/examples/qt3d/dynamicscene-cpp/dynamicscene-cpp.pro index 527cc6183..264989f43 100644 --- a/examples/qt3d/dynamicscene-cpp/dynamicscene-cpp.pro +++ b/examples/qt3d/dynamicscene-cpp/dynamicscene-cpp.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput +QT += 3dcore 3drender 3dinput 3dextras SOURCES += \ main.cpp \ diff --git a/examples/qt3d/dynamicscene-cpp/main.cpp b/examples/qt3d/dynamicscene-cpp/main.cpp index 353f6a42d..ebc36ab5f 100644 --- a/examples/qt3d/dynamicscene-cpp/main.cpp +++ b/examples/qt3d/dynamicscene-cpp/main.cpp @@ -59,13 +59,13 @@ #include #include "examplescene.h" -#include "qt3dwindow.h" -#include "qfirstpersoncameracontroller.h" +#include +#include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; ExampleScene *sceneRoot = new ExampleScene(); @@ -78,7 +78,7 @@ int main(int argc, char* argv[]) basicCamera->setPosition(QVector3D(0.0f, 3.5f, 25.0f)); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(sceneRoot); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot); camController->setCamera(basicCamera); view.setRootEntity(sceneRoot); diff --git a/examples/qt3d/enabled-qml/enabled-qml.pro b/examples/qt3d/enabled-qml/enabled-qml.pro index a1f83a2f4..142af5e41 100644 --- a/examples/qt3d/enabled-qml/enabled-qml.pro +++ b/examples/qt3d/enabled-qml/enabled-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dquick qml +QT += 3dcore 3drender 3dquick qml 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/enabled-qml/main.cpp b/examples/qt3d/enabled-qml/main.cpp index 5bf849758..349d7ad31 100644 --- a/examples/qt3d/enabled-qml/main.cpp +++ b/examples/qt3d/enabled-qml/main.cpp @@ -49,12 +49,12 @@ ****************************************************************************/ #include -#include "qt3dquickwindow.h" +#include int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl(QStringLiteral("qrc:/main.qml"))); view.show(); diff --git a/examples/qt3d/examples-common/FirstPersonCameraController.qml b/examples/qt3d/examples-common/FirstPersonCameraController.qml deleted file mode 100644 index e6950140d..000000000 --- a/examples/qt3d/examples-common/FirstPersonCameraController.qml +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Paul Lemire -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt3D.Core 2.0 -import Qt3D.Render 2.0 -import Qt3D.Input 2.0 -import Qt3D.Logic 2.0 -import QtQml 2.2 - -Entity { - id: root - property Camera camera - property real linearSpeed: 10.0 - property real lookSpeed: 180.0 - - QtObject { - id: d - readonly property vector3d firstPersonUp: Qt.vector3d(0, 1, 0) - readonly property bool leftMouseButtonPressed: leftMouseButtonAction.active - readonly property real vx: txAxis.value * linearSpeed; - readonly property real vy: tyAxis.value * linearSpeed; - readonly property real vz: tzAxis.value * linearSpeed; - readonly property real dx: rxAxis.value * lookSpeed - readonly property real dy: ryAxis.value * lookSpeed - readonly property bool fineMotion: fineMotionAction.active - } - - KeyboardDevice { - id: keyboardSourceDevice - } - - MouseDevice { - id: mouseSourceDevice - sensitivity: d.fineMotion ? 0.01 : 0.1 - } - - components: [ - - LogicalDevice { - actions: [ - Action { - id: leftMouseButtonAction - ActionInput { - sourceDevice: mouseSourceDevice - buttons: [MouseEvent.LeftButton] - } - }, - Action { - id: fineMotionAction - ActionInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Shift] - } - } - ] // actions - - axes: [ - // Rotation - Axis { - id: rxAxis - AxisInput { - sourceDevice: mouseSourceDevice - axis: MouseDevice.X - } - }, - Axis { - id: ryAxis - AxisInput { - sourceDevice: mouseSourceDevice - axis: MouseDevice.Y - } - }, - // Translation - Axis { - id: txAxis - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Left] - scale: -1.0 - } - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Right] - scale: 1.0 - } - }, - Axis { - id: tzAxis - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Up] - scale: 1.0 - } - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Down] - scale: -1.0 - } - }, - Axis { - id: tyAxis - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_PageUp] - scale: 1.0 - } - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_PageDown] - scale: -1.0 - } - } - ] // axes - }, - - FrameAction { - onTriggered: { - // The time difference since the last frame is passed in as the - // argument dt. It is a floating point value in units of seconds. - root.camera.translate(Qt.vector3d(d.vx, d.vy, d.vz).times(dt)) - - if (d.leftMouseButtonPressed) { - root.camera.pan(d.dx * dt, d.firstPersonUp) - root.camera.tilt(d.dy * dt) - } - } - } - ] // components -} diff --git a/examples/qt3d/examples-common/OrbitController.qml b/examples/qt3d/examples-common/OrbitController.qml deleted file mode 100644 index bba114730..000000000 --- a/examples/qt3d/examples-common/OrbitController.qml +++ /dev/null @@ -1,235 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Paul Lemire -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt3D.Core 2.0 -import Qt3D.Render 2.0 -import Qt3D.Input 2.0 -import Qt3D.Logic 2.0 -import QtQml 2.2 - -Entity { - id: root - property Camera camera - property real linearSpeed: 10.0 - property real lookSpeed: 180.0 - property real zoomLimit: 2.0 - - QtObject { - id: d - readonly property vector3d firstPersonUp: Qt.vector3d(0, 1, 0) - readonly property bool leftMouseButtonPressed: leftMouseButtonAction.active - readonly property bool rightMouseButtonPressed: rightMouseButtonAction.active - readonly property bool shiftPressed: shiftAction.active - readonly property bool altPressed: altAction.active - property real translationX: clampInputs(leftMouseButtonPressed ? mouseXAxis.value : 0, keyboardXAxis.value) * linearSpeed; - property real translationY: clampInputs(leftMouseButtonPressed ? mouseYAxis.value : 0, keyboardYAxis.value) * linearSpeed; - property real translationZ: keyboardZAxis.value * linearSpeed; - property real orbitX: clampInputs(rightMouseButtonPressed ? mouseXAxis.value : 0, keyboardXAxis.value) * lookSpeed; - property real orbitY: clampInputs(rightMouseButtonPressed ? mouseYAxis.value : 0, keyboardYAxis.value) * lookSpeed; - } - - function clampInputs(input1, input2) { - var axisValue = input1 + input2; - return (axisValue < -1) ? -1 : (axisValue > 1) ? 1 : axisValue; - } - - function zoomDistance(firstPoint, secondPoint) { - var u = secondPoint.minus(firstPoint); u = u.times(u); - return u.x + u.y + u.z; - } - - KeyboardDevice { - id: keyboardSourceDevice - } - - MouseDevice { - id: mouseSourceDevice - sensitivity: 0.1 - } - - components: [ - - LogicalDevice { - actions: [ - Action { - id: leftMouseButtonAction - ActionInput { - sourceDevice: mouseSourceDevice - buttons: [MouseEvent.LeftButton] - } - }, - Action { - id: rightMouseButtonAction - ActionInput { - sourceDevice: mouseSourceDevice - buttons: [MouseEvent.RightButton] - } - }, - Action { - id: shiftAction - ActionInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Shift] - } - }, - Action { - id: altAction - ActionInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Alt] - } - } - ] // actions - - axes: [ - // Mouse - Axis { - id: mouseXAxis - AxisInput { - sourceDevice: mouseSourceDevice - axis: MouseDevice.X - } - }, - Axis { - id: mouseYAxis - AxisInput { - sourceDevice: mouseSourceDevice - axis: MouseDevice.Y - } - }, - // Keyboard - Axis { - id: keyboardXAxis - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Left] - scale: -1.0 - } - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Right] - scale: 1.0 - } - }, - Axis { - id: keyboardZAxis - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Up] - scale: d.shiftPressed ? 1.0 : 0.0 - } - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Down] - scale: d.shiftPressed ? -1.0 : 0.0 - } - }, - Axis { - id: keyboardYAxis - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Up] - scale: d.shiftPressed ? 0.0 : 1.0 - } - AxisInput { - sourceDevice: keyboardSourceDevice - buttons: [Qt.Key_Down] - scale: d.shiftPressed ? 0.0 : -1.0 - } - } - ] // axes - }, - - FrameAction { - onTriggered: { - // The time difference since the last frame is passed in as the - // argument dt. It is a floating point value in units of seconds. - - // Mouse input - if (d.leftMouseButtonPressed) { - if (d.rightMouseButtonPressed) { - if (zoomDistance(root.camera.position, root.camera.viewCenter) > root.zoomLimit * root.zoomLimit) { - // Dolly up to limit - root.camera.translate(Qt.vector3d(0, 0, d.translationY).times(dt), Camera.DontTranslateViewCenter); - } else { - // Too close, Dolly backwards - root.camera.translate(Qt.vector3d(0, 0, -1).times(dt), Camera.DontTranslateViewCenter); - } - } else { - // Translate - root.camera.translate(Qt.vector3d(d.translationX, d.translationY, 0).times(dt)); - return - } - } else if (d.rightMouseButtonPressed) { - // Orbit - root.camera.panAboutViewCenter(d.orbitX * dt, d.firstPersonUp); - root.camera.tiltAboutViewCenter(d.orbitY * dt); - } - // Keyboard input - if (d.altPressed) { - // Orbit - root.camera.panAboutViewCenter(d.orbitX * dt, d.firstPersonUp); - root.camera.tiltAboutViewCenter(d.orbitY * dt); - } else if (d.shiftPressed) { - if (zoomDistance(root.camera.position, root.camera.viewCenter) > root.zoomLimit * root.zoomLimit) { - // Dolly up to limit - root.camera.translate(Qt.vector3d(0, 0, d.translationZ).times(dt), Camera.DontTranslateViewCenter); - } else { - // Too close, Dolly backwards - root.camera.translate(Qt.vector3d(0, 0, -1).times(dt), Camera.DontTranslateViewCenter); - } - } else { - // Translate - root.camera.translate(Qt.vector3d(d.translationX, d.translationY, 0).times(dt)); - } - } - } - ] // components -} diff --git a/examples/qt3d/examples-common/examples-common.pri b/examples/qt3d/examples-common/examples-common.pri deleted file mode 100644 index ddfea6765..000000000 --- a/examples/qt3d/examples-common/examples-common.pri +++ /dev/null @@ -1,20 +0,0 @@ -QT += 3dcore 3drender 3dinput 3dlogic qml 3dextras - -INCLUDEPATH += $$PWD - -win32 { - build_pass { - CONFIG(debug, debug|release) { - common_static_lib = $$OUT_PWD/../examples-common/debug/$${QMAKE_PREFIX_STATICLIB}examples-common.$${QMAKE_EXTENSION_STATICLIB} - } else { - common_static_lib = $$OUT_PWD/../examples-common/release/$${QMAKE_PREFIX_STATICLIB}examples-common.$${QMAKE_EXTENSION_STATICLIB} - } - } - LIBS += $$common_static_lib - PRE_TARGETDEPS += $$common_static_lib -} else { - LIBS += -L$$OUT_PWD/../examples-common -l$$qtLibraryTarget(examples-common) - PRE_TARGETDEPS += $$OUT_PWD/../examples-common/lib$$qtLibraryTarget(examples-common).a -} - -RESOURCES += $$OUT_PWD/../examples-common/examples-common.qrc diff --git a/examples/qt3d/examples-common/examples-common.pro b/examples/qt3d/examples-common/examples-common.pro deleted file mode 100644 index a11a77ee5..000000000 --- a/examples/qt3d/examples-common/examples-common.pro +++ /dev/null @@ -1,48 +0,0 @@ -TEMPLATE = lib -CONFIG += staticlib -TARGET = $$qtLibraryTarget(examples-common) -QT += core-private 3dcore 3dcore-private 3drender 3dinput 3dlogic qml quick 3dextras - -SOURCES += \ - qfirstpersoncameracontroller.cpp \ - qorbitcontrol.cpp \ - qt3dwindow.cpp \ - qt3dquickwindow.cpp - - -HEADERS += \ - qfirstpersoncameracontroller.h \ - qfirstpersoncameracontroller_p.h \ - qorbitcontrol_p.h \ - qorbitcontrol.h \ - qt3dwindow.h \ - qt3dquickwindow.h - -QML_FILES = \ - $$PWD/OrbitController.qml \ - $$PWD/FirstPersonCameraController.qml - -OTHER_FILES += \ - $$QML_FILES - -# Create a resource file for qml files that need to be registered by the plugin -GENERATED_RESOURCE_FILE = $$OUT_PWD/examples-common.qrc -INCLUDED_RESOURCE_FILES = $$QML_FILES -RESOURCE_CONTENT = \ - "" \ - "" - -for(resourcefile, INCLUDED_RESOURCE_FILES) { - resourcefileabsolutepath = $$absolute_path($$resourcefile) - relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_) - relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD) - RESOURCE_CONTENT += "$$relativepath_out" -} - -RESOURCE_CONTENT += \ - "" \ - "" - -write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.") - -RESOURCES += $$GENERATED_RESOURCE_FILE diff --git a/examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp b/examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp deleted file mode 100644 index 3e0bd2c68..000000000 --- a/examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfirstpersoncameracontroller_p.h" -#include "qfirstpersoncameracontroller.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DInput { - - -QFirstPersonCameraControllerPrivate::QFirstPersonCameraControllerPrivate() - : Qt3DCore::QEntityPrivate() - , m_camera(Q_NULLPTR) - , m_leftMouseButtonAction(new QAction()) - , m_fineMotionAction(new QAction()) - , m_rxAxis(new QAxis()) - , m_ryAxis(new QAxis()) - , m_txAxis(new QAxis()) - , m_tyAxis(new QAxis()) - , m_tzAxis(new QAxis()) - , m_leftMouseButtonInput(new QActionInput()) - , m_fineMotionKeyInput(new QActionInput()) - , m_mouseRxInput(new QAxisInput()) - , m_mouseRyInput(new QAxisInput()) - , m_keyboardTxPosInput(new QAxisInput()) - , m_keyboardTyPosInput(new QAxisInput()) - , m_keyboardTzPosInput(new QAxisInput()) - , m_keyboardTxNegInput(new QAxisInput()) - , m_keyboardTyNegInput(new QAxisInput()) - , m_keyboardTzNegInput(new QAxisInput()) - , m_keyboardDevice(new QKeyboardDevice()) - , m_mouseDevice(new QMouseDevice()) - , m_logicalDevice(new QLogicalDevice()) - , m_frameAction(new Qt3DLogic::QFrameAction()) - , m_linearSpeed(10.0f) - , m_lookSpeed(180.0f) - , m_firstPersonUp(QVector3D(0.0f, 1.0f, 0.0f)) -{} - -void QFirstPersonCameraControllerPrivate::init() -{ - //// Actions - - // Left Mouse Button Action - m_leftMouseButtonInput->setButtons(QVariantList() << QMouseEvent::LeftButton); - m_leftMouseButtonInput->setSourceDevice(m_mouseDevice); - m_leftMouseButtonAction->addInput(m_leftMouseButtonInput); - - // Fine Motion Action - m_fineMotionKeyInput->setButtons(QVariantList() << Qt::Key_Shift); - m_fineMotionKeyInput->setSourceDevice(m_keyboardDevice); - m_fineMotionAction->addInput(m_fineMotionKeyInput); - - //// Axes - - // Mouse X - m_mouseRxInput->setAxis(QMouseDevice::X); - m_mouseRxInput->setSourceDevice(m_mouseDevice); - m_rxAxis->addInput(m_mouseRxInput); - - // Mouse Y - m_mouseRyInput->setAxis(QMouseDevice::Y); - m_mouseRyInput->setSourceDevice(m_mouseDevice); - m_ryAxis->addInput(m_mouseRyInput); - - // Keyboard Pos Tx - m_keyboardTxPosInput->setButtons(QVariantList() << Qt::Key_Right); - m_keyboardTxPosInput->setScale(1.0f); - m_keyboardTxPosInput->setSourceDevice(m_keyboardDevice); - m_txAxis->addInput(m_keyboardTxPosInput); - - // Keyboard Pos Ty - m_keyboardTyPosInput->setButtons(QVariantList() << Qt::Key_PageUp); - m_keyboardTyPosInput->setScale(1.0f); - m_keyboardTyPosInput->setSourceDevice(m_keyboardDevice); - m_tyAxis->addInput(m_keyboardTyPosInput); - - // Keyboard Pos Tz - m_keyboardTzPosInput->setButtons(QVariantList() << Qt::Key_Up); - m_keyboardTzPosInput->setScale(1.0f); - m_keyboardTzPosInput->setSourceDevice(m_keyboardDevice); - m_tzAxis->addInput(m_keyboardTzPosInput); - - // Keyboard Neg Tx - m_keyboardTxNegInput->setButtons(QVariantList() << Qt::Key_Left); - m_keyboardTxNegInput->setScale(-1.0f); - m_keyboardTxNegInput->setSourceDevice(m_keyboardDevice); - m_txAxis->addInput(m_keyboardTxNegInput); - - // Keyboard Neg Ty - m_keyboardTyNegInput->setButtons(QVariantList() << Qt::Key_PageDown); - m_keyboardTyNegInput->setScale(-1.0f); - m_keyboardTyNegInput->setSourceDevice(m_keyboardDevice); - m_tyAxis->addInput(m_keyboardTyNegInput); - - // Keyboard Neg Tz - m_keyboardTzNegInput->setButtons(QVariantList() << Qt::Key_Down); - m_keyboardTzNegInput->setScale(-1.0f); - m_keyboardTzNegInput->setSourceDevice(m_keyboardDevice); - m_tzAxis->addInput(m_keyboardTzNegInput); - - //// Logical Device - - m_logicalDevice->addAction(m_fineMotionAction); - m_logicalDevice->addAction(m_leftMouseButtonAction); - m_logicalDevice->addAxis(m_rxAxis); - m_logicalDevice->addAxis(m_ryAxis); - m_logicalDevice->addAxis(m_txAxis); - m_logicalDevice->addAxis(m_tyAxis); - m_logicalDevice->addAxis(m_tzAxis); - - Q_Q(QFirstPersonCameraController); - //// FrameAction - - QObject::connect(m_frameAction, SIGNAL(triggered(float)), - q, SLOT(_q_onTriggered(float))); - - q->addComponent(m_frameAction); - q->addComponent(m_logicalDevice); -} - -void QFirstPersonCameraControllerPrivate::_q_onTriggered(float dt) -{ - if (m_camera != Q_NULLPTR) { - m_camera->translate(QVector3D(m_txAxis->value() * m_linearSpeed, - m_tyAxis->value() * m_linearSpeed, - m_tzAxis->value() * m_linearSpeed) * dt); - if (m_leftMouseButtonAction->isActive()) { - m_camera->pan(m_rxAxis->value() * m_lookSpeed * dt, m_firstPersonUp); - m_camera->tilt(m_ryAxis->value() * m_lookSpeed * dt); - } - } -} - -QFirstPersonCameraController::QFirstPersonCameraController(Qt3DCore::QNode *parent) - : Qt3DCore::QEntity(*new QFirstPersonCameraControllerPrivate, parent) -{ - Q_D(QFirstPersonCameraController); - d->init(); -} - -QFirstPersonCameraController::~QFirstPersonCameraController() -{ -} - -Qt3DRender::QCamera *QFirstPersonCameraController::camera() const -{ - Q_D(const QFirstPersonCameraController); - return d->m_camera; -} - -float QFirstPersonCameraController::linearSpeed() const -{ - Q_D(const QFirstPersonCameraController); - return d->m_linearSpeed; -} - -float QFirstPersonCameraController::lookSpeed() const -{ - Q_D(const QFirstPersonCameraController); - return d->m_lookSpeed; -} - -void QFirstPersonCameraController::setCamera(Qt3DRender::QCamera *camera) -{ - Q_D(QFirstPersonCameraController); - if (d->m_camera != camera) { - d->m_camera = camera; - emit cameraChanged(); - } -} - -void QFirstPersonCameraController::setLinearSpeed(float linearSpeed) -{ - Q_D(QFirstPersonCameraController); - if (d->m_linearSpeed != linearSpeed) { - d->m_linearSpeed = linearSpeed; - emit linearSpeedChanged(); - } -} - -void QFirstPersonCameraController::setLookSpeed(float lookSpeed) -{ - Q_D(QFirstPersonCameraController); - if (d->m_lookSpeed != lookSpeed) { - d->m_lookSpeed = lookSpeed; - emit lookSpeedChanged(); - } -} - -} // Qt3DInput - -QT_END_NAMESPACE - -#include "moc_qfirstpersoncameracontroller.cpp" diff --git a/examples/qt3d/examples-common/qfirstpersoncameracontroller.h b/examples/qt3d/examples-common/qfirstpersoncameracontroller.h deleted file mode 100644 index 5b9019586..000000000 --- a/examples/qt3d/examples-common/qfirstpersoncameracontroller.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DINPUT_QFIRSTPERSONCAMERACONTROLLER_H -#define QT3DINPUT_QFIRSTPERSONCAMERACONTROLLER_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -class QCamera; -} - -namespace Qt3DInput { - -class QFirstPersonCameraControllerPrivate; - -class QFirstPersonCameraController : public Qt3DCore::QEntity -{ - Q_OBJECT - Q_PROPERTY(Qt3DRender::QCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged) - Q_PROPERTY(float linearSpeed READ linearSpeed WRITE setLinearSpeed NOTIFY linearSpeedChanged) - Q_PROPERTY(float lookSpeed READ lookSpeed WRITE setLookSpeed NOTIFY lookSpeedChanged) - -public: - explicit QFirstPersonCameraController(Qt3DCore::QNode *parent = Q_NULLPTR); - ~QFirstPersonCameraController(); - - Qt3DRender::QCamera *camera() const; - float linearSpeed() const; - float lookSpeed() const; - - void setCamera(Qt3DRender::QCamera *camera); - void setLinearSpeed(float linearSpeed); - void setLookSpeed(float lookSpeed); - -Q_SIGNALS: - void cameraChanged(); - void linearSpeedChanged(); - void lookSpeedChanged(); - -private: - Q_DECLARE_PRIVATE(QFirstPersonCameraController) - Q_PRIVATE_SLOT(d_func(), void _q_onTriggered(float)) -}; - -} // Qt3DInput - -QT_END_NAMESPACE - -#endif // QT3DINPUT_QFIRSTPERSONCAMERACONTROLLER_H diff --git a/examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h b/examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h deleted file mode 100644 index 4df7278d1..000000000 --- a/examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DINPUT_QFIRSTPERSONCAMERACONTROLLER_P_H -#define QT3DINPUT_QFIRSTPERSONCAMERACONTROLLER_P_H - -#include -#include -#include "qfirstpersoncameracontroller.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -class QCamera; -} - -namespace Qt3DLogic { -class QFrameAction; -} - -namespace Qt3DInput { - -class QKeyboardDevice; -class QMouseDevice; -class QLogicalDevice; -class QAction; -class QActionInput; -class QAxis; -class QAxisInput; -class QAxisActionHandler; - -class QFirstPersonCameraControllerPrivate : public Qt3DCore::QEntityPrivate -{ -public: - QFirstPersonCameraControllerPrivate(); - - void init(); - - Qt3DRender::QCamera *m_camera; - - QAction *m_leftMouseButtonAction; - QAction *m_fineMotionAction; - - QAxis *m_rxAxis; - QAxis *m_ryAxis; - QAxis *m_txAxis; - QAxis *m_tyAxis; - QAxis *m_tzAxis; - - QActionInput *m_leftMouseButtonInput; - QActionInput *m_fineMotionKeyInput; - - QAxisInput *m_mouseRxInput; - QAxisInput *m_mouseRyInput; - QAxisInput *m_keyboardTxPosInput; - QAxisInput *m_keyboardTyPosInput; - QAxisInput *m_keyboardTzPosInput; - QAxisInput *m_keyboardTxNegInput; - QAxisInput *m_keyboardTyNegInput; - QAxisInput *m_keyboardTzNegInput; - - QKeyboardDevice *m_keyboardDevice; - QMouseDevice *m_mouseDevice; - - QLogicalDevice *m_logicalDevice; - - Qt3DLogic::QFrameAction *m_frameAction; - - float m_linearSpeed; - float m_lookSpeed; - QVector3D m_firstPersonUp; - - void _q_onTriggered(float); - - Q_DECLARE_PUBLIC(QFirstPersonCameraController) -}; - -} // Qt3DInput - -QT_END_NAMESPACE - -#endif // QT3DINPUT_QFIRSTPERSONCAMERACONTROLLER_P_H diff --git a/examples/qt3d/examples-common/qorbitcontrol.cpp b/examples/qt3d/examples-common/qorbitcontrol.cpp deleted file mode 100644 index 4f35158f6..000000000 --- a/examples/qt3d/examples-common/qorbitcontrol.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qorbitcontrol_p.h" -#include "qorbitcontrol.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DInput { - -/*! - * \class QOrbitControl::QOrbitControl - * \internal - */ - -QOrbitControlPrivate::QOrbitControlPrivate() - : Qt3DCore::QEntityPrivate() - , m_camera(Q_NULLPTR) - , m_leftMouseButtonAction(new QAction()) - , m_rightMouseButtonAction(new QAction()) - , m_altButtonAction(new QAction()) - , m_shiftButtonAction(new QAction()) - , m_rxAxis(new QAxis()) - , m_ryAxis(new QAxis()) - , m_txAxis(new QAxis()) - , m_tyAxis(new QAxis()) - , m_tzAxis(new QAxis()) - , m_leftMouseButtonInput(new QActionInput()) - , m_rightMouseButtonInput(new QActionInput()) - , m_altButtonInput(new QActionInput()) - , m_shiftButtonInput(new QActionInput()) - , m_mouseRxInput(new QAxisInput()) - , m_mouseRyInput(new QAxisInput()) - , m_keyboardTxPosInput(new QAxisInput()) - , m_keyboardTyPosInput(new QAxisInput()) - , m_keyboardTzPosInput(new QAxisInput()) - , m_keyboardTxNegInput(new QAxisInput()) - , m_keyboardTyNegInput(new QAxisInput()) - , m_keyboardTzNegInput(new QAxisInput()) - , m_keyboardDevice(new QKeyboardDevice()) - , m_mouseDevice(new QMouseDevice()) - , m_logicalDevice(new QLogicalDevice()) - , m_frameAction(new Qt3DLogic::QFrameAction()) - , m_linearSpeed(10.0f) - , m_lookSpeed(180.0f) - , m_zoomInLimit(2.0f) - , m_cameraUp(QVector3D(0.0f, 1.0f, 0.0f)) -{} - -void QOrbitControlPrivate::init() -{ - //// Actions - - // Left Mouse Button Action - m_leftMouseButtonInput->setButtons(QVariantList() << QMouseEvent::LeftButton); - m_leftMouseButtonInput->setSourceDevice(m_mouseDevice); - m_leftMouseButtonAction->addInput(m_leftMouseButtonInput); - - // Right Mouse Button Action - m_rightMouseButtonInput->setButtons(QVariantList() << QMouseEvent::RightButton); - m_rightMouseButtonInput->setSourceDevice(m_mouseDevice); - m_rightMouseButtonAction->addInput(m_rightMouseButtonInput); - - // Alt Button Action - m_altButtonInput->setButtons(QVariantList() << Qt::Key_Alt); - m_altButtonInput->setSourceDevice(m_keyboardDevice); - m_altButtonAction->addInput(m_altButtonInput); - - // Shift Button Action - m_shiftButtonInput->setButtons(QVariantList() << Qt::Key_Shift); - m_shiftButtonInput->setSourceDevice(m_keyboardDevice); - m_shiftButtonAction->addInput(m_shiftButtonInput); - - //// Axes - - // Mouse X - m_mouseRxInput->setAxis(QMouseDevice::X); - m_mouseRxInput->setSourceDevice(m_mouseDevice); - m_rxAxis->addInput(m_mouseRxInput); - - // Mouse Y - m_mouseRyInput->setAxis(QMouseDevice::Y); - m_mouseRyInput->setSourceDevice(m_mouseDevice); - m_ryAxis->addInput(m_mouseRyInput); - - // Keyboard Pos Tx - m_keyboardTxPosInput->setButtons(QVariantList() << Qt::Key_Right); - m_keyboardTxPosInput->setScale(1.0f); - m_keyboardTxPosInput->setSourceDevice(m_keyboardDevice); - m_txAxis->addInput(m_keyboardTxPosInput); - - // Keyboard Pos Tz - m_keyboardTzPosInput->setButtons(QVariantList() << Qt::Key_PageUp); - m_keyboardTzPosInput->setScale(1.0f); - m_keyboardTzPosInput->setSourceDevice(m_keyboardDevice); - m_tzAxis->addInput(m_keyboardTzPosInput); - - // Keyboard Pos Ty - m_keyboardTyPosInput->setButtons(QVariantList() << Qt::Key_Up); - m_keyboardTyPosInput->setScale(1.0f); - m_keyboardTyPosInput->setSourceDevice(m_keyboardDevice); - m_tyAxis->addInput(m_keyboardTyPosInput); - - // Keyboard Neg Tx - m_keyboardTxNegInput->setButtons(QVariantList() << Qt::Key_Left); - m_keyboardTxNegInput->setScale(-1.0f); - m_keyboardTxNegInput->setSourceDevice(m_keyboardDevice); - m_txAxis->addInput(m_keyboardTxNegInput); - - // Keyboard Neg Tz - m_keyboardTzNegInput->setButtons(QVariantList() << Qt::Key_PageDown); - m_keyboardTzNegInput->setScale(-1.0f); - m_keyboardTzNegInput->setSourceDevice(m_keyboardDevice); - m_tzAxis->addInput(m_keyboardTzNegInput); - - // Keyboard Neg Ty - m_keyboardTyNegInput->setButtons(QVariantList() << Qt::Key_Down); - m_keyboardTyNegInput->setScale(-1.0f); - m_keyboardTyNegInput->setSourceDevice(m_keyboardDevice); - m_tyAxis->addInput(m_keyboardTyNegInput); - - //// Logical Device - - m_logicalDevice->addAction(m_leftMouseButtonAction); - m_logicalDevice->addAction(m_rightMouseButtonAction); - m_logicalDevice->addAction(m_altButtonAction); - m_logicalDevice->addAction(m_shiftButtonAction); - m_logicalDevice->addAxis(m_rxAxis); - m_logicalDevice->addAxis(m_ryAxis); - m_logicalDevice->addAxis(m_txAxis); - m_logicalDevice->addAxis(m_tyAxis); - m_logicalDevice->addAxis(m_tzAxis); - - Q_Q(QOrbitControl); - //// FrameAction - - QObject::connect(m_frameAction, SIGNAL(triggered(float)), - q, SLOT(_q_onTriggered(float))); - - q->addComponent(m_frameAction); - q->addComponent(m_logicalDevice); -} - -float clampInputs(float input1, float input2) -{ - float axisValue = input1 + input2; - return (axisValue < -1) ? -1 : (axisValue > 1) ? 1 : axisValue; -} - -float zoomDistance(QVector3D firstPoint, QVector3D secondPoint) -{ - return (secondPoint - firstPoint).lengthSquared(); -} - -void QOrbitControlPrivate::_q_onTriggered(float dt) -{ - if (m_camera != Q_NULLPTR) { - // Mouse input - if (m_leftMouseButtonAction->isActive()) { - if (m_rightMouseButtonAction->isActive()) { - if ( zoomDistance(m_camera->position(), m_camera->viewCenter()) > m_zoomInLimit * m_zoomInLimit) { - // Dolly up to limit - m_camera->translate(QVector3D(0, 0, m_ryAxis->value()), m_camera->DontTranslateViewCenter); - } else { - m_camera->translate(QVector3D(0, 0, -0.5), m_camera->DontTranslateViewCenter); - } - } else { - // Translate - m_camera->translate(QVector3D(clampInputs(m_rxAxis->value(), m_txAxis->value()) * m_linearSpeed, - clampInputs(m_ryAxis->value(), m_tyAxis->value()) * m_linearSpeed, - 0) * dt); - return; - } - } - else if (m_rightMouseButtonAction->isActive()) { - // Orbit - m_camera->panAboutViewCenter((m_rxAxis->value() * m_lookSpeed) * dt, m_cameraUp); - m_camera->tiltAboutViewCenter((m_ryAxis->value() * m_lookSpeed) * dt); - } - // Keyboard Input - if (m_altButtonAction->isActive()) { - // Orbit - m_camera->panAboutViewCenter((m_txAxis->value() * m_lookSpeed) * dt, m_cameraUp); - m_camera->tiltAboutViewCenter((m_tyAxis->value() * m_lookSpeed) * dt); - } else if (m_shiftButtonAction->isActive()) { - if (zoomDistance(m_camera->position(), m_camera->viewCenter()) > m_zoomInLimit * m_zoomInLimit) { - // Dolly - m_camera->translate(QVector3D(0, 0, m_tyAxis->value()), m_camera->DontTranslateViewCenter); - } else { - m_camera->translate(QVector3D(0, 0, -0.5), m_camera->DontTranslateViewCenter); - } - } else { - // Translate - m_camera->translate(QVector3D(clampInputs(m_leftMouseButtonAction->isActive() ? m_rxAxis->value() : 0, m_txAxis->value()) * m_linearSpeed, - clampInputs(m_leftMouseButtonAction->isActive() ? m_ryAxis->value() : 0, m_tyAxis->value()) * m_linearSpeed, - m_tzAxis->value() * m_linearSpeed) * dt); - } - } -} - -QOrbitControl::QOrbitControl(Qt3DCore::QNode *parent) - : Qt3DCore::QEntity(*new QOrbitControlPrivate, parent) -{ - Q_D(QOrbitControl); - d->init(); -} - -QOrbitControl::~QOrbitControl() -{ -} - -Qt3DRender::QCamera *QOrbitControl::camera() const -{ - Q_D(const QOrbitControl); - return d->m_camera; -} - -float QOrbitControl::linearSpeed() const -{ - Q_D(const QOrbitControl); - return d->m_linearSpeed; -} - -float QOrbitControl::lookSpeed() const -{ - Q_D(const QOrbitControl); - return d->m_lookSpeed; -} - -float QOrbitControl::zoomInLimit() const -{ - Q_D(const QOrbitControl); - return d->m_zoomInLimit; -} - -void QOrbitControl::setCamera(Qt3DRender::QCamera *camera) -{ - Q_D(QOrbitControl); - if (d->m_camera != camera) { - d->m_camera = camera; - emit cameraChanged(); - } -} - -void QOrbitControl::setLinearSpeed(float linearSpeed) -{ - Q_D(QOrbitControl); - if (d->m_linearSpeed != linearSpeed) { - d->m_linearSpeed = linearSpeed; - emit linearSpeedChanged(); - } -} - -void QOrbitControl::setLookSpeed(float lookSpeed) -{ - Q_D(QOrbitControl); - if (d->m_lookSpeed != lookSpeed) { - d->m_lookSpeed = lookSpeed; - emit lookSpeedChanged(); - } -} - -void QOrbitControl::setZoomInLimit(float zoomInLimit) -{ - Q_D(QOrbitControl); - if (d->m_zoomInLimit != zoomInLimit) { - d->m_zoomInLimit = zoomInLimit; - emit zoomInLimitChanged(); - } -} - -} // Qt3DInput - -QT_END_NAMESPACE - -#include "moc_qorbitcontrol.cpp" diff --git a/examples/qt3d/examples-common/qorbitcontrol.h b/examples/qt3d/examples-common/qorbitcontrol.h deleted file mode 100644 index dbfc6e08d..000000000 --- a/examples/qt3d/examples-common/qorbitcontrol.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DINPUT_QORBITCONTROL_H -#define QT3DINPUT_QORBITCONTROL_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -class QCamera; -} - -namespace Qt3DInput { - -class QOrbitControlPrivate; - -class QOrbitControl : public Qt3DCore::QEntity -{ - Q_OBJECT - Q_PROPERTY(Qt3DRender::QCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged) - Q_PROPERTY(float linearSpeed READ linearSpeed WRITE setLinearSpeed NOTIFY linearSpeedChanged) - Q_PROPERTY(float lookSpeed READ lookSpeed WRITE setLookSpeed NOTIFY lookSpeedChanged) - Q_PROPERTY(float zoomInLimit READ zoomInLimit WRITE setZoomInLimit NOTIFY zoomInLimitChanged) - -public: - explicit QOrbitControl(Qt3DCore::QNode *parent = nullptr); - ~QOrbitControl(); - - float clampInputs(float input1, float input2); - Qt3DRender::QCamera *camera() const; - float linearSpeed() const; - float lookSpeed() const; - float zoomInLimit() const; - - void setCamera(Qt3DRender::QCamera *camera); - void setLinearSpeed(float linearSpeed); - void setLookSpeed(float lookSpeed); - void setZoomInLimit(float zoomInLimit); - -Q_SIGNALS: - void cameraChanged(); - void linearSpeedChanged(); - void lookSpeedChanged(); - void zoomInLimitChanged(); - -private: - Q_DECLARE_PRIVATE(QOrbitControl) - Q_PRIVATE_SLOT(d_func(), void _q_onTriggered(float)) -}; - -} // Qt3DInput - -QT_END_NAMESPACE - -#endif // QT3DINPUT_QORBITCONTROL_H diff --git a/examples/qt3d/examples-common/qorbitcontrol_p.h b/examples/qt3d/examples-common/qorbitcontrol_p.h deleted file mode 100644 index 34f853685..000000000 --- a/examples/qt3d/examples-common/qorbitcontrol_p.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTINPUT_QORBITCONTROL_P_H -#define QTINPUT_QORBITCONTROL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include "qorbitcontrol.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -class QCamera; -} - -namespace Qt3DLogic { -class QFrameAction; -} - -namespace Qt3DInput { - -class QKeyboardDevice; -class QMouseDevice; -class QLogicalDevice; -class QAction; -class QActionInput; -class QAxis; -class QAxisInput; -class QAxisActionHandler; - -class QOrbitControlPrivate : public Qt3DCore::QEntityPrivate -{ -public: - QOrbitControlPrivate(); - - void init(); - - Qt3DRender::QCamera *m_camera; - - QAction *m_leftMouseButtonAction; - QAction *m_rightMouseButtonAction; - QAction *m_altButtonAction; - QAction *m_shiftButtonAction; - - QAxis *m_rxAxis; - QAxis *m_ryAxis; - QAxis *m_txAxis; - QAxis *m_tyAxis; - QAxis *m_tzAxis; - - QActionInput *m_leftMouseButtonInput; - QActionInput *m_rightMouseButtonInput; - QActionInput *m_altButtonInput; - QActionInput *m_shiftButtonInput; - - QAxisInput *m_mouseRxInput; - QAxisInput *m_mouseRyInput; - QAxisInput *m_keyboardTxPosInput; - QAxisInput *m_keyboardTyPosInput; - QAxisInput *m_keyboardTzPosInput; - QAxisInput *m_keyboardTxNegInput; - QAxisInput *m_keyboardTyNegInput; - QAxisInput *m_keyboardTzNegInput; - - QKeyboardDevice *m_keyboardDevice; - QMouseDevice *m_mouseDevice; - - QLogicalDevice *m_logicalDevice; - - Qt3DLogic::QFrameAction *m_frameAction; - - float m_linearSpeed; - float m_lookSpeed; - float m_zoomInLimit; - QVector3D m_cameraUp; - - void _q_onTriggered(float); - - Q_DECLARE_PUBLIC(QOrbitControl) -}; - -} // namespace Qt3DInput - -QT_END_NAMESPACE - -#endif // QTINPUT_QORBITCONTROL_P_H diff --git a/examples/qt3d/examples-common/qt3dquickwindow.cpp b/examples/qt3d/examples-common/qt3dquickwindow.cpp deleted file mode 100644 index 1537b4e71..000000000 --- a/examples/qt3d/examples-common/qt3dquickwindow.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qt3dquickwindow.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -QT_BEGIN_NAMESPACE - -Qt3DQuickWindow::Qt3DQuickWindow(QWindow *parent) - : QQuickWindow(parent) - , m_engine(Q_NULLPTR) - , m_renderAspect(Q_NULLPTR) - , m_inputAspect(Q_NULLPTR) - , m_logicAspect(Q_NULLPTR) - , m_initialized(false) - , m_cameraAspectRatioMode(AutomaticAspectRatio) -{ - setSurfaceType(QSurface::OpenGLSurface); - - resize(1024, 768); - - QSurfaceFormat format; -#ifdef QT_OPENGL_ES_2 - format.setRenderableType(QSurfaceFormat::OpenGLES); -#else - if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { - format.setVersion(4, 3); - format.setProfile(QSurfaceFormat::CoreProfile); - } -#endif - format.setDepthBufferSize(24); - format.setSamples(4); - format.setStencilBufferSize(8); - setFormat(format); - QSurfaceFormat::setDefaultFormat(format); - create(); - - m_engine.reset(new Qt3DCore::Quick::QQmlAspectEngine); - m_renderAspect = new Qt3DRender::QRenderAspect; - m_inputAspect = new Qt3DInput::QInputAspect; - m_logicAspect = new Qt3DLogic::QLogicAspect; - - m_engine->aspectEngine()->registerAspect(m_renderAspect); - m_engine->aspectEngine()->registerAspect(m_inputAspect); - m_engine->aspectEngine()->registerAspect(m_logicAspect); -} - -Qt3DQuickWindow::~Qt3DQuickWindow() -{ -} - -void Qt3DQuickWindow::registerAspect(Qt3DCore::QAbstractAspect *aspect) -{ - Q_ASSERT(!isVisible()); - m_engine->aspectEngine()->registerAspect(aspect); -} - -void Qt3DQuickWindow::registerAspect(const QString &name) -{ - Q_ASSERT(!isVisible()); - m_engine->aspectEngine()->registerAspect(name); -} - -void Qt3DQuickWindow::setSource(const QUrl &source) -{ - m_source = source; -} - -Qt3DCore::Quick::QQmlAspectEngine *Qt3DQuickWindow::engine() const -{ - return m_engine.data(); -} - -void Qt3DQuickWindow::setCameraAspectRatioMode(CameraAspectRatioMode mode) -{ - if (m_cameraAspectRatioMode == mode) - return; - - m_cameraAspectRatioMode = mode; - setCameraAspectModeHelper(); - emit cameraAspectRatioModeChanged(mode); -} - -Qt3DQuickWindow::CameraAspectRatioMode Qt3DQuickWindow::cameraAspectRatioMode() const -{ - return m_cameraAspectRatioMode; -} - -void Qt3DQuickWindow::showEvent(QShowEvent *e) -{ - if (!m_initialized) { - - // Connect to the QQmlAspectEngine's statusChanged signal so that when the QML is loaded - // and th eobjects hav ebeen instantiated, but before we set them on the QAspectEngine we - // can swoop in and set the window surface and camera on the framegraph and ensure the camera - // respects the window's aspect ratio - connect(m_engine.data(), &Qt3DCore::Quick::QQmlAspectEngine::sceneCreated, - this, &Qt3DQuickWindow::onSceneCreated); - - m_engine->setSource(m_source); - - // Set the QQmlIncubationController on the window - // to benefit from asynchronous incubation - m_engine->qmlEngine()->setIncubationController(QQuickWindow::incubationController()); - - m_initialized = true; - } - QQuickWindow::showEvent(e); -} - -void Qt3DQuickWindow::onSceneCreated(QObject *rootObject) -{ - Q_ASSERT(rootObject); - - setWindowSurface(rootObject); - - if (m_cameraAspectRatioMode == AutomaticAspectRatio) { - // Set aspect ratio of first camera to match the window - QList cameras - = rootObject->findChildren(); - if (cameras.isEmpty()) { - qWarning() << "No camera found"; - } else { - m_camera = cameras.first(); - setCameraAspectModeHelper(); - } - } - - // Set ourselves up as a source of input events for the input aspect - Qt3DInput::QInputSettings *inputSettings = rootObject->findChild(); - if (inputSettings) { - inputSettings->setEventSource(this); - } else { - qWarning() << "No Input Settings found, keyboard and mouse events won't be handled"; - } -} - -void Qt3DQuickWindow::setWindowSurface(QObject *rootObject) -{ - // Find surface selector in framegraph and set ourselves up as the - // render surface there - Qt3DRender::QRenderSettings *rendererSettings - = rootObject->findChild(); - if (!rendererSettings) { - qWarning() << "No renderer settings component found"; - return; - } - - Qt3DCore::QNode *frameGraphRoot = rendererSettings->activeFrameGraph(); - if (!frameGraphRoot) { - qWarning() << "No active frame graph found"; - return; - } - - Qt3DRender::QRenderSurfaceSelector *surfaceSelector = qobject_cast(frameGraphRoot); - if (!surfaceSelector) - surfaceSelector = frameGraphRoot->findChild(); - if (!surfaceSelector) { - qWarning() << "No render surface selector found in frame graph"; - return; - } - - surfaceSelector->setSurface(this); -} - -void Qt3DQuickWindow::setCameraAspectModeHelper() -{ - switch (m_cameraAspectRatioMode) { - case AutomaticAspectRatio: - connect(this, &QWindow::widthChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); - connect(this, &QWindow::heightChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); - break; - case UserAspectRatio: - disconnect(this, &QWindow::widthChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); - disconnect(this, &QWindow::heightChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); - break; - } -} - -void Qt3DQuickWindow::updateCameraAspectRatio() -{ - if (m_camera) { - m_camera->setAspectRatio(static_cast(width()) / - static_cast(height())); - } -} - -QT_END_NAMESPACE diff --git a/examples/qt3d/examples-common/qt3dquickwindow.h b/examples/qt3d/examples-common/qt3dquickwindow.h deleted file mode 100644 index 5a01be779..000000000 --- a/examples/qt3d/examples-common/qt3dquickwindow.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DQUICKWINDOW_H -#define QT3DQUICKWINDOW_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { -class QAbstractAspect; -namespace Quick { -class QQmlAspectEngine; -} -} - -namespace Qt3DRender { -class QRenderAspect; -class QCamera; -} - -namespace Qt3DInput { -class QInputAspect; -} - -namespace Qt3DLogic { -class QLogicAspect; -} - -class Qt3DQuickWindow : public QQuickWindow -{ - Q_OBJECT - Q_PROPERTY(CameraAspectRatioMode cameraAspectRatioMode READ cameraAspectRatioMode WRITE setCameraAspectRatioMode NOTIFY cameraAspectRatioModeChanged) - -public: - Qt3DQuickWindow(QWindow *parent = Q_NULLPTR); - ~Qt3DQuickWindow(); - - void registerAspect(Qt3DCore::QAbstractAspect *aspect); - void registerAspect(const QString &name); - - void setSource(const QUrl &source); - Qt3DCore::Quick::QQmlAspectEngine *engine() const; - - enum CameraAspectRatioMode { - AutomaticAspectRatio, - UserAspectRatio - }; - Q_ENUM(CameraAspectRatioMode); - - void setCameraAspectRatioMode(CameraAspectRatioMode mode); - CameraAspectRatioMode cameraAspectRatioMode() const; - -Q_SIGNALS: - void cameraAspectRatioModeChanged(CameraAspectRatioMode mode); - -protected: - void showEvent(QShowEvent *e) Q_DECL_OVERRIDE; - -private: - void onSceneCreated(QObject *rootObject); - void setWindowSurface(QObject *rootObject); - void setCameraAspectModeHelper(); - void updateCameraAspectRatio(); - - QScopedPointer m_engine; - - // Aspects - Qt3DRender::QRenderAspect *m_renderAspect; - Qt3DInput::QInputAspect *m_inputAspect; - Qt3DLogic::QLogicAspect *m_logicAspect; - - QUrl m_source; - bool m_initialized; - QPointer m_camera; - CameraAspectRatioMode m_cameraAspectRatioMode; -}; - -QT_END_NAMESPACE - -#endif // QT3DQUICKWINDOW_H diff --git a/examples/qt3d/examples-common/qt3dwindow.cpp b/examples/qt3d/examples-common/qt3dwindow.cpp deleted file mode 100644 index 4c0bfc21a..000000000 --- a/examples/qt3d/examples-common/qt3dwindow.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qt3dwindow.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -Qt3DWindow::Qt3DWindow(QScreen *screen) - : QWindow(screen) - , m_aspectEngine(new Qt3DCore::QAspectEngine) - , m_renderAspect(new Qt3DRender::QRenderAspect) - , m_inputAspect(new Qt3DInput::QInputAspect) - , m_logicAspect(new Qt3DLogic::QLogicAspect) - , m_renderSettings(new Qt3DRender::QRenderSettings) - , m_forwardRenderer(new Qt3DExtras::QForwardRenderer) - , m_defaultCamera(new Qt3DRender::QCamera) - , m_inputSettings(new Qt3DInput::QInputSettings) - , m_root(new Qt3DCore::QEntity) - , m_userRoot(nullptr) - , m_initialized(false) -{ - setSurfaceType(QSurface::OpenGLSurface); - - resize(1024, 768); - - QSurfaceFormat format; -#ifdef QT_OPENGL_ES_2 - format.setRenderableType(QSurfaceFormat::OpenGLES); -#else - if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { - format.setVersion(4, 3); - format.setProfile(QSurfaceFormat::CoreProfile); - } -#endif - format.setDepthBufferSize(24); - format.setSamples(4); - format.setStencilBufferSize(8); - setFormat(format); - create(); - - m_aspectEngine->registerAspect(m_renderAspect); - m_aspectEngine->registerAspect(m_inputAspect); - m_aspectEngine->registerAspect(m_logicAspect); - - m_defaultCamera->setParent(m_root); - m_forwardRenderer->setCamera(m_defaultCamera); - m_forwardRenderer->setSurface(this); - m_renderSettings->setActiveFrameGraph(m_forwardRenderer); - m_inputSettings->setEventSource(this); -} - -Qt3DWindow::~Qt3DWindow() -{ -} - -void Qt3DWindow::registerAspect(Qt3DCore::QAbstractAspect *aspect) -{ - Q_ASSERT(!isVisible()); - m_aspectEngine->registerAspect(aspect); -} - -void Qt3DWindow::registerAspect(const QString &name) -{ - Q_ASSERT(!isVisible()); - m_aspectEngine->registerAspect(name); -} - -void Qt3DWindow::setRootEntity(Qt3DCore::QEntity *root) -{ - Q_ASSERT(!isVisible()); - m_userRoot = root; -} - -void Qt3DWindow::setActiveFrameGraph(Qt3DRender::QFrameGraphNode *activeFrameGraph) -{ - m_renderSettings->setActiveFrameGraph(activeFrameGraph); -} - -Qt3DRender::QFrameGraphNode *Qt3DWindow::activeFrameGraph() const -{ - return m_renderSettings->activeFrameGraph(); -} - -Qt3DExtras::QForwardRenderer *Qt3DWindow::defaultFramegraph() const -{ - return m_forwardRenderer; -} - -Qt3DRender::QCamera *Qt3DWindow::camera() const -{ - return m_defaultCamera; -} - -void Qt3DWindow::showEvent(QShowEvent *e) -{ - if (!m_initialized) { - if (m_userRoot != nullptr) - m_userRoot->setParent(m_root); - - m_root->addComponent(m_renderSettings); - m_root->addComponent(m_inputSettings); - m_aspectEngine->setRootEntity(Qt3DCore::QEntityPtr(m_root)); - - m_initialized = true; - } - - QWindow::showEvent(e); -} - -void Qt3DWindow::resizeEvent(QResizeEvent *) -{ - m_defaultCamera->setAspectRatio(float(width()) / float(height())); -} - -QT_END_NAMESPACE diff --git a/examples/qt3d/examples-common/qt3dwindow.h b/examples/qt3d/examples-common/qt3dwindow.h deleted file mode 100644 index 5cb71d1d9..000000000 --- a/examples/qt3d/examples-common/qt3dwindow.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DWINDOW_H -#define QT3DWINDOW_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { -class QAspectEngine; -class QAbstractAspect; -class QEntity; -} - -namespace Qt3DRender { -class QCamera; -class QFrameGraphNode; -class QRenderAspect; -class QRenderSettings; -} - -namespace Qt3DExtras { -class QForwardRenderer; -} - -namespace Qt3DInput { -class QInputAspect; -class QInputSettings; -} - -namespace Qt3DLogic { -class QLogicAspect; -} - -class Qt3DWindow : public QWindow -{ - Q_OBJECT -public: - Qt3DWindow(QScreen *screen = nullptr); - ~Qt3DWindow(); - - void registerAspect(Qt3DCore::QAbstractAspect *aspect); - void registerAspect(const QString &name); - - void setRootEntity(Qt3DCore::QEntity *root); - - void setActiveFrameGraph(Qt3DRender::QFrameGraphNode *activeFrameGraph); - Qt3DRender::QFrameGraphNode *activeFrameGraph() const; - Qt3DExtras::QForwardRenderer *defaultFramegraph() const; - - Qt3DRender::QCamera *camera() const; - -public Q_SLOTS: - -Q_SIGNALS: - -protected: - void showEvent(QShowEvent *e) Q_DECL_OVERRIDE; - void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; - -private: - QScopedPointer m_aspectEngine; - - // Aspects - Qt3DRender::QRenderAspect *m_renderAspect; - Qt3DInput::QInputAspect *m_inputAspect; - Qt3DLogic::QLogicAspect *m_logicAspect; - - // Renderer configuration - Qt3DRender::QRenderSettings *m_renderSettings; - Qt3DExtras::QForwardRenderer *m_forwardRenderer; - Qt3DRender::QCamera *m_defaultCamera; - - // Input configuration - Qt3DInput::QInputSettings *m_inputSettings; - - // Logic configuration - - // Scene - Qt3DCore::QEntity *m_root; - Qt3DCore::QEntity *m_userRoot; - - bool m_initialized; -}; - -QT_END_NAMESPACE - -#endif // QT3DWINDOW_H diff --git a/examples/qt3d/examples.pri b/examples/qt3d/examples.pri index 1f58b0f02..31cafc396 100644 --- a/examples/qt3d/examples.pri +++ b/examples/qt3d/examples.pri @@ -1,10 +1,6 @@ TEMPLATE = app -include(./examples-common/examples-common.pri) - -#INCLUDEPATH += $$PWD/common -#SOURCES += $$PWD/common/window.cpp -#HEADERS += $$PWD/common/window.h +QT += 3dextras target.path = $$[QT_INSTALL_EXAMPLES]/qt3d/$$TARGET INSTALLS += target diff --git a/examples/qt3d/gltf/gltf.pro b/examples/qt3d/gltf/gltf.pro index 8a79ab06c..2ec5551a9 100644 --- a/examples/qt3d/gltf/gltf.pro +++ b/examples/qt3d/gltf/gltf.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras HEADERS += \ diff --git a/examples/qt3d/gltf/main.cpp b/examples/qt3d/gltf/main.cpp index afde3a5f9..8fc9cd8e2 100644 --- a/examples/qt3d/gltf/main.cpp +++ b/examples/qt3d/gltf/main.cpp @@ -48,14 +48,14 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/gooch-qml/gooch-qml.pro b/examples/qt3d/gooch-qml/gooch-qml.pro index c5ead19d8..1239a73c3 100644 --- a/examples/qt3d/gooch-qml/gooch-qml.pro +++ b/examples/qt3d/gooch-qml/gooch-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dquick 3dinput qml quick +QT += 3dcore 3drender 3dquick 3dinput qml quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/gooch-qml/main.cpp b/examples/qt3d/gooch-qml/main.cpp index 007b73590..95044bf67 100644 --- a/examples/qt3d/gooch-qml/main.cpp +++ b/examples/qt3d/gooch-qml/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include #include @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; // Expose the window as a context property so we can set the aspect ratio view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); view.setSource(QUrl("qrc:/main.qml")); diff --git a/examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro b/examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro index d15f5ad56..e3f7e436f 100644 --- a/examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro +++ b/examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += qml quick 3dcore 3drender 3dinput 3dquick +QT += qml quick 3dcore 3drender 3dinput 3dquick 3dquickextras SOURCES += \ main.cpp \ diff --git a/examples/qt3d/instanced-arrays-qml/main.cpp b/examples/qt3d/instanced-arrays-qml/main.cpp index cc651590e..20b32563b 100644 --- a/examples/qt3d/instanced-arrays-qml/main.cpp +++ b/examples/qt3d/instanced-arrays-qml/main.cpp @@ -49,7 +49,7 @@ ****************************************************************************/ #include "instancebuffer.h" -#include "qt3dquickwindow.h" +#include #include #include #include @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; InstanceBuffer buffer; view.engine()->qmlEngine()->rootContext()->setContextProperty("_instanceBuffer", &buffer); diff --git a/examples/qt3d/keyboardinput-qml/keyboardinput-qml.pro b/examples/qt3d/keyboardinput-qml/keyboardinput-qml.pro index 5ebea8962..406c6b8b8 100644 --- a/examples/qt3d/keyboardinput-qml/keyboardinput-qml.pro +++ b/examples/qt3d/keyboardinput-qml/keyboardinput-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dquick 3dinput quick qml +QT += 3dcore 3drender 3dquick 3dinput quick qml 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/keyboardinput-qml/main.cpp b/examples/qt3d/keyboardinput-qml/main.cpp index b91cd44d6..70a8ec467 100644 --- a/examples/qt3d/keyboardinput-qml/main.cpp +++ b/examples/qt3d/keyboardinput-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/lights/lights.pro b/examples/qt3d/lights/lights.pro index 85fe72c15..be41ac01d 100644 --- a/examples/qt3d/lights/lights.pro +++ b/examples/qt3d/lights/lights.pro @@ -4,7 +4,7 @@ SOURCE += main.cpp -QT += qml quick 3dcore 3drender 3dinput 3dquick +QT += qml quick 3dcore 3drender 3dinput 3dquick 3dquickextras OTHER_FILES += main.qml \ PlaneEntity.qml diff --git a/examples/qt3d/lights/main.cpp b/examples/qt3d/lights/main.cpp index a99db6f74..ddddf6e3d 100644 --- a/examples/qt3d/lights/main.cpp +++ b/examples/qt3d/lights/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/loader-qml/loader-qml.pro b/examples/qt3d/loader-qml/loader-qml.pro index ed74a300a..55572232d 100644 --- a/examples/qt3d/loader-qml/loader-qml.pro +++ b/examples/qt3d/loader-qml/loader-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/loader-qml/main.cpp b/examples/qt3d/loader-qml/main.cpp index 0a8b739d9..70a8ec467 100644 --- a/examples/qt3d/loader-qml/main.cpp +++ b/examples/qt3d/loader-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/materials-cpp/main.cpp b/examples/qt3d/materials-cpp/main.cpp index 0514df414..5ca6998e0 100644 --- a/examples/qt3d/materials-cpp/main.cpp +++ b/examples/qt3d/materials-cpp/main.cpp @@ -66,14 +66,14 @@ #include "rotatingtrefoilknot.h" #include "barrel.h" #include "houseplant.h" -#include "qt3dwindow.h" -#include "qfirstpersoncameracontroller.h" +#include +#include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; // Scene Root Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity(); @@ -86,7 +86,7 @@ int main(int argc, char* argv[]) basicCamera->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f)); basicCamera->setPosition(QVector3D(0.0f, 3.5f, 25.0f)); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(sceneRoot); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot); camController->setCamera(basicCamera); // Scene floor diff --git a/examples/qt3d/materials-cpp/materials-cpp.pro b/examples/qt3d/materials-cpp/materials-cpp.pro index 8cdffd313..326feca75 100644 --- a/examples/qt3d/materials-cpp/materials-cpp.pro +++ b/examples/qt3d/materials-cpp/materials-cpp.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput +QT += 3dcore 3drender 3dinput 3dextras HEADERS += \ planeentity.h \ diff --git a/examples/qt3d/materials/main.cpp b/examples/qt3d/materials/main.cpp index 2661de1ff..faed40390 100644 --- a/examples/qt3d/materials/main.cpp +++ b/examples/qt3d/materials/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include #include @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; // Expose the window as a context property so we can set the aspect ratio view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); diff --git a/examples/qt3d/materials/materials.pro b/examples/qt3d/materials/materials.pro index a5c892fe8..c19361472 100644 --- a/examples/qt3d/materials/materials.pro +++ b/examples/qt3d/materials/materials.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras HEADERS += \ diff --git a/examples/qt3d/mouseinput-qml/main.cpp b/examples/qt3d/mouseinput-qml/main.cpp index 428891833..e1a359d2a 100644 --- a/examples/qt3d/mouseinput-qml/main.cpp +++ b/examples/qt3d/mouseinput-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl(QStringLiteral("qrc:/main.qml"))); view.show(); diff --git a/examples/qt3d/mouseinput-qml/mouseinput-qml.pro b/examples/qt3d/mouseinput-qml/mouseinput-qml.pro index 8d72e3a8b..a5bad5991 100644 --- a/examples/qt3d/mouseinput-qml/mouseinput-qml.pro +++ b/examples/qt3d/mouseinput-qml/mouseinput-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras SOURCES += main.cpp diff --git a/examples/qt3d/multiviewport/main.cpp b/examples/qt3d/multiviewport/main.cpp index 74e8e7b0b..ce5b883bd 100644 --- a/examples/qt3d/multiviewport/main.cpp +++ b/examples/qt3d/multiviewport/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include +#include #include int main(int ac, char **av) { QGuiApplication app(ac, av); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/multiviewport/multiviewport.pro b/examples/qt3d/multiviewport/multiviewport.pro index 12b30ad50..c53be2113 100644 --- a/examples/qt3d/multiviewport/multiviewport.pro +++ b/examples/qt3d/multiviewport/multiviewport.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras HEADERS += \ diff --git a/examples/qt3d/picking-qml/main.cpp b/examples/qt3d/picking-qml/main.cpp index 05ca909d8..337a0766a 100644 --- a/examples/qt3d/picking-qml/main.cpp +++ b/examples/qt3d/picking-qml/main.cpp @@ -49,7 +49,7 @@ ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include #include @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.engine()->qmlEngine()->rootContext()->setContextProperty("_view", &view); view.setSource(QUrl(QStringLiteral("qrc:/main.qml"))); diff --git a/examples/qt3d/picking-qml/picking-qml.pro b/examples/qt3d/picking-qml/picking-qml.pro index 6639f745f..93fd17583 100644 --- a/examples/qt3d/picking-qml/picking-qml.pro +++ b/examples/qt3d/picking-qml/picking-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3drender-private 3dinput 3dquick qml quick +QT += 3dcore 3drender 3drender-private 3dinput 3dquick qml quick 3dquickextras SOURCES += main.cpp diff --git a/examples/qt3d/plasma/main.cpp b/examples/qt3d/plasma/main.cpp index f2a470828..7b2c4041b 100644 --- a/examples/qt3d/plasma/main.cpp +++ b/examples/qt3d/plasma/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include #include @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; // Expose the window as a context property so we can set the aspect ratio view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); diff --git a/examples/qt3d/plasma/plasma.pro b/examples/qt3d/plasma/plasma.pro index dbd221b40..0e2e9cdb3 100644 --- a/examples/qt3d/plasma/plasma.pro +++ b/examples/qt3d/plasma/plasma.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dquick qml quick +QT += 3dcore 3drender 3dquick qml quick 3dquickextras HEADERS += \ diff --git a/examples/qt3d/playground-qml/main.cpp b/examples/qt3d/playground-qml/main.cpp index 0bf16c79e..7e130a718 100644 --- a/examples/qt3d/playground-qml/main.cpp +++ b/examples/qt3d/playground-qml/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include +#include #include #include @@ -56,7 +56,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/playground-qml/playground-qml.pro b/examples/qt3d/playground-qml/playground-qml.pro index bbd16e027..a8a659a68 100644 --- a/examples/qt3d/playground-qml/playground-qml.pro +++ b/examples/qt3d/playground-qml/playground-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dquick qml quick 3dinput +QT += 3dcore 3drender 3dquick qml quick 3dinput 3dquickextras HEADERS += \ diff --git a/examples/qt3d/qt3d.pro b/examples/qt3d/qt3d.pro index af2fd703a..6fd9cf30b 100644 --- a/examples/qt3d/qt3d.pro +++ b/examples/qt3d/qt3d.pro @@ -1,7 +1,6 @@ TEMPLATE = subdirs SUBDIRS += \ - examples-common \ playground-qml \ simple-qml \ simple-cpp \ @@ -59,9 +58,3 @@ qtHaveModule(multimedia): SUBDIRS += audio-visualizer-qml #SUBDIRS += qt3d qtHaveModule(widgets): SUBDIRS += assimp-cpp \ basicshapes-cpp - -for(subdir, SUBDIRS) { - !equals(subdir, examples-common) { - $${subdir}.depends += examples-common - } -} diff --git a/examples/qt3d/shadow-map-qml/main.cpp b/examples/qt3d/shadow-map-qml/main.cpp index f08717185..a8b76c224 100644 --- a/examples/qt3d/shadow-map-qml/main.cpp +++ b/examples/qt3d/shadow-map-qml/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.resize(1600, 800); view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); view.setSource(QUrl("qrc:/main.qml")); diff --git a/examples/qt3d/shadow-map-qml/shadow-map-qml.pro b/examples/qt3d/shadow-map-qml/shadow-map-qml.pro index b8f50aed0..0819dc196 100644 --- a/examples/qt3d/shadow-map-qml/shadow-map-qml.pro +++ b/examples/qt3d/shadow-map-qml/shadow-map-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/simple-cpp/main.cpp b/examples/qt3d/simple-cpp/main.cpp index af7f429fe..af7f1f9d9 100644 --- a/examples/qt3d/simple-cpp/main.cpp +++ b/examples/qt3d/simple-cpp/main.cpp @@ -124,7 +124,7 @@ Qt3DCore::QEntity *createScene() int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DWindow view; + Qt3DExtras::Qt3DWindow view; Qt3DCore::QEntity *scene = createScene(); @@ -134,7 +134,7 @@ int main(int argc, char* argv[]) camera->setPosition(QVector3D(0, 0, 40.0f)); // For camera controls - Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(scene); + Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(scene); camController->setLinearSpeed( 50.0f ); camController->setLookSpeed( 180.0f ); camController->setCamera(camera); diff --git a/examples/qt3d/simple-cpp/simple-cpp.pro b/examples/qt3d/simple-cpp/simple-cpp.pro index db0d0d972..cf01c1242 100644 --- a/examples/qt3d/simple-cpp/simple-cpp.pro +++ b/examples/qt3d/simple-cpp/simple-cpp.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput +QT += 3dcore 3drender 3dinput 3dextras SOURCES += \ main.cpp \ diff --git a/examples/qt3d/simple-qml/main.cpp b/examples/qt3d/simple-qml/main.cpp index 6c5d56582..32ae912df 100644 --- a/examples/qt3d/simple-qml/main.cpp +++ b/examples/qt3d/simple-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/simple-qml/simple-qml.pro b/examples/qt3d/simple-qml/simple-qml.pro index 8abb2b301..f9fc1156b 100644 --- a/examples/qt3d/simple-qml/simple-qml.pro +++ b/examples/qt3d/simple-qml/simple-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick 3dlogic qml quick +QT += 3dcore 3drender 3dinput 3dquick 3dlogic qml quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/simple-shaders-qml/main.cpp b/examples/qt3d/simple-shaders-qml/main.cpp index 196eefe05..41d2f08a5 100644 --- a/examples/qt3d/simple-shaders-qml/main.cpp +++ b/examples/qt3d/simple-shaders-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro b/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro index 6da510e50..e7c398b4b 100644 --- a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro +++ b/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/skybox/main.cpp b/examples/qt3d/skybox/main.cpp index 97df70a8d..066421e9d 100644 --- a/examples/qt3d/skybox/main.cpp +++ b/examples/qt3d/skybox/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); return app.exec(); diff --git a/examples/qt3d/skybox/skybox.pro b/examples/qt3d/skybox/skybox.pro index 919858d35..d836f2058 100644 --- a/examples/qt3d/skybox/skybox.pro +++ b/examples/qt3d/skybox/skybox.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras RESOURCES += \ skybox.qrc \ diff --git a/examples/qt3d/tessellation-modes/main.cpp b/examples/qt3d/tessellation-modes/main.cpp index e74ec7dbd..a0eae5175 100644 --- a/examples/qt3d/tessellation-modes/main.cpp +++ b/examples/qt3d/tessellation-modes/main.cpp @@ -49,7 +49,7 @@ ****************************************************************************/ #include "tessellatedquadmesh.h" -#include "qt3dquickwindow.h" +#include #include #include #include @@ -60,7 +60,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; // Register our custom types qmlRegisterType("Qt3D.Examples", 1, 0, "TessellatedQuadMesh"); diff --git a/examples/qt3d/tessellation-modes/tessellation-modes.pro b/examples/qt3d/tessellation-modes/tessellation-modes.pro index e6c758577..c1691e607 100644 --- a/examples/qt3d/tessellation-modes/tessellation-modes.pro +++ b/examples/qt3d/tessellation-modes/tessellation-modes.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras HEADERS += \ tessellatedquadmesh.h diff --git a/examples/qt3d/torus-qml/main.cpp b/examples/qt3d/torus-qml/main.cpp index bf120144b..32ae912df 100644 --- a/examples/qt3d/torus-qml/main.cpp +++ b/examples/qt3d/torus-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/torus-qml/torus-qml.pro b/examples/qt3d/torus-qml/torus-qml.pro index dddcd9aad..2aba23531 100644 --- a/examples/qt3d/torus-qml/torus-qml.pro +++ b/examples/qt3d/torus-qml/torus-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/transforms-qml/main.cpp b/examples/qt3d/transforms-qml/main.cpp index ee0837a1b..3487e7bb2 100644 --- a/examples/qt3d/transforms-qml/main.cpp +++ b/examples/qt3d/transforms-qml/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include #include @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.engine()->qmlEngine()->rootContext()->setContextProperty("_view", &view); view.setSource(QUrl("qrc:/main.qml")); diff --git a/examples/qt3d/transforms-qml/transforms-qml.pro b/examples/qt3d/transforms-qml/transforms-qml.pro index 18dd6fa43..060ddbd2a 100644 --- a/examples/qt3d/transforms-qml/transforms-qml.pro +++ b/examples/qt3d/transforms-qml/transforms-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras SOURCES += \ main.cpp diff --git a/examples/qt3d/transparency-qml/main.cpp b/examples/qt3d/transparency-qml/main.cpp index 196eefe05..41d2f08a5 100644 --- a/examples/qt3d/transparency-qml/main.cpp +++ b/examples/qt3d/transparency-qml/main.cpp @@ -48,13 +48,13 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); view.show(); diff --git a/examples/qt3d/transparency-qml/transparency-qml.pro b/examples/qt3d/transparency-qml/transparency-qml.pro index e39694137..273e31546 100644 --- a/examples/qt3d/transparency-qml/transparency-qml.pro +++ b/examples/qt3d/transparency-qml/transparency-qml.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += qml quick 3dcore 3drender 3dinput 3dquick +QT += qml quick 3dcore 3drender 3dinput 3dquick 3dquickextras SOURCES += main.cpp diff --git a/examples/qt3d/wave/main.cpp b/examples/qt3d/wave/main.cpp index 4c2480741..56d78f17a 100644 --- a/examples/qt3d/wave/main.cpp +++ b/examples/qt3d/wave/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include #include @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; // Expose the window as a context property so we can set the aspect ratio view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); diff --git a/examples/qt3d/wave/wave.pro b/examples/qt3d/wave/wave.pro index 2ec36d43a..45c8c64b6 100644 --- a/examples/qt3d/wave/wave.pro +++ b/examples/qt3d/wave/wave.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dquick 3dinput qml quick +QT += 3dcore 3drender 3dquick 3dinput qml quick 3dquickextras HEADERS += \ diff --git a/examples/qt3d/wireframe/main.cpp b/examples/qt3d/wireframe/main.cpp index a2140fd1f..760786ee8 100644 --- a/examples/qt3d/wireframe/main.cpp +++ b/examples/qt3d/wireframe/main.cpp @@ -48,7 +48,7 @@ ** ****************************************************************************/ -#include "qt3dquickwindow.h" +#include #include #include @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3DQuickWindow view; + Qt3DExtras::Quick::Qt3DQuickWindow view; // Expose the window as a context property so we can set the aspect ratio view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); diff --git a/examples/qt3d/wireframe/wireframe.pro b/examples/qt3d/wireframe/wireframe.pro index 6aeb7a5ae..a7c538bc8 100644 --- a/examples/qt3d/wireframe/wireframe.pro +++ b/examples/qt3d/wireframe/wireframe.pro @@ -2,7 +2,7 @@ error( "Couldn't find the examples.pri file!" ) } -QT += 3dcore 3drender 3dinput 3dquick qml quick +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras HEADERS += \ -- cgit v1.2.3