Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
NavMeshContext.cpp
Go to the documentation of this file.
1
2
4
7
9
10void rcContextDivide::doLog(const rcLogCategory category,
11 const char* msg,
12 [[maybe_unused]] const I32 len)
13{
14 switch (category) {
15 case RC_LOG_PROGRESS:
16 Console::printfn(LOCALE_STR("RECAST_CTX_LOG_PROGRESS"), msg);
17 break;
18 case RC_LOG_WARNING:
19 Console::printfn(LOCALE_STR("RECAST_CTX_LOG_WARNING"), msg);
20 break;
21 case RC_LOG_ERROR:
22 Console::errorfn(LOCALE_STR("RECAST_CTX_LOG_ERROR"), msg);
23 break;
24 }
25}
26
28 for (I32 i = 0; i < RC_MAX_TIMERS; ++i) _accTime[i] = -1;
29}
30
31void rcContextDivide::doStartTimer(const rcTimerLabel label) noexcept {
32 _startTime[label] = Time::App::ElapsedMilliseconds();
33}
34
35void rcContextDivide::doStopTimer(const rcTimerLabel label) {
36 const D64 deltaTime = Time::App::ElapsedMilliseconds() - _startTime[label];
37 if (_accTime[label] == -1) {
38 _accTime[label] = to_I32(deltaTime);
39 } else {
40 _accTime[label] += to_I32(deltaTime);
41 }
42}
43
44I32 rcContextDivide::doGetAccumulatedTime(const rcTimerLabel label) const noexcept {
45 return _accTime[label];
46}
47
48} // namespace Divide::AI::Navigation
#define LOCALE_STR(X)
Definition: Localization.h:91
std::array< D64, RC_MAX_TIMERS > _startTime
void doStopTimer(rcTimerLabel) override
std::array< I32, RC_MAX_TIMERS > _accTime
void doLog(rcLogCategory category, const char *msg, I32 len) override
void doStartTimer(rcTimerLabel) noexcept override
void doResetTimers() noexcept override
I32 doGetAccumulatedTime(rcTimerLabel) const noexcept override
D64 ElapsedMilliseconds() noexcept
int32_t I32
double D64
constexpr I32 to_I32(const T value)
static NO_INLINE void errorfn(const char *format, T &&... args)
static NO_INLINE void printfn(const char *format, T &&... args)