Qt3DRender::QComputeCommand Class
class Qt3DRender::QComputeCommandQComponent per assegnare il lavoro allo shader di calcolo sulla GPU. Altro...
| Intestazione: | #include <qcomputecommand.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| In QML: | ComputeCommand |
| Eredita da: | Qt3DCore::QComponent |
| Stato: | Obsoleto |
Questa classe è deprecata. Si sconsiglia vivamente di utilizzarla nel nuovo codice.
Proprietà
- runType : RunType
- workGroupX : int
- workGroupY : int
- workGroupZ : int
Funzioni pubbliche
| QComputeCommand(Qt3DCore::QNode *parent = nullptr) | |
| Qt3DRender::QComputeCommand::RunType | runType() const |
| int | workGroupX() const |
| int | workGroupY() const |
| int | workGroupZ() const |
Slot pubblici
| void | setRunType(Qt3DRender::QComputeCommand::RunType runType) |
| void | setWorkGroupX(int workGroupX) |
| void | setWorkGroupY(int workGroupY) |
| void | setWorkGroupZ(int workGroupZ) |
| void | trigger(int frameCount = 1) |
| void | trigger(int workGroupX, int workGroupY, int workGroupZ, int frameCount = 1) |
Segnali
| void | runTypeChanged() |
| void | workGroupXChanged() |
| void | workGroupYChanged() |
| void | workGroupZChanged() |
Descrizione dettagliata
Un comando di calcolo ( Qt3DRender::QComputeCommand ) viene utilizzato per assegnare un carico di lavoro allo shader di calcolo. Lo shader di calcolo è specificato nel componente " QMaterial " della stessa entità a cui è stato aggiunto il QComputeCommand. Le proprietà " workGroupX", " workGroupY " e " workGroupZ " specificano le dimensioni dei gruppi di lavoro per l'invocazione dello shader di calcolo. Per poter effettivamente eseguire i comandi, è necessario che nel FrameGraph sia presente un nodo " Qt3DRender::QDispatchCompute ".
Nota: se la politica di rendering è impostata su « Qt3DRender::QRenderSettings::OnDemand » e non vi sono modifiche alla scena, l’ ComputeCommand non verrà richiamato ripetutamente. La politica di rendering « Qt3DRender::QRenderSettings::Always » deve essere impostata affinché l’ ComputeCommand venga richiamato ripetutamente, qualora non vi siano altre modifiche alla scena che attivino il rendering di un nuovo fotogramma.
Documentazione delle proprietà
runType : RunType
Specifica se il comando di calcolo debba essere eseguito ad ogni fotogramma o attivato manualmente.
Se impostato su "Continuo", il comando di calcolo viene eseguito ad ogni fotogramma. Questa è l'impostazione predefinita.
Se impostato su "Manuale", il comando di calcolo viene eseguito per un determinato numero di fotogrammi, dopodiché il componente si disattiva automaticamente.
Funzioni di accesso:
| Qt3DRender::QComputeCommand::RunType | runType() const |
| void | setRunType(Qt3DRender::QComputeCommand::RunType runType) |
Segnale di notifica:
| void | runTypeChanged() |
workGroupX : int
Specifica la dimensione del gruppo di lavoro X.
Funzioni di accesso:
| int | workGroupX() const |
| void | setWorkGroupX(int workGroupX) |
Segnale di notifica:
| void | workGroupXChanged() |
workGroupY : int
Specifica la dimensione del gruppo di lavoro Y.
Funzioni di accesso:
| int | workGroupY() const |
| void | setWorkGroupY(int workGroupY) |
Segnale di notifica:
| void | workGroupYChanged() |
workGroupZ : int
Specifica la dimensione del gruppo di lavoro Z.
Funzioni di accesso:
| int | workGroupZ() const |
| void | setWorkGroupZ(int workGroupZ) |
Segnale di notifica:
| void | workGroupZChanged() |
Documentazione delle funzioni membro
[explicit] QComputeCommand::QComputeCommand(Qt3DCore::QNode *parent = nullptr)
Il costruttore crea una nuova istanza di ` Qt3DRender::QComputeCommand ` con il valore specificato in ` parent`.
[slot] void QComputeCommand::setWorkGroupX(int workGroupX)
Imposta il gruppo di lavoro per la prima dimensione su workGroupX.
Nota: funzionesetter per la proprietà workGroupX.
Vedi anche workGroupX().
[slot] void QComputeCommand::setWorkGroupY(int workGroupY)
Imposta il gruppo di lavoro per la seconda dimensione su workGroupY.
Nota: funzionedi impostazione per la proprietà workGroupY.
Vedi anche workGroupY().
[slot] void QComputeCommand::setWorkGroupZ(int workGroupZ)
Imposta il gruppo di lavoro per la terza dimensione su workGroupZ.
Nota: funzionesetter per la proprietà workGroupZ.
Vedi anche workGroupZ().
[slot] void QComputeCommand::trigger(int frameCount = 1)
Quando il tipo di esecuzione è impostato su "Manuale", l'attivazione del trigger farà sì che il comando di calcolo venga eseguito per i prossimi frameCount frame. Al termine dell'esecuzione, la proprietà "enabled" verrà impostata su "false".
Nota: questo slot è sovraccaricato. Per connettersi a questo slot:
// Connect using qOverload:
connect(sender, &SenderClass::signal,
computeCommand, qOverload(&QComputeCommand::trigger));
// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
computeCommand, [receiver = computeCommand](int frameCount) { receiver->trigger(frameCount); }); [slot] void QComputeCommand::trigger(int workGroupX, int workGroupY, int workGroupZ, int frameCount = 1)
Quando il tipo di esecuzione è impostato su "Manuale", l'attivazione del trigger farà sì che il comando di calcolo venga eseguito per i prossimi frameCount frame. Al termine dell'esecuzione, la proprietà "enabled" verrà impostata su "false". La dimensione del gruppo di lavoro precedentemente impostata verrà sovrascritta con workGroupX, workGroupY, workGroupZ.
Nota: questo slot è sovraccaricato. Per connettersi a questo slot:
// Connect using qOverload:
connect(sender, &SenderClass::signal,
computeCommand, qOverload(&QComputeCommand::trigger));
// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
computeCommand, [receiver = computeCommand](int workGroupX, int workGroupY, int workGroupZ, int frameCount) { receiver->trigger(workGroupX, workGroupY, workGroupZ, frameCount); }); © 2026 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.