class QParameter#

Provides storage for a name and value pair. This maps to a shader uniform. More

Inheritance diagram of PySide6.Qt3DRender.Qt3DRender.QParameter

Synopsis#

Properties#

Methods#

Slots#

Signals#

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

Detailed Description#

A QParameter can be referenced by a QRenderPass , QTechnique , QEffect , QMaterial , QTechniqueFilter , QRenderPassFilter . At runtime, depending on which shader is selected for a given step of the rendering, the value contained in a QParameter will be converted and uploaded if the shader contains a uniform with a name matching that of the QParameter .

QParameter *param = new QParameter();
param->setName(QStringLiteral("diffuseColor"));
param->setValue(QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));

// Alternatively you can create and set a QParameter this way
QParameter *param2 = new QParameter(QStringLiteral("diffuseColor"), QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));

// Such QParameters will work with the following GLSL uniform shader declarations
// uniform vec4 diffuseColor;
// uniform vec3 diffuseColor;
// uniform vec2 diffuseColor;
// uniform float diffuseColor;

Note

some care must be taken to ensure the value wrapped by a QParameter can actually be converted to what the real uniform expect. Giving a value stored as an int where the actual shader uniform is of type float could result in undefined behaviors.

Note

when the targeted uniform is an array, the name should be the name of the uniform with [0] appended to it.

Note

QParameter node can not be disabled.

QParameter *param = new QParameter();
QVariantList values = QVariantList() << 0.0f << 1.0f << 2.0f << 3.0f << 4.0f << 883.0f << 1340.0f << 1584.0f;

param->setName(QStringLiteral("diffuseValues[0]"));
param->setValue(values);

// Matching GLSL shader uniform  declaration
// uniform float diffuseValues[8];

When it comes to texture support, the QParameter value should be set to the appropriate QAbstractTexture subclass that matches the sampler type of the shader uniform.

QTexture2D *texture = new QTexture2D();
...
QParameter *param = new QParameter();
param->setName(QStringLiteral("diffuseTexture"));
param->setValue(QVariant::fromValue(texture));

// Works with the following GLSL uniform shader declaration
// uniform sampler2D diffuseTexture

See also

QAbstractTexture

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property nameᅟ: str#

Specifies the name of the parameter

Access functions:
property valueᅟ: object#

Specifies the value of the parameter

Access functions:
__init__([parent=None])#
Parameters:

parentQNode

Constructs a new QParameter with the specified parent.

__init__(name, texture[, parent=None])
Parameters:
  • name – str

  • textureQAbstractTexture

  • parentQNode

Constructs a new QParameter with the specified parent name and takes its value from texture.

__init__(name, value[, parent=None])
Parameters:
  • name – str

  • value – object

  • parentQNode

Constructs a new QParameter with the specified parent name and value.

name()#
Return type:

str

See also

setName()

Getter of property nameᅟ .

nameChanged(name)#
Parameters:

name – str

Notification signal of property nameᅟ .

setName(name)#
Parameters:

name – str

See also

name()

Setter of property nameᅟ .

setValue(dv)#
Parameters:

dv – object

See also

value()

Setter of property valueᅟ .

value()#
Return type:

object

See also

setValue()

Getter of property valueᅟ .

valueChanged(value)#
Parameters:

value – object

Notification signal of property valueᅟ .