summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvenn-Arne Dragly <s@dragly.com>2018-10-31 14:33:39 +0100
committerAndy Nichols <andy.nichols@qt.io>2018-11-09 09:03:13 +0000
commitc6899dc93c9a1e93663128bd6155da75ade434dc (patch)
treec18b7170d1ab44ac5e6ef40447d47d610f8b6ed7
parentc80f912d6f2d39c5ede167f765037dd0bfeb63d9 (diff)
Dragon: Reduce the number of texture-related includes
- Move TextureProperties and TextureParameters into a separate file. - Reduce the number of #include's by adding forward declarations. - Remove mis-placed LoadedTexture in wrong namespace. Change-Id: I119cbaecf977dcba7fcdc5eb504bfa75829bf2a0 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--src/runtime/dragon/dragon.pri3
-rw-r--r--src/runtime/dragon/dragonactivatedsurface.cpp4
-rw-r--r--src/runtime/dragon/dragongltexture.cpp1
-rw-r--r--src/runtime/dragon/dragongltexture_p.h5
-rw-r--r--src/runtime/dragon/dragonrenderer_p.h8
-rw-r--r--src/runtime/dragon/dragontexture_p.h59
-rw-r--r--src/runtime/dragon/dragontextureproperties_p.h109
-rw-r--r--src/runtime/dragon/renderer/dragondraw.cpp1
8 files changed, 127 insertions, 63 deletions
diff --git a/src/runtime/dragon/dragon.pri b/src/runtime/dragon/dragon.pri
index 476269b..3df6856 100644
--- a/src/runtime/dragon/dragon.pri
+++ b/src/runtime/dragon/dragon.pri
@@ -45,7 +45,8 @@ HEADERS += \
$$PWD/dragonstringtoint_p.h \
$$PWD/dragonimmutable_p.h \
$$PWD/dragonmutable_p.h \
- $$PWD/dragoncomparegenerators_p.h
+ $$PWD/dragoncomparegenerators_p.h \
+ $$PWD/dragontextureproperties_p.h
SOURCES += \
$$PWD/dragonattachmentpack.cpp \
diff --git a/src/runtime/dragon/dragonactivatedsurface.cpp b/src/runtime/dragon/dragonactivatedsurface.cpp
index 7086f45..2d79a94 100644
--- a/src/runtime/dragon/dragonactivatedsurface.cpp
+++ b/src/runtime/dragon/dragonactivatedsurface.cpp
@@ -39,6 +39,7 @@
#include <private/dragonrenderview_p.h>
#include <private/dragonrendertarget_p.h>
#include <private/dragonblitframebuffer_p.h>
+#include <private/dragontexture_p.h>
// GL types
#include <private/dragonglbuffer_p.h>
@@ -59,11 +60,10 @@
#include <private/dragongraphicshelperes2_p.h>
#include <private/dragongraphicshelperes3_2_p.h>
#include <private/dragongraphicshelperes3_p.h>
+#include <private/dragongraphicshelperinterface_p.h>
// Qt3DRender::Render
-#include <private/dragongraphicshelperinterface_p.h>
#include <Qt3DRender/private/platformsurfacefilter_p.h>
-//#include <private/dragonattachmentpack_p.h>
#include <Qt3DCore/QNodeId>
diff --git a/src/runtime/dragon/dragongltexture.cpp b/src/runtime/dragon/dragongltexture.cpp
index 7abfdc9..2245b34 100644
--- a/src/runtime/dragon/dragongltexture.cpp
+++ b/src/runtime/dragon/dragongltexture.cpp
@@ -31,6 +31,7 @@
#include "dragongltexture_p.h"
#include <private/dragontextureimage_p.h>
+#include <private/dragontexture_p.h>
#include <QOpenGLContext>
#include <QOpenGLPixelTransferOptions>
diff --git a/src/runtime/dragon/dragongltexture_p.h b/src/runtime/dragon/dragongltexture_p.h
index a490db9..48a20fa 100644
--- a/src/runtime/dragon/dragongltexture_p.h
+++ b/src/runtime/dragon/dragongltexture_p.h
@@ -44,7 +44,8 @@
#include <Qt3DRender/QAbstractTexture>
-#include <private/dragontexture_p.h>
+#include <private/dragonimmutable_p.h>
+#include <private/dragontextureproperties_p.h>
QT_BEGIN_NAMESPACE
@@ -53,6 +54,8 @@ class QOpenGLContext;
namespace Qt3DRender {
namespace Dragon {
+struct LoadedTexture;
+
// TODO move to separate file
struct GLTexture
{
diff --git a/src/runtime/dragon/dragonrenderer_p.h b/src/runtime/dragon/dragonrenderer_p.h
index 092694d..446fef7 100644
--- a/src/runtime/dragon/dragonrenderer_p.h
+++ b/src/runtime/dragon/dragonrenderer_p.h
@@ -48,11 +48,8 @@
#include <private/dragontexturejobs_p.h>
//
-#include <private/dragonglbuffer_p.h>
-#include <private/dragonglshader_p.h>
#include <private/dragonoffscreensurfacehelper_p.h>
#include <private/dragonopenglvertexarrayobject_p.h>
-#include <private/dragontexture_p.h>
#include <QAtomicInt>
#include <QElapsedTimer>
@@ -74,9 +71,6 @@ class SubmissionContext;
// runs?
class ShaderCache;
-// TODO does this belong in this namespace?
-class LoadedTexture;
-
// TODO do we need the VSyncFrameAdvanceService?
class VSyncFrameAdvanceService;
@@ -86,6 +80,8 @@ class VSyncFrameAdvanceService;
namespace Dragon {
// renderer.h
+struct GLBuffer;
+struct GLShader;
struct GLTexture;
class Renderer;
class GraphicsHelperInterface;
diff --git a/src/runtime/dragon/dragontexture_p.h b/src/runtime/dragon/dragontexture_p.h
index f55d6c3..0a2c48c 100644
--- a/src/runtime/dragon/dragontexture_p.h
+++ b/src/runtime/dragon/dragontexture_p.h
@@ -44,10 +44,12 @@
#include "dragonbackendnode_p.h"
-#include <Qt3DRender/qabstracttexture.h>
-#include <Qt3DRender/qtexturewrapmode.h>
+#include <private/dragonimmutable_p.h>
+#include <private/dragontextureproperties_p.h>
+#include <Qt3DRender/qabstracttexture.h>
#include <Qt3DRender/qtexturedata.h>
+#include <Qt3DRender/qtexturewrapmode.h>
#include <private/q3dsruntimeglobal_p.h>
@@ -61,57 +63,6 @@ namespace Dragon {
struct LoadedTextureImage;
-/**
- * General, constant properties of a texture
- */
-struct TextureProperties
-{
- int width = 1;
- int height = 1;
- int depth = 1;
- int layers = 1;
- int mipLevels = 1;
- int samples = 1;
- QAbstractTexture::Target target = QAbstractTexture::Target2D;
- QAbstractTexture::TextureFormat format = QAbstractTexture::RGBA8_UNorm;
- bool generateMipMaps = false;
-
- bool operator==(const TextureProperties &o) const
- {
- return (width == o.width) && (height == o.height) && (depth == o.depth)
- && (layers == o.layers) && (mipLevels == o.mipLevels) && (target == o.target)
- && (format == o.format) && (generateMipMaps == o.generateMipMaps)
- && (samples == o.samples);
- }
- inline bool operator!=(const TextureProperties &o) const { return !(*this == o); }
-};
-
-/**
- * Texture parameters that are independent of texture data and that may
- * change without the re-uploading the texture
- */
-struct TextureParameters
-{
- QAbstractTexture::Filter magnificationFilter = QAbstractTexture::Nearest;
- QAbstractTexture::Filter minificationFilter = QAbstractTexture::Nearest;
- QTextureWrapMode::WrapMode wrapModeX = QTextureWrapMode::ClampToEdge;
- QTextureWrapMode::WrapMode wrapModeY = QTextureWrapMode::ClampToEdge;
- QTextureWrapMode::WrapMode wrapModeZ = QTextureWrapMode::ClampToEdge;
- float maximumAnisotropy = 1.0f;
- QAbstractTexture::ComparisonFunction comparisonFunction = QAbstractTexture::CompareLessEqual;
- QAbstractTexture::ComparisonMode comparisonMode = QAbstractTexture::CompareNone;
-
- bool operator==(const TextureParameters &o) const
- {
- return (magnificationFilter == o.magnificationFilter)
- && (minificationFilter == o.minificationFilter) && (wrapModeX == o.wrapModeX)
- && (wrapModeY == o.wrapModeY) && (wrapModeZ == o.wrapModeZ)
- && qFuzzyCompare(maximumAnisotropy, o.maximumAnisotropy)
- && (comparisonFunction == o.comparisonFunction) && (comparisonMode == o.comparisonMode);
- }
- inline bool operator!=(const TextureParameters &o) const { return !(*this == o); }
-};
-
class Q3DSV_PRIVATE_EXPORT Texture : public BackendNode
{
public:
@@ -124,6 +75,8 @@ public:
};
Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag)
+ virtual ~Texture() = default;
+
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override;
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) final;
void addDirtyFlag(DirtyFlags flags);
diff --git a/src/runtime/dragon/dragontextureproperties_p.h b/src/runtime/dragon/dragontextureproperties_p.h
new file mode 100644
index 0000000..07e65c1
--- /dev/null
+++ b/src/runtime/dragon/dragontextureproperties_p.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_DRAGON_TEXTUREPROPERTIES_H
+#define QT3DRENDER_DRAGON_TEXTUREPROPERTIES_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/qabstracttexture.h>
+#include <Qt3DRender/qtexturewrapmode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Dragon {
+
+/**
+ * General, constant properties of a texture
+ */
+struct TextureProperties
+{
+ int width = 1;
+ int height = 1;
+ int depth = 1;
+ int layers = 1;
+ int mipLevels = 1;
+ int samples = 1;
+ QAbstractTexture::Target target = QAbstractTexture::Target2D;
+ QAbstractTexture::TextureFormat format = QAbstractTexture::RGBA8_UNorm;
+ bool generateMipMaps = false;
+
+ bool operator==(const TextureProperties &o) const
+ {
+ return (width == o.width) && (height == o.height) && (depth == o.depth)
+ && (layers == o.layers) && (mipLevels == o.mipLevels) && (target == o.target)
+ && (format == o.format) && (generateMipMaps == o.generateMipMaps)
+ && (samples == o.samples);
+ }
+ inline bool operator!=(const TextureProperties &o) const { return !(*this == o); }
+};
+
+/**
+ * Texture parameters that are independent of texture data and that may
+ * change without the re-uploading the texture
+ */
+struct TextureParameters
+{
+ QAbstractTexture::Filter magnificationFilter = QAbstractTexture::Nearest;
+ QAbstractTexture::Filter minificationFilter = QAbstractTexture::Nearest;
+ QTextureWrapMode::WrapMode wrapModeX = QTextureWrapMode::ClampToEdge;
+ QTextureWrapMode::WrapMode wrapModeY = QTextureWrapMode::ClampToEdge;
+ QTextureWrapMode::WrapMode wrapModeZ = QTextureWrapMode::ClampToEdge;
+ float maximumAnisotropy = 1.0f;
+ QAbstractTexture::ComparisonFunction comparisonFunction = QAbstractTexture::CompareLessEqual;
+ QAbstractTexture::ComparisonMode comparisonMode = QAbstractTexture::CompareNone;
+
+ bool operator==(const TextureParameters &o) const
+ {
+ return (magnificationFilter == o.magnificationFilter)
+ && (minificationFilter == o.minificationFilter) && (wrapModeX == o.wrapModeX)
+ && (wrapModeY == o.wrapModeY) && (wrapModeZ == o.wrapModeZ)
+ && qFuzzyCompare(maximumAnisotropy, o.maximumAnisotropy)
+ && (comparisonFunction == o.comparisonFunction) && (comparisonMode == o.comparisonMode);
+ }
+ inline bool operator!=(const TextureParameters &o) const { return !(*this == o); }
+};
+
+} // namespace Dragon
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_DRAGON_TEXTUREPROPERTIES_H
diff --git a/src/runtime/dragon/renderer/dragondraw.cpp b/src/runtime/dragon/renderer/dragondraw.cpp
index 7a64c79..38ca6a8 100644
--- a/src/runtime/dragon/renderer/dragondraw.cpp
+++ b/src/runtime/dragon/renderer/dragondraw.cpp
@@ -36,6 +36,7 @@
#include <private/dragongeometryrenderer_p.h>
#include <private/dragonparameter_p.h>
#include <private/dragonrenderview_p.h>
+#include <private/dragontexture_p.h>
#include <private/dragonglbuffer_p.h>
#include <private/dragonglshader_p.h>