SDK/GraphicsComponent: Add ForEachRenderable method

This commit is contained in:
Lynix 2018-06-06 19:37:58 +02:00
parent bc2f6f67cc
commit 056bd0efdd
3 changed files with 15 additions and 0 deletions

View File

@ -159,6 +159,7 @@ Nazara Development Kit:
- ⚠️ TextAreaWidget::GetHoveredGlyph now returns a two-dimensional position instead of a single glyph position
- Fixed Entity::OnEntityDestruction signal not being properly moved and thus not being called.
- Fixed EntityOwner move assignment which was losing entity ownership
- Add GraphicsComponent:ForEachRenderable method
# 0.4:

View File

@ -44,6 +44,8 @@ namespace Ndk
inline bool DoesRequireRealTimeReflections() const;
template<typename Func> void ForEachRenderable(const Func& func) const;
inline void EnsureBoundingVolumeUpdate() const;
inline void EnsureTransformMatrixUpdate() const;

View File

@ -107,6 +107,18 @@ namespace Ndk
return m_reflectiveMaterialCount != 0 && m_reflectionMap;
}
/*!
* \brief Calls a function for every renderable attached to this component
*
* \param func Callback function which will be called with renderable data
*/
template<typename Func>
void GraphicsComponent::ForEachRenderable(const Func& func) const
{
for (const auto& renderableData : m_renderables)
func(renderableData.renderable, renderableData.data.localMatrix, renderableData.data.renderOrder);
}
/*!
* \brief Ensures the bounding volume is up to date
*/