Kuesa Runtime

EffectCollection Class

class Kuesa::EffectCollection

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

Header: #include <Kuesa/EffectCollection>
Since: Kuesa 1.0
Inherits: Kuesa::AbstractAssetCollection

This class was introduced in Kuesa 1.0.

Public Functions

Qt3DRender::QEffect *addEffect(const QString &name, const QString &id, const QVariantMap &properties)
void registerType(const QString &id, Kuesa::EffectCreator f)
void unregisterType(const QString &id)

Detailed Description

Kuesa::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.

Member Function Documentation

Qt3DRender::QEffect *EffectCollection::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.

void EffectCollection::registerType(const QString &id, Kuesa::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.

void EffectCollection::unregisterType(const QString &id)

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