summaryrefslogtreecommitdiffstats
path: root/src/runtime
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-01-08 09:58:28 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-01-09 13:34:24 +0000
commit409d4273f15643aa440ef1f4a6b2dc83bdbdb531 (patch)
tree6e41555a0cc5404e9e26b20c4d7d16253f4044d0 /src/runtime
parente39db76d27d10afec33aa94c0f6db2a2a7cea6fb (diff)
Basic effect bookkeeping
...so that we do not immediately crash when having an animated effect property in the scene. Change-Id: I77766c70efcfbd276fe8f018e8f8ff6057e3b11c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/q3dsscenemanager.cpp13
-rw-r--r--src/runtime/q3dsscenemanager.h6
2 files changed, 18 insertions, 1 deletions
diff --git a/src/runtime/q3dsscenemanager.cpp b/src/runtime/q3dsscenemanager.cpp
index 02bc892..07ce181 100644
--- a/src/runtime/q3dsscenemanager.cpp
+++ b/src/runtime/q3dsscenemanager.cpp
@@ -2654,6 +2654,15 @@ void Q3DSSceneManager::updateProgressiveAA(Q3DSLayerNode *layer3DS)
++data->progAA.pass;
}
+void Q3DSSceneManager::buildEffect(Q3DSEffectInstance *eff3DS, Q3DSLayerNode *layer3DS)
+{
+ Q3DSLayerAttached *layerData = static_cast<Q3DSLayerAttached *>(layer3DS->attached());
+ Q3DSEffectAttached *effData = new Q3DSEffectAttached;
+ effData->entity = layerData->entity;
+ eff3DS->setAttached(effData);
+ layerData->effects.append(eff3DS);
+}
+
static void setLayerBlending(Qt3DRender::QBlendEquation *blendFunc,
Qt3DRender::QBlendEquationArguments *blendArgs,
Q3DSLayerNode *layer3DS)
@@ -3086,6 +3095,10 @@ void Q3DSSceneManager::buildLayerScene(Q3DSGraphObject *obj, Q3DSLayerNode *laye
if (!obj->isNode()) {
obj->addPropertyChangeObserver(std::bind(&Q3DSSceneManager::handlePropertyChange, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+
+ if (obj->type() == Q3DSGraphObject::Effect)
+ buildEffect(static_cast<Q3DSEffectInstance *>(obj), layer3DS);
+
return;
}
diff --git a/src/runtime/q3dsscenemanager.h b/src/runtime/q3dsscenemanager.h
index 3a175ea..1cbef91 100644
--- a/src/runtime/q3dsscenemanager.h
+++ b/src/runtime/q3dsscenemanager.h
@@ -274,6 +274,8 @@ public:
Qt3DRender::QTexture2D *tempTexture = nullptr;
Qt3DRender::QRenderTarget *tempRt = nullptr;
} advBlend;
+
+ QVector<Q3DSEffectInstance *> effects;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Q3DSLayerAttached::SizeManagedTexture::Flags)
@@ -399,7 +401,7 @@ Q_DECLARE_TYPEINFO(Q3DSCustomMaterialAttached::Parameter, Q_MOVABLE_TYPE);
class Q3DSEffectAttached : public Q3DSGraphObjectAttached
{
public:
- Qt3DCore::QEntity *entity = nullptr;
+ Qt3DCore::QEntity *entity = nullptr; // for animations
};
class Q3DSSlideAttached : public Q3DSGraphObjectAttached
@@ -577,6 +579,8 @@ private:
void updateLightsBuffer(const QVector<Q3DSLightSource> &lights, Qt3DRender::QBuffer *uniformBuffer);
void updateModel(Q3DSModelNode *model3DS);
+ void buildEffect(Q3DSEffectInstance *eff3DS, Q3DSLayerNode *layer3DS);
+
void buildLayerQuadEntity(Q3DSLayerNode *layer3DS, Qt3DCore::QEntity *parentEntity, Qt3DRender::QLayer *tag,
BuildLayerQuadFlags flags, Qt3DRender::QRenderPass **renderPass);
void buildCompositor(Qt3DRender::QFrameGraphNode *parent, Qt3DCore::QEntity *parentEntity);