diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/3rdparty/assimp/qt_attribution.json | 1 | ||||
-rw-r--r-- | src/extras/defaults/defaults.pri | 1 | ||||
-rw-r--r-- | src/extras/defaults/qt3dwindow.cpp | 80 | ||||
-rw-r--r-- | src/extras/defaults/qt3dwindow.h | 25 | ||||
-rw-r--r-- | src/extras/defaults/qt3dwindow_p.h | 92 | ||||
-rw-r--r-- | src/extras/text/qdistancefieldglyphcache.cpp | 2 | ||||
-rw-r--r-- | src/plugins/geometryloaders/default/objgeometryloader.cpp | 2 | ||||
-rw-r--r-- | src/quick3d/quick3dextras/qt3dquickwindow.cpp | 80 | ||||
-rw-r--r-- | src/quick3d/quick3dextras/qt3dquickwindow.h | 14 | ||||
-rw-r--r-- | src/quick3d/quick3dextras/qt3dquickwindow_p.h | 86 | ||||
-rw-r--r-- | src/quick3d/quick3dextras/quick3dextras.pro | 1 | ||||
-rw-r--r-- | src/render/materialsystem/shader.cpp | 12 | ||||
-rw-r--r-- | src/render/texture/apitexturemanager_p.h | 2 |
14 files changed, 296 insertions, 104 deletions
diff --git a/.qmake.conf b/.qmake.conf index b1c22d3b7..0dcf6d9b0 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,3 @@ load(qt_build_config) -MODULE_VERSION = 5.9.0 +MODULE_VERSION = 5.9.1 diff --git a/src/3rdparty/assimp/qt_attribution.json b/src/3rdparty/assimp/qt_attribution.json index 79f23979e..564058dc4 100644 --- a/src/3rdparty/assimp/qt_attribution.json +++ b/src/3rdparty/assimp/qt_attribution.json @@ -6,6 +6,7 @@ "QtUsage": "Used in Qt 3D.", "Homepage": "http://www.assimp.org/", + "Version": "3.3.1", "License": "BSD 3-clause \"New\" or \"Revised\" Licensee", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENSE", diff --git a/src/extras/defaults/defaults.pri b/src/extras/defaults/defaults.pri index ec8c9a7b5..8a18fb6e9 100644 --- a/src/extras/defaults/defaults.pri +++ b/src/extras/defaults/defaults.pri @@ -24,6 +24,7 @@ HEADERS += \ $$PWD/qphongalphamaterial.h \ $$PWD/qphongalphamaterial_p.h \ $$PWD/qt3dwindow.h \ + $$PWD/qt3dwindow_p.h \ $$PWD/qfirstpersoncameracontroller.h \ $$PWD/qfirstpersoncameracontroller_p.h \ $$PWD/qorbitcameracontroller.h \ diff --git a/src/extras/defaults/qt3dwindow.cpp b/src/extras/defaults/qt3dwindow.cpp index a0ce40e16..635d81956 100644 --- a/src/extras/defaults/qt3dwindow.cpp +++ b/src/extras/defaults/qt3dwindow.cpp @@ -49,6 +49,7 @@ ****************************************************************************/ #include "qt3dwindow.h" +#include "qt3dwindow_p.h" #include <Qt3DCore/qaspectengine.h> #include <Qt3DCore/qentity.h> @@ -65,9 +66,8 @@ QT_BEGIN_NAMESPACE namespace Qt3DExtras { -Qt3DWindow::Qt3DWindow(QScreen *screen) - : QWindow(screen) - , m_aspectEngine(new Qt3DCore::QAspectEngine) +Qt3DWindowPrivate::Qt3DWindowPrivate() + : m_aspectEngine(new Qt3DCore::QAspectEngine) , m_renderAspect(new Qt3DRender::QRenderAspect) , m_inputAspect(new Qt3DInput::QInputAspect) , m_logicAspect(new Qt3DLogic::QLogicAspect) @@ -79,6 +79,16 @@ Qt3DWindow::Qt3DWindow(QScreen *screen) , m_userRoot(nullptr) , m_initialized(false) { +} + +Qt3DWindow::Qt3DWindow(QScreen *screen) + : QWindow(*new Qt3DWindowPrivate(), nullptr) +{ + Q_D(Qt3DWindow); + + if (!d->parentWindow) + d->connectToScreen(screen ? screen : d->topLevelScreen.data()); + setSurfaceType(QSurface::OpenGLSurface); resize(1024, 768); @@ -98,77 +108,88 @@ Qt3DWindow::Qt3DWindow(QScreen *screen) setFormat(format); QSurfaceFormat::setDefaultFormat(format); - m_aspectEngine->registerAspect(m_renderAspect); - m_aspectEngine->registerAspect(m_inputAspect); - m_aspectEngine->registerAspect(m_logicAspect); + d->m_aspectEngine->registerAspect(d->m_renderAspect); + d->m_aspectEngine->registerAspect(d->m_inputAspect); + d->m_aspectEngine->registerAspect(d->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); + d->m_defaultCamera->setParent(d->m_root); + d->m_forwardRenderer->setCamera(d->m_defaultCamera); + d->m_forwardRenderer->setSurface(this); + d->m_renderSettings->setActiveFrameGraph(d->m_forwardRenderer); + d->m_inputSettings->setEventSource(this); } Qt3DWindow::~Qt3DWindow() { + Q_D(Qt3DWindow); + delete d->m_aspectEngine; } void Qt3DWindow::registerAspect(Qt3DCore::QAbstractAspect *aspect) { Q_ASSERT(!isVisible()); - m_aspectEngine->registerAspect(aspect); + Q_D(Qt3DWindow); + d->m_aspectEngine->registerAspect(aspect); } void Qt3DWindow::registerAspect(const QString &name) { Q_ASSERT(!isVisible()); - m_aspectEngine->registerAspect(name); + Q_D(Qt3DWindow); + d->m_aspectEngine->registerAspect(name); } void Qt3DWindow::setRootEntity(Qt3DCore::QEntity *root) { - if (m_userRoot != root) { - if (m_userRoot != nullptr) - m_userRoot->setParent(static_cast<Qt3DCore::QNode*>(nullptr)); + Q_D(Qt3DWindow); + if (d->m_userRoot != root) { + if (d->m_userRoot != nullptr) + d->m_userRoot->setParent(static_cast<Qt3DCore::QNode*>(nullptr)); if (root != nullptr) - root->setParent(m_root); - m_userRoot = root; + root->setParent(d->m_root); + d->m_userRoot = root; } } void Qt3DWindow::setActiveFrameGraph(Qt3DRender::QFrameGraphNode *activeFrameGraph) { - m_renderSettings->setActiveFrameGraph(activeFrameGraph); + Q_D(Qt3DWindow); + d->m_renderSettings->setActiveFrameGraph(activeFrameGraph); } Qt3DRender::QFrameGraphNode *Qt3DWindow::activeFrameGraph() const { - return m_renderSettings->activeFrameGraph(); + Q_D(const Qt3DWindow); + return d->m_renderSettings->activeFrameGraph(); } Qt3DExtras::QForwardRenderer *Qt3DWindow::defaultFrameGraph() const { - return m_forwardRenderer; + Q_D(const Qt3DWindow); + return d->m_forwardRenderer; } Qt3DRender::QCamera *Qt3DWindow::camera() const { - return m_defaultCamera; + Q_D(const Qt3DWindow); + return d->m_defaultCamera; } Qt3DRender::QRenderSettings *Qt3DWindow::renderSettings() const { - return m_renderSettings; + Q_D(const Qt3DWindow); + return d->m_renderSettings; } void Qt3DWindow::showEvent(QShowEvent *e) { - if (!m_initialized) { - m_root->addComponent(m_renderSettings); - m_root->addComponent(m_inputSettings); - m_aspectEngine->setRootEntity(Qt3DCore::QEntityPtr(m_root)); + Q_D(Qt3DWindow); + if (!d->m_initialized) { + d->m_root->addComponent(d->m_renderSettings); + d->m_root->addComponent(d->m_inputSettings); + d->m_aspectEngine->setRootEntity(Qt3DCore::QEntityPtr(d->m_root)); - m_initialized = true; + d->m_initialized = true; } QWindow::showEvent(e); @@ -176,7 +197,8 @@ void Qt3DWindow::showEvent(QShowEvent *e) void Qt3DWindow::resizeEvent(QResizeEvent *) { - m_defaultCamera->setAspectRatio(float(width()) / float(height())); + Q_D(Qt3DWindow); + d->m_defaultCamera->setAspectRatio(float(width()) / float(height())); } } // Qt3DExtras diff --git a/src/extras/defaults/qt3dwindow.h b/src/extras/defaults/qt3dwindow.h index 811bb134d..6ec1bbf8b 100644 --- a/src/extras/defaults/qt3dwindow.h +++ b/src/extras/defaults/qt3dwindow.h @@ -84,6 +84,8 @@ class QLogicAspect; namespace Qt3DExtras { +class Qt3DWindowPrivate; + class QT3DEXTRASSHARED_EXPORT Qt3DWindow : public QWindow { Q_OBJECT @@ -112,28 +114,7 @@ protected: void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; private: - QScopedPointer<Qt3DCore::QAspectEngine> 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; + Q_DECLARE_PRIVATE(Qt3DWindow) }; } // Qt3DExtras diff --git a/src/extras/defaults/qt3dwindow_p.h b/src/extras/defaults/qt3dwindow_p.h new file mode 100644 index 000000000..731d5298e --- /dev/null +++ b/src/extras/defaults/qt3dwindow_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 QT3DWINDOW_P_H +#define QT3DWINDOW_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 <QtGui/private/qwindow_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DExtras { + +class Qt3DWindowPrivate : public QWindowPrivate +{ +public: + Qt3DWindowPrivate(); + + Qt3DCore::QAspectEngine *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; + + Q_DECLARE_PUBLIC(Qt3DWindow) +}; + +} // Qt3DExtras + +QT_END_NAMESPACE + +#endif // QT3DWINDOW_P_H diff --git a/src/extras/text/qdistancefieldglyphcache.cpp b/src/extras/text/qdistancefieldglyphcache.cpp index 9c997013e..99085f378 100644 --- a/src/extras/text/qdistancefieldglyphcache.cpp +++ b/src/extras/text/qdistancefieldglyphcache.cpp @@ -272,7 +272,7 @@ DistanceFieldFont* QDistanceFieldGlyphCache::getOrCreateDistanceFieldFont(const // return, if font already exists (make sure to only create one DistanceFieldFont for // each unique QRawFont, by building a hash on the QRawFont that ignores the font size) const QString key = fontKey(font); - const auto it = m_fonts.find(key); + const auto it = m_fonts.constFind(key); if (it != m_fonts.cend()) return it.value(); diff --git a/src/plugins/geometryloaders/default/objgeometryloader.cpp b/src/plugins/geometryloaders/default/objgeometryloader.cpp index a6c635190..b1fb1f931 100644 --- a/src/plugins/geometryloaders/default/objgeometryloader.cpp +++ b/src/plugins/geometryloaders/default/objgeometryloader.cpp @@ -219,7 +219,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh) if (hasNormals) m_normals.resize(vertexCount); - for (QHash<FaceIndices, unsigned int>::const_iterator it = faceIndexMap.begin(), endIt = faceIndexMap.end(); it != endIt; ++it) { + for (auto it = faceIndexMap.cbegin(), endIt = faceIndexMap.cend(); it != endIt; ++it) { m_points[it.value()] = positions[it.key().positionIndex]; if (hasTexCoords) m_texCoords[it.value()] = std::numeric_limits<unsigned int>::max() != it.key().texCoordIndex ? texCoords[it.key().texCoordIndex] : QVector2D(); diff --git a/src/quick3d/quick3dextras/qt3dquickwindow.cpp b/src/quick3d/quick3dextras/qt3dquickwindow.cpp index 7f32f03f0..91773bb66 100644 --- a/src/quick3d/quick3dextras/qt3dquickwindow.cpp +++ b/src/quick3d/quick3dextras/qt3dquickwindow.cpp @@ -49,6 +49,7 @@ ****************************************************************************/ #include <Qt3DQuickExtras/qt3dquickwindow.h> +#include "qt3dquickwindow_p.h" #include <Qt3DQuick/QQmlAspectEngine> #include <Qt3DQuickExtras/qt3dquickwindow.h> #include <Qt3DInput/qinputaspect.h> @@ -96,16 +97,21 @@ private: } // anonymous -Qt3DQuickWindow::Qt3DQuickWindow(QWindow *parent) - : QWindow(parent) - , m_engine(nullptr) +Qt3DQuickWindowPrivate::Qt3DQuickWindowPrivate() + : m_engine(nullptr) , m_renderAspect(nullptr) , m_inputAspect(nullptr) , m_logicAspect(nullptr) , m_initialized(false) - , m_cameraAspectRatioMode(AutomaticAspectRatio) + , m_cameraAspectRatioMode(Qt3DQuickWindow::AutomaticAspectRatio) , m_incubationController(nullptr) { +} + +Qt3DQuickWindow::Qt3DQuickWindow(QWindow *parent) + : QWindow(*new Qt3DQuickWindowPrivate(), parent) +{ + Q_D(Qt3DQuickWindow); setSurfaceType(QSurface::OpenGLSurface); resize(1024, 768); @@ -125,78 +131,87 @@ Qt3DQuickWindow::Qt3DQuickWindow(QWindow *parent) setFormat(format); QSurfaceFormat::setDefaultFormat(format); - m_engine.reset(new Qt3DCore::Quick::QQmlAspectEngine); - m_renderAspect = new Qt3DRender::QRenderAspect; - m_inputAspect = new Qt3DInput::QInputAspect; - m_logicAspect = new Qt3DLogic::QLogicAspect; + d->m_engine = new Qt3DCore::Quick::QQmlAspectEngine; + d->m_renderAspect = new Qt3DRender::QRenderAspect; + d->m_inputAspect = new Qt3DInput::QInputAspect; + d->m_logicAspect = new Qt3DLogic::QLogicAspect; - m_engine->aspectEngine()->registerAspect(m_renderAspect); - m_engine->aspectEngine()->registerAspect(m_inputAspect); - m_engine->aspectEngine()->registerAspect(m_logicAspect); + d->m_engine->aspectEngine()->registerAspect(d->m_renderAspect); + d->m_engine->aspectEngine()->registerAspect(d->m_inputAspect); + d->m_engine->aspectEngine()->registerAspect(d->m_logicAspect); } Qt3DQuickWindow::~Qt3DQuickWindow() { + Q_D(Qt3DQuickWindow); + delete d->m_engine; } void Qt3DQuickWindow::registerAspect(Qt3DCore::QAbstractAspect *aspect) { Q_ASSERT(!isVisible()); - m_engine->aspectEngine()->registerAspect(aspect); + Q_D(Qt3DQuickWindow); + d->m_engine->aspectEngine()->registerAspect(aspect); } void Qt3DQuickWindow::registerAspect(const QString &name) { Q_ASSERT(!isVisible()); - m_engine->aspectEngine()->registerAspect(name); + Q_D(Qt3DQuickWindow); + d->m_engine->aspectEngine()->registerAspect(name); } void Qt3DQuickWindow::setSource(const QUrl &source) { - m_source = source; + Q_D(Qt3DQuickWindow); + d->m_source = source; } Qt3DCore::Quick::QQmlAspectEngine *Qt3DQuickWindow::engine() const { - return m_engine.data(); + Q_D(const Qt3DQuickWindow); + return d->m_engine; } void Qt3DQuickWindow::setCameraAspectRatioMode(CameraAspectRatioMode mode) { - if (m_cameraAspectRatioMode == mode) + Q_D(Qt3DQuickWindow); + if (d->m_cameraAspectRatioMode == mode) return; - m_cameraAspectRatioMode = mode; + d->m_cameraAspectRatioMode = mode; setCameraAspectModeHelper(); emit cameraAspectRatioModeChanged(mode); } Qt3DQuickWindow::CameraAspectRatioMode Qt3DQuickWindow::cameraAspectRatioMode() const { - return m_cameraAspectRatioMode; + Q_D(const Qt3DQuickWindow); + return d->m_cameraAspectRatioMode; } void Qt3DQuickWindow::showEvent(QShowEvent *e) { - if (!m_initialized) { + Q_D(Qt3DQuickWindow); + if (!d->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, + connect(d->m_engine, &Qt3DCore::Quick::QQmlAspectEngine::sceneCreated, this, &Qt3DQuickWindow::onSceneCreated); - m_engine->setSource(m_source); + d->m_engine->setSource(d->m_source); // Set the QQmlIncubationController on the window // to benefit from asynchronous incubation - if (!m_incubationController) - m_incubationController = new Qt3DQuickWindowIncubationController(this); + if (!d->m_incubationController) + d->m_incubationController = new Qt3DQuickWindowIncubationController(this); - m_engine->qmlEngine()->setIncubationController(m_incubationController); + d->m_engine->qmlEngine()->setIncubationController(d->m_incubationController); - m_initialized = true; + d->m_initialized = true; } QWindow::showEvent(e); } @@ -204,17 +219,18 @@ void Qt3DQuickWindow::showEvent(QShowEvent *e) void Qt3DQuickWindow::onSceneCreated(QObject *rootObject) { Q_ASSERT(rootObject); + Q_D(Qt3DQuickWindow); setWindowSurface(rootObject); - if (m_cameraAspectRatioMode == AutomaticAspectRatio) { + if (d->m_cameraAspectRatioMode == AutomaticAspectRatio) { // Set aspect ratio of first camera to match the window QList<Qt3DRender::QCamera *> cameras = rootObject->findChildren<Qt3DRender::QCamera *>(); if (cameras.isEmpty()) { qCDebug(QuickWindow) << "No camera found"; } else { - m_camera = cameras.first(); + d->m_camera = cameras.first(); setCameraAspectModeHelper(); } } @@ -237,7 +253,8 @@ void Qt3DQuickWindow::setWindowSurface(QObject *rootObject) void Qt3DQuickWindow::setCameraAspectModeHelper() { - switch (m_cameraAspectRatioMode) { + Q_D(Qt3DQuickWindow); + switch (d->m_cameraAspectRatioMode) { case AutomaticAspectRatio: connect(this, &QWindow::widthChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); connect(this, &QWindow::heightChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); @@ -253,9 +270,10 @@ void Qt3DQuickWindow::setCameraAspectModeHelper() void Qt3DQuickWindow::updateCameraAspectRatio() { - if (m_camera) { - m_camera->setAspectRatio(static_cast<float>(width()) / - static_cast<float>(height())); + Q_D(Qt3DQuickWindow); + if (d->m_camera) { + d->m_camera->setAspectRatio(static_cast<float>(width()) / + static_cast<float>(height())); } } diff --git a/src/quick3d/quick3dextras/qt3dquickwindow.h b/src/quick3d/quick3dextras/qt3dquickwindow.h index 1b4d3fabf..0880fc160 100644 --- a/src/quick3d/quick3dextras/qt3dquickwindow.h +++ b/src/quick3d/quick3dextras/qt3dquickwindow.h @@ -84,6 +84,7 @@ namespace Qt3DExtras { namespace Quick { +class Qt3DQuickWindowPrivate; class QT3DQUICKEXTRASSHARED_EXPORT Qt3DQuickWindow : public QWindow { @@ -121,18 +122,7 @@ private: void setCameraAspectModeHelper(); void updateCameraAspectRatio(); - QScopedPointer<Qt3DCore::Quick::QQmlAspectEngine> m_engine; - - // Aspects - Qt3DRender::QRenderAspect *m_renderAspect; - Qt3DInput::QInputAspect *m_inputAspect; - Qt3DLogic::QLogicAspect *m_logicAspect; - - QUrl m_source; - bool m_initialized; - QPointer<Qt3DRender::QCamera> m_camera; - CameraAspectRatioMode m_cameraAspectRatioMode; - QQmlIncubationController *m_incubationController; + Q_DECLARE_PRIVATE(Qt3DQuickWindow) }; } // Quick diff --git a/src/quick3d/quick3dextras/qt3dquickwindow_p.h b/src/quick3d/quick3dextras/qt3dquickwindow_p.h new file mode 100644 index 000000000..f2f8d0492 --- /dev/null +++ b/src/quick3d/quick3dextras/qt3dquickwindow_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 QT3DQUICKWINDOW_P_H +#define QT3DQUICKWINDOW_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 <QtGui/private/qwindow_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DExtras { + +namespace Quick { + +class Qt3DQuickWindowPrivate : public QWindowPrivate +{ +public: + Qt3DQuickWindowPrivate(); + + Qt3DCore::Quick::QQmlAspectEngine *m_engine; + + // Aspects + Qt3DRender::QRenderAspect *m_renderAspect; + Qt3DInput::QInputAspect *m_inputAspect; + Qt3DLogic::QLogicAspect *m_logicAspect; + + QUrl m_source; + bool m_initialized; + QPointer<Qt3DRender::QCamera> m_camera; + Qt3DQuickWindow::CameraAspectRatioMode m_cameraAspectRatioMode; + QQmlIncubationController *m_incubationController; + + Q_DECLARE_PUBLIC(Qt3DQuickWindow) +}; + +} // Quick + +} // Qt3DExtras + +QT_END_NAMESPACE + +#endif // QT3DQUICKWINDOW_P_H diff --git a/src/quick3d/quick3dextras/quick3dextras.pro b/src/quick3d/quick3dextras/quick3dextras.pro index 9044c1668..976430eba 100644 --- a/src/quick3d/quick3dextras/quick3dextras.pro +++ b/src/quick3d/quick3dextras/quick3dextras.pro @@ -21,6 +21,7 @@ HEADERS += \ qt3dquickextras_global.h \ qt3dquickextras_global_p.h \ qt3dquickwindow.h \ + qt3dquickwindow_p.h \ qt3dquickwindowlogging_p.h # otherwise mingw headers do not declare common functions like ::strcasecmp diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp index 3ee00739d..915ca1d54 100644 --- a/src/render/materialsystem/shader.cpp +++ b/src/render/materialsystem/shader.cpp @@ -311,8 +311,8 @@ void Shader::updateDNA() QMutexLocker locker(&m_mutex); uint attachmentHash = 0; - QHash<QString, int>::const_iterator it = m_fragOutputs.begin(); - QHash<QString, int>::const_iterator end = m_fragOutputs.end(); + QHash<QString, int>::const_iterator it = m_fragOutputs.cbegin(); + QHash<QString, int>::const_iterator end = m_fragOutputs.cend(); while (it != end) { attachmentHash += ::qHash(it.value()) + ::qHash(it.key()); ++it; @@ -373,11 +373,11 @@ void Shader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &uniformB qCDebug(Shaders) << "Initializing Uniform Block {" << m_uniformBlockNames[i] << "}"; // Find all active uniforms for the shader block - QVector<ShaderUniform>::const_iterator uniformsIt = m_uniforms.begin(); - const QVector<ShaderUniform>::const_iterator uniformsEnd = m_uniforms.end(); + QVector<ShaderUniform>::const_iterator uniformsIt = m_uniforms.cbegin(); + const QVector<ShaderUniform>::const_iterator uniformsEnd = m_uniforms.cend(); - QVector<QString>::const_iterator uniformNamesIt = m_uniformsNames.begin(); - const QVector<QString>::const_iterator uniformNamesEnd = m_attributesNames.end(); + QVector<QString>::const_iterator uniformNamesIt = m_uniformsNames.cbegin(); + const QVector<QString>::const_iterator uniformNamesEnd = m_attributesNames.cend(); QHash<QString, ShaderUniform> activeUniformsInBlock; diff --git a/src/render/texture/apitexturemanager_p.h b/src/render/texture/apitexturemanager_p.h index c062f0971..91747b3bc 100644 --- a/src/render/texture/apitexturemanager_p.h +++ b/src/render/texture/apitexturemanager_p.h @@ -273,7 +273,7 @@ public: if (impl->isUnique()) return false; - auto it = m_sharedTextures.find(impl); + auto it = m_sharedTextures.constFind(impl); if (it == m_sharedTextures.cend()) return false; |