Changeset View
Changeset View
Standalone View
Standalone View
src/scenegraph/shadowedtexturematerial.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl> | ||||
3 | * | ||||
4 | * SPDX-License-Identifier: LGPL-2.0-or-later | ||||
5 | */ | ||||
6 | | ||||
7 | #pragma once | ||||
8 | | ||||
9 | #include <QSGTexture> | ||||
10 | | ||||
11 | #include "shadowedrectanglematerial.h" | ||||
12 | | ||||
13 | /** | ||||
14 | * A material rendering a rectangle with a shadow. | ||||
15 | * | ||||
16 | * This material uses a distance field shader to render a rectangle with a | ||||
17 | * shadow below it, optionally with rounded corners. | ||||
18 | */ | ||||
19 | class ShadowedTextureMaterial : public ShadowedRectangleMaterial | ||||
20 | { | ||||
21 | public: | ||||
22 | ShadowedTextureMaterial(); | ||||
23 | | ||||
24 | QSGMaterialShader* createShader() const override; | ||||
25 | QSGMaterialType* type() const override; | ||||
26 | int compare(const QSGMaterial* other) const override; | ||||
27 | | ||||
28 | QSGTexture *textureSource = nullptr; | ||||
29 | | ||||
30 | static QSGMaterialType staticType; | ||||
31 | }; | ||||
32 | | ||||
33 | class ShadowedTextureShader : public ShadowedRectangleShader | ||||
34 | { | ||||
35 | public: | ||||
36 | ShadowedTextureShader(); | ||||
37 | | ||||
38 | void initialize() override; | ||||
39 | void updateState(const QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; | ||||
40 | }; |