NDK/RenderSystem: Begin to implement Update

Former-commit-id: 404b7998afffa79568c722677f9760c467e78166
This commit is contained in:
Lynix
2015-06-02 17:20:57 +02:00
parent 844062cfd0
commit 2d0cf1794e
3 changed files with 43 additions and 3 deletions

View File

@@ -3,11 +3,40 @@
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/Components/CameraComponent.hpp>
#include <Nazara/Renderer/Renderer.hpp>
#include <NDK/Algorithm.hpp>
#include <NDK/Components/NodeComponent.hpp>
namespace Ndk
{
void CameraComponent::ApplyView() const
{
NazaraAssert(m_target, "CameraComponent has no target");
EnsureProjectionMatrixUpdate();
EnsureViewMatrixUpdate();
EnsureViewportUpdate();
NzRenderer::SetMatrix(nzMatrixType_Projection, m_projectionMatrix);
NzRenderer::SetMatrix(nzMatrixType_View, m_viewMatrix);
NzRenderer::SetTarget(m_target);
NzRenderer::SetViewport(m_viewport);
}
NzVector3f CameraComponent::GetEyePosition() const
{
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "CameraComponent requires NodeComponent");
return m_entity->GetComponent<NodeComponent>().GetPosition();
}
NzVector3f CameraComponent::GetForward() const
{
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "CameraComponent requires NodeComponent");
return m_entity->GetComponent<NodeComponent>().GetForward();
}
void CameraComponent::SetLayer(unsigned int layer)
{
m_layer = layer;