Alphabetical commit
Former-commit-id: 4f1e73bd1228fefefd7f788adcd3ccb396d0b141
This commit is contained in:
parent
5345e615a1
commit
36b39ec868
|
|
@ -46,8 +46,8 @@ class NAZARA_API NzView : public NzAbstractViewer, public NzNode, NzRenderTarget
|
||||||
float GetZFar() const;
|
float GetZFar() const;
|
||||||
float GetZNear() const;
|
float GetZNear() const;
|
||||||
|
|
||||||
NzVector2i MapWorldToPixel(const NzVector2f& coords);
|
|
||||||
NzVector2f MapPixelToWorld(const NzVector2i& pixel);
|
NzVector2f MapPixelToWorld(const NzVector2i& pixel);
|
||||||
|
NzVector2i MapWorldToPixel(const NzVector2f& coords);
|
||||||
|
|
||||||
void SetSize(const NzVector2f& size);
|
void SetSize(const NzVector2f& size);
|
||||||
void SetSize(float width, float height);
|
void SetSize(float width, float height);
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,24 @@ float NzView::GetZNear() const
|
||||||
return m_zNear;
|
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)
|
NzVector2i NzView::MapWorldToPixel(const NzVector2f& coords)
|
||||||
{
|
{
|
||||||
if (!m_viewProjMatrixUpdated)
|
if (!m_viewProjMatrixUpdated)
|
||||||
|
|
@ -190,24 +208,6 @@ NzVector2i NzView::MapWorldToPixel(const NzVector2f& coords)
|
||||||
return pixel;
|
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)
|
void NzView::SetSize(const NzVector2f& size)
|
||||||
{
|
{
|
||||||
SetSize(size.x, size.y);
|
SetSize(size.x, size.y);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue