ModelParticle3D QML Type

Particle using a Qt Quick 3D Model. 更多...

import 语句: import QtQuick3D.Particles3D
Since: Qt 6.2
继承:

Particle3D

特性

详细描述

The ModelParticle3D is a logical particle element that creates particles from a Qt Quick 3D Model 组件。

特性文档编制

delegate : Component

The delegate provides a template defining each object instantiated by the particle.

For example, to allocate 200 red cube particles:

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

The instanceTable provides access to the Instancing table of the model particle. ModelParticle3D uses an internal instance table to implement efficient rendering. This table can be applied to the instancing property of models that are not part of the particle system.

It is also possible to use this feature to provide an instancing table without showing any particles. This is done by omitting the delegate property. For example:

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"
    }
}