diff options
| -rw-r--r-- | indra/llprimitive/lltextureentry.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | 4 | ||||
| -rw-r--r-- | indra/newview/lldrawable.h | 1 | ||||
| -rw-r--r-- | indra/newview/llreflectionmapmanager.cpp | 20 | ||||
| -rw-r--r-- | indra/newview/llreflectionmapmanager.h | 4 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.h | 1 | ||||
| -rw-r--r-- | indra/newview/llvovolume.cpp | 30 | ||||
| -rw-r--r-- | indra/newview/llvovolume.h | 2 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 22 | ||||
| -rw-r--r-- | indra/newview/pipeline.h | 5 | 
10 files changed, 78 insertions, 19 deletions
diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index d057e5ab29..fdf3774bfa 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -696,14 +696,6 @@ S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams)  	}  	mMaterial = pMaterialParams; -    // TODO: GZ: We should avoid magic UUIDs in the future, but for development we're using one for the time being.  Remove this later. -    if (mMaterial->getSpecularID().asString() == "da7ecda1-e780-423f-ce27-26df7dc69cb6") -    { -        setRenderableTarget(RT_MIRROR); -    } else { -        setRenderableTarget(RT_DISABLED); -    } -      	return TEM_CHANGE_TEXTURE;  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 0152c0612a..e485c26e9b 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -217,7 +217,9 @@ void main()          {              color = atmosFragLightingLinear(color, additive, atten);          } -        color = texture(heroProbes, vec4(norm.xyz * env_mat, 0), 0).xyz; +         +        vec3 refnormpersp = reflect(pos.xyz, norm.xyz); +        color = texture(heroProbes, vec4(env_mat * refnormpersp, 0), 0).xyz;      }      else if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS))      { diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 970e8c8b2a..fc182fc2e2 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -286,6 +286,7 @@ public:  		ANIMATED_CHILD  = 0x01000000,  		ACTIVE_CHILD	= 0x02000000,  		FOR_UNLOAD		= 0x04000000, //should be unload from memory +        MIRROR          = 0x08000000, // Used as a mirror, needs a hero probe position to be calculated.  	} EDrawableFlags;  public: diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 99ebcf5231..ad4d3d94e2 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -140,7 +140,7 @@ void LLReflectionMapManager::update()      if (mMipChain.empty())      { -        U32 res = mProbeResolution; +        U32 res = mHeroProbeResolution;          U32 count = log2((F32)res) + 0.5f;          mMipChain.resize(count); @@ -326,7 +326,7 @@ void LLReflectionMapManager::update()          mRadiancePass = mRealtimeRadiancePass;          for (U32 i = 0; i < 6; ++i)          { -            updateProbeFace(closestDynamic, i, mProbeResolution, mTexture); +            updateProbeFace(closestDynamic, i, mProbeResolution, mTexture, mMipChain, mReflectionProbeCount);          }          mRealtimeRadiancePass = !mRealtimeRadiancePass; @@ -343,7 +343,7 @@ void LLReflectionMapManager::update()          mRadiancePass = true;          for (U32 i = 0; i < 6; ++i)          { -            updateProbeFace(mHeroProbe, i, mHeroProbeResolution, mHeroArray); +            updateProbeFace(mHeroProbe, i, mHeroProbeResolution, mHeroArray, mMipChain, mHeroProbeCount);          }          // restore "isRadiancePass" @@ -555,7 +555,7 @@ void LLReflectionMapManager::doProbeUpdate()      LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;      llassert(mUpdatingProbe != nullptr); -    updateProbeFace(mUpdatingProbe, mUpdatingFace, mProbeResolution, mTexture); +    updateProbeFace(mUpdatingProbe, mUpdatingFace, mProbeResolution, mTexture, mMipChain, mReflectionProbeCount);      if (++mUpdatingFace == 6)      { @@ -582,14 +582,14 @@ void LLReflectionMapManager::doProbeUpdate()  // The next six passes render the scene with both radiance and irradiance into the same scratch space cube map and generate a simple mip chain.  // At the end of these passes, a radiance map is generated for this probe and placed into the radiance cube map array at the index for this probe.  // In effect this simulates single-bounce lighting. -void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face, U32 probeResolution, LLPointer<LLCubeMapArray> cubeArray) +void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face, U32 probeResolution, LLPointer<LLCubeMapArray> cubeArray, std::vector<LLRenderTarget> &mipChain, U32 probeCount)  {      // hacky hot-swap of camera specific render targets      gPipeline.mRT = &gPipeline.mAuxillaryRT;      LLRenderTarget* target = &mRenderTarget; -    S32 sourceIdx = mReflectionProbeCount; +    S32 sourceIdx = probeCount;      if (probeResolution == mHeroProbeResolution)      { @@ -1327,9 +1327,13 @@ void LLReflectionMapManager::initReflectionMaps()          mHeroProbeResolution = 128; -        mHeroArray = new LLCubeMapArray();          // Revise when we have both water and mirrors in hero probes. -        mHeroArray->allocate(mHeroProbeResolution, 3, 2, true); +        mHeroProbeCount = 1; +         +        mHeroArray = new LLCubeMapArray(); +         +        // We use an extra probe for scratch space on these. +        mHeroArray->allocate(mHeroProbeResolution, 3, mHeroProbeCount + 1, true);          if (mHeroProbe.isNull()) {              mHeroProbe = new LLReflectionMap(); diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h index 81b0ef8ed8..9f48ce3cfd 100644 --- a/indra/newview/llreflectionmapmanager.h +++ b/indra/newview/llreflectionmapmanager.h @@ -148,7 +148,7 @@ private:      void doProbeUpdate();      // update the specified face of the specified probe -    void updateProbeFace(LLReflectionMap* probe, U32 face, U32 probeResolution, LLPointer<LLCubeMapArray> cubeArray); +    void updateProbeFace(LLReflectionMap* probe, U32 face, U32 probeResolution, LLPointer<LLCubeMapArray> cubeArray, std::vector<LLRenderTarget> &mipChain, U32 probeCount);      // list of active reflection maps      std::vector<LLPointer<LLReflectionMap> > mProbes; @@ -188,6 +188,8 @@ private:      // number of reflection probes to use for rendering      U32 mReflectionProbeCount; +     +    U32 mHeroProbeCount;      // resolution of reflection probes      U32 mProbeResolution = 128; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 4d49c61b23..fe33047218 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -257,6 +257,7 @@ public:  	virtual BOOL isRiggedMesh() const				{ return FALSE; }  	virtual BOOL hasLightTexture() const			{ return FALSE; }      virtual BOOL isReflectionProbe() const          { return FALSE; } +    virtual BOOL isMirror() const                   { return FALSE; }  	// This method returns true if the object is over land owned by  	// the agent, one of its groups, or it encroaches and  diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 556ec083a7..254e945243 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1044,7 +1044,9 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline)      {          updateReflectionProbePtr();      } - +     +    gPipeline.setMirror(mDrawable, isMirror()); +      	updateRadius();  	bool force_update = true; // avoid non-alpha mDistance update being optimized away  	mDrawable->updateDistance(*LLViewerCamera::getInstance(), force_update); @@ -3377,6 +3379,30 @@ F32 LLVOVolume::getLightCutoff() const  	}  } +BOOL LLVOVolume::isMirror() const +{ +    S32 faceCount = getNumFaces(); +     +    // Temporary hack to set the object to mirror. +    for (int i = 0; i < faceCount; i++) +    { +        const LLTextureEntry* te = getTE(i); +         +        if (te->getMaterialParams().notNull()) +        { +            LLViewerTexture* specularp = getTESpecularMap(0); +             +            if (specularp && specularp->getID() == "da7ecda1-e780-423f-ce27-26df7dc69cb6") +            { +                LL_INFOS() << "BELLADONNA OF SADNESS" << LL_ENDL; +                return TRUE; +            } +        } +    } +     +    return FALSE; +} +  BOOL LLVOVolume::isReflectionProbe() const  {      return getParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE); @@ -4427,6 +4453,8 @@ void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_u  	}      updateReflectionProbePtr(); +     +    gPipeline.setMirror(mDrawable, isMirror());  }  void LLVOVolume::updateReflectionProbePtr() diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 93aba9b8cb..cecf726763 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -308,6 +308,8 @@ public:      F32 getReflectionProbeNearClip() const;      bool getReflectionProbeIsBox() const;      bool getReflectionProbeIsDynamic() const; +     +    BOOL isMirror() const override;  	// Flexible Objects  	U32 getVolumeInterfaceID() const; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d7188c0fe7..e742992c1d 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2761,6 +2761,23 @@ void LLPipeline::markShift(LLDrawable *drawablep)  	}  } +void LLPipeline::setMirror(LLDrawable *drawablep, bool is_mirror) +{ +    if (drawablep && assertInitialized()) +    { +        if (is_mirror) +        { +            drawablep->setState(LLDrawable::MIRROR); +            mMirrorList.insert(drawablep); +        } +        else +        { +            mMirrorList.erase(drawablep); +            drawablep->clearState(LLDrawable::MIRROR); +        } +    } +} +  void LLPipeline::shiftObjects(const LLVector3 &offset)  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; @@ -5812,6 +5829,11 @@ void LLPipeline::findReferences(LLDrawable *drawablep)  	{  		LL_INFOS() << "In mRetexturedList" << LL_ENDL;  	} +     +    if (std::find(mMirrorList.begin(), mMirrorList.end(), drawablep) !=  mMirrorList.end()) +    { +        LL_INFOS() << "In mMirrorList" << LL_ENDL; +    }  	if (std::find(mBuildQ1.begin(), mBuildQ1.end(), drawablep) != mBuildQ1.end())  	{ diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index c0559ce83b..f3b35e0325 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -357,6 +357,7 @@ public:  	void shiftObjects(const LLVector3 &offset);  	void setLight(LLDrawable *drawablep, bool is_light); +    void setMirror(LLDrawable *drawablep, bool is_mirror);  	bool hasRenderBatches(const U32 type) const;  	LLCullResult::drawinfo_iterator beginRenderMap(U32 type); @@ -818,6 +819,10 @@ protected:  	LLDrawable::ordered_drawable_set_t	mLights;  	light_set_t						mNearbyLights; // lights near camera  	LLColor4						mHWLightColors[8]; +     +     +    LLDrawable::ordered_drawable_set_t  mMirrorList; +    LLDrawable*                         mNearestMirror;  	/////////////////////////////////////////////  	//  | 
