QMorphingAnimation Class

class Qt3DAnimation::QMorphingAnimation

A class implementing blend-shape morphing animation. More...

Header: #include <QMorphingAnimation>
qmake: QT += 3danimation
Since: Qt 5.9
Instantiated By: MorphingAnimation
Inherits: Qt3DAnimation::QAbstractAnimation

This class was introduced in Qt 5.9.

Public Types

enum Method { Normalized, Relative }

Public Functions

void addMorphTarget(Qt3DAnimation::QMorphTarget *target)
QVector<float> getWeights(int positionIndex)
QVector<Qt3DAnimation::QMorphTarget *> morphTargetList()
void removeMorphTarget(Qt3DAnimation::QMorphTarget *target)
void setMorphTargets(const QVector<Qt3DAnimation::QMorphTarget *> &targets)
void setWeights(int positionIndex, const QVector<float> &weights)

Detailed Description

A Qt3DAnimation::QMorphingAnimation class implements blend-shape morphing animation to a target QGeometryRenderer. The QMorphingAnimation sets the correct QAttributes from the morph targets to the target QGeometryRenderer::geometry and calculates interpolator for the current position. The actual blending between the attributes must be implemented in the material. Qt3DAnimation::QMorphPhongMaterial implements material with morphing support for phong lighting model. The blending happens between 2 attributes - 'base' and 'target'. The names for the base and target attributes are taken from the morph target names, where the base attribute retains the name it already has and the target attribute name gets 'Target' appended to the name. The interpolator can be set as a QParameter to the used material. All morph targets in the animation should contain the attributes with same names as those in the base geometry.

Member Type Documentation

enum QMorphingAnimation::Method

This enumeration specifies the morphing method.

ConstantValueDescription
Qt3DAnimation::QMorphingAnimation::Normalized0The blending should use the normalized formula; V' = Vbase * (1.0 - sum(Wi)) + sum[Vi * Wi]
Qt3DAnimation::QMorphingAnimation::Relative1The blending should use the relative formula; V' = Vbase + sum[Vi * Wi]

Member Function Documentation

void QMorphingAnimation::addMorphTarget(Qt3DAnimation::QMorphTarget *target)

Add new morph target at the end of the animation.

QVector<float> QMorphingAnimation::getWeights(int positionIndex)

Return morph weights at positionIndex.

QVector<Qt3DAnimation::QMorphTarget *> QMorphingAnimation::morphTargetList()

Return morph target list.

void QMorphingAnimation::removeMorphTarget(Qt3DAnimation::QMorphTarget *target)

Remove morph target from the animation.

void QMorphingAnimation::setMorphTargets(const QVector<Qt3DAnimation::QMorphTarget *> &targets)

Set morph targets to animation. Old targets are cleared.

void QMorphingAnimation::setWeights(int positionIndex, const QVector<float> &weights)

Sets morph weights at positionIndex.