Skip to content

Kuesa::Qt3D::EffectCollection

Module: Kuesa Qt 3D API

A collection of assets of type Qt3DRender::QEffect. More...

#include <Kuesa/Qt3D/api/collections/effectcollection.h>

Inherits from Kuesa::Qt3D::AbstractAssetCollection, Qt3DCore::QNode

Public Functions

Name
EffectCollection(Qt3DCore::QNode * parent =nullptr)
~EffectCollection()
Qt3DRender::QEffect * addEffect(const QString & name, const QString & id, const QVariantMap & properties)
void registerType(const QString & id, EffectCreator f)
void unregisterType(const QString & id)

Additional inherited members

Public Signals inherited from Kuesa::Qt3D::AbstractAssetCollection

Name
void namesChanged()
void sizeChanged()
void assetAdded(const QString & name)

Public Functions inherited from Kuesa::Qt3D::AbstractAssetCollection

Name
~AbstractAssetCollection()
QStringList names()
int size()
bool contains(const QString & name) const
bool contains(Qt3DCore::QNode * asset) const
Qt3DCore::QNode * findAsset(const QString & name)
void remove(const QString & name)
void clear()

Protected Functions inherited from Kuesa::Qt3D::AbstractAssetCollection

Name
AbstractAssetCollection(Qt3DCore::QNode * parent =nullptr)
void addAsset(const QString & name, Qt3DCore::QNode * asset)

Public Properties inherited from Kuesa::Qt3D::AbstractAssetCollection

Name
QStringList names
int size

Detailed Description

1
class Kuesa::Qt3D::EffectCollection;

A collection of assets of type Qt3DRender::QEffect.

Since: Kuesa 2.0

Kuesa::Qt3D::EffectCollection manages a set of Qt3DRender::QEffect assets.

It also works as a factory and provides a way of creating instances of effects based on a unique key.

Factory functions are created by calling EffectCollection::registerType.

These functions are used to create specific instances of QEffect derived class when calling EffectCollection::addEffect.

Public Functions Documentation

function EffectCollection

1
2
3
explicit EffectCollection(
    Qt3DCore::QNode * parent =nullptr
)

function ~EffectCollection

1
~EffectCollection()

function addEffect

1
2
3
4
5
Qt3DRender::QEffect * addEffect(
    const QString & name,
    const QString & id,
    const QVariantMap & properties
)

Creates a new instance of an asset using a previously registered factory method.

id is used to find the appropriate factory. Once the effect is created, the content of the properties map will be assigned on the new effect. The effect is then added to the collection and returned to the caller.

Any pre-existing effect with the same name will be deleted.

function registerType

1
2
3
4
void registerType(
    const QString & id,
    EffectCreator f
)

Register a new functor with the factory.

The functor f can be any callable function that returns an new QEffect (or derived) instance.

The registered id should be passed to EffectCollection::addEffect for the functor to be invoked.

function unregisterType

1
2
3
void unregisterType(
    const QString & id
)

Removes a previous registered functor with identified id from the factory.


Updated on 2023-07-03 at 11:02:12 +0000