1// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef SCENE3DSGMATERIAL_H
5#define SCENE3DSGMATERIAL_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/QSGMaterial>
19#include <QtQuick/qsgtexture.h>
20
21#include <scene3dsgmaterialshader_p.h>
22
23QT_BEGIN_NAMESPACE
24
25namespace Qt3DRender {
26
27class Scene3DSGMaterial : public QSGMaterial
28{
29public:
30 Scene3DSGMaterial();
31
32 void setTexture(QSGTexture *texture)
33 {
34 m_texture = texture;
35 setFlag(flags: Blending, on: m_texture ? m_texture->hasAlphaChannel() : false);
36 }
37
38 QSGTexture *texture() const noexcept { return m_texture; }
39 QSGMaterialType *type() const final { return &Scene3DSGMaterialShader::type; }
40 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const final;
41
42 void show() { m_visible = true; }
43 bool visible() const { return m_visible; }
44
45private:
46 QSGTexture *m_texture;
47 bool m_visible;
48};
49
50} // namespace Qt3DRender
51
52QT_END_NAMESPACE
53
54#endif // SCENE3DSGMATERIAL_H
55

source code of qt3d/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h