Added CopyTo(Image/Texture) to NzRenderWindow

Added several methods to NzRenderer
Optimized NzRenderer::GetMax*();
Nz(Render)Window::GetSize now returns an unsigned vector
Fixed textures being flipped
This commit is contained in:
Lynix
2012-06-05 23:06:47 +02:00
parent a176648265
commit ddd2a2f310
13 changed files with 619 additions and 229 deletions

View File

@@ -729,8 +729,7 @@ bool NzImage::Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z
EnsureOwnership();
nzUInt8 bpp = NzPixelFormat::GetBPP(m_sharedImage->format);
nzUInt8* dstPixels = &m_sharedImage->pixels[level][(m_sharedImage->height*(m_sharedImage->width*z + rect.y) + rect.x) * NzPixelFormat::GetBPP(m_sharedImage->format)];
nzUInt8* dstPixels = &m_sharedImage->pixels[level][(m_sharedImage->height*(m_sharedImage->width*z + rect.y) + rect.x) * bpp];
unsigned int srcStride = rect.width * bpp;
unsigned int blockSize = m_sharedImage->width * bpp;
for (unsigned int i = 0; i < rect.height; ++i)
@@ -822,8 +821,7 @@ bool NzImage::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, const NzRect
EnsureOwnership();
nzUInt8 bpp = NzPixelFormat::GetBPP(m_sharedImage->format);
nzUInt8* dstPixels = &m_sharedImage->pixels[level][(m_sharedImage->height*(m_sharedImage->width*(face-nzCubemapFace_PositiveX) + rect.y) + rect.x) * NzPixelFormat::GetBPP(m_sharedImage->format)];
nzUInt8* dstPixels = &m_sharedImage->pixels[level][(m_sharedImage->height*(m_sharedImage->width*(face-nzCubemapFace_PositiveX) + rect.y) + rect.x) * bpp];
unsigned int srcStride = rect.width * bpp;
unsigned int blockSize = m_sharedImage->width * bpp;
for (unsigned int i = 0; i < rect.height; ++i)

View File

@@ -202,11 +202,11 @@ NzVector2i NzWindowImpl::GetPosition() const
return NzVector2i(rect.left, rect.top);
}
NzVector2i NzWindowImpl::GetSize() const
NzVector2ui NzWindowImpl::GetSize() const
{
RECT rect;
GetClientRect(m_handle, &rect);
return NzVector2i(rect.right-rect.left, rect.bottom-rect.top);
return NzVector2ui(rect.right-rect.left, rect.bottom-rect.top);
}
NzString NzWindowImpl::GetTitle() const
@@ -689,7 +689,7 @@ bool NzWindowImpl::HandleMessage(HWND window, UINT message, WPARAM wParam, LPARA
{
if (wParam != SIZE_MINIMIZED)
{
NzVector2i size = GetSize(); // On récupère uniquement la taille de la zone client
NzVector2ui size = GetSize(); // On récupère uniquement la taille de la zone client
NzEvent event;
event.type = NzEvent::Resized;

View File

@@ -45,7 +45,7 @@ class NzWindowImpl : NzNonCopyable
NzWindowHandle GetHandle() const;
unsigned int GetHeight() const;
NzVector2i GetPosition() const;
NzVector2i GetSize() const;
NzVector2ui GetSize() const;
NzString GetTitle() const;
unsigned int GetWidth() const;

View File

@@ -222,12 +222,12 @@ NzVector2i NzWindow::GetPosition() const
return NzVector2i(0);
}
NzVector2i NzWindow::GetSize() const
NzVector2ui NzWindow::GetSize() const
{
if (m_impl)
return m_impl->GetSize();
else
return NzVector2i(0);
return NzVector2ui(0U);
}
NzString NzWindow::GetTitle() const