summaryrefslogtreecommitdiffstats
path: root/src/render/jobs
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-11-17 09:16:03 +0100
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-11-24 15:01:25 +0000
commitcf3771abcac373b8e4fbca3682a91d0195b7446d (patch)
tree38cfff362de69743aebb8862fe9ed48cf0ab1bbe /src/render/jobs
parent6150e8ebe31ed0bfc2604cb35118a4e4ceff0fb9 (diff)
CalcGeometryTriangleVolumes: retrieve triangles from a GeometryRenderer
Change-Id: I074aa540e88a5772542a08263266429fc6be9ae4 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/render/jobs')
-rw-r--r--src/render/jobs/calcgeometrytrianglevolumes.cpp66
-rw-r--r--src/render/jobs/calcgeometrytrianglevolumes_p.h83
-rw-r--r--src/render/jobs/jobs.pri6
3 files changed, 153 insertions, 2 deletions
diff --git a/src/render/jobs/calcgeometrytrianglevolumes.cpp b/src/render/jobs/calcgeometrytrianglevolumes.cpp
new file mode 100644
index 000000000..77b3c362a
--- /dev/null
+++ b/src/render/jobs/calcgeometrytrianglevolumes.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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$
+**
+****************************************************************************/
+
+#include "calcgeometrytrianglevolumes_p.h"
+#include <Qt3DRender/private/trianglesextractor_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
+#include <Qt3DRender/private/geometryrenderermanager_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+CalcGeometryTriangleVolumes::CalcGeometryTriangleVolumes(const Qt3DCore::QNodeId geometryRendererId, NodeManagers *manager)
+ : Qt3DCore::QAspectJob()
+ , m_geometryRendererId(geometryRendererId)
+ , m_manager(manager)
+{
+}
+
+void CalcGeometryTriangleVolumes::run()
+{
+ GeometryRenderer *renderer = m_manager->geometryRendererManager()->lookupResource(m_geometryRendererId);
+ if (renderer != Q_NULLPTR) {
+ TrianglesExtractor extractor(renderer, m_manager);
+ renderer->setTriangleVolumes(extractor.extract(m_geometryRendererId));
+ }
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/jobs/calcgeometrytrianglevolumes_p.h b/src/render/jobs/calcgeometrytrianglevolumes_p.h
new file mode 100644
index 000000000..552f79c05
--- /dev/null
+++ b/src/render/jobs/calcgeometrytrianglevolumes_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 QT3DRENDER_RENDER_ALCGEOMETRYTRIANGLEVOLUMES_P_H
+#define QT3DRENDER_RENDER_CALCGEOMETRYTRIANGLEVOLUMES_P_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 <Qt3DCore/qaspectjob.h>
+#include <Qt3DCore/qnodeid.h>
+#include <QSharedPointer>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+class Geometry;
+class NodeManagers;
+
+class Q_AUTOTEST_EXPORT CalcGeometryTriangleVolumes : public Qt3DCore::QAspectJob
+{
+public:
+ explicit CalcGeometryTriangleVolumes(const Qt3DCore::QNodeId geometryRendererId, NodeManagers *manager);
+
+protected:
+ void run() Q_DECL_OVERRIDE;
+
+private:
+ Qt3DCore::QNodeId m_geometryRendererId;
+ NodeManagers *m_manager;
+};
+
+typedef QSharedPointer<CalcGeometryTriangleVolumes> CalcGeometryTriangleVolumesPtr;
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_CALCGEOMETRYTRIANGLEVOLUMES_P_H
diff --git a/src/render/jobs/jobs.pri b/src/render/jobs/jobs.pri
index 424de25f5..f79cd64e3 100644
--- a/src/render/jobs/jobs.pri
+++ b/src/render/jobs/jobs.pri
@@ -12,7 +12,8 @@ HEADERS += \
$$PWD/loadbufferjob_p.h \
$$PWD/loadgeometryjob_p.h \
$$PWD/calcboundingvolumejob_p.h \
- $$PWD/pickboundingvolumejob_p.h
+ $$PWD/pickboundingvolumejob_p.h \
+ $$PWD/calcgeometrytrianglevolumes_p.h
SOURCES += \
$$PWD/updateworldtransformjob.cpp \
@@ -26,4 +27,5 @@ SOURCES += \
$$PWD/loadbufferjob.cpp \
$$PWD/loadgeometryjob.cpp \
$$PWD/calcboundingvolumejob.cpp \
- $$PWD/pickboundingvolumejob.cpp
+ $$PWD/pickboundingvolumejob.cpp \
+ $$PWD/calcgeometrytrianglevolumes.cpp