Turned the Transform namespace into TransformSystem so it would be able to subscribe to EntityDeleted and clean up after itself

This commit is contained in:
2016-03-13 00:55:53 +01:00
parent f6113b9d9c
commit a1fda82d3a
31 changed files with 311 additions and 128 deletions
+3 -3
View File
@@ -113,7 +113,7 @@ void SoundManager::updateEmitters(double dt)
if (!m_World->ValidEntity(m_World->GetParent(it->first))) {
return;
}
glm::vec3 nextPos = Transform::AbsolutePosition(m_World, it->first);
glm::vec3 nextPos = TransformSystem::AbsolutePosition(m_World, it->first);
// Calculate velocity
glm::vec3 velocity = glm::vec3(nextPos - previousPos) / (float)dt;
setSourcePos(it->second->ALsource, nextPos);
@@ -147,11 +147,11 @@ void SoundManager::updateListener(double dt)
if (listener.IsChildOf(m_LocalPlayer) || listener == m_LocalPlayer) {
glm::vec3 previousPos;
alGetListener3f(AL_POSITION, &previousPos.x, &previousPos.y, &previousPos.z); // Get previous pos
glm::vec3 nextPos = Transform::AbsolutePosition(listener); // Get next (current) pos
glm::vec3 nextPos = TransformSystem::AbsolutePosition(listener); // Get next (current) pos
glm::vec3 velocity = glm::vec3(nextPos - previousPos) / (float)dt; // Calculate velocity
setListenerPos(nextPos);
setListenerVel(velocity);
setListenerOri(glm::eulerAngles(Transform::AbsoluteOrientation(listener)));
setListenerOri(glm::eulerAngles(TransformSystem::AbsoluteOrientation(listener)));
break;
}
}