Skip to content

Commit 8492f88

Browse files
Refactor setting the profiler in CollisionBody and RigidBody
1 parent 1ab72e2 commit 8492f88

File tree

4 files changed

+19
-36
lines changed

4 files changed

+19
-36
lines changed

include/reactphysics3d/body/CollisionBody.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,6 @@ RP3D_FORCE_INLINE Entity CollisionBody::getEntity() const {
190190
return mEntity;
191191
}
192192

193-
#ifdef IS_RP3D_PROFILING_ENABLED
194-
195-
// Set the profiler
196-
RP3D_FORCE_INLINE void CollisionBody::setProfiler(Profiler* profiler) {
197-
mProfiler = profiler;
198-
}
199-
200-
#endif
201-
202193
}
203194

204195
#endif

include/reactphysics3d/body/RigidBody.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,6 @@ class RigidBody : public CollisionBody {
219219
/// Remove a collider from the body
220220
virtual void removeCollider(Collider* collider) override;
221221

222-
#ifdef IS_RP3D_PROFILING_ENABLED
223-
224-
/// Set the profiler
225-
void setProfiler(Profiler* profiler) override;
226-
227-
#endif
228-
229222
// -------------------- Friendship -------------------- //
230223

231224
friend class PhysicsWorld;

src/body/CollisionBody.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,3 +465,22 @@ Vector3 CollisionBody::getLocalPoint(const Vector3& worldPoint) const {
465465
Vector3 CollisionBody::getLocalVector(const Vector3& worldVector) const {
466466
return mWorld.mTransformComponents.getTransform(mEntity).getOrientation().getInverse() * worldVector;
467467
}
468+
469+
#ifdef IS_RP3D_PROFILING_ENABLED
470+
471+
// Set the profiler
472+
void CollisionBody::setProfiler(Profiler* profiler) {
473+
474+
mProfiler = profiler;
475+
476+
// Set the profiler for each collider
477+
const Array<Entity>& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity);
478+
for (uint32 i=0; i < colliderEntities.size(); i++) {
479+
480+
Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]);
481+
482+
collider->setProfiler(profiler);
483+
}
484+
}
485+
486+
#endif

src/body/RigidBody.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,23 +1088,3 @@ void RigidBody::setIsActive(bool isActive) {
10881088

10891089
CollisionBody::setIsActive(isActive);
10901090
}
1091-
1092-
#ifdef IS_RP3D_PROFILING_ENABLED
1093-
1094-
1095-
// Set the profiler
1096-
void RigidBody::setProfiler(Profiler* profiler) {
1097-
1098-
CollisionBody::setProfiler(profiler);
1099-
1100-
// Set the profiler for each collider
1101-
const Array<Entity>& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity);
1102-
for (uint32 i=0; i < colliderEntities.size(); i++) {
1103-
1104-
Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]);
1105-
1106-
collider->setProfiler(profiler);
1107-
}
1108-
}
1109-
1110-
#endif

0 commit comments

Comments
 (0)