Skip to content

Commit

Permalink
Fix Forward Clustered for Orthographic camera (#36)
Browse files Browse the repository at this point in the history
FET_TAN_HALF_ANGLES math assumes camera is projected. It must fall back
to the main path for orthographic projection

Fixes #36
  • Loading branch information
darksylinc committed Dec 7, 2024
1 parent 386cb02 commit 8ebfbfe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions OgreMain/src/OgreFrustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ namespace Ogre {
top = mTop;
bottom = mBottom;

if (mFrustrumExtentsType == FET_TAN_HALF_ANGLES)
if( mFrustrumExtentsType == FET_TAN_HALF_ANGLES && mProjType != PT_ORTHOGRAPHIC )
{
left *= mNearDist;
right *= mNearDist;
Expand Down Expand Up @@ -1388,16 +1388,16 @@ namespace Ogre {
FrustrumExtentsType frustrumExtentsType) const
{
updateFrustum();
if (frustrumExtentsType == FET_TAN_HALF_ANGLES &&
mFrustrumExtentsType == FET_PROJ_PLANE_POS)
if( frustrumExtentsType == FET_TAN_HALF_ANGLES && mFrustrumExtentsType == FET_PROJ_PLANE_POS &&
mProjType != PT_ORTHOGRAPHIC )
{
outleft = mLeft / mNearDist;
outright = mRight / mNearDist;
outtop = mTop / mNearDist;
outbottom = mBottom / mNearDist;
}
else if (frustrumExtentsType == FET_PROJ_PLANE_POS &&
mFrustrumExtentsType == FET_TAN_HALF_ANGLES)
else if( frustrumExtentsType == FET_PROJ_PLANE_POS &&
mFrustrumExtentsType == FET_TAN_HALF_ANGLES && mProjType != PT_ORTHOGRAPHIC )
{
outleft = mLeft * mNearDist;
outright = mRight * mNearDist;
Expand Down

0 comments on commit 8ebfbfe

Please sign in to comment.