Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qheightfieldshape_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef HEIGHTFIELDMESHSHAPE_H
5#define HEIGHTFIELDMESHSHAPE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3DPhysics/qtquick3dphysicsglobal.h>
19#include <QtQuick3DPhysics/private/qabstractcollisionshape_p.h>
20#include <QtCore/QObject>
21#include <QtGui/QVector3D>
22#include <QtQml/QQmlEngine>
23#include <QtQuick3D/QQuick3DGeometry>
24#include <QtQuick/private/qquickimage_p.h>
25
26namespace physx {
27class PxBoxGeometry;
28class PxTriangleMesh;
29class PxTriangleMeshGeometry;
30class PxHeightFieldGeometry;
31class PxHeightField;
32struct PxHeightFieldSample;
33}
34
36
38
39class Q_QUICK3DPHYSICS_EXPORT QHeightFieldShape : public QAbstractCollisionShape
40{
41 Q_OBJECT
42 Q_PROPERTY(QVector3D extents READ extents WRITE setExtents NOTIFY extentsChanged)
43 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged REVISION(6, 5))
44 Q_PROPERTY(QQuickImage *image READ image WRITE setImage NOTIFY imageChanged REVISION(6, 7))
45 QML_NAMED_ELEMENT(HeightFieldShape)
46public:
47 QHeightFieldShape();
48 ~QHeightFieldShape();
49
50 physx::PxGeometry *getPhysXGeometry() override;
51
52 Q_REVISION(6, 5) const QUrl &source() const;
53 Q_REVISION(6, 5) void setSource(const QUrl &newSource);
54
55 const QVector3D &hfOffset() const { return m_hfOffset; }
56
57 const QVector3D &extents() const;
58 void setExtents(const QVector3D &newExtents);
59 bool isStaticShape() const override { return true; }
60
61 Q_REVISION(6, 7) QQuickImage *image() const;
62 Q_REVISION(6, 7) void setImage(QQuickImage *newImage);
63
64signals:
65 Q_REVISION(6, 5) void sourceChanged();
66 void extentsChanged();
67 Q_REVISION(6, 7) void imageChanged();
68
69private slots:
70 void imageDestroyed(QObject *image);
71 void imageGeometryChanged();
72
73private:
74 void updatePhysXGeometry();
75 void getSamples();
76 void updateExtents();
77
78 QQuick3DPhysicsHeightField *m_heightField = nullptr;
79
80 physx::PxHeightFieldGeometry *m_heightFieldGeometry = nullptr;
81 QVector3D m_hfOffset;
82 QUrl m_heightMapSource;
83 bool m_dirtyPhysx = false;
84 QVector3D m_extents = { 100, 100, 100 };
85 bool m_extentsSetExplicitly = false;
86 QQuickImage *m_image = nullptr;
87};
88
90
91#endif // HEIGHTFIELDMESHSHAPE_H
QAbstractPhysicsNode * frontendNode
virtual void cleanup(QPhysXWorld *)
physx::PxMaterial * material
QAbstractPhysXNode(QAbstractPhysicsNode *node)
void setShapesDirty(bool dirty)
void setFiltersDirty(bool dirty)
virtual void createMaterial(QPhysXWorld *physX)
void simulationEnabledChanged()
Q_REVISION(6, 7) bool simulationEnabled() const
void setPhysicsMaterial(QPhysicsMaterial *newPhysicsMaterial)
QPhysicsMaterial * physicsMaterial() const
void markDirtyShapes() override
void buildShapes(QPhysXWorld *physX)
void rebuildDirtyShapes(QPhysicsWorld *world, QPhysXWorld *physX) override
void init(QPhysicsWorld *world, QPhysXWorld *physX) override
bool debugGeometryCapability() override
QPhysXActorBody(QAbstractPhysicsNode *frontEnd)
void cleanup(QPhysXWorld *physX) override
physx::PxRigidActor * actor
virtual void createActor(QPhysXWorld *physX)
void sync(float deltaTime, QHash< QQuick3DNode *, QMatrix4x4 > &transformCache) override
void updateFilters() override
physx::PxTransform getGlobalPose() override
void createWorld()
SimulationEventCallback * callback
void deleteWorld()
physx::PxScene * scene
void createScene(float typicalLength, float typicalSpeed, const QVector3D &gravity, bool enableCCD, QPhysicsWorld *physicsWorld, unsigned int numThreads)
physx::PxControllerManager * controllerManager
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
#define PHYSX_RELEASE(x)
static QT_BEGIN_NAMESPACE physx::PxTransform getPhysXLocalTransform(const QQuick3DNode *node)
#define QT_BEGIN_NAMESPACE
#define QT_END_NAMESPACE
static StaticPhysXObjects & getReference()