QmlMaterial 0.1.0
Loading...
Searching...
No Matches
shadow_material.h
1#pragma once
2
3#include <QSGMaterial>
4
5namespace qml_material::sg
6{
7
8class ShadowMaterial : public QSGMaterial {
9public:
10 ShadowMaterial();
11 ~ShadowMaterial() = default;
12
13 QSGMaterialShader* createShader(QSGRendererInterface::RenderMode) const override;
14 QSGMaterialType* type() const override;
15 int compare(const QSGMaterial* other) const override;
16
18 void init_fadeoff_texture(QQuickWindow* win);
19 auto strength_texture() -> QSGTexture*;
20
21private:
22 // Not owned — the per-window texture cache owns the storage.
23 QSGTexture* m_fadeoff_texture { nullptr };
24};
25
26class ShadowShader : public QSGMaterialShader {
27public:
28 ShadowShader();
29
30 bool updateUniformData(QSGMaterialShader::RenderState& state, QSGMaterial* newMaterial,
31 QSGMaterial* oldMaterial) override;
32
33 void updateSampledImage(RenderState&, int binding, QSGTexture** texture,
34 QSGMaterial* newMaterial, QSGMaterial*) override;
35};
36
37} // namespace qml_material::sg