diff --git a/src/engine/CollisionWorld.cpp b/src/engine/CollisionWorld.cpp index d9b5f258..04cf252f 100644 --- a/src/engine/CollisionWorld.cpp +++ b/src/engine/CollisionWorld.cpp @@ -39,7 +39,7 @@ uint CollisionWorld::mNbWorlds = 0; CollisionWorld::CollisionWorld(const WorldSettings& worldSettings, Logger* logger, Profiler* profiler) : mConfig(worldSettings), mCollisionDetection(this, mMemoryManager), mBodies(mMemoryManager.getPoolAllocator()), mCurrentBodyId(0), mFreeBodiesIds(mMemoryManager.getPoolAllocator()), mEventListener(nullptr), mName(worldSettings.worldName), - mProfiler(profiler), mLogger(logger), mIsProfilerCreatedByUser(profiler != nullptr), + mIsProfilerCreatedByUser(profiler != nullptr), mIsLoggerCreatedByUser(logger != nullptr) { // Automatically generate a name for the world @@ -57,6 +57,8 @@ CollisionWorld::CollisionWorld(const WorldSettings& worldSettings, Logger* logge #ifdef IS_PROFILING_ACTIVE + mProfiler = profiler; + // If the user has not provided its own profiler, we create one if (mProfiler == nullptr) { @@ -74,6 +76,8 @@ CollisionWorld::CollisionWorld(const WorldSettings& worldSettings, Logger* logge #ifdef IS_LOGGING_ACTIVE + mLogger = logger; + // If the user has not provided its own logger, we create one if (mLogger == nullptr) { diff --git a/src/utils/Logger.h b/src/utils/Logger.h index 879909c7..0e7bb27d 100644 --- a/src/utils/Logger.h +++ b/src/utils/Logger.h @@ -463,7 +463,7 @@ class Logger { #else // If logger is not active // Empty macro in case logs are not enabled -#define RP3D_LOG(logger, level, message) +#define RP3D_LOG(logger, level, category, message) #endif diff --git a/src/utils/Profiler.h b/src/utils/Profiler.h index df64dfd6..57fbc84b 100644 --- a/src/utils/Profiler.h +++ b/src/utils/Profiler.h @@ -26,8 +26,6 @@ #ifndef REACTPHYSICS3D_PROFILER_H #define REACTPHYSICS3D_PROFILER_H -#ifdef IS_PROFILING_ACTIVE - // Libraries #include "configuration.h" #include "engine/Timer.h" @@ -381,9 +379,18 @@ class ProfileSample { } }; +#ifdef IS_PROFILING_ACTIVE + // Use this macro to start profile a block of code #define RP3D_PROFILE(name, profiler) ProfileSample profileSample(name, profiler) +#else // If profile is not active + +// Empty macro in case profiling is not active +#define RP3D_PROFILE(name, profiler) + +#endif + // Return true if we are at the root of the profiler tree inline bool ProfileNodeIterator::isRoot() { return (mCurrentParentNode->getParentNode() == nullptr); @@ -497,11 +504,5 @@ inline void Profiler::destroy() { } -#else // If profile is not active - -// Empty macro in case profiling is not active -#define RP3D_PROFILE(name, profiler) - -#endif #endif