aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick3dphysics/qabstractcollisionshape_p.h
blob: 3de4595ad6566952139c07630f01909168bd4391 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef ABSTRACTCOLLISIONSHAPE_H
#define ABSTRACTCOLLISIONSHAPE_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 <QtQuick3DPhysics/qtquick3dphysicsglobal.h>
#include <QtQuick3D/private/qquick3dnode_p.h>
#include <QtQml/QQmlEngine>

namespace physx {
class PxGeometry;
}

QT_BEGIN_NAMESPACE

class Q_QUICK3DPHYSICS_EXPORT QAbstractCollisionShape : public QQuick3DNode
{
    Q_OBJECT
    Q_PROPERTY(bool enableDebugDraw READ enableDebugDraw WRITE setEnableDebugDraw NOTIFY
                       enableDebugDrawChanged)
    QML_NAMED_ELEMENT(CollisionShape)
    QML_UNCREATABLE("abstract interface")
public:
    explicit QAbstractCollisionShape(QQuick3DNode *parent = nullptr);
    virtual ~QAbstractCollisionShape();

    virtual physx::PxGeometry *getPhysXGeometry() = 0;
    bool enableDebugDraw() const;

    virtual bool isStaticShape() const = 0;

public slots:
    void setEnableDebugDraw(bool enableDebugDraw);

signals:
    void enableDebugDrawChanged(bool enableDebugDraw);
    void needsRebuild(QObject *);

protected:
    bool m_scaleDirty = true;
    QVector3D m_prevScale;

private slots:
    void handleScaleChange();

private:
    bool m_enableDebugDraw = false;
};

QT_END_NAMESPACE

#endif // ABSTRACTCOLLISIONSHAPE_H