In questa pagina

Qt3DRender::QShaderProgramBuilder Class

class Qt3DRender::QShaderProgramBuilder

Genera il codice di un programma shader a partire dai grafici caricati. Altro...

Intestazione: #include <qshaderprogrambuilder.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
In QML: ShaderProgramBuilder
Eredita da: Qt3DCore::QNode
Stato: Obsoleta

Questa classe è deprecata. Si sconsiglia vivamente di utilizzarla nel nuovo codice.

Proprietà

Funzioni pubbliche

QByteArray computeShaderCode() const
QUrl computeShaderGraph() const
QStringList enabledLayers() const
QByteArray fragmentShaderCode() const
QUrl fragmentShaderGraph() const
QByteArray geometryShaderCode() const
QUrl geometryShaderGraph() const
Qt3DRender::QShaderProgram *shaderProgram() const
QByteArray tessellationControlShaderCode() const
QUrl tessellationControlShaderGraph() const
QByteArray tessellationEvaluationShaderCode() const
QUrl tessellationEvaluationShaderGraph() const
QByteArray vertexShaderCode() const
QUrl vertexShaderGraph() const

Slot pubblici

void setComputeShaderGraph(const QUrl &computeShaderGraph)
void setEnabledLayers(const QStringList &layers)
void setFragmentShaderGraph(const QUrl &fragmentShaderGraph)
void setGeometryShaderGraph(const QUrl &geometryShaderGraph)
void setShaderProgram(Qt3DRender::QShaderProgram *program)
void setTessellationControlShaderGraph(const QUrl &tessellationControlShaderGraph)
void setTessellationEvaluationShaderGraph(const QUrl &tessellationEvaluationShaderGraph)
void setVertexShaderGraph(const QUrl &vertexShaderGraph)

Segnali

void computeShaderCodeChanged(const QByteArray &computeShaderCode)
void computeShaderGraphChanged(const QUrl &computeShaderGraph)
void enabledLayersChanged(const QStringList &layers)
void fragmentShaderCodeChanged(const QByteArray &fragmentShaderCode)
void fragmentShaderGraphChanged(const QUrl &fragmentShaderGraph)
void geometryShaderCodeChanged(const QByteArray &geometryShaderCode)
void geometryShaderGraphChanged(const QUrl &geometryShaderGraph)
void shaderProgramChanged(Qt3DRender::QShaderProgram *shaderProgram)
void tessellationControlShaderCodeChanged(const QByteArray &tessellationControlShaderCode)
void tessellationControlShaderGraphChanged(const QUrl &tessellationControlShaderGraph)
void tessellationEvaluationShaderCodeChanged(const QByteArray &tessellationEvaluationShaderCode)
void tessellationEvaluationShaderGraphChanged(const QUrl &tessellationEvaluationShaderGraph)
void vertexShaderCodeChanged(const QByteArray &vertexShaderCode)
void vertexShaderGraphChanged(const QUrl &vertexShaderGraph)

Descrizione dettagliata

Un generatore di programmi shader è costituito da diversi grafici shader utilizzati per generare il codice shader.

Viene mantenuta una cache del codice shader generato. Gli shader generati vengono salvati per impostazione predefinita in QStandardPaths::writableLocation(QStandardPaths::TempLocation)). Questo percorso può essere sovrascritto impostando la variabile d'ambiente QT3D_WRITABLE_CACHE_PATH su un percorso valido in cui è possibile scrivere.

È possibile disabilitare l’uso della cache impostando la variabile d’ambiente QT3D_DISABLE_SHADER_CACHE.

Nella maggior parte dei casi, le modifiche apportate a un grafico vengono rilevate da Qt 3D e verrà generata una nuova voce nella cache. Un caso in cui ciò non avviene è quando vengono modificati i frammenti di codice inclusi in un grafico. Per ovviare a questo problema, è possibile svuotare la directory della cache o impostare la variabile d’ambiente QT3D_REBUILD_SHADER_CACHE per forzare la rigenerazione del codice dello shader.

Documentazione delle proprietà

[read-only] computeShaderCode : QByteArray

Contiene il codice generato per lo shader di calcolo.

Funzioni di accesso:

QByteArray computeShaderCode() const

Segnale di notifica:

void computeShaderCodeChanged(const QByteArray &computeShaderCode)

computeShaderGraph : QUrl

Contiene l'URL del grafico dello shader di calcolo utilizzato da questo generatore di programmi shader.

Funzioni di accesso:

QUrl computeShaderGraph() const
void setComputeShaderGraph(const QUrl &computeShaderGraph)

Segnale di notifica:

void computeShaderGraphChanged(const QUrl &computeShaderGraph)

enabledLayers : QStringList

Contiene l'elenco dei livelli che questo builder attiverà nei grafici degli shader durante la generazione del codice.

Funzioni di accesso:

QStringList enabledLayers() const
void setEnabledLayers(const QStringList &layers)

Segnale di notifica:

void enabledLayersChanged(const QStringList &layers)

[read-only] fragmentShaderCode : QByteArray

Contiene il codice generato per lo shader dei frammenti.

Funzioni di accesso:

QByteArray fragmentShaderCode() const

Segnale di notifica:

void fragmentShaderCodeChanged(const QByteArray &fragmentShaderCode)

fragmentShaderGraph : QUrl

Contiene l'URL del grafico dello shader di frammento utilizzato da questo generatore di programmi shader.

Funzioni di accesso:

QUrl fragmentShaderGraph() const
void setFragmentShaderGraph(const QUrl &fragmentShaderGraph)

Segnale di notifica:

void fragmentShaderGraphChanged(const QUrl &fragmentShaderGraph)

[read-only] geometryShaderCode : QByteArray

Contiene il codice generato dallo shader geometrico.

Funzioni di accesso:

QByteArray geometryShaderCode() const

Segnale di notifica:

void geometryShaderCodeChanged(const QByteArray &geometryShaderCode)

geometryShaderGraph : QUrl

Contiene l'URL del grafico dello shader geometrico utilizzato da questo generatore di programmi shader.

Funzioni di accesso:

QUrl geometryShaderGraph() const
void setGeometryShaderGraph(const QUrl &geometryShaderGraph)

Segnale di notifica:

void geometryShaderGraphChanged(const QUrl &geometryShaderGraph)

shaderProgram : Qt3DRender::QShaderProgram*

Contiene il programma shader sulla base del quale questo generatore produce il codice.

Funzioni di accesso:

Qt3DRender::QShaderProgram *shaderProgram() const
void setShaderProgram(Qt3DRender::QShaderProgram *program)

Segnale di notifica:

void shaderProgramChanged(Qt3DRender::QShaderProgram *shaderProgram)

[read-only] tessellationControlShaderCode : QByteArray

Contiene il codice dello shader di controllo per la generazione della tassellatura.

Funzioni di accesso:

QByteArray tessellationControlShaderCode() const

Segnale di notifica:

void tessellationControlShaderCodeChanged(const QByteArray &tessellationControlShaderCode)

tessellationControlShaderGraph : QUrl

Contiene l'URL del grafico shader di controllo della tassellatura utilizzato da questo generatore di programmi shader.

Funzioni di accesso:

QUrl tessellationControlShaderGraph() const
void setTessellationControlShaderGraph(const QUrl &tessellationControlShaderGraph)

Segnale di notifica:

void tessellationControlShaderGraphChanged(const QUrl &tessellationControlShaderGraph)

[read-only] tessellationEvaluationShaderCode : QByteArray

Contiene il codice dello shader per la valutazione della tassellatura generata.

Funzioni di accesso:

QByteArray tessellationEvaluationShaderCode() const

Segnale di notifica:

void tessellationEvaluationShaderCodeChanged(const QByteArray &tessellationEvaluationShaderCode)

tessellationEvaluationShaderGraph : QUrl

Contiene l'URL del grafico dello shader di valutazione della tassellatura utilizzato da questo generatore di programmi shader.

Funzioni di accesso:

QUrl tessellationEvaluationShaderGraph() const
void setTessellationEvaluationShaderGraph(const QUrl &tessellationEvaluationShaderGraph)

Segnale di notifica:

void tessellationEvaluationShaderGraphChanged(const QUrl &tessellationEvaluationShaderGraph)

[read-only] vertexShaderCode : QByteArray

Contiene il codice generato per il vertex shader.

Funzioni di accesso:

QByteArray vertexShaderCode() const

Segnale di notifica:

void vertexShaderCodeChanged(const QByteArray &vertexShaderCode)

vertexShaderGraph : QUrl

Contiene l'URL del grafico dello shader dei vertici utilizzato da questo generatore di programmi shader.

Funzioni di accesso:

QUrl vertexShaderGraph() const
void setVertexShaderGraph(const QUrl &vertexShaderGraph)

Segnale di notifica:

void vertexShaderGraphChanged(const QUrl &vertexShaderGraph)

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