diff options
author | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2016-05-13 18:47:23 +0300 |
---|---|---|
committer | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2016-05-13 18:47:23 +0300 |
commit | 1b5af4be298198cedc407b6b294b2d71129d7731 (patch) | |
tree | 0fdc088875470a70c684da2ef7fea1055775b203 /indra/llrender | |
parent | bceafa5062db394048312aa7fe0a7706fb9524b7 (diff) |
Add invert texture coordinates for media textures.
Diffstat (limited to 'indra/llrender')
-rwxr-xr-x | indra/llrender/llglslshader.cpp | 22 | ||||
-rwxr-xr-x | indra/llrender/llglslshader.h | 1 | ||||
-rwxr-xr-x | indra/llrender/llrender.cpp | 8 | ||||
-rwxr-xr-x | indra/llrender/llrender.h | 1 | ||||
-rwxr-xr-x | indra/llrender/llshadermgr.cpp | 1 | ||||
-rwxr-xr-x | indra/llrender/llshadermgr.h | 3 |
6 files changed, 35 insertions, 1 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 52b8de8365..8790b1ed7d 100755 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1278,6 +1278,28 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c } } +void LLGLSLShader::uniform1b(U32 index, GLboolean x) +{ + if (mProgramObject > 0) + { + if (mUniform.size() <= index) + { + UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL; + return; + } + + if (mUniform[index] >= 0) + { + std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]); + if (iter == mValue.end() || iter->second.mV[0] != x) + { + glUniform1iARB(mUniform[index], x); + mValue[mUniform[index]] = LLVector4(x, 0.f, 0.f, 0.f); + } + } + } +} + GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform) { GLint ret = -1; diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 0746e8760a..8663a5a5ff 100755 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -125,6 +125,7 @@ public: void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); void uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); void uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat *v); + void uniform1b(U32 index, GLboolean b); void setMinimumAlpha(F32 minimum); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 69420dd0bb..b5ed67f66a 100755 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1466,6 +1466,14 @@ U32 LLRender::getMatrixMode() return mMatrixMode; } +void LLRender::setInverseTexCoordByY(bool v) +{ + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + if (shader) + { + shader->uniform1b(LLShaderMgr::INVERSE_TEX_Y, v); + } +} void LLRender::loadIdentity() { diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index a67fb8da52..4c3547f8e4 100755 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -355,6 +355,7 @@ public: void multMatrix(const GLfloat* m); void matrixMode(U32 mode); U32 getMatrixMode(); + void setInverseTexCoordByY(bool v); const glh::matrix4f& getModelviewMatrix(); const glh::matrix4f& getProjectionMatrix(); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index b2be3cc3b6..79e0b3da28 100755 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1206,6 +1206,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("origin"); mReservedUniforms.push_back("display_gamma"); + mReservedUniforms.push_back("invert_tex_y"); llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); std::set<std::string> dupe_check; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 394b38f832..50b7c8b9d9 100755 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -215,7 +215,8 @@ public: TERRAIN_ALPHARAMP, SHINY_ORIGIN, -DISPLAY_GAMMA, + DISPLAY_GAMMA, + INVERSE_TEX_Y, END_RESERVED_UNIFORMS } eGLSLReservedUniforms; |