1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
3 | #pragma once |
4 | |
5 | #include "BsPhysXPrerequisites.h" |
6 | #include "Physics/BsMeshCollider.h" |
7 | #include "PxPhysics.h" |
8 | |
9 | namespace bs |
10 | { |
11 | /** @addtogroup PhysX |
12 | * @{ |
13 | */ |
14 | |
15 | /** PhysX implementation of a MeshCollider. */ |
16 | class PhysXMeshCollider : public MeshCollider |
17 | { |
18 | public: |
19 | PhysXMeshCollider(physx::PxPhysics* physx, physx::PxScene* scene, const Vector3& position, |
20 | const Quaternion& rotation); |
21 | ~PhysXMeshCollider(); |
22 | |
23 | /** @copydoc MeshCollider::setScale */ |
24 | void setScale(const Vector3& scale) override; |
25 | |
26 | private: |
27 | /** Returns the PhysX collider implementation common to all colliders. */ |
28 | FPhysXCollider* getInternal() const; |
29 | |
30 | /** @copydoc MeshCollider::onMeshChanged */ |
31 | void onMeshChanged() override; |
32 | |
33 | /** Applies mesh geometry using the set mesh and scale. */ |
34 | void applyGeometry(); |
35 | |
36 | /** Sets new geometry to the underlying shape. Rebuilds the shape if necessary. */ |
37 | void setGeometry(const physx::PxGeometry& geometry); |
38 | }; |
39 | |
40 | /** @} */ |
41 | } |