Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QRhiViewport Class Reference

\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h More...

#include <qrhi.h>

Collaboration diagram for QRhiViewport:

Public Member Functions

 QRhiViewport ()=default
 Constructs a viewport description with an empty rectangle and a depth range of 0.0f - 1.0f.
 QRhiViewport (float x, float y, float w, float h, float minDepth=0.0f, float maxDepth=1.0f)
 Constructs a viewport description with the rectangle specified by x, y, w, h and the depth range minDepth and maxDepth.
std::array< float, 4 > viewport () const
void setViewport (float x, float y, float w, float h)
 Sets the viewport's position and size to x, y, w, and h.
float minDepth () const
void setMinDepth (float minDepth)
 Sets the minDepth of the depth range of the viewport.
float maxDepth () const
void setMaxDepth (float maxDepth)
 Sets the maxDepth of the depth range of the viewport.

Friends

bool operator== (const QRhiViewport &a, const QRhiViewport &b) noexcept
bool operator!= (const QRhiViewport &a, const QRhiViewport &b) noexcept
size_t qHash (const QRhiViewport &v, size_t seed=0) noexcept
 \qhash{QRhiViewport}

Detailed Description

\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h

Since
6.6

Specifies a viewport rectangle.

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);
// ...
std::array< float, 4 > viewport() const
Definition qrhi.h:91
QRhiViewport()=default
Constructs a viewport description with an empty rectangle and a depth range of 0.0f - 1....
\inmodule QtCore
Definition qsize.h:26
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:143
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:140
@ black
Definition qnamespace.h:31
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
Note
This is a RHI API with limited compatibility guarantees, see \l QRhi for details.
See also
QRhiCommandBuffer::setViewport(), QRhi::clipSpaceCorrMatrix(), QRhiScissor

Definition at line 85 of file qrhi.h.

Constructor & Destructor Documentation

◆ QRhiViewport() [1/2]

QRhiViewport::QRhiViewport ( )
default

Constructs a viewport description with an empty rectangle and a depth range of 0.0f - 1.0f.

See also
QRhi::clipSpaceCorrMatrix()

◆ QRhiViewport() [2/2]

QRhiViewport::QRhiViewport ( float x,
float y,
float w,
float h,
float minDepth = 0.0f,
float maxDepth = 1.0f )

Constructs a viewport description with the rectangle specified by x, y, w, h and the depth range minDepth and maxDepth.

Note
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.
See also
QRhi::clipSpaceCorrMatrix()

Definition at line 1369 of file qrhi.cpp.

Member Function Documentation

◆ maxDepth()

float QRhiViewport::maxDepth ( ) const
inline
Returns
the maxDepth value of the depth range of the viewport.

Definition at line 99 of file qrhi.h.

◆ minDepth()

float QRhiViewport::minDepth ( ) const
inline
Returns
the minDepth value of the depth range of the viewport.

Definition at line 96 of file qrhi.h.

◆ setMaxDepth()

void QRhiViewport::setMaxDepth ( float maxDepth)
inline

Sets the maxDepth of the depth range of the viewport.

By default this is set to 1.0f.

Definition at line 100 of file qrhi.h.

◆ setMinDepth()

void QRhiViewport::setMinDepth ( float minDepth)
inline

Sets the minDepth of the depth range of the viewport.

By default this is set to 0.0f.

Definition at line 97 of file qrhi.h.

◆ setViewport()

void QRhiViewport::setViewport ( float x,
float y,
float w,
float h )
inline

Sets the viewport's position and size to x, y, w, and h.

Note
Viewports are specified in a coordinate system that has its origin in the bottom-left.

Definition at line 92 of file qrhi.h.

◆ viewport()

std::array< float, 4 > QRhiViewport::viewport ( ) const
inline
Returns
the viewport x, y, width, and height.

Definition at line 91 of file qrhi.h.

◆ operator!=

bool operator!= ( const QRhiViewport & a,
const QRhiViewport & b )
friend
Returns
false if the values in the two QRhiViewport objects a and b are equal; otherwise returns true.

Definition at line 114 of file qrhi.h.

◆ operator==

bool operator== ( const QRhiViewport & a,
const QRhiViewport & b )
friend
Returns
true if the values in the two QRhiViewport objects a and b are equal.

Definition at line 107 of file qrhi.h.

◆ qHash

size_t qHash ( const QRhiViewport & v,
size_t seed = 0 )
friend

\qhash{QRhiViewport}

Definition at line 119 of file qrhi.h.


The documentation for this class was generated from the following files: