File indexing completed on 2024-04-28 03:56:00

0001 /*
0002  *  SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QSGTexture>
0010 
0011 #include "shadowedrectanglematerial.h"
0012 
0013 /**
0014  * A material rendering a rectangle with a shadow.
0015  *
0016  * This material uses a distance field shader to render a rectangle with a
0017  * shadow below it, optionally with rounded corners.
0018  */
0019 class ShadowedTextureMaterial : public ShadowedRectangleMaterial
0020 {
0021 public:
0022     ShadowedTextureMaterial();
0023 
0024     QSGMaterialShader *createShader(QSGRendererInterface::RenderMode) const override;
0025     QSGMaterialType *type() const override;
0026     int compare(const QSGMaterial *other) const override;
0027 
0028     QSGTexture *textureSource = nullptr;
0029 
0030     static QSGMaterialType staticType;
0031 };
0032 
0033 class ShadowedTextureShader : public ShadowedRectangleShader
0034 {
0035 public:
0036     ShadowedTextureShader(ShadowedRectangleMaterial::ShaderType shaderType);
0037 
0038     void
0039     updateSampledImage(QSGMaterialShader::RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
0040 };