ModelParticle3D QML 类型
使用 Qt Quick 3D 模型的粒子。更多...
| 导入声明 | import QtQuick3D.Particles3D | 
| 从 | Qt 6.2 | 
| 继承自 | 
属性
- delegate : 组件
- instanceTable : 实例化
详细描述
ModelParticle3D 是一个逻辑粒子元素,它从 Qt Quick 3D Model 组件创建粒子。
属性文档
| delegate : Component | 
该委托提供了一个模板,用于定义粒子实例化的每个对象。
例如,为了分配 200 个红色立方体粒子
Component {
    id: particleComponent
    Model {
        source: "#Cube"
        scale: Qt.vector3d(0.2, 0.2, 0.2)
        materials: DefaultMaterial { }
    }
}
ModelParticle3D {
    id: particleRed
    delegate: particleComponent
    maxAmount: 200
    color: "#ff0000"
}| instanceTable : Instancing | 
该实例表提供了对模型粒子 Instancing 表的访问。模型粒子使用内部实例表来实现高效的渲染。此表可以应用于不是粒子系统部分的模型的 instancing 属性。
也可以使用此功能提供实例化表而不显示任何粒子。这是通过省略 delegate 属性来完成的。例如
ParticleSystem3D {
    id: psystem
    ModelParticle3D {
        id: particleRed
        maxAmount: 200
        color: "#ff0000"
        colorVariation: Qt.vector4d(0.5,0.5,0.5,0.5)
    }
    ParticleEmitter3D {
        particle: particleRed
        velocity: VectorDirection3D {
            direction: Qt.vector3d(-20, 200, 0)
            directionVariation: Qt.vector3d(20, 20, 20)
        }
        particleScale: 0.2
        emitRate: 20
        lifeSpan: 2000
    }
}
Model {
    source: "#Sphere"
    instancing: particleRed.instanceTable
    materials: PrincipledMaterial {
        baseColor: "yellow"
    }
}© 2024 The Qt Company Ltd. 本文件中的文档贡献是各自所有者的版权。本文件中的文档是在自由软件基金会的发布下,根据 GNU 自由文档许可证版本 1.3 的条款许可的。Qt 及其 respective 牌是 The Qt Company Ltd. 在芬兰和/或世界其他国家的商标。所有其他商标均是各自所有者的财产。