diff options
author | Graham Linden <graham@lindenlab.com> | 2018-10-09 01:17:26 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-10-09 01:17:26 +0100 |
commit | 8c4258009b09f16751437d0549067ab2950e725a (patch) | |
tree | ed02d7d89ff8c7c17deab4fccf57114ee864602b /indra/newview | |
parent | ffc6393309d06446f9d1361f0f0282b2110768ae (diff) |
SL-9709
Make VOWater objects avoid culling.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llworld.cpp | 51 | ||||
-rw-r--r-- | indra/newview/llworld.h | 3 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 57 |
3 files changed, 87 insertions, 24 deletions
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index cee47a591e..a519b5a957 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -873,6 +873,57 @@ void LLWorld::waterHeightRegionInfo(std::string const& sim_name, F32 water_heigh } } +void LLWorld::precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water) +{ + if (!gAgent.getRegion()) + { + return; + } + + if (mRegionList.empty()) + { + LL_WARNS() << "No regions!" << LL_ENDL; + return; + } + + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) + { + LLViewerRegion* regionp = *iter; + LLVOWater* waterp = regionp->getLand().getWaterObj(); + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } + + if (include_void_water) + { + for (std::list<LLVOWater*>::iterator iter = mHoleWaterObjects.begin(); + iter != mHoleWaterObjects.end(); ++ iter) + { + LLVOWater* waterp = *iter; + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } + } + + S32 dir; + for (dir = 0; dir < 8; dir++) + { + LLVOWater* waterp = mEdgeWaterObjects[dir]; + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } +} + void LLWorld::updateWaterObjects() { if (!gAgent.getRegion()) diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index c9ac241d5a..9722448746 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -138,6 +138,9 @@ public: LLViewerTexture *getDefaultWaterTexture(); void updateWaterObjects(); + + void precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water); + void waterHeightRegionInfo(std::string const& sim_name, F32 water_height); void shiftRegions(const LLVector3& offset); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a513588568..c1b7fdc780 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -88,6 +88,7 @@ #include "llvocache.h" #include "llvoground.h" #include "llvosky.h" +#include "llvowlsky.h" #include "llvotree.h" #include "llvovolume.h" #include "llvosurfacepatch.h" @@ -2415,21 +2416,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl { 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); - } + pnorm.setVec(0,0,-(F32)water_clip); + plane.setVec(pnorm, height * pnorm.mV[VZ]); } } glh::matrix4f modelview = get_last_modelview(); - glh::matrix4f proj = get_last_projection(); + glh::matrix4f proj = get_last_projection(); + LLGLUserClipPlane clip(plane, modelview, proj, water_clip != 0 && LLPipeline::sReflectionRender); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -2455,9 +2449,9 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; - if (water_clip != 0) + if (water_clip != 0 && LLPipeline::sReflectionRender) { - LLPlane plane(LLVector3(0,0, (F32) -water_clip), (F32) water_clip*region->getWaterHeight()); + LLPlane plane(LLVector3(0,0, -(F32)water_clip), water_clip * region->getWaterHeight()); camera.setUserClipPlane(plane); } else @@ -2513,7 +2507,20 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl sCull->pushDrawable(gSky.mVOGroundp->mDrawable); } + if (hasRenderType(LLPipeline::RENDER_TYPE_WL_SKY) && + gPipeline.canUseWindLightShaders() && + gSky.mVOWLSkyp.notNull() && + gSky.mVOWLSkyp->mDrawable.notNull()) + { + gSky.mVOWLSkyp->mDrawable->setVisible(camera); + sCull->pushDrawable(gSky.mVOWLSkyp->mDrawable); + } + if (hasRenderType(LLPipeline::RENDER_TYPE_WATER)) + { + LLWorld::getInstance()->precullWaterObjects(camera, sCull, hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER)); + } + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); gGL.matrixMode(LLRender::MM_MODELVIEW); @@ -9823,21 +9830,23 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) F32 plane_d; 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; + + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + //camera is below water, clip plane points down + 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; + { + //camera is above water, clip plane points up + water_clip = -1; } + //camera is below water, clip plane points down + pnorm = LLVector3(0,0,-(F32)water_clip); + plane_d = water_height * pnorm.mV[VZ]; + plane.setVec(pnorm, distance_to_water * pnorm.mV[VZ]); + bool materials_in_water = false; #if MATERIALS_IN_REFLECTIONS |