Documentation for module 'NDK'
Former-commit-id: 63e1cac538c577a1f1aafa71fa7eef69a6d4daab [formerly b2d8769fd02a0e7d9c476d4ad7be1988a1fd6789] [formerly 636b5cb79bcb8da44d9aa45ba1023565bcf29f0d [formerly a2361ec2b8679d4d4ba096e543b5d4b91825dd62]] Former-commit-id: d402d35477f9db0135c553d55c401939426bf62d [formerly 607336ea0f42731e4604f3a8c2df06f3aecfc401] Former-commit-id: 69e23cd6c06723486de5e4641ce810012dac66da
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