diff options
| author | Dave Parks <davep@lindenlab.com> | 2022-04-29 13:51:11 +0000 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2022-04-29 13:51:11 +0000 | 
| commit | 93a025966649e281ceff8d1471bc983cc036bc17 (patch) | |
| tree | 478dad507b450dce72c84ce7c87ab0266549ef45 /indra/llrender | |
| parent | deffbca3ee209f6aea3358692d9ca6dc7090e748 (diff) | |
SL-17282 prototype mixing of reflection map into legacy materials
Diffstat (limited to 'indra/llrender')
| -rw-r--r-- | indra/llrender/llcubemap.cpp | 8 | ||||
| -rw-r--r-- | indra/llrender/llglslshader.cpp | 18 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.cpp | 1 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.h | 1 | 
4 files changed, 25 insertions, 3 deletions
diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 40d15280d3..cc61158aa6 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -183,8 +183,7 @@ void LLCubeMap::initEnvironmentMap(const std::vector<LLPointer<LLImageRaw> >& ra          llassert(rawimages[i]->getHeight() == resolution);          llassert(rawimages[i]->getComponents() == components); - -        mImages[i] = new LLImageGL(resolution, resolution, components, FALSE); +        mImages[i] = new LLImageGL(resolution, resolution, components, TRUE);          mImages[i]->setTarget(mTargets[i], LLTexUnit::TT_CUBE_MAP);          mRawImages[i] = rawimages[i];          mImages[i]->createGLTexture(0, mRawImages[i], texname); @@ -195,6 +194,11 @@ void LLCubeMap::initEnvironmentMap(const std::vector<LLPointer<LLImageRaw> >& ra          mImages[i]->setSubImage(mRawImages[i], 0, 0, resolution, resolution);      } +    enableTexture(0); +    bind(); +    mImages[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); +    glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); +    glGenerateMipmap(GL_TEXTURE_CUBE_MAP);      gGL.getTexUnit(0)->disable();      disable();  } diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 185c1450c8..3001375c60 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -832,6 +832,9 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)  	As example where this situation appear see: "Deferred Material Shader 28/29/30/31"  	And tickets: MAINT-4165, MAINT-4839, MAINT-3568, MAINT-6437 + +    --- davep TODO -- pretty sure the entire block here is superstitious and that the uniform index has nothing to do with the texture channel +                texture channel should follow the uniform VALUE  	*/ @@ -840,6 +843,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)  	S32 bumpMap = glGetUniformLocationARB(mProgramObject, "bumpMap");      S32 altDiffuseMap = glGetUniformLocationARB(mProgramObject, "altDiffuseMap");  	S32 environmentMap = glGetUniformLocationARB(mProgramObject, "environmentMap"); +    S32 reflectionMap = glGetUniformLocationARB(mProgramObject, "reflectionMap");  	std::set<S32> skip_index; @@ -882,6 +886,12 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)  				continue;  			} +            if (-1 == reflectionMap && std::string(name) == "reflectionMap") +            { +                reflectionMap = i; +                continue; +            } +              if (-1 == altDiffuseMap && std::string(name) == "altDiffuseMap")  			{  				altDiffuseMap = i; @@ -892,8 +902,9 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)  		bool specularDiff = specularMap < diffuseMap && -1 != specularMap;  		bool bumpLessDiff = bumpMap < diffuseMap && -1 != bumpMap;  		bool envLessDiff = environmentMap < diffuseMap && -1 != environmentMap; +        bool refLessDiff = reflectionMap < diffuseMap && -1 != reflectionMap; -		if (specularDiff || bumpLessDiff || envLessDiff) +		if (specularDiff || bumpLessDiff || envLessDiff || refLessDiff)  		{  			mapUniform(diffuseMap, uniforms);  			skip_index.insert(diffuseMap); @@ -912,6 +923,11 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)  				mapUniform(environmentMap, uniforms);  				skip_index.insert(environmentMap);  			} + +            if (-1 != reflectionMap) { +                mapUniform(reflectionMap, uniforms); +                skip_index.insert(reflectionMap); +            }  		}  	} diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index c100c182dd..cd7ec478bb 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1155,6 +1155,7 @@ void LLShaderMgr::initAttribsAndUniforms()  	mReservedUniforms.push_back("bumpMap");      mReservedUniforms.push_back("bumpMap2");  	mReservedUniforms.push_back("environmentMap"); +    mReservedUniforms.push_back("reflectionMap");  	mReservedUniforms.push_back("cloud_noise_texture");      mReservedUniforms.push_back("cloud_noise_texture_next");  	mReservedUniforms.push_back("fullbright"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 67c0d6ab10..7ca4862ed9 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -80,6 +80,7 @@ public:          BUMP_MAP,                           //  "bumpMap"          BUMP_MAP2,                          //  "bumpMap2"          ENVIRONMENT_MAP,                    //  "environmentMap" +        REFLECTION_MAP,                     //  "reflectionMap"          CLOUD_NOISE_MAP,                    //  "cloud_noise_texture"          CLOUD_NOISE_MAP_NEXT,               //  "cloud_noise_texture_next"          FULLBRIGHT,                         //  "fullbright"  | 
