diff options
author | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
commit | 2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch) | |
tree | 95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/newview/llpostprocess.cpp | |
parent | Second Life viewer sources 1.20.6 (diff) | |
download | meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2 meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz |
Second Life viewer sources 1.20.7
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llpostprocess.cpp | 89 |
1 files changed, 9 insertions, 80 deletions
diff --git a/linden/indra/newview/llpostprocess.cpp b/linden/indra/newview/llpostprocess.cpp index c72b8ae..7ee7100 100644 --- a/linden/indra/newview/llpostprocess.cpp +++ b/linden/indra/newview/llpostprocess.cpp | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "llpostprocess.h" | 35 | #include "llpostprocess.h" |
36 | #include "llglslshader.h" | 36 | #include "llglslshader.h" |
37 | #include "llsdserialize.h" | 37 | #include "llsdserialize.h" |
38 | #include "llglimmediate.h" | 38 | #include "llrender.h" |
39 | 39 | ||
40 | 40 | ||
41 | LLPostProcess * gPostProcess = NULL; | 41 | LLPostProcess * gPostProcess = NULL; |
@@ -59,7 +59,7 @@ LLPostProcess::LLPostProcess(void) : | |||
59 | screenW(1), screenH(1) | 59 | screenW(1), screenH(1) |
60 | { | 60 | { |
61 | LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); | 61 | LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); |
62 | llinfos << "Loading PostProcess Effects settings from " << pathName << llendl; | 62 | LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; |
63 | 63 | ||
64 | llifstream effectsXML(pathName.c_str()); | 64 | llifstream effectsXML(pathName.c_str()); |
65 | 65 | ||
@@ -215,7 +215,7 @@ void LLPostProcess::applyColorFilterShader(void) | |||
215 | { | 215 | { |
216 | gPostColorFilterProgram.bind(); | 216 | gPostColorFilterProgram.bind(); |
217 | 217 | ||
218 | glActiveTextureARB(GL_TEXTURE0_ARB); | 218 | gGL.getTexUnit(0)->activate(); |
219 | glEnable(GL_TEXTURE_RECTANGLE_ARB); | 219 | glEnable(GL_TEXTURE_RECTANGLE_ARB); |
220 | 220 | ||
221 | glBindTexture(GL_TEXTURE_RECTANGLE_ARB, sceneRenderTexture); | 221 | glBindTexture(GL_TEXTURE_RECTANGLE_ARB, sceneRenderTexture); |
@@ -234,7 +234,7 @@ void LLPostProcess::applyColorFilterShader(void) | |||
234 | glUniform3fARB(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); | 234 | glUniform3fARB(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); |
235 | 235 | ||
236 | LLGLEnable blend(GL_BLEND); | 236 | LLGLEnable blend(GL_BLEND); |
237 | gGL.blendFunc(GL_ONE,GL_ZERO); | 237 | gGL.setSceneBlendType(LLRender::BT_REPLACE); |
238 | LLGLDepthTest depth(GL_FALSE); | 238 | LLGLDepthTest depth(GL_FALSE); |
239 | 239 | ||
240 | /// Draw a screen space quad | 240 | /// Draw a screen space quad |
@@ -257,14 +257,14 @@ void LLPostProcess::applyNightVisionShader(void) | |||
257 | { | 257 | { |
258 | gPostNightVisionProgram.bind(); | 258 | gPostNightVisionProgram.bind(); |
259 | 259 | ||
260 | glActiveTextureARB(GL_TEXTURE0_ARB); | 260 | gGL.getTexUnit(0)->activate(); |
261 | glEnable(GL_TEXTURE_RECTANGLE_ARB); | 261 | glEnable(GL_TEXTURE_RECTANGLE_ARB); |
262 | 262 | ||
263 | getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject); | 263 | getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject); |
264 | glBindTexture(GL_TEXTURE_RECTANGLE_ARB, sceneRenderTexture); | 264 | glBindTexture(GL_TEXTURE_RECTANGLE_ARB, sceneRenderTexture); |
265 | glUniform1iARB(nightVisionUniforms["RenderTexture"], 0); | 265 | glUniform1iARB(nightVisionUniforms["RenderTexture"], 0); |
266 | 266 | ||
267 | glActiveTextureARB(GL_TEXTURE1_ARB); | 267 | gGL.getTexUnit(1)->activate(); |
268 | glEnable(GL_TEXTURE_2D); | 268 | glEnable(GL_TEXTURE_2D); |
269 | 269 | ||
270 | glBindTexture(GL_TEXTURE_2D, noiseTexture); | 270 | glBindTexture(GL_TEXTURE_2D, noiseTexture); |
@@ -280,13 +280,13 @@ void LLPostProcess::applyNightVisionShader(void) | |||
280 | glUniform3fARB(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); | 280 | glUniform3fARB(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); |
281 | 281 | ||
282 | LLGLEnable blend(GL_BLEND); | 282 | LLGLEnable blend(GL_BLEND); |
283 | gGL.blendFunc(GL_ONE,GL_ZERO); | 283 | gGL.setSceneBlendType(LLRender::BT_REPLACE); |
284 | LLGLDepthTest depth(GL_FALSE); | 284 | LLGLDepthTest depth(GL_FALSE); |
285 | 285 | ||
286 | /// Draw a screen space quad | 286 | /// Draw a screen space quad |
287 | drawOrthoQuad(screenW, screenH, QUAD_NOISE); | 287 | drawOrthoQuad(screenW, screenH, QUAD_NOISE); |
288 | gPostNightVisionProgram.unbind(); | 288 | gPostNightVisionProgram.unbind(); |
289 | glActiveTextureARB(GL_TEXTURE0_ARB); | 289 | gGL.getTexUnit(0)->activate(); |
290 | } | 290 | } |
291 | 291 | ||
292 | void LLPostProcess::createNightVisionShader(void) | 292 | void LLPostProcess::createNightVisionShader(void) |
@@ -352,7 +352,7 @@ void LLPostProcess::doEffects(void) | |||
352 | checkError(); | 352 | checkError(); |
353 | applyShaders(); | 353 | applyShaders(); |
354 | 354 | ||
355 | glUseProgramObjectARB(0); | 355 | LLGLSLShader::bindNoShader(); |
356 | checkError(); | 356 | checkError(); |
357 | 357 | ||
358 | /// Change to a perspective view | 358 | /// Change to a perspective view |
@@ -565,74 +565,3 @@ void LLPostProcess::checkShaderError(GLhandleARB shader) | |||
565 | } | 565 | } |
566 | checkError(); // Check for OpenGL errors | 566 | checkError(); // Check for OpenGL errors |
567 | } | 567 | } |
568 | |||
569 | void LLPostProcess::textureBlendReplace(void) | ||
570 | { | ||
571 | glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); | ||
572 | glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE ); | ||
573 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE ); | ||
574 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR ); | ||
575 | } | ||
576 | |||
577 | void LLPostProcess::textureBlendAdd(void) | ||
578 | { | ||
579 | glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); | ||
580 | glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD ); | ||
581 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS ); | ||
582 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR ); | ||
583 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE ); | ||
584 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR ); | ||
585 | } | ||
586 | |||
587 | void LLPostProcess::textureBlendAddSigned(void) | ||
588 | { | ||
589 | glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); | ||
590 | glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD_SIGNED ); | ||
591 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS ); | ||
592 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR ); | ||
593 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE ); | ||
594 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR ); | ||
595 | } | ||
596 | |||
597 | void LLPostProcess::textureBlendSubtract(void) | ||
598 | { | ||
599 | glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); | ||
600 | glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_SUBTRACT ); | ||
601 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS ); | ||
602 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR ); | ||
603 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE ); | ||
604 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR ); | ||
605 | } | ||
606 | |||
607 | void LLPostProcess::textureBlendAlpha(void) | ||
608 | { | ||
609 | glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); | ||
610 | glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE ); | ||
611 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); | ||
612 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR ); | ||
613 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS ); | ||
614 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR ); | ||
615 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE); | ||
616 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA ); | ||
617 | } | ||
618 | |||
619 | void LLPostProcess::textureBlendMultiply(void) | ||
620 | { | ||
621 | glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); | ||
622 | glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE ); | ||
623 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS ); | ||
624 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR ); | ||
625 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE ); | ||
626 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR ); | ||
627 | } | ||
628 | |||
629 | void LLPostProcess::textureBlendMultiplyX2(void) | ||
630 | { | ||
631 | glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); | ||
632 | glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE ); | ||
633 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS ); | ||
634 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR ); | ||
635 | glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE ); | ||
636 | glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR ); | ||
637 | glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, 2 ); | ||
638 | } | ||