void LLPostProcess::applyShaders(void) { if (tweaks.useColorFilter()){ applyColorFilterShader(); checkError(); } if (tweaks.useNightVisionShader()){ /// If any of the above shaders have been called update the frame buffer; if (tweaks.useColorFilter()) { U32 tex = mSceneRenderTexture->getTexName() ; copyFrameBuffer(tex, screenW, screenH); } applyNightVisionShader(); checkError(); } if (tweaks.useBloomShader()){ /// If any of the above shaders have been called update the frame buffer; if (tweaks.useColorFilter().asBoolean() || tweaks.useNightVisionShader().asBoolean()) { U32 tex = mSceneRenderTexture->getTexName() ; copyFrameBuffer(tex, screenW, screenH); } applyBloomShader(); checkError(); } }
void LLPostProcess::applyShaders(void) { bool copy_buffer = false; if (tweaks.useColorFilter()) { applyColorFilterShader(); checkError(); copy_buffer = true; } if (tweaks.useGaussBlurFilter()) { /// If any of the above shaders have been called update the frame buffer; if (copy_buffer) copyFrameBuffer(); applyGaussBlurShader(); checkError(); copy_buffer = true; } if (tweaks.useNightVisionShader()) { /// If any of the above shaders have been called update the frame buffer; if (copy_buffer) copyFrameBuffer(); applyNightVisionShader(); checkError(); copy_buffer = true; } }
void LLPostProcess::doEffects(void) { /// Save GL State glPushAttrib(GL_ALL_ATTRIB_BITS); glPushClientAttrib(GL_ALL_ATTRIB_BITS); /// Copy the screen buffer to the render texture { U32 tex = mSceneRenderTexture->getTexName() ; copyFrameBuffer(tex, screenW, screenH); } /// Clear the frame buffer. glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); /// Change to an orthogonal view viewOrthogonal(screenW, screenH); checkError(); applyShaders(); LLGLSLShader::bindNoShader(); checkError(); /// Change to a perspective view viewPerspective(); /// Reset GL State glPopClientAttrib(); glPopAttrib(); checkError(); }
void LLPostProcess::doEffects(void) { LLVertexBuffer::unbind(); mNoiseTextureScale = 0.001f + ((100.f - mSelectedEffectInfo["noise_size"].asFloat()) / 100.f); mNoiseTextureScale *= (mScreenHeight / NOISE_SIZE); /// Copy the screen buffer to the render texture copyFrameBuffer(); stop_glerror(); //Disable depth. Set blendmode to replace. LLGLDepthTest depth(GL_FALSE,GL_FALSE); LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_REPLACE); /// Change to an orthogonal view gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); gGL.loadIdentity(); gGL.ortho( 0.f, (GLdouble) mScreenWidth, 0.f, (GLdouble) mScreenHeight, -1.f, 1.f ); gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); gGL.loadIdentity(); applyShaders(); LLGLSLShader::bindNoShader(); /// Change to a perspective view gGL.flush(); gGL.matrixMode( LLRender::MM_PROJECTION ); gGL.popMatrix(); gGL.matrixMode( LLRender::MM_MODELVIEW ); gGL.popMatrix(); gGL.setSceneBlendType(LLRender::BT_ALPHA); //Restore blendstate. Alpha is ASSUMED for hud/ui render, etc. gGL.getTexUnit(1)->disable(); }
void LLPostProcess::applyGaussBlurShader(void) { int pass_count = tweaks.getGaussBlurPasses(); if(!pass_count || gPostGaussianBlurProgram.mProgramObject == 0) return; gPostGaussianBlurProgram.bind(); gGL.getTexUnit(0)->bind(mSceneRenderTexture); GLint horiz_pass = gPostGaussianBlurProgram.getUniformLocation("horizontalPass"); for(int i = 0;i<pass_count;++i) { for(int j = 0;j<2;++j) { if(i || j) copyFrameBuffer(); glUniform1iARB(horiz_pass, j); drawOrthoQuad(QUAD_NORMAL); } } gPostGaussianBlurProgram.unbind(); }