From 29ac52770ed2a8617b5aadedb3e20c0504b288ba Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 27 Sep 2016 18:09:25 +0200 Subject: [PATCH] SDK/CameraComponent: Moved virtual functions to source file Former-commit-id: 633046a6f599ce9f8712e11b8195509d9704bfc0 [formerly 080ea253a37d683c72372b406148372f9c1b92d2] [formerly 528dbe2f2c9dcac7b48c11feafb24a12afd43652 [formerly af9843c5eae928fb2f03c0ec1550e7ef95f69108]] Former-commit-id: f17eed57cd271cfc55ef380bde44917ea26deac7 [formerly 30667bf567620cc339c96388303582b8b8601f68] Former-commit-id: 66843984b23bee78fdbcefebbf56febddcdb4bb2 --- .../NDK/Components/CameraComponent.hpp | 20 ++-- .../NDK/Components/CameraComponent.inl | 93 +------------------ SDK/src/NDK/Components/CameraComponent.cpp | 82 +++++++++++++++- 3 files changed, 92 insertions(+), 103 deletions(-) diff --git a/SDK/include/NDK/Components/CameraComponent.hpp b/SDK/include/NDK/Components/CameraComponent.hpp index af2245b11..b26901a79 100644 --- a/SDK/include/NDK/Components/CameraComponent.hpp +++ b/SDK/include/NDK/Components/CameraComponent.hpp @@ -34,21 +34,21 @@ namespace Ndk inline void EnsureViewMatrixUpdate() const; inline void EnsureViewportUpdate() const; - inline float GetAspectRatio() const override; - inline Nz::Vector3f GetEyePosition() const override; - inline Nz::Vector3f GetForward() const override; + float GetAspectRatio() const override; + Nz::Vector3f GetEyePosition() const override; + Nz::Vector3f GetForward() const override; inline float GetFOV() const; - inline const Nz::Frustumf& GetFrustum() const override; + const Nz::Frustumf& GetFrustum() const override; inline unsigned int GetLayer() const; - inline const Nz::Matrix4f& GetProjectionMatrix() const override; + const Nz::Matrix4f& GetProjectionMatrix() const override; inline Nz::ProjectionType GetProjectionType() const; inline const Nz::Vector2f& GetSize() const; - inline const Nz::RenderTarget* GetTarget() const override; + const Nz::RenderTarget* GetTarget() const override; inline const Nz::Rectf& GetTargetRegion() const; - inline const Nz::Matrix4f& GetViewMatrix() const override; - inline const Nz::Recti& GetViewport() const override; - inline float GetZFar() const override; - inline float GetZNear() const override; + const Nz::Matrix4f& GetViewMatrix() const override; + const Nz::Recti& GetViewport() const override; + float GetZFar() const override; + float GetZNear() const override; inline void SetFOV(float fov); inline void SetLayer(unsigned int layer); diff --git a/SDK/include/NDK/Components/CameraComponent.inl b/SDK/include/NDK/Components/CameraComponent.inl index d42d0e152..541096de5 100644 --- a/SDK/include/NDK/Components/CameraComponent.inl +++ b/SDK/include/NDK/Components/CameraComponent.inl @@ -95,40 +95,15 @@ namespace Ndk UpdateViewport(); } - /*! - * \brief Gets the aspect ratio of the camera - * \return Aspect ratio of the camera - */ - - inline float CameraComponent::GetAspectRatio() const - { - EnsureViewportUpdate(); - - return m_aspectRatio; - } - /*! * \brief Gets the field of view of the camera * \return Field of view of the camera */ - - inline float CameraComponent::GetFOV() const + float CameraComponent::GetFOV() const { return m_fov; } - /*! - * \brief Gets the frutum of the camera - * \return A constant reference to the frustum of the camera - */ - - inline const Nz::Frustumf& CameraComponent::GetFrustum() const - { - EnsureFrustumUpdate(); - - return m_frustum; - } - /*! * \brief Gets the layer of the camera * \return Layer of the camera @@ -139,18 +114,6 @@ namespace Ndk return m_layer; } - /*! - * \brief Gets the projection matrix of the camera - * \return A constant reference to the projection matrix of the camera - */ - - inline const Nz::Matrix4f& CameraComponent::GetProjectionMatrix() const - { - EnsureProjectionMatrixUpdate(); - - return m_projectionMatrix; - } - /*! * \brief Gets the projection type of the camera * \return Projection type of the camera @@ -171,16 +134,6 @@ namespace Ndk return m_size; } - /*! - * \brief Gets the target of the camera - * \return A constant reference to the render target of the camera - */ - - inline const Nz::RenderTarget* CameraComponent::GetTarget() const - { - return m_target; - } - /*! * \brief Gets the target region of the camera * \return A constant reference to the target region of the camera @@ -191,50 +144,6 @@ namespace Ndk return m_targetRegion; } - /*! - * \brief Gets the view matrix of the camera - * \return A constant reference to the view matrix of the camera - */ - - inline const Nz::Matrix4f& CameraComponent::GetViewMatrix() const - { - EnsureViewMatrixUpdate(); - - return m_viewMatrix; - } - - /*! - * \brief Gets the view port of the camera - * \return A constant reference to the view port of the camera - */ - - inline const Nz::Recti& CameraComponent::GetViewport() const - { - EnsureViewportUpdate(); - - return m_viewport; - } - - /*! - * \brief Gets the Z far distance of the camera - * \return Z far distance of the camera - */ - - inline float CameraComponent::GetZFar() const - { - return m_zFar; - } - - /*! - * \brief Gets the Z near distance of the camera - * \return Z near distance of the camera - */ - - inline float CameraComponent::GetZNear() const - { - return m_zNear; - } - /*! * \brief Sets the field of view of the camera * diff --git a/SDK/src/NDK/Components/CameraComponent.cpp b/SDK/src/NDK/Components/CameraComponent.cpp index 71c653823..28f4e31d5 100644 --- a/SDK/src/NDK/Components/CameraComponent.cpp +++ b/SDK/src/NDK/Components/CameraComponent.cpp @@ -35,6 +35,17 @@ namespace Ndk Nz::Renderer::SetViewport(m_viewport); } + /*! + * \brief Gets the aspect ratio of the camera + * \return Aspect ratio of the camera + */ + float CameraComponent::GetAspectRatio() const + { + EnsureViewportUpdate(); + + return m_aspectRatio; + } + /*! * \brief Gets the eye position of the camera * @@ -53,7 +64,6 @@ namespace Ndk * * \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent */ - Nz::Vector3f CameraComponent::GetForward() const { NazaraAssert(m_entity && m_entity->HasComponent(), "CameraComponent requires NodeComponent"); @@ -61,6 +71,76 @@ namespace Ndk return m_entity->GetComponent().GetForward(); } + /*! + * \brief Gets the frutum of the camera + * \return A constant reference to the frustum of the camera + */ + const Nz::Frustumf& CameraComponent::GetFrustum() const + { + EnsureFrustumUpdate(); + + return m_frustum; + } + + /*! + * \brief Gets the projection matrix of the camera + * \return A constant reference to the projection matrix of the camera + */ + const Nz::Matrix4f& CameraComponent::GetProjectionMatrix() const + { + EnsureProjectionMatrixUpdate(); + + return m_projectionMatrix; + } + + /*! + * \brief Gets the target of the camera + * \return A constant reference to the render target of the camera + */ + const Nz::RenderTarget* CameraComponent::GetTarget() const + { + return m_target; + } + + /*! + * \brief Gets the view matrix of the camera + * \return A constant reference to the view matrix of the camera + */ + const Nz::Matrix4f& CameraComponent::GetViewMatrix() const + { + EnsureViewMatrixUpdate(); + + return m_viewMatrix; + } + + /*! + * \brief Gets the view port of the camera + * \return A constant reference to the view port of the camera + */ + const Nz::Recti& CameraComponent::GetViewport() const + { + EnsureViewportUpdate(); + + return m_viewport; + } + + /*! + * \brief Gets the Z far distance of the camera + * \return Z far distance of the camera + */ + float CameraComponent::GetZFar() const + { + return m_zFar; + } + + /*! + * \brief Gets the Z near distance of the camera + * \return Z near distance of the camera + */ + float CameraComponent::GetZNear() const + { + return m_zNear; + } /*! * \brief Sets the layer of the camera in case of multiples fields *