Specifies a viewport rectangle. 更多...
头: | #include <QRhiViewport> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
Since: | Qt 6.6 |
QRhiViewport () | |
QRhiViewport (float x , float y , float w , float h , float minDepth = 0.0f, float maxDepth = 1.0f) | |
float | maxDepth () const |
float | minDepth () const |
void | setMaxDepth (float maxDepth ) |
void | setMinDepth (float minDepth ) |
void | setViewport (float x , float y , float w , float h ) |
std::array<float, 4> | viewport () const |
size_t | qHash (const QRhiViewport & v , size_t seed = 0) |
bool | operator!= (const QRhiViewport & a , const QRhiViewport & b ) |
bool | operator== (const QRhiViewport & a , const QRhiViewport & b ) |
Used with QRhiCommandBuffer::setViewport ().
QRhi assumes OpenGL-style viewport coordinates, meaning x and y are bottom-left. Negative width or height are not allowed.
Typical usage is like the following:
const QSize outputSizeInPixels = swapchain->currentPixelSize(); const QRhiViewport viewport(0, 0, outputSizeInPixels.width(), outputSizeInPixels.height()); cb->beginPass(swapchain->currentFrameRenderTarget(), Qt::black, { 1.0f, 0 }); cb->setGraphicsPipeline(ps); cb->setViewport(viewport); // ...
注意: This is a RHI API with limited compatibility guarantees, see QRhi 了解细节。
另请参阅 QRhiCommandBuffer::setViewport (), QRhi::clipSpaceCorrMatrix (),和 QRhiScissor .
[constexpr noexcept]
QRhiViewport::
QRhiViewport
()
Constructs a viewport description with an empty rectangle and a depth range of 0.0f - 1.0f.
另请参阅 QRhi::clipSpaceCorrMatrix ().
Constructs a viewport description with the rectangle specified by x , y , w , h and the depth range minDepth and maxDepth .
注意: x and y are assumed to be the bottom-left position. w and h should not be negative, the viewport will be ignored by QRhiCommandBuffer::setViewport () otherwise.
另请参阅 QRhi::clipSpaceCorrMatrix ().
Returns the maxDepth value of the depth range of the viewport.
另请参阅 setMaxDepth ().
Returns the minDepth value of the depth range of the viewport.
另请参阅 setMinDepth ().
设置 maxDepth of the depth range of the viewport. By default this is set to 1.0f.
另请参阅 maxDepth ().
设置 minDepth of the depth range of the viewport. By default this is set to 0.0f.
另请参阅 minDepth ().
Sets the viewport's position and size to x , y , w ,和 h .
注意: Viewports are specified in a coordinate system that has its origin in the bottom-left.
另请参阅 viewport ().
Returns the viewport x, y, width, and height.
另请参阅 setViewport ().
[noexcept]
size_t
qHash
(const
QRhiViewport
&
v
,
size_t
seed
= 0)
返回哈希值为 v ,使用 seed 做计算种子。
[noexcept]
bool
operator!=
(const
QRhiViewport
&
a
, const
QRhiViewport
&
b
)
返回
false
if the values in the two
QRhiViewport
对象
a
and
b
相等;否则返回
true
.
[noexcept]
bool
operator==
(const
QRhiViewport
&
a
, const
QRhiViewport
&
b
)
返回
true
if the values in the two
QRhiViewport
对象
a
and
b
相等。