Fixed zfar during tiled render.

This commit is contained in:
Leonardo Zide 2017-08-05 12:12:42 -07:00
parent 51afa3acde
commit 4bf4f14d4e

View file

@ -305,7 +305,7 @@ lcMatrix44 View::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, int
int ImageWidth = mRenderImage.width(); int ImageWidth = mRenderImage.width();
int ImageHeight = mRenderImage.height(); int ImageHeight = mRenderImage.height();
double mLeft, mRight, mBottom, mTop, mNear, mFar; double ImageLeft, ImageRight, ImageBottom, ImageTop, Near, Far;
double AspectRatio = (double)ImageWidth / (double)ImageHeight; double AspectRatio = (double)ImageWidth / (double)ImageHeight;
if (mCamera->IsOrtho()) if (mCamera->IsOrtho())
@ -313,12 +313,12 @@ lcMatrix44 View::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, int
float OrthoHeight = mCamera->GetOrthoHeight() / 2.0f; float OrthoHeight = mCamera->GetOrthoHeight() / 2.0f;
float OrthoWidth = OrthoHeight * AspectRatio; float OrthoWidth = OrthoHeight * AspectRatio;
mLeft = -OrthoWidth; ImageLeft = -OrthoWidth;
mRight = OrthoWidth; ImageRight = OrthoWidth;
mBottom = -OrthoHeight; ImageBottom = -OrthoHeight;
mTop = OrthoHeight; ImageTop = OrthoHeight;
mNear = mCamera->m_zNear; Near = mCamera->m_zNear;
mFar = mCamera->m_zFar * 4; Far = mCamera->m_zFar * 4;
} }
else else
{ {
@ -328,23 +328,23 @@ lcMatrix44 View::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, int
xmin = ymin * AspectRatio; xmin = ymin * AspectRatio;
xmax = ymax * AspectRatio; xmax = ymax * AspectRatio;
mLeft = xmin; ImageLeft = xmin;
mRight = xmax; ImageRight = xmax;
mBottom = ymin; ImageBottom = ymin;
mTop = ymax; ImageTop = ymax;
mNear = mCamera->m_zNear; Near = mCamera->m_zNear;
mFar = mCamera->m_zFar * 4; Far = mCamera->m_zFar;
} }
double Left = mLeft + (mRight - mLeft) * (CurrentColumn * mWidth) / ImageWidth; double Left = ImageLeft + (ImageRight - ImageLeft) * (CurrentColumn * mWidth) / ImageWidth;
double Right = Left + (mRight - mLeft) * CurrentTileWidth / ImageWidth; double Right = Left + (ImageRight - ImageLeft) * CurrentTileWidth / ImageWidth;
double Bottom = mBottom + (mTop - mBottom) * (CurrentRow * mHeight) / ImageHeight; double Bottom = ImageBottom + (ImageTop - ImageBottom) * (CurrentRow * mHeight) / ImageHeight;
double Top = Bottom + (mTop - mBottom) * CurrentTileHeight / ImageHeight; double Top = Bottom + (ImageTop - ImageBottom) * CurrentTileHeight / ImageHeight;
if (mCamera->IsOrtho()) if (mCamera->IsOrtho())
return lcMatrix44Ortho(Left, Right, Bottom, Top, mNear, mFar); return lcMatrix44Ortho(Left, Right, Bottom, Top, Near, Far);
else else
return lcMatrix44Frustum(Left, Right, Bottom, Top, mNear, mFar); return lcMatrix44Frustum(Left, Right, Bottom, Top, Near, Far);
} }
LC_CURSOR_TYPE View::GetCursor() const LC_CURSOR_TYPE View::GetCursor() const