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:
@@ -9,6 +9,18 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \ingroup NDK
|
||||
* \class Ndk::CameraComponent
|
||||
* \brief NDK class that represents the component for camera
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Applys the view of the camera
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the camera has no target
|
||||
*/
|
||||
|
||||
void CameraComponent::ApplyView() const
|
||||
{
|
||||
NazaraAssert(m_target, "CameraComponent has no target");
|
||||
@@ -23,6 +35,12 @@ namespace Ndk
|
||||
Nz::Renderer::SetViewport(m_viewport);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the eye position of the camera
|
||||
*
|
||||
* \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent
|
||||
*/
|
||||
|
||||
Nz::Vector3f CameraComponent::GetEyePosition() const
|
||||
{
|
||||
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "CameraComponent requires NodeComponent");
|
||||
@@ -30,6 +48,12 @@ namespace Ndk
|
||||
return m_entity->GetComponent<NodeComponent>().GetPosition();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the forward direction of the camera
|
||||
*
|
||||
* \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent
|
||||
*/
|
||||
|
||||
Nz::Vector3f CameraComponent::GetForward() const
|
||||
{
|
||||
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "CameraComponent requires NodeComponent");
|
||||
@@ -37,6 +61,12 @@ namespace Ndk
|
||||
return m_entity->GetComponent<NodeComponent>().GetForward();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the layer of the camera in case of multiples fields
|
||||
*
|
||||
* \param layer Layer of the camera
|
||||
*/
|
||||
|
||||
void CameraComponent::SetLayer(unsigned int layer)
|
||||
{
|
||||
m_layer = layer;
|
||||
@@ -44,6 +74,10 @@ namespace Ndk
|
||||
m_entity->Invalidate(); // Invalidate the entity to make it passes through RenderSystem validation
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operation to perform when component is attached to an entity
|
||||
*/
|
||||
|
||||
void CameraComponent::OnAttached()
|
||||
{
|
||||
if (m_entity->HasComponent<NodeComponent>())
|
||||
@@ -52,6 +86,12 @@ namespace Ndk
|
||||
InvalidateViewMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operation to perform when component is attached to this component
|
||||
*
|
||||
* \param component Component being attached
|
||||
*/
|
||||
|
||||
void CameraComponent::OnComponentAttached(BaseComponent& component)
|
||||
{
|
||||
if (IsComponent<NodeComponent>(component))
|
||||
@@ -63,6 +103,12 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operation to perform when component is detached from this component
|
||||
*
|
||||
* \param component Component being detached
|
||||
*/
|
||||
|
||||
void CameraComponent::OnComponentDetached(BaseComponent& component)
|
||||
{
|
||||
if (IsComponent<NodeComponent>(component))
|
||||
@@ -73,6 +119,10 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operation to perform when component is detached from an entity
|
||||
*/
|
||||
|
||||
void CameraComponent::OnDetached()
|
||||
{
|
||||
m_nodeInvalidationSlot.Disconnect();
|
||||
@@ -80,6 +130,12 @@ namespace Ndk
|
||||
InvalidateViewMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operation to perform when the node is invalidated
|
||||
*
|
||||
* \param node Pointer to the node
|
||||
*/
|
||||
|
||||
void CameraComponent::OnNodeInvalidated(const Nz::Node* node)
|
||||
{
|
||||
NazaraUnused(node);
|
||||
@@ -88,6 +144,12 @@ namespace Ndk
|
||||
InvalidateViewMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operation to perform when the render target is released
|
||||
*
|
||||
* \param renderTarget Pointer to the RenderTarget
|
||||
*/
|
||||
|
||||
void CameraComponent::OnRenderTargetRelease(const Nz::RenderTarget* renderTarget)
|
||||
{
|
||||
if (renderTarget == m_target)
|
||||
@@ -96,6 +158,12 @@ namespace Ndk
|
||||
NazaraInternalError("Not listening to " + Nz::String::Pointer(renderTarget));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operation to perform when the render target has its size changed
|
||||
*
|
||||
* \param renderTarget Pointer to the RenderTarget
|
||||
*/
|
||||
|
||||
void CameraComponent::OnRenderTargetSizeChange(const Nz::RenderTarget* renderTarget)
|
||||
{
|
||||
if (renderTarget == m_target)
|
||||
@@ -104,6 +172,10 @@ namespace Ndk
|
||||
NazaraInternalError("Not listening to " + Nz::String::Pointer(renderTarget));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Updates the frustum of the camera
|
||||
*/
|
||||
|
||||
void CameraComponent::UpdateFrustum() const
|
||||
{
|
||||
EnsureProjectionMatrixUpdate();
|
||||
@@ -114,6 +186,10 @@ namespace Ndk
|
||||
m_frustumUpdated = true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Updates the project matrix of the camera
|
||||
*/
|
||||
|
||||
void CameraComponent::UpdateProjectionMatrix() const
|
||||
{
|
||||
switch (m_projectionType)
|
||||
@@ -139,6 +215,12 @@ namespace Ndk
|
||||
m_projectionMatrixUpdated = true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Updates the view matrix of the camera
|
||||
*
|
||||
* \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent
|
||||
*/
|
||||
|
||||
void CameraComponent::UpdateViewMatrix() const
|
||||
{
|
||||
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "CameraComponent requires NodeComponent");
|
||||
@@ -150,6 +232,12 @@ namespace Ndk
|
||||
m_viewMatrixUpdated = true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Updates the view port of the camera
|
||||
*
|
||||
* \remark Produces a NazaraAssert if entity has no target
|
||||
*/
|
||||
|
||||
void CameraComponent::UpdateViewport() const
|
||||
{
|
||||
NazaraAssert(m_target, "CameraComponent has no target");
|
||||
|
||||
Reference in New Issue
Block a user