diff options
-rw-r--r-- | examples/3dstudioruntime2/simpleoffscreen/main.cpp | 3 | ||||
-rw-r--r-- | src/runtime/api/q3dssurfaceviewer.cpp | 2 | ||||
-rw-r--r-- | src/runtime/q3dsengine.cpp | 4 | ||||
-rw-r--r-- | src/runtime/q3dsengine_p.h | 2 | ||||
-rw-r--r-- | src/runtime/q3dsscenemanager.cpp | 17 | ||||
-rw-r--r-- | src/runtime/q3dsscenemanager_p.h | 2 |
6 files changed, 14 insertions, 16 deletions
diff --git a/examples/3dstudioruntime2/simpleoffscreen/main.cpp b/examples/3dstudioruntime2/simpleoffscreen/main.cpp index 3b77362..68ab00e 100644 --- a/examples/3dstudioruntime2/simpleoffscreen/main.cpp +++ b/examples/3dstudioruntime2/simpleoffscreen/main.cpp @@ -105,6 +105,9 @@ int main(int argc, char *argv[]) qDebug("Rendered and saved frame %d to %s", frame, qPrintable(fn)); + // Keep events delivered on this (main) thread. + QCoreApplication::processEvents(); + // ### hack until QT3DS-1041 is in place QThread::msleep(10); } diff --git a/src/runtime/api/q3dssurfaceviewer.cpp b/src/runtime/api/q3dssurfaceviewer.cpp index 17ed152..eb4c93a 100644 --- a/src/runtime/api/q3dssurfaceviewer.cpp +++ b/src/runtime/api/q3dssurfaceviewer.cpp @@ -248,7 +248,7 @@ void Q3DSSurfaceViewer::update() } if (d->actualSize != sz) { d->actualSize = sz; - d->engine->resize(sz, dpr); + d->engine->resize(sz, dpr, true); d->sendResizeToQt3D(sz); } diff --git a/src/runtime/q3dsengine.cpp b/src/runtime/q3dsengine.cpp index 306b2f5..95339bc 100644 --- a/src/runtime/q3dsengine.cpp +++ b/src/runtime/q3dsengine.cpp @@ -1003,12 +1003,12 @@ bool Q3DSEngine::start() return false; } -void Q3DSEngine::resize(const QSize &size, qreal dpr) +void Q3DSEngine::resize(const QSize &size, qreal dpr, bool forceSynchronous) { m_size = size; m_dpr = dpr; if (!m_uipPresentations.isEmpty()) - m_uipPresentations[0].sceneManager->updateSizes(m_size, m_dpr); + m_uipPresentations[0].sceneManager->updateSizes(m_size, m_dpr, forceSynchronous); } void Q3DSEngine::setAutoStart(bool autoStart) diff --git a/src/runtime/q3dsengine_p.h b/src/runtime/q3dsengine_p.h index 34490bb..649fe2f 100644 --- a/src/runtime/q3dsengine_p.h +++ b/src/runtime/q3dsengine_p.h @@ -119,7 +119,7 @@ public: bool start(); - void resize(const QSize &size, qreal dpr = qreal(1.0)); + void resize(const QSize &size, qreal dpr = qreal(1.0), bool forceSynchronous = false); void resize(int w, int h, qreal dpr) { resize(QSize(w, h), dpr); } void setAutoStart(bool autoStart); diff --git a/src/runtime/q3dsscenemanager.cpp b/src/runtime/q3dsscenemanager.cpp index acfe0cc..16ba64c 100644 --- a/src/runtime/q3dsscenemanager.cpp +++ b/src/runtime/q3dsscenemanager.cpp @@ -464,7 +464,7 @@ bool operator!=(const Q3DSLayerAttached::SizeManagedTexture &a, const Q3DSLayerA return a.texture != b.texture; } -void Q3DSSceneManager::updateSizes(const QSize &size, qreal dpr) +void Q3DSSceneManager::updateSizes(const QSize &size, qreal dpr, bool forceSynchronous) { if (!m_scene) return; @@ -486,17 +486,12 @@ void Q3DSSceneManager::updateSizes(const QSize &size, qreal dpr) Q3DSUipPresentation::forAllLayers(m_scene, [=](Q3DSLayerNode *layer3DS) { Q3DSLayerAttached *data = static_cast<Q3DSLayerAttached *>(layer3DS->attached()); if (data) { + data->parentSize = m_outputPixelSize; + data->frameDirty |= Q3DSGraphObjectAttached::LayerDirty; // do it right away if there was no size set yet - if (data->parentSize.isEmpty()) { - updateSizesForLayer(layer3DS, m_outputPixelSize); - } else { - // Defer otherwise, like it is done for other property changes. - // This is not merely an optimization, it is required to defer - // everything that affects the logic for - for example - - // progressive AA to prepareNextFrame(). - data->parentSize = m_outputPixelSize; - data->frameDirty |= Q3DSGraphObjectAttached::LayerDirty; - } + if (data->parentSize.isEmpty() || forceSynchronous) + updateSubTree(m_scene); + // Defer otherwise, like it is done for other property changes. } }); } diff --git a/src/runtime/q3dsscenemanager_p.h b/src/runtime/q3dsscenemanager_p.h index 98a58ca..8970d7c 100644 --- a/src/runtime/q3dsscenemanager_p.h +++ b/src/runtime/q3dsscenemanager_p.h @@ -550,7 +550,7 @@ public: Scene buildScene(Q3DSUipPresentation *presentation, const SceneBuilderParams ¶ms); void finalizeMainScene(const QVector<Q3DSSubPresentation> &subPresentations); - void updateSizes(const QSize &size, qreal dpr); + void updateSizes(const QSize &size, qreal dpr, bool forceSynchronous = false); void prepareEngineReset(); static void prepareEngineResetGlobal(); |