Alphabetical commit

Former-commit-id: 4f1e73bd1228fefefd7f788adcd3ccb396d0b141
This commit is contained in:
Lynix 2015-03-19 18:17:52 +01:00
parent 5345e615a1
commit 36b39ec868
2 changed files with 19 additions and 19 deletions

View File

@ -46,8 +46,8 @@ class NAZARA_API NzView : public NzAbstractViewer, public NzNode, NzRenderTarget
float GetZFar() const;
float GetZNear() const;
NzVector2i MapWorldToPixel(const NzVector2f& coords);
NzVector2f MapPixelToWorld(const NzVector2i& pixel);
NzVector2i MapWorldToPixel(const NzVector2f& coords);
void SetSize(const NzVector2f& size);
void SetSize(float width, float height);

View File

@ -170,6 +170,24 @@ float NzView::GetZNear() const
return m_zNear;
}
NzVector2f NzView::MapPixelToWorld(const NzVector2i& pixel)
{
if (!m_invViewProjMatrixUpdated)
UpdateInvViewProjMatrix();
if (!m_viewportUpdated)
UpdateViewport();
// Conversion du viewport en flottant
NzRectf viewport(m_viewport);
NzVector2f normalized;
normalized.x = -1.f + 2.f * (pixel.x - viewport.x) / viewport.width;
normalized.y = 1.f - 2.f * (pixel.y - viewport.y) / viewport.height;
return m_invViewProjMatrix.Transform(normalized);
}
NzVector2i NzView::MapWorldToPixel(const NzVector2f& coords)
{
if (!m_viewProjMatrixUpdated)
@ -190,24 +208,6 @@ NzVector2i NzView::MapWorldToPixel(const NzVector2f& coords)
return pixel;
}
NzVector2f NzView::MapPixelToWorld(const NzVector2i& pixel)
{
if (!m_invViewProjMatrixUpdated)
UpdateInvViewProjMatrix();
if (!m_viewportUpdated)
UpdateViewport();
// Conversion du viewport en flottant
NzRectf viewport(m_viewport);
NzVector2f normalized;
normalized.x = -1.f + 2.f * (pixel.x - viewport.x) / viewport.width;
normalized.y = 1.f - 2.f * (pixel.y - viewport.y) / viewport.height;
return m_invViewProjMatrix.Transform(normalized);
}
void NzView::SetSize(const NzVector2f& size)
{
SetSize(size.x, size.y);