SL-10099
Remove user clip plane from culling pass and from attachment vis update. There will be more slop and render submits, but the results will be more stable and involve less culling mystery bugs like 9708.meow-7.2.2
parent
8d3e5a3eac
commit
86981981c8
|
|
@ -2433,36 +2433,8 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
|
|||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
|
||||
//setup a clip plane in projection matrix for reflection renders (prevents flickering from occlusion culling)
|
||||
LLViewerRegion* region = gAgent.getRegion();
|
||||
LLPlane plane;
|
||||
|
||||
if (planep)
|
||||
{
|
||||
plane = *planep;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (region)
|
||||
{
|
||||
LLVector3 pnorm;
|
||||
F32 height = region->getWaterHeight();
|
||||
if (water_clip < 0)
|
||||
{ //camera is above water, clip plane points up
|
||||
pnorm.setVec(0,0,1);
|
||||
plane.setVec(pnorm, -height);
|
||||
}
|
||||
else if (water_clip > 0)
|
||||
{ //camera is below water, clip plane points down
|
||||
pnorm = LLVector3(0,0,-1);
|
||||
plane.setVec(pnorm, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glh::matrix4f modelview = get_last_modelview();
|
||||
glh::matrix4f proj = get_last_projection();
|
||||
LLGLUserClipPlane clip(plane, modelview, proj, water_clip != 0 && LLPipeline::sReflectionRender);
|
||||
|
||||
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
|
||||
|
||||
|
|
@ -2483,21 +2455,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
|
|||
mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
}
|
||||
|
||||
camera.disableUserClipPlane();
|
||||
|
||||
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
|
||||
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
|
||||
{
|
||||
LLViewerRegion* region = *iter;
|
||||
if (water_clip != 0)
|
||||
{
|
||||
LLPlane plane(LLVector3(0,0, (F32) -water_clip), (F32) water_clip*region->getWaterHeight());
|
||||
camera.setUserClipPlane(plane);
|
||||
}
|
||||
else
|
||||
{
|
||||
camera.disableUserClipPlane();
|
||||
}
|
||||
|
||||
for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
|
||||
|
||||
for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
|
||||
{
|
||||
LLSpatialPartition* part = region->getSpatialPartition(i);
|
||||
if (part)
|
||||
|
|
@ -9869,23 +9834,19 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point);
|
||||
|
||||
//plane params
|
||||
LLVector3 pnorm;
|
||||
F32 plane_d;
|
||||
|
||||
LLVector3 pnorm;
|
||||
S32 water_clip = 0;
|
||||
if (!LLViewerCamera::getInstance()->cameraUnderWater())
|
||||
{ //camera is above water, clip plane points up
|
||||
pnorm.setVec(0,0,1);
|
||||
plane_d = -water_height;
|
||||
plane.setVec(pnorm, -distance_to_water);
|
||||
water_clip = -1;
|
||||
plane.setVec(pnorm, -water_height);
|
||||
water_clip = 1;
|
||||
}
|
||||
else
|
||||
{ //camera is below water, clip plane points down
|
||||
pnorm = LLVector3(0,0,-1);
|
||||
plane_d = water_height;
|
||||
plane.setVec(pnorm, distance_to_water);
|
||||
water_clip = 1;
|
||||
plane.setVec(pnorm, water_height);
|
||||
water_clip = -1;
|
||||
}
|
||||
|
||||
bool materials_in_water = false;
|
||||
|
|
@ -10002,7 +9963,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
|
||||
LLGLUserClipPlane clip_plane(plane, mat, projection);
|
||||
LLGLDisable cull(GL_CULL_FACE);
|
||||
updateCull(camera, ref_result, -water_clip, &plane);
|
||||
updateCull(camera, ref_result, water_clip, &plane);
|
||||
stateSort(camera, ref_result);
|
||||
}
|
||||
|
||||
|
|
@ -10145,8 +10106,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
gPipeline.popRenderTypeMask();
|
||||
LLDrawPoolWater::sNeedsReflectionUpdate = FALSE;
|
||||
LLDrawPoolWater::sNeedsDistortionUpdate = FALSE;
|
||||
LLPlane npnorm(-pnorm, -plane_d);
|
||||
LLViewerCamera::getInstance()->setUserClipPlane(npnorm);
|
||||
|
||||
LLGLState::checkStates();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue