QDiffuseSpecularMaterial Class

class Qt3DExtras::QDiffuseSpecularMaterial

QDiffuseSpecularMaterial クラスは、フォン照明効果のデフォルト実装を提供します。詳細...

ヘッダー #include <QDiffuseSpecularMaterial>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dextras)
target_link_libraries(mytarget PRIVATE Qt6::3dextras)
qmake QT += 3dextras
QML で DiffuseSpecularMaterial
を継承しています: Qt3DRender::QMaterial
ステータス非推奨

プロパティ

パブリック機能

QDiffuseSpecularMaterial(Qt3DCore::QNode *parent = nullptr)
virtual ~QDiffuseSpecularMaterial()
QColor ambient() const
QVariant diffuse() const
bool isAlphaBlendingEnabled() const
QVariant normal() const
float shininess() const
QVariant specular() const
float textureScale() const

パブリックスロット

void setAlphaBlendingEnabled(bool enabled)
void setAmbient(const QColor &ambient)
void setDiffuse(const QVariant &diffuse)
void setNormal(const QVariant &normal)
void setShininess(float shininess)
void setSpecular(const QVariant &specular)
void setTextureScale(float textureScale)

シグナル

void alphaBlendingEnabledChanged(bool enabled)
void ambientChanged(const QColor &ambient)
void diffuseChanged(const QVariant &diffuse)
void normalChanged(const QVariant &normal)
void shininessChanged(float shininess)
void specularChanged(const QVariant &specular)
void textureScaleChanged(float textureScale)

詳細説明

フォンの照明効果は、アンビエント、ディフューズ、スペキュラの3つの照明コンポーネントの組み合わせに基づいています。これらのコンポーネントの相対的な強さは、RGBトリプレットとしてモデル化された反射率係数によって制御されます:

  • アンビエントは、他の光源がない場合に物体から発せられる色です。
  • ディフューズ(Diffuse)とは、ライトによる急激な表面反射に対して発せられる色です。
  • スペキュラ(Specular)とは、ライトによる光沢のある表面の反射に対して発せられる色です。
  • 表面の輝きは float プロパティで制御します。

このマテリアルは、シングル レンダー パス アプローチのエフェクトを使用し、フラグメントごとにライティングを実行します。テクニックはOpenGL 2、OpenGL 3以上、OpenGL ES 2用に提供されています。

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

alphaBlending : bool

diffuseプロパティから得られるアルファ情報をレンダリング時に考慮するかどうかを示します。デフォルトは false です。

アクセス関数

bool isAlphaBlendingEnabled() const
void setAlphaBlendingEnabled(bool enabled)

通知シグナル:

void alphaBlendingEnabledChanged(bool enabled)

ambient : QColor

他の光源がない場合にオブジェクトが発する周囲の色を保持します。

アクセス機能:

QColor ambient() const
void setAmbient(const QColor &ambient)

通知シグナル:

void ambientChanged(const QColor &ambient)

diffuse : QVariant

ライトによる粗い表面反射のために放出されるマテリアルの拡散カラーを保持します。これは、プレーンなカラー値またはテクスチャのいずれかになります。

アクセス関数:

QVariant diffuse() const
void setDiffuse(const QVariant &diffuse)

通知シグナル:

void diffuseChanged(const QVariant &diffuse)

normal : QVariant

マテリアルの現在の法線マップテクスチャを保持します。これはテクスチャのみで、それ以外は無視されます。デフォルトでは、このマップは設定されていません。

アクセス関数:

QVariant normal() const
void setNormal(const QVariant &normal)

通知シグナル:

void normalChanged(const QVariant &normal)

shininess : float

shininess指数を保持する。shininess の値が高いほど、ハイライトは小さく明るくなります。

デフォルトは150.0。

アクセス関数:

float shininess() const
void setShininess(float shininess)

通知シグナル:

void shininessChanged(float shininess)

specular : QVariant

マテリアルのスペキュラカラーを保持します。これは、プレーンなカラー値またはテクスチャのいずれかになります。

アクセス関数:

QVariant specular() const
void setSpecular(const QVariant &specular)

通知シグナル

void specularChanged(const QVariant &specular)

textureScale : float

現在のテクスチャスケールを保持します。レンダリング時にテクスチャ座標に乗数として適用されます。デフォルトは 1.0 です。

QTextureWrapMode::Repeatと組み合わせて使用すると、textureScaleは、サーフェス全体にテクスチャをタイル化する簡単な方法を提供します。例えば、4.0 のテクスチャスケールは、16 (4x4) のタイルになります。

アクセス関数

float textureScale() const
void setTextureScale(float textureScale)

通知シグナル

void textureScaleChanged(float textureScale)

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

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

親オブジェクトparent を持つ新しい QDiffuseSpecularMaterial インスタンスを構築します。

[virtual noexcept] QDiffuseSpecularMaterial::~QDiffuseSpecularMaterial()

QDiffuseSpecularMaterial を破壊する。

© 2025 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.