PySide6.QtGui.QRhiVertexInputBinding¶
- class QRhiVertexInputBinding¶
Describes a vertex input binding.
Details
Specifies the stride (in bytes, must be a multiple of 4), the classification and optionally the instance step rate.
As an example, assume a vertex shader with the following inputs:
layout(location = 0) in vec4 position; layout(location = 1) in vec2 texcoord;
Now let’s assume also that 3 component vertex positions
(x, y, z)and 2 component texture coordinates(u, v)are provided in a non-interleaved format in a buffer (or separate buffers even). Defining two bindings could then be done like this:QRhiVertexInputLayout inputLayout; inputLayout.setBindings({ { 3 * sizeof(float) }, { 2 * sizeof(float) } });
Only the stride is interesting here since instancing is not used. The binding number is given by the index of the
QRhiVertexInputBindingelement in the bindings vector of theQRhiVertexInputLayout.Once a graphics pipeline with this vertex input layout is bound, the vertex inputs could be set up like the following for drawing a cube with 36 vertices, assuming we have a single buffer with first the positions and then the texture coordinates:
const QRhiCommandBuffer::VertexInput vbufBindings[] = { { cubeBuf, 0 }, { cubeBuf, 36 * 3 * sizeof(float) } }; cb->setVertexInput(0, 2, vbufBindings);
Note how the index defined by
startBinding + i, whereiis the index in the second argument ofsetVertexInput(), matches the index of the corresponding entry in thebindingsvector of theQRhiVertexInputLayout.Note
the stride must always be a multiple of 4.
Added in version 6.6.
Synopsis¶
Methods¶
def
__init__()def
classification()def
__ne__()def
__eq__()def
setStride()def
stride()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- class Classification¶
Describes the input data classification.
Constant
Description
QRhiVertexInputBinding.Classification.PerVertex
Data is per-vertex
QRhiVertexInputBinding.Classification.PerInstance
Data is per-instance
- __init__()¶
Constructs a default vertex input binding description.
- __init__(stride[, cls=QRhiVertexInputBinding.Classification.PerVertex[, stepRate=1]])
- Parameters:
stride – int
cls –
ClassificationstepRate – int
Constructs a vertex input binding description with the specified
stride, classificationcls, and instance step ratestepRate.Note
stepRateother than 1 is only supported whenCustomInstanceStepRateis reported to be supported.- classification()¶
- Return type:
Returns the input data classification.
See also
- instanceStepRate()¶
- Return type:
int
Returns the instance step rate.
See also
- __ne__(b)¶
- Parameters:
- Return type:
bool
- __eq__(b)¶
- Parameters:
- Return type:
bool
- setClassification(c)¶
- Parameters:
c –
Classification
Sets the input data classification
c. By default this is set toPerVertex.See also
- setInstanceStepRate(rate)¶
- Parameters:
rate – int
Sets the instance step
rate. By default this is set to 1.See also
- setStride(s)¶
- Parameters:
s – int
Sets the stride to
s.See also
- stride()¶
- Return type:
int
Returns the stride in bytes.
See also