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/basicshapes-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/basicshapes-cpp')
-rw-r--r-- | examples/qt3d/basicshapes-cpp/main.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/examples/qt3d/basicshapes-cpp/main.cpp b/examples/qt3d/basicshapes-cpp/main.cpp index f7e50fdd5..586647849 100644 --- a/examples/qt3d/basicshapes-cpp/main.cpp +++ b/examples/qt3d/basicshapes-cpp/main.cpp @@ -38,9 +38,9 @@ #include <QGuiApplication> -#include <Qt3DCore/qcamera.h> +#include <Qt3DRender/qcamera.h> #include <Qt3DCore/qentity.h> -#include <Qt3DCore/qcameralens.h> +#include <Qt3DRender/qcameralens.h> #include <QtWidgets/QApplication> #include <QtWidgets/QWidget> @@ -59,7 +59,6 @@ #include <Qt3DRender/qtexture.h> #include <Qt3DRender/qrenderpass.h> #include <Qt3DRender/qsceneloader.h> -#include <Qt3DRender/qwindow.h> #include <Qt3DCore/qtransform.h> #include <Qt3DCore/qaspectengine.h> @@ -68,10 +67,13 @@ #include <Qt3DRender/qframegraph.h> #include <Qt3DRender/qforwardrenderer.h> +#include "qt3dwindow.h" +#include "qfirstpersoncameracontroller.h" + int main(int argc, char **argv) { QApplication app(argc, argv); - Qt3DRender::QWindow *view = new Qt3DRender::QWindow(); + Qt3DWindow *view = new Qt3DWindow(); QWidget *container = QWidget::createWindowContainer(view); QSize screenSize = view->screen()->size(); container->setMinimumSize(QSize(200, 100)); @@ -93,13 +95,16 @@ int main(int argc, char **argv) Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity(); // Camera - Qt3DCore::QCamera *cameraEntity = view->defaultCamera(); + Qt3DRender::QCamera *cameraEntity = view->camera(); cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f); cameraEntity->setPosition(QVector3D(0, 0, 20.0f)); cameraEntity->setUpVector(QVector3D(0, 1, 0)); cameraEntity->setViewCenter(QVector3D(0, 0, 0)); - input->setCamera(cameraEntity); + + // For camera controls + Qt3DInput::QFirstPersonCameraController *camController = new Qt3DInput::QFirstPersonCameraController(rootEntity); + camController->setCamera(cameraEntity); // FrameGraph Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph(); |