diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2015-08-09 00:30:21 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-08-10 01:24:17 +0000 |
commit | 97263c5d8ebb6755191f4fac642ac9ea0eec3238 (patch) | |
tree | f26579264158e461f908e6e52b41157e7cfa91eb | |
parent | e98640c14d7b5ed800c7c16afc062a71a33fe813 (diff) |
Add QGeometryCollider C++ and QML types
Change-Id: I6f36f80f87770d5fc6e5a9be340ac84c8b12e8e1
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r-- | src/collision/collision.pri | 7 | ||||
-rw-r--r-- | src/collision/qgeometrycollider.cpp | 90 | ||||
-rw-r--r-- | src/collision/qgeometrycollider.h | 71 | ||||
-rw-r--r-- | src/collision/qgeometrycollider_p.h | 60 | ||||
-rw-r--r-- | src/quick3d/imports/collision/qt3dquick3dcollisionplugin.cpp | 2 |
5 files changed, 228 insertions, 2 deletions
diff --git a/src/collision/collision.pri b/src/collision/collision.pri index 4d5f8a35e..20f05ff7a 100644 --- a/src/collision/collision.pri +++ b/src/collision/collision.pri @@ -9,10 +9,13 @@ HEADERS += \ $$PWD/qboxcollider.h \ $$PWD/qboxcollider_p.h \ $$PWD/qcapsulecollider.h \ - $$PWD/qcapsulecollider_p.h + $$PWD/qcapsulecollider_p.h \ + $$PWD/qgeometrycollider.h \ + $$PWD/qgeometrycollider_p.h SOURCES += \ $$PWD/qcollisionaspect.cpp \ $$PWD/qspherecollider.cpp \ $$PWD/qboxcollider.cpp \ - $$PWD/qcapsulecollider.cpp + $$PWD/qcapsulecollider.cpp \ + $$PWD/qgeometrycollider.cpp diff --git a/src/collision/qgeometrycollider.cpp b/src/collision/qgeometrycollider.cpp new file mode 100644 index 000000000..e9414aedc --- /dev/null +++ b/src/collision/qgeometrycollider.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** 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 "qgeometrycollider.h" +#include "qgeometrycollider_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +/*! + \class Qt3D::QGeometryColliderPrivate + \internal +*/ +QGeometryColliderPrivate::QGeometryColliderPrivate() + : QComponentPrivate() +{ +} + +/*! + \class Qt3D::QGeometryCollider + \inmodule Qt3DCollision + \since 5.5 + \brief Represents a geometric mesh used for collision detection +*/ + +/*! + \qmltype GeometryCollider + \inqmlmodule Qt3D.Collision + \instantiates Qt3D::QGeometryCollider + \inherits Component3D + \since 5.5 +*/ + +/*! + Constructs a new QGeometryCollider instance with parent \a parent. + */ +QGeometryCollider::QGeometryCollider(QNode *parent) + : QComponent(*new QGeometryColliderPrivate, parent) +{ +} + +/*! \internal */ +QGeometryCollider::QGeometryCollider(QGeometryColliderPrivate &dd, QNode *parent) + : QComponent(dd, parent) +{ +} + +QGeometryCollider::~QGeometryCollider() +{ + QNode::cleanup(); +} + +QT_END_NAMESPACE + +} // namespace Qt3D + diff --git a/src/collision/qgeometrycollider.h b/src/collision/qgeometrycollider.h new file mode 100644 index 000000000..1d5fa0a8f --- /dev/null +++ b/src/collision/qgeometrycollider.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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 QT3D_QGEOMETRYCOLLIDER_H +#define QT3D_QGEOMETRYCOLLIDER_H + +#include <QComponent> +#include <Qt3DCollision/qt3dcollision_global.h> +#include <QtGui/qvector3d.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QGeometryColliderPrivate; + +class QT3DCOLLISIONSHARED_EXPORT QGeometryCollider : public QComponent +{ + Q_OBJECT + // TODO: Add QAbstractGeometry * property to hold the mesh data. Can we reuse functors from render aspect? + +public: + explicit QGeometryCollider(QNode *parent = 0); + ~QGeometryCollider(); + +protected: + QGeometryCollider(QGeometryColliderPrivate &dd, QNode *parent = 0); + +private: + Q_DECLARE_PRIVATE(QGeometryCollider) + QT3D_CLONEABLE(QGeometryCollider) +}; + +} // namespace Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_QGEOMETRYCOLLIDER_H diff --git a/src/collision/qgeometrycollider_p.h b/src/collision/qgeometrycollider_p.h new file mode 100644 index 000000000..979d5e5bd --- /dev/null +++ b/src/collision/qgeometrycollider_p.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** 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 QT3D_QGEOMETRYCOLLIDER_P_H +#define QT3D_QGEOMETRYCOLLIDER_P_H + +#include <Qt3DCore/private/qcomponent_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QGeometryCollider; + +class QGeometryColliderPrivate : public QComponentPrivate +{ + QGeometryColliderPrivate(); + + Q_DECLARE_PUBLIC(QGeometryCollider) +}; + +} // namespace Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_QGEOMETRYCOLLIDER_P_H + diff --git a/src/quick3d/imports/collision/qt3dquick3dcollisionplugin.cpp b/src/quick3d/imports/collision/qt3dquick3dcollisionplugin.cpp index 931a3db3e..214cfa292 100644 --- a/src/quick3d/imports/collision/qt3dquick3dcollisionplugin.cpp +++ b/src/quick3d/imports/collision/qt3dquick3dcollisionplugin.cpp @@ -37,6 +37,7 @@ #include <QtQml> #include <Qt3DCollision/qboxcollider.h> #include <Qt3DCollision/qcapsulecollider.h> +#include <Qt3DCollision/qgeometrycollider.h> #include <Qt3DCollision/qspherecollider.h> #include "qt3dquick3dcollisionplugin.h" @@ -46,6 +47,7 @@ void Qt3DQuick3DCollisionPlugin::registerTypes(const char *uri) { qmlRegisterType<Qt3D::QBoxCollider>(uri, 2, 0, "BoxCollider"); qmlRegisterType<Qt3D::QCapsuleCollider>(uri, 2, 0, "CapsuleCollider"); + qmlRegisterType<Qt3D::QGeometryCollider>(uri, 2, 0, "GeometryCollider"); qmlRegisterType<Qt3D::QSphereCollider>(uri, 2, 0, "SphereCollider"); } |