Qt3DAnimation::QMorphingAnimation Class
class Qt3DAnimation::QMorphingAnimation实现混合形状变形动画的类。更多
Header: | #include <QMorphingAnimation> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3danimation) target_link_libraries(mytarget PRIVATE Qt6::3danimation) |
qmake: | QT += 3danimation |
在 QML 中: | MorphingAnimation |
继承: | Qt3DAnimation::QAbstractAnimation |
状态: | 已废弃 |
公共类型
enum | Method { Normalized, Relative } |
属性
|
|
公共功能
QMorphingAnimation(QObject *parent = nullptr) | |
void | addMorphTarget(Qt3DAnimation::QMorphTarget *target) |
QEasingCurve | easing() const |
QVector<float> | getWeights(int positionIndex) |
float | interpolator() const |
Qt3DAnimation::QMorphingAnimation::Method | method() const |
QVector<Qt3DAnimation::QMorphTarget *> | morphTargetList() |
void | removeMorphTarget(Qt3DAnimation::QMorphTarget *target) |
void | setMorphTargets(const QVector<Qt3DAnimation::QMorphTarget *> &targets) |
void | setWeights(int positionIndex, const QVector<float> &weights) |
Qt3DRender::QGeometryRenderer * | target() const |
QString | targetName() const |
QVector<float> | targetPositions() const |
公共插槽
void | setEasing(const QEasingCurve &easing) |
void | setMethod(Qt3DAnimation::QMorphingAnimation::Method method) |
void | setTarget(Qt3DRender::QGeometryRenderer *target) |
void | setTargetName(const QString name) |
void | setTargetPositions(const QVector<float> &targetPositions) |
信号
void | easingChanged(const QEasingCurve &easing) |
void | interpolatorChanged(float interpolator) |
void | methodChanged(Qt3DAnimation::QMorphingAnimation::Method method) |
void | targetChanged(Qt3DRender::QGeometryRenderer *target) |
void | targetNameChanged(const QString &name) |
void | targetPositionsChanged(const QVector<float> &targetPositions) |
详细说明
Qt3DAnimation::QMorphingAnimation 类实现了与目标QGeometryRenderer 的混合形状变形动画。QMorphingAnimation 会设置从morph targets 到目标QGeometryRenderer::geometry 的正确QAttributes ,并计算当前位置的插值器。属性之间的实际混合必须在材质中实现。Qt3DAnimation::QMorphPhongMaterial 为 phong 灯光模型实现了支持变形的材质。混合发生在两个属性--"基本 "和 "目标 "之间。基本属性和目标属性的名称取自变形目标名称,其中基本属性保留已有名称,目标属性名称后附加 "Target"。插值器可以设置为QParameter ,并与所使用的材质一致。动画中的所有变形目标都应包含与基本几何体中的属性名称相同的属性。
成员类型文档
enum QMorphingAnimation::Method
该枚举用于指定变形方法。
常量 | 值 | 说明 |
---|---|---|
Qt3DAnimation::QMorphingAnimation::Normalized | 0 | 混合应使用归一化公式;V' = Vbase * (1.0 - sum(Wi))+ sum[Vi * Wi] |
Qt3DAnimation::QMorphingAnimation::Relative | 1 | 混合应使用相对公式;V' = Vbase + sum[Vi * Wi] 混合应使用相对公式。 |
属性文档
easing : QEasingCurve
保存变形目标之间插值器的缓和曲线。
访问功能
QEasingCurve | easing() const |
void | setEasing(const QEasingCurve &easing) |
通知信号
void | easingChanged(const QEasingCurve &easing) |
[read-only]
interpolator : const float
保存基础属性和目标属性之间的插值器。
访问功能:
float | interpolator() const |
通知信号:
void | interpolatorChanged(float interpolator) |
method : Method
表示变形方法。默认为 "相对"。
访问功能:
Qt3DAnimation::QMorphingAnimation::Method | method() const |
void | setMethod(Qt3DAnimation::QMorphingAnimation::Method method) |
通知信号:
void | methodChanged(Qt3DAnimation::QMorphingAnimation::Method method) |
target : Qt3DRender::QGeometryRenderer*
保存变形动画应用的目标 QGeometryRenderer。
访问功能:
Qt3DRender::QGeometryRenderer * | target() const |
void | setTarget(Qt3DRender::QGeometryRenderer *target) |
通知信号
void | targetChanged(Qt3DRender::QGeometryRenderer *target) |
targetName : QString
目标几何体的名称。这是一个方便的属性,可以更容易地将目标几何体与变形动画相匹配。该名称通常与目标 QGeometryRenderer 的父实体名称相同,但并非必须如此。
访问功能:
QString | targetName() const |
void | setTargetName(const QString name) |
通知信号
void | targetNameChanged(const QString &name) |
targetPositions : QVector<float>
保存形态目标的位置值。列表中的每个位置都指定了具有相同索引的相应 morph target 的位置。数值必须以升序排列。数值可以是正数或负数,没有预定义单位。
访问功能
QVector<float> | targetPositions() const |
void | setTargetPositions(const QVector<float> &targetPositions) |
Notifier 信号:
void | targetPositionsChanged(const QVector<float> &targetPositions) |
成员函数 文档
[explicit]
QMorphingAnimation::QMorphingAnimation(QObject *parent = nullptr)
使用parent 构建一个新的 QMorphingAnimation。
void QMorphingAnimation::addMorphTarget(Qt3DAnimation::QMorphTarget *target)
在动画结尾处添加新的变形target 。
QVector<float> QMorphingAnimation::getWeights(int positionIndex)
返回形态权重positionIndex 。
QVector<Qt3DAnimation::QMorphTarget *> QMorphingAnimation::morphTargetList()
返回变形目标列表。
void QMorphingAnimation::removeMorphTarget(Qt3DAnimation::QMorphTarget *target)
从动画中移除变形target 。
void QMorphingAnimation::setMorphTargets(const QVector<Qt3DAnimation::QMorphTarget *> &targets)
将变形targets 设置为动画。清除旧目标。
void QMorphingAnimation::setWeights(int positionIndex, const QVector<float> &weights)
将变形weights 设置为positionIndex 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.