4#ifndef HEIGHTFIELDMESHSHAPE_H
5#define HEIGHTFIELDMESHSHAPE_H
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>
29class PxTriangleMeshGeometry;
30class PxHeightFieldGeometry;
32struct PxHeightFieldSample;
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)
50 physx::PxGeometry *getPhysXGeometry() override;
52 Q_REVISION(6, 5)
const QUrl &source()
const;
53 Q_REVISION(6, 5)
void setSource(
const QUrl &newSource);
55 const QVector3D &hfOffset()
const {
return m_hfOffset; }
57 const QVector3D &extents()
const;
58 void setExtents(
const QVector3D &newExtents);
59 bool isStaticShape()
const override {
return true; }
61 Q_REVISION(6, 7) QQuickImage *image()
const;
62 Q_REVISION(6, 7)
void setImage(QQuickImage *newImage);
65 Q_REVISION(6, 5)
void sourceChanged();
66 void extentsChanged();
67 Q_REVISION(6, 7)
void imageChanged();
70 void imageDestroyed(QObject *image);
71 void imageGeometryChanged();
74 void updatePhysXGeometry();
78 QQuick3DPhysicsHeightField *m_heightField =
nullptr;
80 physx::PxHeightFieldGeometry *m_heightFieldGeometry =
nullptr;
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;
QAbstractPhysicsNode * frontendNode
bool filtersDirty() const
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
SimulationEventCallback * callback
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.
static QT_BEGIN_NAMESPACE physx::PxTransform getPhysXLocalTransform(const QQuick3DNode *node)
#define QT_BEGIN_NAMESPACE
static StaticPhysXObjects & getReference()