Renderer: Replaced RenderTarget::Get[Height|Width] by RenderTarget::GetSize
Utility: Removed Window::Get[Height|Width] methods
This commit is contained in:
parent
bf8ebbd046
commit
d688cecbde
|
|
@ -4,6 +4,8 @@ Nazara Engine:
|
||||||
- VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned.
|
- VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned.
|
||||||
- Bitset swap operation is now correctly marked as noexcept`
|
- Bitset swap operation is now correctly marked as noexcept`
|
||||||
- Mesh loaders now takes MeshParams vertexDeclaration into account
|
- Mesh loaders now takes MeshParams vertexDeclaration into account
|
||||||
|
- ⚠️ Replaced RenderTarget::Get[Height|Width] by RenderTarget::GetSize
|
||||||
|
- ⚠️ Removed Window::Get[Height|Width] methods
|
||||||
|
|
||||||
# 0.4:
|
# 0.4:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,10 +237,9 @@ namespace Ndk
|
||||||
NazaraAssert(m_target, "Component has no render target");
|
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
|
// We compute the region necessary to make this view port with the actual size of the target
|
||||||
float invWidth = 1.f / m_target->GetWidth();
|
Nz::Vector2f invSize = 1.f / Nz::Vector2f(m_target->GetSize());
|
||||||
float invHeight = 1.f / m_target->GetHeight();
|
|
||||||
|
|
||||||
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;
|
Nz::Vector2ui windowDimensions;
|
||||||
if (info.window->IsValid())
|
if (info.window->IsValid())
|
||||||
windowDimensions.Set(info.window->GetWidth(), info.window->GetHeight() / 4);
|
{
|
||||||
|
windowDimensions = info.window->GetSize();
|
||||||
|
windowDimensions.y /= 4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
windowDimensions.MakeZero();
|
windowDimensions.MakeZero();
|
||||||
|
|
||||||
|
|
@ -212,7 +215,8 @@ namespace Ndk
|
||||||
|
|
||||||
overlay->resizedSlot.Connect(info.renderTarget->OnRenderTargetSizeChange, [&consoleRef] (const Nz::RenderTarget* renderTarget)
|
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);
|
info.console = std::move(overlay);
|
||||||
|
|
|
||||||
|
|
@ -334,15 +334,15 @@ namespace Ndk
|
||||||
{
|
{
|
||||||
NazaraAssert(m_target, "CameraComponent has no target");
|
NazaraAssert(m_target, "CameraComponent has no target");
|
||||||
|
|
||||||
unsigned int targetWidth = m_target->GetWidth();
|
Nz::Vector2ui targetSize = m_target->GetSize();
|
||||||
unsigned int targetHeight = std::max(m_target->GetHeight(), 1U); // Let's make sure we won't divide by zero
|
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
|
// Our target region is expressed as % of the viewport dimensions, let's compute it in pixels
|
||||||
Nz::Rectf fViewport(m_targetRegion);
|
Nz::Rectf fViewport(m_targetRegion);
|
||||||
fViewport.x *= targetWidth;
|
fViewport.x *= targetSize.x;
|
||||||
fViewport.y *= targetHeight;
|
fViewport.y *= targetSize.y;
|
||||||
fViewport.width *= targetWidth;
|
fViewport.width *= targetSize.x;
|
||||||
fViewport.height *= targetHeight;
|
fViewport.height *= targetSize.y;
|
||||||
|
|
||||||
// Compute the new aspect ratio, if it's different we need to invalidate the projection matrix
|
// Compute the new aspect ratio, if it's different we need to invalidate the projection matrix
|
||||||
float aspectRatio = fViewport.width/fViewport.height;
|
float aspectRatio = fViewport.width/fViewport.height;
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,8 @@ int main()
|
||||||
|
|
||||||
// Pour éviter que le curseur ne sorte de l'écran, nous le renvoyons au centre de la fenêtre
|
// Pour éviter que le curseur ne sorte de l'écran, nous le renvoyons au centre de la fenêtre
|
||||||
// Cette fonction est codée de sorte à ne pas provoquer d'évènement MouseMoved
|
// Cette fonction est codée de sorte à ne pas provoquer d'évènement MouseMoved
|
||||||
Nz::Mouse::SetPosition(window.GetWidth() / 2, window.GetHeight() / 2, window);
|
Nz::Vector2ui size = window.GetSize();
|
||||||
|
Nz::Mouse::SetPosition(size.x / 2, size.y / 2, window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -251,21 +251,20 @@ bool LogoExample::Update(Ndk::StateMachine& fsm, float elapsedTime)
|
||||||
|
|
||||||
void LogoExample::ResetParticles(float elapsed)
|
void LogoExample::ResetParticles(float elapsed)
|
||||||
{
|
{
|
||||||
unsigned int width = m_shared.target->GetWidth();
|
Nz::Vector2ui size = m_shared.target->GetSize();
|
||||||
unsigned int height = m_shared.target->GetHeight();
|
|
||||||
|
|
||||||
Nz::Vector2f center = {width / 2.f, height / 2.f};
|
Nz::Vector2f center = {size.x / 2.f, size.y / 2.f};
|
||||||
Nz::Vector2f offset = center - Nz::Vector2f(Nz::Vector2ui(m_logo.GetSize()) / 2);
|
Nz::Vector2f offset = center - Nz::Vector2f(Nz::Vector2ui(m_logo.GetSize()) / 2);
|
||||||
|
|
||||||
std::uniform_real_distribution<float> disX(0.f, float(width));
|
std::uniform_real_distribution<float> disX(0.f, float(size.x));
|
||||||
std::uniform_real_distribution<float> disY(-float(height) * 0.5f, float(height) * 1.5f);
|
std::uniform_real_distribution<float> disY(-float(size.y) * 0.5f, float(size.y) * 1.5f);
|
||||||
|
|
||||||
ParticleData* sprite = static_cast<ParticleData*>(m_particles);
|
ParticleData* sprite = static_cast<ParticleData*>(m_particles);
|
||||||
for (PixelData& data : m_pixels)
|
for (PixelData& data : m_pixels)
|
||||||
{
|
{
|
||||||
sprite->color = data.color;
|
sprite->color = data.color;
|
||||||
sprite->destination = offset + Nz::Vector2f(data.pos);
|
sprite->destination = offset + Nz::Vector2f(data.pos);
|
||||||
sprite->position.Set(disX(m_shared.randomGen) - float(width), disY(m_shared.randomGen), 0.f);
|
sprite->position.Set(disX(m_shared.randomGen) - float(size.x), disY(m_shared.randomGen), 0.f);
|
||||||
sprite->velocity = Nz::Vector2f::Zero();
|
sprite->velocity = Nz::Vector2f::Zero();
|
||||||
sprite++;
|
sprite++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -820,5 +820,6 @@ void SpacebattleExample::OnMouseMoved(const Nz::EventHandler* /*eventHandler*/,
|
||||||
m_turretCannonBaseRotation = Nz::Clamp(m_turretCannonBaseRotation + speed * event.deltaY, -65.f, 40.f);
|
m_turretCannonBaseRotation = Nz::Clamp(m_turretCannonBaseRotation + speed * event.deltaY, -65.f, 40.f);
|
||||||
m_turretBaseRotation -= event.deltaX * speed;
|
m_turretBaseRotation -= event.deltaX * speed;
|
||||||
|
|
||||||
Nz::Mouse::SetPosition(m_shared.target->GetWidth() / 2, m_shared.target->GetHeight() / 2, *m_shared.target);
|
Nz::Vector2ui size = m_shared.target->GetSize();
|
||||||
|
Nz::Mouse::SetPosition(size.x / 2, size.y / 2, *m_shared.target);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,10 @@ int main()
|
||||||
Nz::Boxf fpsCountBox = fpsGfx.GetBoundingVolume().aabb;
|
Nz::Boxf fpsCountBox = fpsGfx.GetBoundingVolume().aabb;
|
||||||
Nz::Boxf particleCountBox = particleCountGfx.GetBoundingVolume().aabb;
|
Nz::Boxf particleCountBox = particleCountGfx.GetBoundingVolume().aabb;
|
||||||
|
|
||||||
|
Nz::Vector2ui windowSize = window.GetSize();
|
||||||
demoNameNode.SetPosition(5.f, 5.f);
|
demoNameNode.SetPosition(5.f, 5.f);
|
||||||
particleCountNode.SetPosition(5.f, window.GetHeight() - particleCountBox.height - 5.f);
|
particleCountNode.SetPosition(5.f, windowSize.y - particleCountBox.height - 5.f);
|
||||||
fpsNode.SetPosition(5.f, window.GetHeight() - fpsCountBox.height - particleCountBox.height - 5.f);
|
fpsNode.SetPosition(5.f, windowSize.x - fpsCountBox.height - particleCountBox.height - 5.f);
|
||||||
|
|
||||||
|
|
||||||
shared.demos.push_back(std::make_shared<LogoExample>(shared));
|
shared.demos.push_back(std::make_shared<LogoExample>(shared));
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ int main(int argc, char* argv[])
|
||||||
graphicsComponent.Attach(textSprite);
|
graphicsComponent.Attach(textSprite);
|
||||||
|
|
||||||
Nz::Boxf textBox = graphicsComponent.GetBoundingVolume().aabb;
|
Nz::Boxf textBox = graphicsComponent.GetBoundingVolume().aabb;
|
||||||
nodeComponent.SetPosition(mainWindow.GetWidth() / 2 - textBox.width / 2, mainWindow.GetHeight() / 2 - textBox.height / 2);
|
Nz::Vector2ui windowSize = mainWindow.GetSize();
|
||||||
|
nodeComponent.SetPosition(windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2);
|
||||||
|
|
||||||
while (application.Run())
|
while (application.Run())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,10 @@ namespace Nz
|
||||||
inline CursorController& GetCursorController();
|
inline CursorController& GetCursorController();
|
||||||
inline EventHandler& GetEventHandler();
|
inline EventHandler& GetEventHandler();
|
||||||
WindowHandle GetHandle() const;
|
WindowHandle GetHandle() const;
|
||||||
unsigned int GetHeight() const;
|
|
||||||
Vector2i GetPosition() const;
|
Vector2i GetPosition() const;
|
||||||
Vector2ui GetSize() const;
|
Vector2ui GetSize() const;
|
||||||
WindowStyleFlags GetStyle() const;
|
WindowStyleFlags GetStyle() const;
|
||||||
String GetTitle() const;
|
String GetTitle() const;
|
||||||
unsigned int GetWidth() const;
|
|
||||||
|
|
||||||
bool HasFocus() const;
|
bool HasFocus() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <Nazara/Prerequesites.hpp>
|
#include <Nazara/Prerequesites.hpp>
|
||||||
#include <Nazara/Core/Signal.hpp>
|
#include <Nazara/Core/Signal.hpp>
|
||||||
|
#include <Nazara/Math/Vector2.hpp>
|
||||||
#include <Nazara/Renderer/Config.hpp>
|
#include <Nazara/Renderer/Config.hpp>
|
||||||
#include <Nazara/Renderer/RenderTargetParameters.hpp>
|
#include <Nazara/Renderer/RenderTargetParameters.hpp>
|
||||||
|
|
||||||
|
|
@ -24,9 +25,8 @@ namespace Nz
|
||||||
RenderTarget(RenderTarget&&) noexcept = default;
|
RenderTarget(RenderTarget&&) noexcept = default;
|
||||||
virtual ~RenderTarget();
|
virtual ~RenderTarget();
|
||||||
|
|
||||||
virtual unsigned int GetHeight() const = 0;
|
|
||||||
virtual RenderTargetParameters GetParameters() const = 0;
|
virtual RenderTargetParameters GetParameters() const = 0;
|
||||||
virtual unsigned int GetWidth() const = 0;
|
virtual Vector2ui GetSize() const = 0;
|
||||||
|
|
||||||
bool IsActive() const;
|
bool IsActive() const;
|
||||||
virtual bool IsRenderable() const = 0;
|
virtual bool IsRenderable() const = 0;
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,8 @@ namespace Nz
|
||||||
|
|
||||||
void Detach(AttachmentPoint attachmentPoint, UInt8 index);
|
void Detach(AttachmentPoint attachmentPoint, UInt8 index);
|
||||||
|
|
||||||
unsigned int GetHeight() const override;
|
|
||||||
RenderTargetParameters GetParameters() const override;
|
RenderTargetParameters GetParameters() const override;
|
||||||
Vector2ui GetSize() const;
|
Vector2ui GetSize() const;
|
||||||
unsigned int GetWidth() const override;
|
|
||||||
|
|
||||||
bool IsComplete() const;
|
bool IsComplete() const;
|
||||||
bool IsRenderable() const override;
|
bool IsRenderable() const override;
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,8 @@ namespace Nz
|
||||||
|
|
||||||
void EnableVerticalSync(bool enabled);
|
void EnableVerticalSync(bool enabled);
|
||||||
|
|
||||||
unsigned int GetHeight() const override;
|
|
||||||
RenderTargetParameters GetParameters() const override;
|
RenderTargetParameters GetParameters() const override;
|
||||||
unsigned int GetWidth() const override;
|
Vector2ui GetSize() const override;
|
||||||
|
|
||||||
bool IsRenderable() const override;
|
bool IsRenderable() const override;
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
|
||||||
|
|
@ -218,11 +218,6 @@ namespace Nz
|
||||||
return m_handle;
|
return m_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int WindowImpl::GetHeight() const
|
|
||||||
{
|
|
||||||
return m_size.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2i WindowImpl::GetPosition() const
|
Vector2i WindowImpl::GetPosition() const
|
||||||
{
|
{
|
||||||
return m_position;
|
return m_position;
|
||||||
|
|
@ -252,11 +247,6 @@ namespace Nz
|
||||||
return String::Unicode(wTitle.get());
|
return String::Unicode(wTitle.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int WindowImpl::GetWidth() const
|
|
||||||
{
|
|
||||||
return m_size.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WindowImpl::HasFocus() const
|
bool WindowImpl::HasFocus() const
|
||||||
{
|
{
|
||||||
return GetForegroundWindow() == m_handle;
|
return GetForegroundWindow() == m_handle;
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,10 @@ namespace Nz
|
||||||
void EnableSmoothScrolling(bool enable);
|
void EnableSmoothScrolling(bool enable);
|
||||||
|
|
||||||
WindowHandle GetHandle() const;
|
WindowHandle GetHandle() const;
|
||||||
unsigned int GetHeight() const;
|
|
||||||
Vector2i GetPosition() const;
|
Vector2i GetPosition() const;
|
||||||
Vector2ui GetSize() const;
|
Vector2ui GetSize() const;
|
||||||
WindowStyleFlags GetStyle() const;
|
WindowStyleFlags GetStyle() const;
|
||||||
String GetTitle() const;
|
String GetTitle() const;
|
||||||
unsigned int GetWidth() const;
|
|
||||||
|
|
||||||
bool HasFocus() const;
|
bool HasFocus() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -203,19 +203,6 @@ namespace Nz
|
||||||
return m_impl->GetHandle();
|
return m_impl->GetHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Window::GetHeight() const
|
|
||||||
{
|
|
||||||
#if NAZARA_PLATFORM_SAFE
|
|
||||||
if (!m_impl)
|
|
||||||
{
|
|
||||||
NazaraError("Window not created");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return m_impl->GetHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2i Window::GetPosition() const
|
Vector2i Window::GetPosition() const
|
||||||
{
|
{
|
||||||
#if NAZARA_PLATFORM_SAFE
|
#if NAZARA_PLATFORM_SAFE
|
||||||
|
|
@ -268,19 +255,6 @@ namespace Nz
|
||||||
return m_impl->GetTitle();
|
return m_impl->GetTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Window::GetWidth() const
|
|
||||||
{
|
|
||||||
#if NAZARA_PLATFORM_SAFE
|
|
||||||
if (!m_impl)
|
|
||||||
{
|
|
||||||
NazaraError("Window not created");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return m_impl->GetWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Window::HasFocus() const
|
bool Window::HasFocus() const
|
||||||
{
|
{
|
||||||
#if NAZARA_PLATFORM_SAFE
|
#if NAZARA_PLATFORM_SAFE
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
if (s_contextStates->currentTarget)
|
if (s_contextStates->currentTarget)
|
||||||
{
|
{
|
||||||
unsigned int height = s_contextStates->currentTarget->GetHeight();
|
unsigned int height = s_contextStates->currentTarget->GetSize().y;
|
||||||
glScissor(scissorBox.x, height - scissorBox.height - scissorBox.y, scissorBox.width, scissorBox.height);
|
glScissor(scissorBox.x, height - scissorBox.height - scissorBox.y, scissorBox.width, scissorBox.height);
|
||||||
s_contextStates->scissorBoxUpdated = true;
|
s_contextStates->scissorBoxUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
@ -494,7 +494,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
if (s_contextStates->currentTarget)
|
if (s_contextStates->currentTarget)
|
||||||
{
|
{
|
||||||
unsigned int height = s_contextStates->currentTarget->GetHeight();
|
unsigned int height = s_contextStates->currentTarget->GetSize().y;
|
||||||
glViewport(viewport.x, height - viewport.height - viewport.y, viewport.width, viewport.height);
|
glViewport(viewport.x, height - viewport.height - viewport.y, viewport.width, viewport.height);
|
||||||
s_contextStates->viewportUpdated = true;
|
s_contextStates->viewportUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1287,7 +1287,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
const Recti& scissorBox = s_contextStates->currentViewport;
|
const Recti& scissorBox = s_contextStates->currentViewport;
|
||||||
|
|
||||||
unsigned int height = s_contextStates->currentTarget->GetHeight();
|
unsigned int height = s_contextStates->currentTarget->GetSize().y;
|
||||||
glScissor(scissorBox.x, height - scissorBox.height - scissorBox.y, scissorBox.width, scissorBox.height);
|
glScissor(scissorBox.x, height - scissorBox.height - scissorBox.y, scissorBox.width, scissorBox.height);
|
||||||
|
|
||||||
s_contextStates->scissorBoxUpdated = true;
|
s_contextStates->scissorBoxUpdated = true;
|
||||||
|
|
@ -1297,7 +1297,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
const Recti& viewport = s_contextStates->currentViewport;
|
const Recti& viewport = s_contextStates->currentViewport;
|
||||||
|
|
||||||
unsigned int height = s_contextStates->currentTarget->GetHeight();
|
unsigned int height = s_contextStates->currentTarget->GetSize().y;
|
||||||
glViewport(viewport.x, height - viewport.height - viewport.y, viewport.width, viewport.height);
|
glViewport(viewport.x, height - viewport.height - viewport.y, viewport.width, viewport.height);
|
||||||
|
|
||||||
s_contextStates->viewportUpdated = true;
|
s_contextStates->viewportUpdated = true;
|
||||||
|
|
|
||||||
|
|
@ -438,16 +438,6 @@ namespace Nz
|
||||||
m_checked = false;
|
m_checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int RenderTexture::GetHeight() const
|
|
||||||
{
|
|
||||||
NazaraAssert(m_impl, "Invalid render texture");
|
|
||||||
|
|
||||||
if (!m_sizeUpdated)
|
|
||||||
UpdateSize();
|
|
||||||
|
|
||||||
return m_impl->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderTargetParameters RenderTexture::GetParameters() const
|
RenderTargetParameters RenderTexture::GetParameters() const
|
||||||
{
|
{
|
||||||
NazaraAssert(m_impl, "Invalid render texture");
|
NazaraAssert(m_impl, "Invalid render texture");
|
||||||
|
|
@ -466,16 +456,6 @@ namespace Nz
|
||||||
return Vector2ui(m_impl->width, m_impl->height);
|
return Vector2ui(m_impl->width, m_impl->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int RenderTexture::GetWidth() const
|
|
||||||
{
|
|
||||||
NazaraAssert(m_impl, "Invalid render texture");
|
|
||||||
|
|
||||||
if (!m_sizeUpdated)
|
|
||||||
UpdateSize();
|
|
||||||
|
|
||||||
return m_impl->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RenderTexture::IsComplete() const
|
bool RenderTexture::IsComplete() const
|
||||||
{
|
{
|
||||||
NazaraAssert(m_impl, "Invalid render texture");
|
NazaraAssert(m_impl, "Invalid render texture");
|
||||||
|
|
@ -665,13 +645,15 @@ namespace Nz
|
||||||
NazaraAssert(dst && dst->IsValid(), "Invalid destination render texture");
|
NazaraAssert(dst && dst->IsValid(), "Invalid destination render texture");
|
||||||
|
|
||||||
#if NAZARA_RENDERER_SAFE
|
#if NAZARA_RENDERER_SAFE
|
||||||
if (srcRect.x+srcRect.width > src->GetWidth() || srcRect.y+srcRect.height > src->GetHeight())
|
Vector2ui srcSize = src->GetSize();
|
||||||
|
if (srcRect.x+srcRect.width > srcSize.x || srcRect.y+srcRect.height > srcSize.y)
|
||||||
{
|
{
|
||||||
NazaraError("Source rectangle dimensions are out of bounds");
|
NazaraError("Source rectangle dimensions are out of bounds");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dstRect.x+dstRect.width > dst->GetWidth() || dstRect.y+dstRect.height > dst->GetHeight())
|
Vector2ui dstSize = dst->GetSize();
|
||||||
|
if (dstRect.x+dstRect.width > dstSize.x || dstRect.y+dstRect.height > dstSize.y)
|
||||||
{
|
{
|
||||||
NazaraError("Destination rectangle dimensions are out of bounds");
|
NazaraError("Destination rectangle dimensions are out of bounds");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -162,11 +162,6 @@ namespace Nz
|
||||||
NazaraError("No context");
|
NazaraError("No context");
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int RenderWindow::GetHeight() const
|
|
||||||
{
|
|
||||||
return Window::GetHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderTargetParameters RenderWindow::GetParameters() const
|
RenderTargetParameters RenderWindow::GetParameters() const
|
||||||
{
|
{
|
||||||
if (m_context)
|
if (m_context)
|
||||||
|
|
@ -181,9 +176,9 @@ namespace Nz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int RenderWindow::GetWidth() const
|
Vector2ui RenderWindow::GetSize() const
|
||||||
{
|
{
|
||||||
return Window::GetWidth();
|
return Window::GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderWindow::IsRenderable() const
|
bool RenderWindow::IsRenderable() const
|
||||||
|
|
|
||||||
|
|
@ -1444,7 +1444,7 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
// Envoi des uniformes liées au Renderer
|
// Envoi des uniformes liées au Renderer
|
||||||
Vector2ui targetSize(s_target->GetWidth(), s_target->GetHeight());
|
Vector2ui targetSize = s_target->GetSize();
|
||||||
if (s_targetSize != targetSize)
|
if (s_targetSize != targetSize)
|
||||||
{
|
{
|
||||||
int location;
|
int location;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue