<commit_before>// Copyright (C) 2015 <NAME>
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp

#include <Nazara/Graphics/View.hpp>
#include <Nazara/Graphics/Scene.hpp>
#include <Nazara/Renderer/Renderer.hpp>
#include <Nazara/Renderer/RenderTarget.hpp>
#include <Nazara/Graphics/Debug.hpp>

NzView::NzView() :
m_targetRegion(0.f, 0.f, 1.f, 1.f),
m_size(0.f),
m_target(nullptr),
m_frustumUpdated(false),
m_invViewProjMatrixUpdated(false),
m_projectionMatrixUpdated(false),
m_viewMatrixUpdated(false),
m_viewProjMatrixUpdated(false),
m_viewportUpdated(false),
m_zFar(1.f),
m_zNear(-1.f)
{
}

NzView::NzView(const NzVector2f& size) :
NzView() // On délègue
{
	SetSize(size);
}

NzView::~NzView()
{
	if (m_target)
		m_target->RemoveListener(this);
}

void NzView::EnsureFrustumUpdate() const
{
	if (!m_frustumUpdated)
		UpdateFrustum();
}

void NzView::EnsureProjectionMatrixUpdate() const
{
	if (!m_projectionMatrixUpdated)
		UpdateProjectionMatrix();
}

void NzView::EnsureViewMatrixUpdate() const
{
	if (!m_viewMatrixUpdated)
		UpdateViewMatrix();
}

void NzView::EnsureViewportUpdate() const
{
	if (!m_viewportUpdated)
		UpdateViewport();
}

float NzView::GetAspectRatio() const
{
	return 1.f;
}

NzVector3f NzView::GetEyePosition() const
{
	return GetPosition(nzCoordSys_Global);
}

NzVector3f NzView::GetForward() const
{
	return NzNode::GetForward();
}

const NzFrustumf& NzView::GetFrustum() const
{
	if (!m_frustumUpdated)
		UpdateFrustum();

	return m_frustum;
}

NzVector3f NzView::GetGlobalForward() const
{
	return NzVector3f::UnitZ();
}

NzVector3f NzView::GetGlobalRight() const
{
	return NzVector3f::UnitX();
}

NzVector3f NzView::GetGlobalUp() const
{
	return -NzVector3f::UnitY();
}

const NzMatrix4f& NzView::GetInvViewProjMatrix() const
{
	if (!m_invViewProjMatrixUpdated)
		UpdateInvViewProjMatrix();

	return m_invViewProjMatrix;
}

const NzMatrix4f& NzView::GetProjectionMatrix() const
{
	if (!m_projectionMatrixUpdated)
		UpdateProjectionMatrix();

	return m_projectionMatrix;
}

const NzRenderTarget* NzView::GetTarget() const
{
	return m_target;
}

const NzRectf& NzView::GetTargetRegion() const
{
	return m_targetRegion;
}

const NzMatrix4f& NzView::GetViewMatrix() const
{
	if (!m_viewMatrixUpdated)
		UpdateViewMatrix();<commit_msg>(View) Fixed missing implementation of GetSize<commit_after>// Copyright (C) 2015 <NAME>
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp

#include <Nazara/Graphics/View.hpp>
#include <Nazara/Graphics/Scene.hpp>
#include <Nazara/Renderer/Renderer.hpp>
#include <Nazara/Renderer/RenderTarget.hpp>
#include <Nazara/Graphics/Debug.hpp>

NzView::NzView() :
m_targetRegion(0.f, 0.f, 1.f, 1.f),
m_size(0.f),
m_target(nullptr),
m_frustumUpdated(false),
m_invViewProjMatrixUpdated(false),
m_projectionMatrixUpdated(false),
m_viewMatrixUpdated(false),
m_viewProjMatrixUpdated(false),
m_viewportUpdated(false),
m_zFar(1.f),
m_zNear(-1.f)
{
}

NzView::NzView(const NzVector2f& size) :
NzView() // On délègue
{
	SetSize(size);
}

NzView::~NzView()
{
	if (m_target)
		m_target->RemoveListener(this);
}

void NzView::EnsureFrustumUpdate() const
{
	if (!m_frustumUpdated)
		UpdateFrustum();
}

void NzView::EnsureProjectionMatrixUpdate() const
{
	if (!m_projectionMatrixUpdated)
		UpdateProjectionMatrix();
}

void NzView::EnsureViewMatrixUpdate() const
{
	if (!m_viewMatrixUpdated)
		UpdateViewMatrix();
}

void NzView::EnsureViewportUpdate() const
{
	if (!m_viewportUpdated)
		UpdateViewport();
}

float NzView::GetAspectRatio() const
{
	return 1.f;
}

NzVector3f NzView::GetEyePosition() const
{
	return GetPosition(nzCoordSys_Global);
}

NzVector3f NzView::GetForward() const
{
	return NzNode::GetForward();
}

const NzFrustumf& NzView::GetFrustum() const
{
	if (!m_frustumUpdated)
		UpdateFrustum();

	return m_frustum;
}

NzVector3f NzView::GetGlobalForward() const
{
	return NzVector3f::UnitZ();
}

NzVector3f NzView::GetGlobalRight() const
{
	return NzVector3f::UnitX();
}

NzVector3f NzView::GetGlobalUp() const
{
	return -NzVector3f::UnitY();
}

const NzMatrix4f& NzView::GetInvViewProjMatrix() const
{
	if (!m_invViewProjMatrixUpdated)
		UpdateInvViewProjMatrix();

	return m_invViewProjMatrix;
}

const NzMatrix4f& NzView::GetProjectionMatrix() const
{
	if (!m_projectionMatrixUpdated)
		UpdateProjectionMatrix();

	return m_projectionMatrix;
}

const NzVector2f& NzView::GetSize() const
{
	return m_size;
}

const NzRenderTarget* NzView::GetTarget() const
{
	return m_target;
}

const NzRectf& NzView::GetTargetRegion() const
{
	return m_targetRegion;
}

const NzMatrix4f& NzView::GetViewMatrix() const
{
	if (!m_viewMatrixUpdated)
		UpdateViewMatrix();
{'fraction_non_alphanumeric': 0.13032581453634084, 'fraction_numerical': 0.01023391812865497, 'mean_word_length': 6.724193548387097, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6512445', 'n_tokens_mistral': 1899, 'n_tokens_neox': 1859, 'n_words': 334}