本页内容

QSGRenderNode::RenderState Struct

struct QSGRenderNode::RenderState

提供有关投影矩阵和裁剪的信息。更多内容...

公共函数

virtual const QRegion *clipRegion() const = 0
virtual void *get(const char *state) const
virtual const QMatrix4x4 *projectionMatrix() const = 0
virtual bool scissorEnabled() const = 0
virtual QRect scissorRect() const = 0
virtual bool stencilEnabled() const = 0
virtual int stencilValue() const = 0

详细描述

渲染状态包含渲染器在向场景图后端调用命令时所需的信息。

另请参阅 QSGRenderNode::render()。

成员函数文档

[pure virtual] const QRegion *RenderState::clipRegion() const

返回当前的剪裁区域;对于通过模板或剪裁方式实现剪裁功能的后端,则返回 null。

software 后端不使用投影、剪切或模板,这意味着大部分渲染状态均未被使用。然而,由于在render()中手动重建该剪裁区域并不合理,因此仍需传递可在QPainter 上设置的剪裁区域。因此,可通过此函数查询该区域。 该区域采用世界坐标系,可通过Qt::ReplaceClip 传递给QPainter::setClipRegion()。此操作必须在调用QPainter::setTransform()之前完成,因为剪切区域已被映射到QSGRenderNode::matrix()中提供的变换上。

[virtual] void *RenderState::get(const char *state) const

返回指向state 值的指针。

保留供将来使用。

[pure virtual] const QMatrix4x4 *RenderState::projectionMatrix() const

返回指向当前投影矩阵的指针。

可以通过QSGRenderNode::matrix()获取模型-视图矩阵。通常,projection * modelview 就是随后在顶点着色器中用于变换顶点的矩阵。

[pure virtual] bool RenderState::scissorEnabled() const

返回剪切功能的当前状态。

注意:仅 适用于具有专用剪切启用/禁用状态的图形 API。

[pure virtual] QRect RenderState::scissorRect() const

当剪裁功能处于启用状态时,返回当前的剪裁矩形。x 和 y 分别是左下角的坐标。

[pure virtual] bool RenderState::stencilEnabled() const

返回当前的模板测试状态。

注意:对于在 管道状态对象中启用模板测试(而非通过单独的状态设置命令)的 图形 API, render() 的实现应通过操作KEEP 、比较函数EQUAL 以及读写掩码0xFF 来启用模板测试。

[pure virtual] int RenderState::stencilValue() const

当剪裁功能处于活动状态时,返回当前的模板参考值。

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