Renderer: Replaced RenderTarget::Get[Height|Width] by RenderTarget::GetSize
Utility: Removed Window::Get[Height|Width] methods
This commit is contained in:
@@ -237,10 +237,9 @@ namespace Ndk
|
||||
NazaraAssert(m_target, "Component has no render target");
|
||||
|
||||
// We compute the region necessary to make this view port with the actual size of the target
|
||||
float invWidth = 1.f / m_target->GetWidth();
|
||||
float invHeight = 1.f / m_target->GetHeight();
|
||||
Nz::Vector2f invSize = 1.f / Nz::Vector2f(m_target->GetSize());
|
||||
|
||||
SetTargetRegion(Nz::Rectf(invWidth * viewport.x, invHeight * viewport.y, invWidth * viewport.width, invHeight * viewport.height));
|
||||
SetTargetRegion(Nz::Rectf(invSize.x * viewport.x, invSize.y * viewport.y, invSize.x * viewport.width, invSize.y * viewport.height));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -148,7 +148,10 @@ namespace Ndk
|
||||
|
||||
Nz::Vector2ui windowDimensions;
|
||||
if (info.window->IsValid())
|
||||
windowDimensions.Set(info.window->GetWidth(), info.window->GetHeight() / 4);
|
||||
{
|
||||
windowDimensions = info.window->GetSize();
|
||||
windowDimensions.y /= 4;
|
||||
}
|
||||
else
|
||||
windowDimensions.MakeZero();
|
||||
|
||||
@@ -212,7 +215,8 @@ namespace Ndk
|
||||
|
||||
overlay->resizedSlot.Connect(info.renderTarget->OnRenderTargetSizeChange, [&consoleRef] (const Nz::RenderTarget* renderTarget)
|
||||
{
|
||||
consoleRef.SetSize({float(renderTarget->GetWidth()), renderTarget->GetHeight() / 4.f});
|
||||
Nz::Vector2ui size = renderTarget->GetSize();
|
||||
consoleRef.SetSize({float(size.x), size.y / 4.f});
|
||||
});
|
||||
|
||||
info.console = std::move(overlay);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user