このページでは

Qt3DRender::QParameter Class

class Qt3DRender::QParameter

名前と値のペアを格納します。これはシェーダーのユニフォームに対応します。詳細...

ヘッダー: #include <Qt3DRender/QParameter>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
QML内: Parameter
継承元: Qt3DCore::QNode
ステータス: 非推奨

このクラスは非推奨です。新しいコードでの使用は強く推奨しません。

プロパティ

パブリック関数

QParameter(Qt3DCore::QNode *parent = nullptr)
QParameter(const QString &name, Qt3DRender::QAbstractTexture *texture, Qt3DCore::QNode *parent = nullptr)
QParameter(const QString &name, const QVariant &value, Qt3DCore::QNode *parent = nullptr)
QString name() const
QVariant value() const

パブリック・スロット

void setName(const QString &name)
void setValue(const QVariant &dv)

シグナル

void nameChanged(const QString &name)
void valueChanged(const QVariant &value)

詳細な説明

QParameter は、QRenderPass 、QTechnique 、QEffect 、QMaterial 、QTechniqueFilter 、QRenderPassFilter によって参照できます。実行時、レンダリングの特定のステップでどのシェーダーが選択されているかによって、そのシェーダーに QParameter の名前と一致するユニフォームが含まれている場合、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;

注: QParameter でラップされた値が、実際のユニフォームが期待する型に確実に変換できるかどうかを確認するために、ある程度の 注意が必要です。実際のシェーダーのユニフォームが float 型であるにもかかわらず、int として格納された値を指定すると、未定義の挙動を引き起こす可能性があります。

注: 対象となるユニフォームが配列である場合 、名前にはユニフォームの名前に [0] を付加したものを指定する必要があります。

注:QParameter ノードは無効にすることはできません。

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];

テクスチャのサポートに関しては、QParameter の値を、シェーダーのユニフォームのサンプラー型に一致する適切なQAbstractTexture サブクラスに設定する必要があります。

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

QAbstractTextureも参照してください 。

プロパティのドキュメント

name : QString

パラメータの名前を指定します

アクセス関数:

QString name() const
void setName(const QString &name)

通知信号:

void nameChanged(const QString &name)

value : QVariant

パラメータの値を指定します

アクセス関数:

QVariant value() const
void setValue(const QVariant &dv)

通知信号:

void valueChanged(const QVariant &value)

メンバ関数のドキュメント

[explicit] QParameter::QParameter(Qt3DCore::QNode *parent = nullptr)

指定されたparent を使用して、新しいQParameterを構築します。

[explicit] QParameter::QParameter(const QString &name, Qt3DRender::QAbstractTexture *texture, Qt3DCore::QNode *parent = nullptr)

指定されたparent name を持つ新しいQParameterを構築し、その値をtexture から取得します。

[explicit] QParameter::QParameter(const QString &name, const QVariant &value, Qt3DCore::QNode *parent = nullptr)

指定されたparent 、name 、およびvalue を使用して、新しい QParameter を作成します。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.