封装技术。 更多...
头: | #include <QTechnique> |
qmake: | QT += 3drender |
Since: | Qt 5.7 |
实例化: | Technique |
继承: | Qt3DCore::QNode |
QTechnique (Qt3DCore::QNode * parent = nullptr) | |
void | addFilterKey (Qt3DRender::QFilterKey * filterKey ) |
void | addParameter (Qt3DRender::QParameter * 参数 ) |
void | addRenderPass (Qt3DRender::QRenderPass * pass ) |
QVector<Qt3DRender::QFilterKey *> | filterKeys () const |
Qt3DRender::QGraphicsApiFilter * | graphicsApiFilter () |
QVector<Qt3DRender::QParameter *> | 参数 () const |
void | removeFilterKey (Qt3DRender::QFilterKey * filterKey ) |
void | removeParameter (Qt3DRender::QParameter * 参数 ) |
void | removeRenderPass (Qt3DRender::QRenderPass * pass ) |
QVector<Qt3DRender::QRenderPass *> | renderPasses () const |
const QMetaObject | staticMetaObject |
封装技术。
A Qt3DRender::QTechnique 指定一组 Qt3DRender::QRenderPass 对象, Qt3DRender::QFilterKey 对象, Qt3DRender::QParameter 对象和 Qt3DRender::QGraphicsApiFilter , which together define a rendering technique the given graphics API can render. The filter keys are used by Qt3DRender::QTechniqueFilter to select specific techniques at specific parts of the FrameGraph. If two QParameter instances with the same name are specified in a QTechnique 和 QRenderPass , the one in Technique overrides the one used in the QRenderPass .
When creating an QEffect that targets several versions of a graphics API, it is useful to create several QTechnique nodes each with a graphicsApiFilter set to match one of the targeted GL versions. At runtime, the Qt3D renderer will select the most appropriate QTechnique based on which graphics API versions are supported and (if specified) the QFilterKey nodes that satisfy a given QTechniqueFilter in the FrameGraph.
注意: When using OpenGL as the graphics API for rendering, Qt3D relies on the QSurfaceFormat 返回通过 QSurfaceFormat::defaultFormat () at runtime to decide what is the most appropriate GL version available. If you need to customize the QSurfaceFormat , do not forget to apply it with QSurfaceFormat::setDefaultFormat (). Setting the QSurfaceFormat on the view will likely have no effect on Qt3D related rendering.
QTechnique *gl3Technique = new QTechnique(); // Create the render passes QRenderPass *firstPass = new QRenderPass(); QRenderPass *secondPass = new QRenderPass(); // Add the passes to the technique gl3Technique->addRenderPass(firstPass); gl3Technique->addRenderPass(secondPass); // Set the targeted GL version for the technique gl3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL); gl3Technique->graphicsApiFilter()->setMajorVersion(3); gl3Technique->graphicsApiFilter()->setMinorVersion(1); gl3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile); // Create a FilterKey QFilterKey *filterKey = new QFilterKey(); filterKey->setName(QStringLiteral("name")); fitlerKey->setValue(QStringLiteral("zFillPass")); // Add the FilterKey to the Technique gl3Technique->addFilterKey(filterKey); // Create a QParameter QParameter *colorParameter = new QParameter(QStringLiteral("color"), QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f)); // Add parameter to technique gl3Technique->addParameter(colorParameter);
另请参阅 QEffect , QRenderPass ,和 QTechniqueFilter .
Specifies the graphics API filter being used
访问函数:
Qt3DRender::QGraphicsApiFilter * | graphicsApiFilter () |
Default constructs an instance of QTechnique.
添加 filterKey 到 Qt3DRender::QTechnique local filter keys.
添加 参数 to the technique's parameters.
Appends a pass to the technique.
Returns the list of Qt3DCore::QFilterKey key objects making up the filter keys of the Qt3DRender::QTechnique .
Returns a vector of the techniques current parameters
移除 filterKey 从 Qt3DRender::QTechnique local filter keys.
移除 参数 from the technique's parameters.
Removes a pass from the technique.
Returns the list of render passes contained in the technique.