Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QRhiViewport Class Reference

\inmodule QtGui 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
 

Detailed Description

\inmodule QtGui

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);
// ...
\inmodule QtGui
Definition qrhi.h:85
std::array< float, 4 > viewport() const
Definition qrhi.h:90
\inmodule QtCore
Definition qsize.h:25
@ black
Definition qnamespace.h:30
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 84 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 1286 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 98 of file qrhi.h.

◆ minDepth()

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

Definition at line 95 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 99 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 96 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 91 of file qrhi.h.

◆ viewport()

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

Definition at line 90 of file qrhi.h.

Friends And Related Symbol Documentation

◆ operator!=

bool QRhiViewport::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 113 of file qrhi.h.

◆ operator==

bool QRhiViewport::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 106 of file qrhi.h.

◆ qHash

size_t QRhiViewport::qHash ( const QRhiViewport & v,
size_t seed = 0 )
friend
Returns
the hash value for v, using seed to seed the calculation.

Definition at line 118 of file qrhi.h.


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