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:
@@ -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