diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2016-01-18 18:32:22 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-01-18 23:28:50 +0000 |
commit | 550a9173f56c2c4a536f2003c232fb5f2b04a158 (patch) | |
tree | 4355e86a9b5b037a0b6294c169bbf311f6bc29c1 /src/quick3d/imports/scene3d/scene3dsgmaterial_p.h | |
parent | ce8e5ed4a6b2c4b1e1b26a33b74e92c3edc8bfd1 (diff) |
Refactor the scene3d classes into one class per pair of files
No functional changes.
Change-Id: I5895e3bcaf65fb7524e6adb10bca1f8c6fdb6c44
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/quick3d/imports/scene3d/scene3dsgmaterial_p.h')
-rw-r--r-- | src/quick3d/imports/scene3d/scene3dsgmaterial_p.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h b/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h new file mode 100644 index 000000000..2a968337d --- /dev/null +++ b/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SCENE3DSGMATERIAL_H +#define SCENE3DSGMATERIAL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuick/QSGMaterial> +#include "scene3dsgmaterialshader_p.h" + +#include <QtQuick/qsgtexture.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +class Scene3DSGMaterial : public QSGMaterial +{ +public: + Scene3DSGMaterial(); + + void setTexture(QSGTexture *texture) Q_DECL_NOEXCEPT + { + m_texture = texture; + setFlag(Blending, m_texture ? m_texture->hasAlphaChannel() : false); + } + + QSGTexture *texture() const Q_DECL_NOEXCEPT { return m_texture; } + QSGMaterialType *type() const Q_DECL_FINAL { return &Scene3DSGMaterialShader::type; } + QSGMaterialShader *createShader() const Q_DECL_FINAL { return new Scene3DSGMaterialShader(); } + +private: + QSGTexture *m_texture; +}; + +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // SCENE3DSGMATERIAL_H |