summaryrefslogtreecommitdiffstats
path: root/src/imports/studio3d/q3dsstudio3ditem.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-08-20 14:54:33 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-08-22 12:29:56 +0000
commit0d07354191b3bf65f514ec2ce9cc9119774d0dd0 (patch)
treedabbdc4e9e52c43d42df1e3abe4cf769e6aeb811 /src/imports/studio3d/q3dsstudio3ditem.cpp
parent1861edec6c4bb8f6b641dda70d12a92d32a9caac (diff)
Add support for SSAA and MSAA in View3D
Change-Id: I5958d6391504d57c8c11c31ccc8b3de0d1a038fc Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/imports/studio3d/q3dsstudio3ditem.cpp')
-rw-r--r--src/imports/studio3d/q3dsstudio3ditem.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/imports/studio3d/q3dsstudio3ditem.cpp b/src/imports/studio3d/q3dsstudio3ditem.cpp
index efc23de..32a7407 100644
--- a/src/imports/studio3d/q3dsstudio3ditem.cpp
+++ b/src/imports/studio3d/q3dsstudio3ditem.cpp
@@ -291,7 +291,7 @@ void Q3DSStudio3DItem::setIgnoredEvents(EventIgnoreFlags flags)
emit ignoredEventsChanged();
}
-void Q3DSStudio3DItem::setupSeparateViews()
+void Q3DSStudio3DItem::setupSeparateViews(bool isAfterPresentationLoad)
{
if (m_engine && window()) {
m_separateViewSetupPending = false;
@@ -307,7 +307,13 @@ void Q3DSStudio3DItem::setupSeparateViews()
const qreal dpr = window()->effectiveDevicePixelRatio();
for (Q3DSStudio3DView *view : m_views) {
+ // set the explicit layer size
handleViewGeometryChange(view, view->size().toSize() * dpr);
+ // Qt 3D is not able to provide frames right away so we must make
+ // the sg node reverts to showing something sensible.
+ if (isAfterPresentationLoad)
+ view->resetToDummy();
+ // trigger an eventual updatePaintNode() for the view
view->update();
}
@@ -496,6 +502,8 @@ void Q3DSStudio3DItem::createEngine()
if (!sz.isEmpty())
sendResizeToQt3D(sz, dpr);
+ setupSeparateViews(true);
+
// cannot start() here, that must be deferred
} else {
@@ -552,7 +560,10 @@ QSGNode *Q3DSStudio3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePain
Q3DSStudio3DViewDesc vd;
vd.view = view;
vd.textureNodeId = nodeId;
- vd.layerSizePixels = layer3DS->attached<Q3DSLayerAttached>()->layerSize;
+ Q3DSLayerAttached *layerData = layer3DS->attached<Q3DSLayerAttached>();
+ vd.layerSizePixels = layerData->layerSize * layerData->ssaaScaleFactor;
+ vd.layerSizePixelsWithoutSsaa = layerData->layerSize;
+ vd.layerSampleCount = layerData->msaaSampleCount;
vd.viewSizeWithoutDpr = view->size().toSize();
vd.dpr = window()->effectiveDevicePixelRatio();
viewDesc.append(vd);