Ndk/GraphicsComponent: Add BoundingVolume

Former-commit-id: e053b21e5495e097a752c17bf2f9367f55b78d78
This commit is contained in:
Lynix
2016-03-26 01:38:30 +01:00
parent 2b9dcb47c0
commit dd87b9b115
3 changed files with 42 additions and 0 deletions

View File

@@ -63,6 +63,18 @@ namespace Ndk
InvalidateTransformMatrix();
}
void GraphicsComponent::UpdateBoundingVolume() const
{
EnsureTransformMatrixUpdate();
m_boundingVolume.MakeNull();
for (const Renderable& r : m_renderables)
m_boundingVolume.ExtendTo(r.renderable->GetBoundingVolume());
m_boundingVolume.Update(m_transformMatrix);
m_boundingVolumeUpdated = true;
}
void GraphicsComponent::UpdateTransformMatrix() const
{
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "GraphicsComponent requires NodeComponent");