Technique QML Type

封装一个技术。更多

Import Statement: import Qt3D.Render 2.9
In C++: QTechnique
Inherits:

Node

Status: Deprecated

属性

详细说明

技术(Technique)指定了一组RenderPass 对象、FilterKey 对象、参数(Parameter)对象和GraphicsApiFilter ,它们共同定义了给定图形 API 可以渲染的渲染技术。TechniqueFilter 使用过滤键在 FrameGraph 的特定部分选择特定技术。技术中定义的参数会覆盖RenderPass 中定义的参数(同名),但会被RenderPassFilterTechniqueFilter 、材质和效果中的参数覆盖。

在创建针对多个图形 API 版本的 Effects 时,最好创建多个 Technique 节点,每个节点的graphicsApiFilter 设置为与其中一个目标版本相匹配。在运行时,Qt3D 渲染器将根据支持的图形 API 版本以及(如果指定)满足 FrameGraph 中给定TechniqueFilterFilterKey 节点,选择最合适的技术。

注意: 当使用 OpenGL 作为渲染的图形 API 时,Qt3D 会依赖运行时QSurfaceFormat::defaultFormat() 返回的QSurfaceFormat 来决定最合适的可用 GL 版本。如果您需要自定义QSurfaceFormat ,请不要忘记使用QSurfaceFormat::setDefaultFormat() 来应用它。在视图上设置QSurfaceFormat 可能不会对与 Qt3D 相关的渲染产生任何影响。

注意: 无法禁用技术节点。

Technique {
    id: gl3Technique
    parameters: [
        Parameter { name: "color"; value: "orange" }
    ]
    filterKeys: [
        FilterKey { name: "renderingStyle"; value: "forward" }
    ]
    graphicsApiFilter: {
        api: GraphicsApiFilter.OpenGL
        profile: GraphicsApiFilter.CoreProfile
        majorVersion: 3
        minorVersion: 1
    }
    renderPasses: [
        RenderPass {
            id: firstPass
            shaderProgram: ShaderProgram {
                // ...
            }
        },
        RenderPass {
            id: secondPass
            shaderProgram: ShaderProgram {
                // ...
            }
        }
    ]
}

另请参阅 Effect,RenderPass, 和TechniqueFilter

属性文档

filterKeys : list<FilterKey>

指定启用此技术的过滤器键列表


graphicsApiFilter : GraphicsApiFilter [read-only]

指定正在使用的图形 API 过滤器


parameters : list<Parameter>

指定技术使用的参数


renderPasses : list<RenderPass>

指定技术使用的渲染通道


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