NazaraEngine/include/Nazara/Physics3D/PhysWorld3D.inl

40 lines
1.2 KiB
C++

// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Physics3D module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Physics3D/Debug.hpp>
namespace Nz
{
inline bool PhysWorld3D::IsBodyActive(UInt32 bodyIndex) const
{
UInt32 blockIndex = bodyIndex / 64;
UInt32 localIndex = bodyIndex % 64;
return m_activeBodies[blockIndex] & (UInt64(1u) << localIndex);
}
inline bool PhysWorld3D::IsBodyRegistered(UInt32 bodyIndex) const
{
UInt32 blockIndex = bodyIndex / 64;
UInt32 localIndex = bodyIndex % 64;
return m_registeredBodies[blockIndex] & (UInt64(1u) << localIndex);
}
inline void PhysWorld3D::RegisterStepListener(Physiscs3DStepListener* stepListener)
{
auto it = std::lower_bound(m_stepListeners.begin(), m_stepListeners.end(), stepListener);
m_stepListeners.insert(it, stepListener);
}
inline void PhysWorld3D::UnregisterStepListener(Physiscs3DStepListener* stepListener)
{
auto it = std::lower_bound(m_stepListeners.begin(), m_stepListeners.end(), stepListener);
assert(*it == stepListener);
m_stepListeners.erase(it);
}
}
#include <Nazara/Physics3D/DebugOff.hpp>