diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-01-15 15:09:44 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-01-16 17:17:49 +0000 |
commit | b0404a42ced2ea5a583e1c6ddc22940ffdc1e48e (patch) | |
tree | b073c3c680e388bda00228b204743b092b11de6a /examples/qt3d/simple-cpp | |
parent | 8656b95ffb67efe7dd1cc3a65b12d277e83e1d22 (diff) |
Move QCamera/QCameraLens to Qt3DRender
Also get rid of Qt3DRender::QWindow and of the hard codes camera
controller.
Change-Id: I307735d01caf97b7a690b28de8dc99fc9866c35f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/simple-cpp')
-rw-r--r-- | examples/qt3d/simple-cpp/main.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/examples/qt3d/simple-cpp/main.cpp b/examples/qt3d/simple-cpp/main.cpp index 990fd36bb..438c4b849 100644 --- a/examples/qt3d/simple-cpp/main.cpp +++ b/examples/qt3d/simple-cpp/main.cpp @@ -37,8 +37,8 @@ #include <QGuiApplication> #include <Qt3DCore/QEntity> -#include <Qt3DCore/QCamera> -#include <Qt3DCore/QCameraLens> +#include <Qt3DRender/QCamera> +#include <Qt3DRender/QCameraLens> #include <Qt3DCore/QTransform> #include <Qt3DCore/QAspectEngine> @@ -56,6 +56,7 @@ #include "qt3dwindow.h" #include "orbittransformcontroller.h" +#include "qfirstpersoncameracontroller.h" Qt3DCore::QEntity *createScene() { @@ -112,12 +113,17 @@ int main(int argc, char* argv[]) QGuiApplication app(argc, argv); Qt3DWindow view; + Qt3DCore::QEntity *scene = createScene(); + // Camera - Qt3DCore::QCamera *camera = view.camera(); + Qt3DRender::QCamera *camera = view.camera(); camera->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f); camera->setPosition(QVector3D(0, 0, 40.0f)); - Qt3DCore::QEntity *scene = createScene(); + // For camera controls + Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(scene); + camController->setCamera(camera); + view.setRootEntity(scene); view.show(); |