QShaderProgramBuilder Class

class Qt3DRender ::QShaderProgramBuilder

Generates a Shader Program content from loaded graphs. 更多...

头: #include <QShaderProgramBuilder>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
实例化: ShaderProgramBuilder
继承: Qt3DCore::QNode

特性

公共函数

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

公共槽

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 )

信号

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 )

详细描述

A shader program builder consists of several different shader graphs used to generate shader code.

A cache of generated shader code is maintained. Generated shaders are by defaults saved in QStandardPaths::writableLocation ( QStandardPaths::TempLocation )). This path can be overridden by setting environment variable QT3D_WRITABLE_CACHE_PATH to a valid writable path.

The use of the cache can be disabled by setting environment variable QT3D_DISABLE_SHADER_CACHE.

In most cases, changes made to a graph are detected by Qt 3D and a new cache entry will be generated. One case were this will not happen is when code snippets included by a graphs are changed. To work around that, clearing the cache directory or setting environment variable QT3D_REBUILD_SHADER_CACHE can be used to force shader code to be generated again.

特性文档编制

[read-only] computeShaderCode : const QByteArray

Holds the generate compute shader code.

访问函数:

QByteArray computeShaderCode () const

通知程序信号:

void computeShaderCodeChanged (const QByteArray & computeShaderCode )

computeShaderGraph : QUrl

Holds the URL to the compute shader graph used by this shader program builder.

访问函数:

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

通知程序信号:

void computeShaderGraphChanged (const QUrl & computeShaderGraph )

enabledLayers : QStringList

Holds the list of layers this builder will activate on the shader graphs during code generation.

访问函数:

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

通知程序信号:

void enabledLayersChanged (const QStringList & layers )

[read-only] fragmentShaderCode : const QByteArray

Holds the generate fragment shader code.

访问函数:

QByteArray fragmentShaderCode () const

通知程序信号:

void fragmentShaderCodeChanged (const QByteArray & fragmentShaderCode )

fragmentShaderGraph : QUrl

Holds the URL to the fragment shader graph used by this shader program builder.

访问函数:

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

通知程序信号:

void fragmentShaderGraphChanged (const QUrl & fragmentShaderGraph )

[read-only] geometryShaderCode : const QByteArray

Holds the generate geometry shader code.

访问函数:

QByteArray geometryShaderCode () const

通知程序信号:

void geometryShaderCodeChanged (const QByteArray & geometryShaderCode )

geometryShaderGraph : QUrl

Holds the URL to the geometry shader graph used by this shader program builder.

访问函数:

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

通知程序信号:

void geometryShaderGraphChanged (const QUrl & geometryShaderGraph )

shaderProgram : Qt3DRender::QShaderProgram *

Holds the shader program on which this builder generates code.

访问函数:

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

通知程序信号:

void shaderProgramChanged (Qt3DRender::QShaderProgram * shaderProgram )

[read-only] tessellationControlShaderCode : const QByteArray

Holds the generate tessellation control shader code.

访问函数:

QByteArray tessellationControlShaderCode () const

通知程序信号:

void tessellationControlShaderCodeChanged (const QByteArray & tessellationControlShaderCode )

tessellationControlShaderGraph : QUrl

Holds the URL to the tesselation control shader graph used by this shader program builder.

访问函数:

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

通知程序信号:

void tessellationControlShaderGraphChanged (const QUrl & tessellationControlShaderGraph )

[read-only] tessellationEvaluationShaderCode : const QByteArray

Holds the generate tessellation evaluation shader code.

访问函数:

QByteArray tessellationEvaluationShaderCode () const

通知程序信号:

void tessellationEvaluationShaderCodeChanged (const QByteArray & tessellationEvaluationShaderCode )

tessellationEvaluationShaderGraph : QUrl

Holds the URL to the tesselation evaluation shader graph used by this shader program builder.

访问函数:

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

通知程序信号:

void tessellationEvaluationShaderGraphChanged (const QUrl & tessellationEvaluationShaderGraph )

[read-only] vertexShaderCode : const QByteArray

Holds the generate vertex shader code.

访问函数:

QByteArray vertexShaderCode () const

通知程序信号:

void vertexShaderCodeChanged (const QByteArray & vertexShaderCode )

vertexShaderGraph : QUrl

Holds the URL to the vertex shader graph used by this shader program builder.

访问函数:

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

通知程序信号:

void vertexShaderGraphChanged (const QUrl & vertexShaderGraph )