Sur cette page

Qt3DRender::QShaderProgramBuilder Class

class Qt3DRender::QShaderProgramBuilder

Génère un contenu de programme d'ombrage à partir des graphiques chargés. Plus d'informations...

En-tête : #include <QShaderProgramBuilder>
CMake : find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake : QT += 3drender
En QML : ShaderProgramBuilder
Hérite : Qt3DCore::QNode
Statut : Déclassé

Propriétés

Fonctions publiques

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

Emplacements publics

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)

Signaux

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)

Description détaillée

Un constructeur de programmes de shaders se compose de plusieurs graphes de shaders différents utilisés pour générer du code de shaders.

Un cache du code de nuanceur généré est maintenu. Les shaders générés sont par défaut enregistrés dans QStandardPaths::writableLocation(QStandardPaths::TempLocation)). Ce chemin peut être modifié en définissant la variable d'environnement QT3D_WRITABLE_CACHE_PATH sur un chemin valide accessible en écriture.

L'utilisation du cache peut être désactivée en définissant la variable d'environnement QT3D_DISABLE_SHADER_CACHE.

Dans la plupart des cas, les modifications apportées à un graphique sont détectées par Qt 3D et une nouvelle entrée de cache est générée. Un cas où cela ne se produit pas est lorsque des extraits de code inclus dans un graphique sont modifiés. Pour contourner ce problème, il est possible de vider le répertoire du cache ou de définir la variable d'environnement QT3D_REBUILD_SHADER_CACHE pour forcer la génération d'un nouveau code de shader.

Documentation sur les propriétés

[read-only] computeShaderCode : QByteArray

Contient le code du shader de calcul généré.

Fonctions d'accès :

QByteArray computeShaderCode() const

Signal de notification :

void computeShaderCodeChanged(const QByteArray &computeShaderCode)

computeShaderGraph : QUrl

Contient l'URL du graphe de shaders de calcul utilisé par ce constructeur de programmes de shaders.

Fonctions d'accès :

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

Signal du notificateur :

void computeShaderGraphChanged(const QUrl &computeShaderGraph)

enabledLayers : QStringList

Contient la liste des couches que ce constructeur activera sur les graphiques de shaders lors de la génération du code.

Fonctions d'accès :

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

Signal de notification :

void enabledLayersChanged(const QStringList &layers)

[read-only] fragmentShaderCode : QByteArray

Contient le code de génération du nuanceur de fragment.

Fonctions d'accès :

QByteArray fragmentShaderCode() const

Signal de notification :

void fragmentShaderCodeChanged(const QByteArray &fragmentShaderCode)

fragmentShaderGraph : QUrl

Contient l'URL du graphique de nuanceur de fragment utilisé par ce constructeur de programme de nuanceur.

Fonctions d'accès :

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

Signal du notificateur :

void fragmentShaderGraphChanged(const QUrl &fragmentShaderGraph)

[read-only] geometryShaderCode : QByteArray

Contient le code de génération du shader géométrique.

Fonctions d'accès :

QByteArray geometryShaderCode() const

Signal de notification :

void geometryShaderCodeChanged(const QByteArray &geometryShaderCode)

geometryShaderGraph : QUrl

Contient l'URL du graphique de nuanceur géométrique utilisé par ce constructeur de programme de nuanceur.

Fonctions d'accès :

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

Signal de notification :

void geometryShaderGraphChanged(const QUrl &geometryShaderGraph)

shaderProgram : Qt3DRender::QShaderProgram*

Contient le programme de shaders sur lequel ce constructeur génère du code.

Fonctions d'accès :

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

Signal de notification :

void shaderProgramChanged(Qt3DRender::QShaderProgram *shaderProgram)

[read-only] tessellationControlShaderCode : QByteArray

Contient le code du shader de contrôle de la tessellation généré.

Fonctions d'accès :

QByteArray tessellationControlShaderCode() const

Signal de notification :

void tessellationControlShaderCodeChanged(const QByteArray &tessellationControlShaderCode)

tessellationControlShaderGraph : QUrl

Contient l'URL du graphe de contrôle de tesselation utilisé par ce constructeur de programmes de shaders.

Fonctions d'accès :

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

Signal du notificateur :

void tessellationControlShaderGraphChanged(const QUrl &tessellationControlShaderGraph)

[read-only] tessellationEvaluationShaderCode : QByteArray

Contient le code du shader d'évaluation de la tessellation générée.

Fonctions d'accès :

QByteArray tessellationEvaluationShaderCode() const

Signal de notification :

void tessellationEvaluationShaderCodeChanged(const QByteArray &tessellationEvaluationShaderCode)

tessellationEvaluationShaderGraph : QUrl

Contient l'URL du graphe de nuanceur d'évaluation de tesselation utilisé par ce constructeur de programme de nuanceur.

Fonctions d'accès :

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

Signal du notificateur :

void tessellationEvaluationShaderGraphChanged(const QUrl &tessellationEvaluationShaderGraph)

[read-only] vertexShaderCode : QByteArray

Contient le code de génération du vertex shader.

Fonctions d'accès :

QByteArray vertexShaderCode() const

Signal de notification :

void vertexShaderCodeChanged(const QByteArray &vertexShaderCode)

vertexShaderGraph : QUrl

Contient l'URL du graphe de nuanceur de sommets utilisé par ce constructeur de programme de nuanceur.

Fonctions d'accès :

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

Signal de notification :

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.