summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/backend/entity.cpp11
-rw-r--r--src/render/backend/entity_p.h8
-rw-r--r--src/render/backend/renderview_p.h14
-rw-r--r--src/render/backend/renderviewbuilder.cpp4
-rw-r--r--src/render/framegraph/layerfilternode.cpp2
-rw-r--r--src/render/framegraph/qlayerfilter.cpp63
-rw-r--r--src/render/framegraph/qlayerfilter.h6
-rw-r--r--src/render/jobs/filterlayerentityjob.cpp262
-rw-r--r--src/render/jobs/filterlayerentityjob_p.h17
-rw-r--r--src/render/jobs/renderviewjobutils.cpp4
10 files changed, 248 insertions, 143 deletions
diff --git a/src/render/backend/entity.cpp b/src/render/backend/entity.cpp
index dc621512a..a0f052d06 100644
--- a/src/render/backend/entity.cpp
+++ b/src/render/backend/entity.cpp
@@ -411,6 +411,17 @@ void Entity::unsetBoundingVolumeDirty()
m_boundingDirty = false;
}
+void Entity::addRecursiveLayerId(const QNodeId layerId)
+{
+ if (!m_recursiveLayerComponents.contains(layerId) && !m_layerComponents.contains(layerId))
+ m_recursiveLayerComponents.push_back(layerId);
+}
+
+void Entity::removeRecursiveLayerId(const QNodeId layerId)
+{
+ m_recursiveLayerComponents.removeOne(layerId);
+}
+
// Handles
template<>
diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h
index 6f8a781e6..9516ee82b 100644
--- a/src/render/backend/entity_p.h
+++ b/src/render/backend/entity_p.h
@@ -120,6 +120,11 @@ public:
void setTreeEnabled(bool enabled) { m_treeEnabled = enabled; }
bool isTreeEnabled() const { return m_treeEnabled; }
+ Qt3DCore::QNodeIdVector layerIds() const { return m_layerComponents + m_recursiveLayerComponents; }
+ void addRecursiveLayerId(const Qt3DCore::QNodeId layerId);
+ void removeRecursiveLayerId(const Qt3DCore::QNodeId layerId);
+ void clearRecursiveLayerIds() { m_recursiveLayerComponents.clear(); }
+
template<class Backend, uint INDEXBITS>
Qt3DCore::QHandle<Backend, INDEXBITS> componentHandle() const
{
@@ -197,6 +202,9 @@ private:
Qt3DCore::QNodeId m_computeComponent;
Qt3DCore::QNodeId m_armatureComponent;
+ // Includes recursive layers
+ Qt3DCore::QNodeIdVector m_recursiveLayerComponents;
+
QString m_objectName;
bool m_boundingDirty;
// true only if this and all parent nodes are enabled
diff --git a/src/render/backend/renderview_p.h b/src/render/backend/renderview_p.h
index 1674db0a5..050dfb71e 100644
--- a/src/render/backend/renderview_p.h
+++ b/src/render/backend/renderview_p.h
@@ -150,12 +150,8 @@ public:
inline void setEyePosition(const QVector3D &eyePos) Q_DECL_NOTHROW { m_data.m_eyePos = eyePos; }
inline QVector3D eyePosition() const Q_DECL_NOTHROW { return m_data.m_eyePos; }
- inline void setHasLayerFilter(bool filter) Q_DECL_NOTHROW { m_data.m_hasLayerFilter = filter; }
- inline bool hasLayerFilter() const Q_DECL_NOTHROW { return m_data.m_hasLayerFilter; }
- inline void appendLayerFilter(const Qt3DCore::QNodeIdVector &layerIds) Q_DECL_NOTHROW { m_data.m_layerIds << layerIds; }
- inline Qt3DCore::QNodeIdVector layerFilter() const Q_DECL_NOTHROW { return m_data.m_layerIds; }
- inline QLayerFilter::FilterMode layerFilterFilterMode() const Q_DECL_NOTHROW { return m_data.m_layerFilterFilterMode; }
- inline void setLayerFilterFilterMode(QLayerFilter::FilterMode filterMode) Q_DECL_NOTHROW { m_data.m_layerFilterFilterMode = filterMode; }
+ inline void appendLayerFilter(const Qt3DCore::QNodeId layerFilterId) Q_DECL_NOTHROW { m_data.m_layerFilterIds.push_back(layerFilterId); }
+ inline Qt3DCore::QNodeIdVector layerFilters() const Q_DECL_NOTHROW { return m_data.m_layerFilterIds; }
inline void setRenderPassFilter(const RenderPassFilter *rpFilter) Q_DECL_NOTHROW { m_data.m_passFilter = rpFilter; }
inline const RenderPassFilter *renderPassFilter() const Q_DECL_NOTHROW { return m_data.m_passFilter; }
@@ -240,8 +236,6 @@ public:
, m_renderCameraNode(nullptr)
, m_techniqueFilter(nullptr)
, m_passFilter(nullptr)
- , m_hasLayerFilter(false)
- , m_layerFilterFilterMode(QLayerFilter::AcceptMatchingLayers)
{
}
CameraLens *m_renderCameraLens;
@@ -250,9 +244,7 @@ public:
const RenderPassFilter *m_passFilter;
QMatrix4x4 m_viewMatrix;
QMatrix4x4 m_viewProjectionMatrix;
- bool m_hasLayerFilter;
- QLayerFilter::FilterMode m_layerFilterFilterMode;
- Qt3DCore::QNodeIdVector m_layerIds;
+ Qt3DCore::QNodeIdVector m_layerFilterIds;
QVector<Qt3DRender::QSortPolicy::SortType> m_sortingTypes;
QVector3D m_eyePos;
};
diff --git a/src/render/backend/renderviewbuilder.cpp b/src/render/backend/renderviewbuilder.cpp
index e651ce180..9676fb32d 100644
--- a/src/render/backend/renderviewbuilder.cpp
+++ b/src/render/backend/renderviewbuilder.cpp
@@ -137,9 +137,7 @@ public:
RenderView *rv = m_renderViewJob->renderView();
// Layer filtering
- m_filterEntityByLayerJob->setHasLayerFilter(rv->hasLayerFilter());
- m_filterEntityByLayerJob->setLayers(rv->layerFilter());
- m_filterEntityByLayerJob->setFilterMode(rv->layerFilterFilterMode());
+ m_filterEntityByLayerJob->setLayerFilters(rv->layerFilters());
// Material Parameter building
for (const auto &materialGatherer : qAsConst(m_materialGathererJobs)) {
diff --git a/src/render/framegraph/layerfilternode.cpp b/src/render/framegraph/layerfilternode.cpp
index 6223543c6..b8fa5c075 100644
--- a/src/render/framegraph/layerfilternode.cpp
+++ b/src/render/framegraph/layerfilternode.cpp
@@ -53,7 +53,7 @@ namespace Render {
LayerFilterNode::LayerFilterNode()
: FrameGraphNode(FrameGraphNode::LayerFilter)
- , m_filterMode(QLayerFilter::AcceptMatchingLayers)
+ , m_filterMode(QLayerFilter::AcceptAnyMatchingLayers)
{
}
diff --git a/src/render/framegraph/qlayerfilter.cpp b/src/render/framegraph/qlayerfilter.cpp
index 4944fb6cc..04ebca572 100644
--- a/src/render/framegraph/qlayerfilter.cpp
+++ b/src/render/framegraph/qlayerfilter.cpp
@@ -51,7 +51,7 @@ namespace Qt3DRender {
QLayerFilterPrivate::QLayerFilterPrivate()
: QFrameGraphNodePrivate()
- , m_filterMode(QLayerFilter::AcceptMatchingLayers)
+ , m_filterMode(QLayerFilter::AcceptAnyMatchingLayers)
{
}
@@ -67,8 +67,17 @@ QLayerFilterPrivate::QLayerFilterPrivate()
the QLayerFilter and as components to Qt3DCore::QEntity.
QLayerFilter can be configured to select or discard entities with a
- specific QLayer depending on the filterMode property. By default, entities
- referencing a QLayer that is also added to the QLayerFilter are selected.
+ specific \l QLayer depending on the filterMode property. By default,
+ entities referencing one of the \l QLayer objects that are also being
+ referenced by the \l QLayerFilter are selected (AcceptAnyMatchingLayers).
+
+ Within the FrameGraph tree, multiple \l QLayerFilter nodes can be nested
+ within a branch going from root to a leaf. In that case the filtering will
+ first operate on all entities of the scene using the filtering method
+ specified by the first declared \l QLayerFilter. Then the filtered subset
+ of entities will be filtered again based on the filtering method set on the
+ second \l QLayerFilter declared. This is then repeated until all \l
+ QLayerFilter nodes of the branch have been consumed.
*/
/*!
@@ -76,11 +85,21 @@ QLayerFilterPrivate::QLayerFilterPrivate()
Specifies the rules for selecting entities to draw.
- \value AcceptMatchingLayers
- Accept entities that reference a QLayer added to this QLayerFilter
+ \value AcceptAnyMatchingLayers
+ Accept entities that reference one or more \l QLayer objects added to this
+ QLayerFilter. This is the default
- \value DiscardMatchingLayers
- Discard entities that reference a QLayer added to this QLayerFilter
+ \value AcceptAllMatchingLayers
+ Accept entities that reference all the \l QLayer objects added to this
+ QLayerFilter
+
+ \value DiscardAnyMatchingLayers
+ Discard entities that reference one or more \l QLayer objects added to this
+ QLayerFilter
+
+ \value DiscardAllMatchingLayers
+ Discard entities that reference all \l QLayer objects added to this
+ QLayerFilter
*/
/*!
@@ -106,8 +125,16 @@ QLayerFilterPrivate::QLayerFilterPrivate()
The LayerFilter can be configured to select or discard entities with a
specific \l Layer depending on the filterMode property. By default,
- entities referencing a \l Layer that is also added to the LayerFilter are
- selected.
+ entities referencing one of the \l Layer objects that are also being
+ referenced by the \l LayerFilter are selected (AcceptAnyMatchingLayers).
+
+ Within the FrameGraph tree, multiple \l LayerFilter nodes can be nested
+ within a branch going from root to a leaf. In that case the filtering will
+ first operate on all entities of the scene using the filtering method
+ specified by the first declared \l LayerFilter. Then the filtered subset of
+ entities will be filtered again based on the filtering method set on the
+ second \l LayerFilter declared. This is then repeated until all \l
+ LayerFilter nodes of the branch have been consumed.
*/
/*!
@@ -123,11 +150,21 @@ QLayerFilterPrivate::QLayerFilterPrivate()
The default value is \c {LayerFilter.AcceptMatchingLayers}.
- \value LayerFilter.AcceptMatchingLayers
- Accept entities that reference a \l Layer added to this LayerFilter
+ \value LayerFilter.AcceptAnyMatchingLayers
+ Accept entities that reference one or more \l Layer objects added to this
+ LayerFilter. This is the default
+
+ \value LayerFilter.AcceptAllMatchingLayers
+ Accept entities that reference all the \l Layer objects added to this
+ LayerFilter
+
+ \value LayerFilter.DiscardAnyMatchingLayers
+ Discard entities that reference one or more \l Layer objects added to this
+ LayerFilter
- \value LayerFilter.DiscardMatchingLayers
- Discard entities that reference a \l Layer added to this LayerFilter
+ \value LayerFilter.DiscardAllMatchingLayers
+ Discard entities that reference all \l Layer objects added to this
+ LayerFilter
*/
/*!
diff --git a/src/render/framegraph/qlayerfilter.h b/src/render/framegraph/qlayerfilter.h
index 243ae7165..68854c722 100644
--- a/src/render/framegraph/qlayerfilter.h
+++ b/src/render/framegraph/qlayerfilter.h
@@ -57,8 +57,10 @@ class QT3DRENDERSHARED_EXPORT QLayerFilter : public QFrameGraphNode
public:
enum FilterMode
{
- AcceptMatchingLayers = 0,
- DiscardMatchingLayers
+ AcceptAnyMatchingLayers = 0,
+ AcceptAllMatchingLayers,
+ DiscardAnyMatchingLayers,
+ DiscardAllMatchingLayers,
};
Q_ENUM(FilterMode) // LOVC_EXLC_LINE
diff --git a/src/render/jobs/filterlayerentityjob.cpp b/src/render/jobs/filterlayerentityjob.cpp
index 1193c4552..902338be7 100644
--- a/src/render/jobs/filterlayerentityjob.cpp
+++ b/src/render/jobs/filterlayerentityjob.cpp
@@ -42,6 +42,7 @@
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/job_common_p.h>
+#include <Qt3DRender/private/layerfilternode_p.h>
QT_BEGIN_NAMESPACE
@@ -51,144 +52,203 @@ namespace Render {
namespace {
int layerFilterJobCounter = 0;
+
+// TO DO: This will be moved to a dedicated job with smarter
+// heuristics in a later commit
+void addLayerIdToEntityChildren(const QVector<Entity *> &children,
+ const Qt3DCore::QNodeId layerId)
+{
+ for (Entity *child : children) {
+ child->addRecursiveLayerId(layerId);
+ addLayerIdToEntityChildren(child->children(), layerId);
+ }
+}
+
+void updateEntityLayers(NodeManagers *manager)
+{
+ EntityManager *entityManager = manager->renderNodesManager();
+
+ const QVector<HEntity> handles = entityManager->activeHandles();
+
+ // Clear list of recursive layerIds
+ for (const HEntity handle : handles) {
+ Entity *entity = entityManager->data(handle);
+ entity->clearRecursiveLayerIds();
+ }
+
+ LayerManager *layerManager = manager->layerManager();
+
+ // Set recursive layerIds on children
+ for (const HEntity handle : handles) {
+ Entity *entity = entityManager->data(handle);
+ const Qt3DCore::QNodeIdVector entityLayers = entity->componentsUuid<Layer>();
+
+ for (const Qt3DCore::QNodeId layerId : entityLayers) {
+ Layer *layer = layerManager->lookupResource(layerId);
+ if (layer->recursive()) {
+ // Find all children of the entity and add the layers to them
+ addLayerIdToEntityChildren(entity->children(), layerId);
+ }
+ }
+ }
+}
+
} // anonymous
FilterLayerEntityJob::FilterLayerEntityJob()
: Qt3DCore::QAspectJob()
, m_manager(nullptr)
- , m_hasLayerFilter(false)
- , m_filterMode(QLayerFilter::AcceptMatchingLayers)
{
SET_JOB_RUN_STAT_TYPE(this, JobTypes::LayerFiltering, layerFilterJobCounter++);
}
+
void FilterLayerEntityJob::run()
{
m_filteredEntities.clear();
- if (m_hasLayerFilter) { // LayerFilter set -> filter
- LayerManager *layerManager = m_manager->layerManager();
-
- // Remove layerIds which are not active/enabled
- for (auto i = m_layerIds.size() - 1; i >= 0; --i) {
- Layer *backendLayer = layerManager->lookupResource(m_layerIds.at(i));
- if (backendLayer == nullptr || !backendLayer->isEnabled())
- m_layerIds.removeAt(i);
- }
-
+ if (hasLayerFilter()) { // LayerFilter set -> filter
+ updateEntityLayers(m_manager);
filterLayerAndEntity();
} else { // No LayerFilter set -> retrieve all
selectAllEntities();
}
}
-void FilterLayerEntityJob::setFilterMode(QLayerFilter::FilterMode filterMode)
+// We accept the entity if it contains any of the layers that are in the layer filter
+void FilterLayerEntityJob::filterAcceptAnyMatchingLayers(Entity *entity,
+ const Qt3DCore::QNodeIdVector &layerIds)
{
- m_filterMode = filterMode;
+ const Qt3DCore::QNodeIdVector entityLayers = entity->layerIds();
+
+ for (const Qt3DCore::QNodeId id : entityLayers) {
+ const bool layerAccepted = layerIds.contains(id);
+
+ if (layerAccepted) {
+ m_filteredEntities.push_back(entity);
+ break;
+ }
+ }
+}
+
+// We accept the entity if it contains all the layers that are in the layer
+// filter
+void FilterLayerEntityJob::filterAcceptAllMatchingLayers(Entity *entity,
+ const Qt3DCore::QNodeIdVector &layerIds)
+{
+ const Qt3DCore::QNodeIdVector entityLayers = entity->layerIds();
+ int layersAccepted = 0;
+
+ for (const Qt3DCore::QNodeId id : entityLayers) {
+ if (layerIds.contains(id))
+ ++layersAccepted;
+ }
+
+ if (layersAccepted == layerIds.size())
+ m_filteredEntities.push_back(entity);
+}
+
+// We discard the entity if it contains any of the layers that are in the layer
+// filter
+// In other words that means we select an entity if one of its layers is not on
+// the layer filter
+void FilterLayerEntityJob::filterDiscardAnyMatchingLayers(Entity *entity,
+ const Qt3DCore::QNodeIdVector &layerIds)
+{
+ const Qt3DCore::QNodeIdVector entityLayers = entity->layerIds();
+ bool entityCanBeDiscarded = false;
+
+ for (const Qt3DCore::QNodeId id : entityLayers) {
+ if (layerIds.contains(id)) {
+ entityCanBeDiscarded = true;
+ break;
+ }
+ }
+
+ if (!entityCanBeDiscarded)
+ m_filteredEntities.push_back(entity);
+}
+
+// We discard the entity if it contains all of the layers that are in the layer
+// filter
+// In other words that means we select an entity if none of its layers are on
+// the layer filter
+void FilterLayerEntityJob::filterDiscardAllMatchingLayers(Entity *entity,
+ const Qt3DCore::QNodeIdVector &layerIds)
+{
+ const Qt3DCore::QNodeIdVector entityLayers = entity->layerIds();
+
+ int containedLayers = 0;
+
+ for (const Qt3DCore::QNodeId id : layerIds) {
+ if (entityLayers.contains(id))
+ ++containedLayers;
+ }
+
+ if (containedLayers != layerIds.size())
+ m_filteredEntities.push_back(entity);
}
-// Note: we assume that m_layerIds contains only enabled layers
-// -> meaning that if an Entity references such a layer, it's enabled
void FilterLayerEntityJob::filterLayerAndEntity()
{
EntityManager *entityManager = m_manager->renderNodesManager();
- LayerManager *layerManager = m_manager->layerManager();
const QVector<HEntity> handles = entityManager->activeHandles();
+ QVector<Entity *> entitiesToFilter;
+ entitiesToFilter.reserve(handles.size());
+
for (const HEntity handle : handles) {
Entity *entity = entityManager->data(handle);
- if (!entity->isTreeEnabled())
- continue;
+ if (entity->isTreeEnabled())
+ entitiesToFilter.push_back(entity);
+ }
- const Qt3DCore::QNodeIdVector entityLayers = entity->componentsUuid<Layer>();
+ FrameGraphManager *frameGraphManager = m_manager->frameGraphManager();
+ LayerManager *layerManager = m_manager->layerManager();
- // An Entity is positively filtered if it contains at least one Layer component with the same id as the
- // layers selected by the LayerFilter
-
- // If !discard, as soon as one entity layer is managed by the FilterLayer, accept the entity
- switch (m_filterMode) {
- case QLayerFilter::AcceptMatchingLayers: {
- // Be aware that the same entity may appear in the filteredEntities vector, is this a problem?
- for (const Qt3DCore::QNodeId id : entityLayers) {
- bool entityIsAlreadyAccepted = false;
- if (m_layerIds.contains(id)) {
- // When we found a layer in the entity that matches a layer in the LayerFilter
-
- // If the entity hasn't been already accepted, accept it
- if (!entityIsAlreadyAccepted) {
- m_filteredEntities.push_back(entity);
- entityIsAlreadyAccepted = true;
- }
-
- Layer *layer = layerManager->lookupResource(id);
-
- // If the found layer is recursive, accept children and break
- if (layer->recursive()) {
- QVector<Entity*> childEntities = entity->children();
- for (int i = 0; i < childEntities.size(); ++i) {
- Entity *childEntity = childEntities[i];
- if (childEntity->isTreeEnabled()) {
- m_filteredEntities.push_back(childEntity);
-
- // Add children of the child entity (so that is recursive in the tree)
- const QVector<Entity*> childChildEntities = childEntity->children();
- for (Entity *childChildEntity : childChildEntities)
- childEntities.push_back(childChildEntity);
- }
- }
- break;
- }
-
- // If the layer is not recursive, maybe another one in the same entity it is, so continue searching
- }
- }
- break;
+ for (const Qt3DCore::QNodeId layerFilterId : m_layerFilterIds) {
+ LayerFilterNode *layerFilter = static_cast<LayerFilterNode *>(frameGraphManager->lookupNode(layerFilterId));
+ Qt3DCore::QNodeIdVector layerIds = layerFilter->layerIds();
+
+ // Remove layerIds which are not active/enabled
+ for (int i = layerIds.size() - 1; i >= 0; --i) {
+ Layer *backendLayer = layerManager->lookupResource(layerIds.at(i));
+ if (backendLayer == nullptr || !backendLayer->isEnabled())
+ layerIds.removeAt(i);
}
- case QLayerFilter::DiscardMatchingLayers: {
- // If discard, the entity must not contain any of the layers managed by the FilterLayer
-
- // Bootstrap accepting the entity and the children
- bool acceptEntity = true;
- bool acceptRecursively = true;
- bool entityHasLayer = entityLayers.size() != 0;
-
- // Check if the entity must be dropped and if it must drop also its children
- for (const Qt3DCore::QNodeId id : entityLayers) {
- if (m_layerIds.contains(id)) {
- acceptEntity = false;
-
- Layer *layer = layerManager->lookupResource(id);
- if (layer->recursive()) {
- acceptRecursively = false;
- break;
- }
- }
- }
- if (entityHasLayer && acceptEntity)
- m_filteredEntities.push_back(entity);
-
- if (acceptRecursively) {
- QVector<Entity*> childEntities = entity->children();
- for (int i = 0; i < childEntities.size(); ++i) {
- Entity *childEntity = childEntities[i];
- if (childEntity->isTreeEnabled()) {
- m_filteredEntities.push_back(childEntity);
-
- // Add children of the child entity (so that is recursive in the tree)
- const QVector<Entity*> childChildEntities = childEntity->children();
- for (Entity *childChildEntity : childChildEntities)
- childEntities.push_back(childChildEntity);
- }
- }
+ const QLayerFilter::FilterMode filterMode = layerFilter->filterMode();
+
+ // Perform filtering
+ for (Entity *entity : entitiesToFilter) {
+ switch (filterMode) {
+ case QLayerFilter::AcceptAnyMatchingLayers: {
+ filterAcceptAnyMatchingLayers(entity, layerIds);
+ break;
+ }
+ case QLayerFilter::AcceptAllMatchingLayers: {
+ filterAcceptAllMatchingLayers(entity, layerIds);
+ break;
+ }
+ case QLayerFilter::DiscardAnyMatchingLayers: {
+ filterDiscardAnyMatchingLayers(entity, layerIds);
+ break;
+ }
+ case QLayerFilter::DiscardAllMatchingLayers: {
+ filterDiscardAllMatchingLayers(entity, layerIds);
+ break;
+ }
+ default:
+ Q_UNREACHABLE();
}
- break;
- }
- default:
- break;
}
+
+ // Entities to filter for the next frame are the filtered result of the
+ // current LayerFilter
+ entitiesToFilter = std::move(m_filteredEntities);
}
+ m_filteredEntities = std::move(entitiesToFilter);
}
// No layer filter -> retrieve all entities
diff --git a/src/render/jobs/filterlayerentityjob_p.h b/src/render/jobs/filterlayerentityjob_p.h
index 59be53a14..4e4619a25 100644
--- a/src/render/jobs/filterlayerentityjob_p.h
+++ b/src/render/jobs/filterlayerentityjob_p.h
@@ -71,28 +71,27 @@ public:
FilterLayerEntityJob();
inline void setManager(NodeManagers *manager) Q_DECL_NOEXCEPT { m_manager = manager; }
- inline void setLayers(const Qt3DCore::QNodeIdVector &layerIds) Q_DECL_NOEXCEPT { m_layerIds = layerIds; }
- inline void setHasLayerFilter(bool hasLayerFilter) Q_DECL_NOEXCEPT { m_hasLayerFilter = hasLayerFilter; }
+ inline void setLayerFilters(const Qt3DCore::QNodeIdVector &layerIds) Q_DECL_NOEXCEPT { m_layerFilterIds = layerIds; }
inline QVector<Entity *> filteredEntities() const Q_DECL_NOEXCEPT { return m_filteredEntities; }
- inline bool hasLayerFilter() const Q_DECL_NOTHROW { return m_hasLayerFilter; }
- inline Qt3DCore::QNodeIdVector layers() const { return m_layerIds; }
+ inline bool hasLayerFilter() const Q_DECL_NOTHROW { return !m_layerFilterIds.isEmpty(); }
+ inline Qt3DCore::QNodeIdVector layerFilters() const { return m_layerFilterIds; }
// QAspectJob interface
void run() Q_DECL_FINAL;
- void setFilterMode(QLayerFilter::FilterMode filterMode);
- bool filterMode() const {return m_filterMode;}
+ void filterAcceptAnyMatchingLayers(Entity *entity, const Qt3DCore::QNodeIdVector &layerIds);
+ void filterAcceptAllMatchingLayers(Entity *entity, const Qt3DCore::QNodeIdVector &layerIds);
+ void filterDiscardAnyMatchingLayers(Entity *entity, const Qt3DCore::QNodeIdVector &layerIds);
+ void filterDiscardAllMatchingLayers(Entity *entity, const Qt3DCore::QNodeIdVector &layerIds);
private:
void filterLayerAndEntity();
void selectAllEntities();
NodeManagers *m_manager;
- Qt3DCore::QNodeIdVector m_layerIds;
+ Qt3DCore::QNodeIdVector m_layerFilterIds;
QVector<Entity *> m_filteredEntities;
- bool m_hasLayerFilter;
- QLayerFilter::FilterMode m_filterMode;
};
typedef QSharedPointer<FilterLayerEntityJob> FilterLayerEntityJobPtr;
diff --git a/src/render/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp
index b9959fe47..41b04190f 100644
--- a/src/render/jobs/renderviewjobutils.cpp
+++ b/src/render/jobs/renderviewjobutils.cpp
@@ -118,9 +118,7 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN
break;
case FrameGraphNode::LayerFilter: // Can be set multiple times in the tree
- rv->setHasLayerFilter(true);
- rv->appendLayerFilter(static_cast<const LayerFilterNode *>(node)->layerIds());
- rv->setLayerFilterFilterMode(static_cast<const LayerFilterNode *>(node)->filterMode());
+ rv->appendLayerFilter(static_cast<const LayerFilterNode *>(node)->peerId());
break;
case FrameGraphNode::RenderPassFilter: