ModelParticle3D QML Type

Partikel unter Verwendung eines Qt Quick 3D Modells. Mehr...

Import Statement: import QtQuick3D.Particles3D
Since: Qt 6.2
Inherits:

Particle3D

Eigenschaften

Detaillierte Beschreibung

Das ModelParticle3D ist ein logisches Partikelelement, das Partikel aus einer Qt Quick 3D Model Komponente erzeugt.

Dokumentation der Eigenschaften

delegate : Component

Der Delegat bietet eine Vorlage, die jedes vom Partikel instanziierte Objekt definiert.

Zum Beispiel, um 200 rote Würfelpartikel zuzuweisen:

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

Die instanceTable bietet Zugriff auf die Instancing Tabelle des Modellpartikels. ModelParticle3D verwendet eine interne Instanztabelle, um effizientes Rendering zu implementieren. Diese Tabelle kann auf die instancing Eigenschaft von Modellen angewendet werden, die nicht Teil des Partikelsystems sind.

Es ist auch möglich, diese Funktion zu nutzen, um eine Instanztabelle bereitzustellen, ohne Partikel anzuzeigen. Dies geschieht durch das Weglassen der delegate Eigenschaft. Zum Beispiel:

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

© 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.