QSGVertexColorMaterial Class
QSGVertexColorMaterial 类提供了一种在场景图中渲染按顶点着色的几何体的便捷方法。更多内容...
| 头文件: | #include <QSGVertexColorMaterial> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
| qmake: | QT += quick |
| 继承自: | QSGMaterial |
- 所有成员列表(包括继承的成员)
- QSGVertexColorMaterial 属于Qt Quick 场景图材质类。
公共函数
详细说明
警告:此 实用类仅在使用Qt Quick 场景图的默认后端时才可正常运行。
顶点颜色材质将为几何体中的每个顶点赋予一种颜色。顶点之间的像素将进行线性插值。颜色可以包含透明度。
要使用顶点颜色渲染的几何体必须具有以下布局。属性位置 0 必须包含顶点。 属性位置 1 必须包含颜色,即一个采用 RGBA 布局的 4 个值的元组。颜色值既可以是 0 到 1 范围内的浮点数,也可以是 0 到 255 范围内的无符号字节数。
注意: 渲染管线 期望像素采用预乘透明度(premultiplied alpha)格式。
QSGGeometry::defaultAttributes_ColoredPoint2D() 可用于构建与该材质兼容的属性集。
顶点颜色材质在更新其渲染状态时,会同时考虑当前不透明度和当前矩阵。
© 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.