From e928eda27581d5dd6a1f7d029a5efdeab23c68fa Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Thu, 4 Jan 2024 00:17:58 +0100 Subject: [PATCH] Main: inline Math::UnitRandom as it is on the hot path for particle emission --- OgreMain/include/OgreMath.h | 2 +- OgreMain/src/OgreMath.cpp | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/OgreMain/include/OgreMath.h b/OgreMain/include/OgreMath.h index 36c7347f0b1..e5a3ab47ccd 100644 --- a/OgreMain/include/OgreMath.h +++ b/OgreMain/include/OgreMath.h @@ -471,7 +471,7 @@ namespace Ogre @return A random number in the range from [0,1]. */ - static float UnitRandom(); + static float UnitRandom() { return mRandProvider ? mRandProvider->getRandomUnit() : rand() / float(RAND_MAX); } /** Generate a random number within the range provided. @param fLow diff --git a/OgreMain/src/OgreMath.cpp b/OgreMain/src/OgreMath.cpp index d79d4edc59e..e61f61d53b8 100644 --- a/OgreMain/src/OgreMath.cpp +++ b/OgreMain/src/OgreMath.cpp @@ -136,13 +136,6 @@ namespace Ogre return Radian(-HALF_PI); } } - //----------------------------------------------------------------------- - float Math::UnitRandom () - { - if (mRandProvider) - return mRandProvider->getRandomUnit(); - else return rand() / float(RAND_MAX); - } //----------------------------------------------------------------------- void Math::SetRandomValueProvider(RandomValueProvider* provider)