Documentation for module 'NDK'
Former-commit-id: a6c2075cfbfd0eccf2b77def71c0d42684bed590 [formerly 36ece2bc6a148bde6cacf45084821d20edcd115e] [formerly 4a6988792ec026e65be6850c46dfe8ddda92a885 [formerly fd3f4f975de5c427f3adc98b220446fd255be396]] Former-commit-id: c87fdc9483202842267c60eff3d619f0df2963bf [formerly ee35202f1b2df7ca20da5b6d8b13147f2b92c933] Former-commit-id: dad5de1b00bb4413f7aa191ca06b7d43b659f32a
This commit is contained in:
@@ -7,6 +7,12 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs a GraphicsComponent object by copy semantic
|
||||
*
|
||||
* \param graphicsComponent GraphicsComponent to copy
|
||||
*/
|
||||
|
||||
inline GraphicsComponent::GraphicsComponent(const GraphicsComponent& graphicsComponent) :
|
||||
Component(graphicsComponent),
|
||||
HandledObject(graphicsComponent),
|
||||
@@ -20,6 +26,12 @@ namespace Ndk
|
||||
Attach(r.renderable, r.data.renderOrder);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the renderable elements to the render queue
|
||||
*
|
||||
* \param renderQueue Queue to be added
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::AddToRenderQueue(Nz::AbstractRenderQueue* renderQueue) const
|
||||
{
|
||||
EnsureTransformMatrixUpdate();
|
||||
@@ -36,6 +48,13 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Attaches a renderable to the entity
|
||||
*
|
||||
* \param renderable Reference to a renderable element
|
||||
* \param renderOrder Render order of the element
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::Attach(Nz::InstancedRenderableRef renderable, int renderOrder)
|
||||
{
|
||||
m_renderables.emplace_back(m_transformMatrix);
|
||||
@@ -48,6 +67,10 @@ namespace Ndk
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Clears every renderable elements
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::Clear()
|
||||
{
|
||||
m_renderables.clear();
|
||||
@@ -55,6 +78,12 @@ namespace Ndk
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Detaches a renderable to the entity
|
||||
*
|
||||
* \param renderable Reference to a renderable element
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::Detach(const Nz::InstancedRenderable* renderable)
|
||||
{
|
||||
for (auto it = m_renderables.begin(); it != m_renderables.end(); ++it)
|
||||
@@ -68,18 +97,34 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Ensures the bounding volume is up to date
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::EnsureBoundingVolumeUpdate() const
|
||||
{
|
||||
if (!m_boundingVolumeUpdated)
|
||||
UpdateBoundingVolume();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Ensures the transformation matrix is up to date
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::EnsureTransformMatrixUpdate() const
|
||||
{
|
||||
if (!m_transformMatrixUpdated)
|
||||
UpdateTransformMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the set of renderable elements
|
||||
*
|
||||
* \param renderables Pointer to the list of renderables
|
||||
*
|
||||
* \remark Produces a NazaraAssert if renderables is invalid
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::GetAttachedRenderables(RenderableList* renderables) const
|
||||
{
|
||||
NazaraAssert(renderables, "Invalid renderable list");
|
||||
@@ -89,11 +134,21 @@ namespace Ndk
|
||||
renderables->push_back(r.renderable);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the number of renderable elements attached to the entity
|
||||
* \return Number of renderable elements
|
||||
*/
|
||||
|
||||
inline std::size_t GraphicsComponent::GetAttachedRenderableCount() const
|
||||
{
|
||||
return m_renderables.size();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the bouding volume of the entity
|
||||
* \return A constant reference to the bounding volume
|
||||
*/
|
||||
|
||||
inline const Nz::BoundingVolumef& GraphicsComponent::GetBoundingVolume() const
|
||||
{
|
||||
EnsureBoundingVolumeUpdate();
|
||||
@@ -101,17 +156,29 @@ namespace Ndk
|
||||
return m_boundingVolume;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the bounding volume
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::InvalidateBoundingVolume()
|
||||
{
|
||||
m_boundingVolumeUpdated = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates every renderable elements
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::InvalidateRenderables()
|
||||
{
|
||||
for (Renderable& r : m_renderables)
|
||||
r.dataUpdated = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the transformation matrix
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::InvalidateTransformMatrix()
|
||||
{
|
||||
m_boundingVolumeUpdated = false;
|
||||
|
||||
Reference in New Issue
Block a user