Changed the method of expanding of the near and far planes in
CullVisitor::popProjectionMatrix so that it better handled models of zero thickness orthogonal to the viewing direction.
This commit is contained in:
parent
02fc6ad5f8
commit
165cc1bf42
@ -224,8 +224,8 @@ void CullVisitor::popProjectionMatrix()
|
||||
// so it doesn't cull them out.
|
||||
osg::Matrix& projection = *_projectionStack.back();
|
||||
|
||||
double desired_znear = _computed_znear;
|
||||
double desired_zfar = _computed_zfar;
|
||||
double desired_znear = _computed_znear*0.98f;
|
||||
double desired_zfar = _computed_zfar*1.02f;
|
||||
|
||||
double min_near_plane = _computed_zfar*0.0005f;
|
||||
if (desired_znear<min_near_plane) desired_znear=min_near_plane;
|
||||
@ -233,7 +233,7 @@ void CullVisitor::popProjectionMatrix()
|
||||
double trans_near_plane = (-desired_znear*projection(2,2)+projection(3,2))/(-desired_znear*projection(2,3)+projection(3,3));
|
||||
double trans_far_plane = (-desired_zfar*projection(2,2)+projection(3,2))/(-desired_zfar*projection(2,3)+projection(3,3));
|
||||
|
||||
double ratio = fabs(2.0f/(trans_near_plane-trans_far_plane))*0.95;
|
||||
double ratio = fabs(2.0f/(trans_near_plane-trans_far_plane));
|
||||
double center = -(trans_near_plane+trans_far_plane)/2.0f;
|
||||
|
||||
projection.postMult(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
|
||||
|
Loading…
Reference in New Issue
Block a user