DrPain
14-10-2005 13:16:21
Discussion continued from: http://www.ogre3d.org/phpBB2/viewtopic.php?t=13789
Actually, I've been meaning to post this but hadn't gotten around to it.
I had already gotten bitten by the "infinite loop" problem a few times, so I revisited the situation.
A better fix it seems would be this:
File OgrePaginglandscapeTile.cpp (did I incorrectly reference OgrePagingLandscapeOptions.cpp before, or did this function move?), line 344.
Also, I think a temp variable should be used in the while loop, to avoid calling getRealPageHeight many times.
What do you think?
Actually, I've been meaning to post this but hadn't gotten around to it.
I had already gotten bitten by the "infinite loop" problem a few times, so I revisited the situation.
A better fix it seems would be this:
File OgrePaginglandscapeTile.cpp (did I incorrectly reference OgrePagingLandscapeOptions.cpp before, or did this function move?), line 344.
if (dir.y > 0.0001)
{
while( ray.y < PagingLandScapeData2DManager::getSingleton().getRealPageHeight( ray.x, ray.z,
mInfo.pageX, mInfo.pageZ,
0))
{
ray += dir;
}
}
else if (dir.y < -0.0001)
{
while( ray.y > PagingLandScapeData2DManager::getSingleton().getRealPageHeight( ray.x, ray.z,
mInfo.pageX, mInfo.pageZ,
0))
{
ray += dir;
}
}
else // dir.y == 0
{
*result = Vector3( -1.0f, -1.0f, -1.0f );
return false;
}
Also, I think a temp variable should be used in the while loop, to avoid calling getRealPageHeight many times.
What do you think?