Renderer: Replaced RenderTarget::Get[Height|Width] by RenderTarget::GetSize

Utility: Removed Window::Get[Height|Width] methods
This commit is contained in:
Lynix
2017-10-28 23:26:22 +02:00
parent bf8ebbd046
commit d688cecbde
20 changed files with 44 additions and 102 deletions

View File

@@ -334,15 +334,15 @@ namespace Ndk
{
NazaraAssert(m_target, "CameraComponent has no target");
unsigned int targetWidth = m_target->GetWidth();
unsigned int targetHeight = std::max(m_target->GetHeight(), 1U); // Let's make sure we won't divide by zero
Nz::Vector2ui targetSize = m_target->GetSize();
targetSize.y = std::max(targetSize.y, 1U); // Let's make sure we won't divide by zero
// Our target region is expressed as % of the viewport dimensions, let's compute it in pixels
Nz::Rectf fViewport(m_targetRegion);
fViewport.x *= targetWidth;
fViewport.y *= targetHeight;
fViewport.width *= targetWidth;
fViewport.height *= targetHeight;
fViewport.x *= targetSize.x;
fViewport.y *= targetSize.y;
fViewport.width *= targetSize.x;
fViewport.height *= targetSize.y;
// Compute the new aspect ratio, if it's different we need to invalidate the projection matrix
float aspectRatio = fViewport.width/fViewport.height;