summaryrefslogtreecommitdiff
path: root/indra/newview/llheroprobemanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llheroprobemanager.cpp')
-rw-r--r--indra/newview/llheroprobemanager.cpp68
1 files changed, 17 insertions, 51 deletions
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 1ecafd4f54..39f5bdec5a 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -165,20 +165,10 @@ void LLHeroProbeManager::update()
LLVector3 reject = offset - project;
LLVector3 point = (reject - project) + hero_pos;
- glh::matrix4f mat = copy_matrix(gGLModelView);
- glh::vec4f tc(face_normal.mV);
- mat.mult_matrix_vec(tc);
-
- LLVector3 mirror_normal;
- mirror_normal.set(tc.v);
-
- LLVector3 hero_pos_render;
- tc = glh::vec4f(hero_pos.mV);
-
- mat.mult_matrix_vec(tc);
- hero_pos_render.set(tc.v);
-
- mCurrentClipPlane.setVec(hero_pos_render, mirror_normal);
+ mCurrentClipPlane.setVec(hero_pos, face_normal);
+ mMirrorPosition = mNearestHero->getPositionAgent();
+ mMirrorNormal = face_normal;
+
probe_pos.load3(point.mV);
}
@@ -227,7 +217,7 @@ void LLHeroProbeManager::update()
void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 near_clip)
{
// hacky hot-swap of camera specific render targets
- gPipeline.mRT = &gPipeline.mAuxillaryRT;
+ gPipeline.mRT = &gPipeline.mHeroProbeRT;
probe->update(mRenderTarget.getWidth(), face, true, near_clip);
@@ -262,32 +252,8 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
static LLStaticHashedString znear("znear");
static LLStaticHashedString zfar("zfar");
- LLRenderTarget *screen_rt = &gPipeline.mAuxillaryRT.screen;
- LLRenderTarget *depth_rt = &gPipeline.mAuxillaryRT.deferredScreen;
-
- // perform a gaussian blur on the super sampled render before downsampling
- {
- gGaussianProgram.bind();
- gGaussianProgram.uniform1f(resScale, 1.f / mProbeResolution);
- S32 diffuseChannel = gGaussianProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_TEXTURE);
-
- // horizontal
- gGaussianProgram.uniform2f(direction, 1.f, 0.f);
- gGL.getTexUnit(diffuseChannel)->bind(screen_rt);
- mRenderTarget.bindTarget();
- gPipeline.mScreenTriangleVB->setBuffer();
- gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- mRenderTarget.flush();
-
- // vertical
- gGaussianProgram.uniform2f(direction, 0.f, 1.f);
- gGL.getTexUnit(diffuseChannel)->bind(&mRenderTarget);
- screen_rt->bindTarget();
- gPipeline.mScreenTriangleVB->setBuffer();
- gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- screen_rt->flush();
- }
-
+ LLRenderTarget *screen_rt = &gPipeline.mHeroProbeRT.screen;
+ LLRenderTarget *depth_rt = &gPipeline.mHeroProbeRT.deferredScreen;
S32 mips = log2((F32)mProbeResolution) + 0.5f;
@@ -348,14 +314,14 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
{
//generate radiance map (even if this is not the irradiance map, we need the mip chain for the irradiance map)
- gRadianceGenProgram.bind();
+ gHeroRadianceGenProgram.bind();
mVertexBuffer->setBuffer();
- S32 channel = gRadianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
+ S32 channel = gHeroRadianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
mTexture->bind(channel);
- gRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
- gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
- gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, mHeroProbeStrength);
+ gHeroRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
+ gHeroRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
+ gHeroRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, mHeroProbeStrength);
U32 res = mMipChain[0].getWidth();
@@ -367,10 +333,10 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
static LLStaticHashedString sWidth("u_width");
static LLStaticHashedString sStrength("probe_strength");
- gRadianceGenProgram.uniform1f(sRoughness, (F32)i / (F32)(mMipChain.size() - 1));
- gRadianceGenProgram.uniform1f(sMipLevel, i);
- gRadianceGenProgram.uniform1i(sWidth, mProbeResolution);
- gRadianceGenProgram.uniform1f(sStrength, 1);
+ gHeroRadianceGenProgram.uniform1f(sRoughness, (F32) i / (F32) (mMipChain.size() - 1));
+ gHeroRadianceGenProgram.uniform1f(sMipLevel, i);
+ gHeroRadianceGenProgram.uniform1i(sWidth, mProbeResolution);
+ gHeroRadianceGenProgram.uniform1f(sStrength, 1);
for (int cf = 0; cf < 6; ++cf)
{ // for each cube face
@@ -393,7 +359,7 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
}
}
- gRadianceGenProgram.unbind();
+ gHeroRadianceGenProgram.unbind();
}
mMipChain[0].flush();