diff options
Diffstat (limited to 'indra/newview/llreflectionmap.cpp')
-rw-r--r-- | indra/newview/llreflectionmap.cpp | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 2604c2ba53..8d164b6883 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -56,7 +56,7 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n llassert(mCubeArray.notNull()); llassert(mCubeIndex != -1); //llassert(LLPipeline::sRenderDeferred); - + // make sure we don't walk off the edge of the render target while (resolution > gPipeline.mRT->deferredScreen.getWidth() || resolution > gPipeline.mRT->deferredScreen.getHeight()) @@ -65,7 +65,7 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n } F32 clip = (near_clip > 0) ? near_clip : getNearClip(); - + gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, clip, getIsDynamic() || force_dynamic, useClipPlane, clipPlane); } @@ -145,7 +145,7 @@ void LLReflectionMap::autoAdjustOrigin() LLVector3 origin(fp); F32 height = LLWorld::instance().resolveLandHeightAgent(origin) + 2.f; fp[2] = llmax(fp[2], height); - + // make sure radius encompasses all objects LLSimdScalar r2 = 0.0; for (int i = 0; i < 8; ++i) @@ -165,7 +165,7 @@ void LLReflectionMap::autoAdjustOrigin() // make sure near clip doesn't poke through ground fp[2] = llmax(fp[2], height+mRadius*0.5f); - + } } else if (mViewerObject && !mViewerObject->isDead()) @@ -220,7 +220,7 @@ F32 LLReflectionMap::getNearClip() if (mViewerObject && mViewerObject->getVolume()) { - ret = ((LLVOVolume*)mViewerObject)->getReflectionProbeNearClip(); + ret = mViewerObject->getReflectionProbeNearClip(); } else if (mGroup) { @@ -237,46 +237,41 @@ F32 LLReflectionMap::getNearClip() bool LLReflectionMap::getIsDynamic() { if (gSavedSettings.getS32("RenderReflectionProbeDetail") > (S32) LLReflectionMapManager::DetailLevel::STATIC_ONLY && - mViewerObject && + mViewerObject && mViewerObject->getVolume()) { - return ((LLVOVolume*)mViewerObject)->getReflectionProbeIsDynamic(); + return mViewerObject->getReflectionProbeIsDynamic(); } return false; } bool LLReflectionMap::getBox(LLMatrix4& box) -{ +{ if (mViewerObject) { LLVolume* volume = mViewerObject->getVolume(); - if (volume) + if (volume && mViewerObject->getReflectionProbeIsBox()) { - LLVOVolume* vobjp = (LLVOVolume*)mViewerObject; - - if (vobjp->getReflectionProbeIsBox()) + glh::matrix4f mv(gGLModelView); + glh::matrix4f scale; + LLVector3 s = mViewerObject->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f)); + mRadius = s.magVec(); + scale.set_scale(glh::vec3f(s.mV)); + if (mViewerObject->mDrawable != nullptr) { - glh::matrix4f mv(gGLModelView); - glh::matrix4f scale; - LLVector3 s = vobjp->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f)); - mRadius = s.magVec(); - scale.set_scale(glh::vec3f(s.mV)); - if (vobjp->mDrawable != nullptr) - { - // object to agent space (no scale) - glh::matrix4f rm((F32*)vobjp->mDrawable->getWorldMatrix().mMatrix); + // object to agent space (no scale) + glh::matrix4f rm((F32*)mViewerObject->mDrawable->getWorldMatrix().mMatrix); - // construct object to camera space (with scale) - mv = mv * rm * scale; + // construct object to camera space (with scale) + mv = mv * rm * scale; - // inverse is camera space to object unit cube - mv = mv.inverse(); + // inverse is camera space to object unit cube + mv = mv.inverse(); - box = LLMatrix4(mv.m); + box = LLMatrix4(mv.m); - return true; - } + return true; } } } @@ -337,7 +332,7 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye) mOccluded = false; return; } - + if (mOcclusionQuery == 0) { // no query was previously issued, allocate one and issue LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGenQueries"); |