16#ifndef QGSMETALROUGHMATERIAL_H
17#define QGSMETALROUGHMATERIAL_H
21#include <Qt3DRender/QMaterial>
32 class QAbstractTexture;
36 class QShaderProgramBuilder;
48class _3D_EXPORT QgsMetalRoughMaterial :
public Qt3DRender::QMaterial
56 explicit QgsMetalRoughMaterial( Qt3DCore::QNode *parent =
nullptr );
57 ~QgsMetalRoughMaterial()
override;
59 QVariant baseColor()
const;
60 QVariant metalness()
const;
61 QVariant roughness()
const;
62 QVariant ambientOcclusion()
const;
63 QVariant normal()
const;
64 float textureScale()
const;
73 bool flatShadingEnabled()
const;
76 void setBaseColor(
const QVariant &baseColor );
77 void setMetalness(
const QVariant &metalness );
78 void setRoughness(
const QVariant &roughness );
79 void setAmbientOcclusion(
const QVariant &ambientOcclusion );
80 void setNormal(
const QVariant &normal );
81 void setTextureScale(
float textureScale );
82 void setFlatShadingEnabled(
bool enabled );
85 void baseColorChanged(
const QVariant &baseColor );
86 void metalnessChanged(
const QVariant &metalness );
87 void roughnessChanged(
const QVariant &roughness );
88 void ambientOcclusionChanged(
const QVariant &ambientOcclusion );
89 void normalChanged(
const QVariant &normal );
90 void textureScaleChanged(
float textureScale );
95 void handleTextureScaleChanged(
const QVariant &var );
96 void updateFragmentShader();
98 Qt3DRender::QParameter *mBaseColorParameter =
nullptr;
99 Qt3DRender::QParameter *mMetalnessParameter =
nullptr;
100 Qt3DRender::QParameter *mRoughnessParameter =
nullptr;
101 Qt3DRender::QParameter *mBaseColorMapParameter =
nullptr;
102 Qt3DRender::QParameter *mMetalnessMapParameter =
nullptr;
103 Qt3DRender::QParameter *mRoughnessMapParameter =
nullptr;
104 Qt3DRender::QParameter *mAmbientOcclusionMapParameter =
nullptr;
105 Qt3DRender::QParameter *mNormalMapParameter =
nullptr;
106 Qt3DRender::QParameter *mTextureScaleParameter =
nullptr;
107 Qt3DRender::QEffect *mMetalRoughEffect =
nullptr;
108 Qt3DRender::QTechnique *mMetalRoughGL3Technique =
nullptr;
109 Qt3DRender::QRenderPass *mMetalRoughGL3RenderPass =
nullptr;
110 Qt3DRender::QShaderProgram *mMetalRoughGL3Shader =
nullptr;
111 Qt3DRender::QFilterKey *mFilterKey =
nullptr;
112 bool mUsingBaseColorMap =
false;
113 bool mUsingMetalnessMap =
false;
114 bool mUsingRoughnessMap =
false;
115 bool mUsingAmbientOcclusionMap =
false;
116 bool mUsingNormalMap =
false;
117 bool mFlatShading =
false;