#include <llpostprocess.h>
Public Types | |
enum | _QuadType { QUAD_NORMAL, QUAD_NOISE, QUAD_BLOOM_EXTRACT, QUAD_BLOOM_COMBINE } |
typedef enum LLPostProcess::_QuadType | QuadType |
typedef std::map< const char *, GLuint > | glslUniforms |
GLSL Shader Encapsulation Struct. | |
Public Member Functions | |
LLPostProcess (void) | |
~LLPostProcess (void) | |
void | apply (unsigned int width, unsigned int height) |
void | setSelectedEffect (std::string const &effectName) |
LLString const & | getSelectedEffect (void) const |
void | saveEffect (std::string const &effectName) |
Static Public Member Functions | |
static void | initClass (void) |
Perform global initialization for this class. | |
static void | cleanupClass () |
Public Attributes | |
GLuint | sceneRenderTexture |
GLuint | noiseTexture |
GLuint | tempBloomTexture |
bool | initialized |
PostProcessTweaks | tweaks |
LLSD | mAllEffects |
Private Member Functions | |
void | initialize (unsigned int width, unsigned int height) |
General functions. | |
void | doEffects (void) |
void | applyShaders (void) |
bool | shadersEnabled (void) |
void | createNightVisionShader (void) |
Night Vision Functions. | |
void | applyNightVisionShader (void) |
void | createBloomShader (void) |
Bloom Functions. | |
void | applyBloomShader (void) |
void | createColorFilterShader (void) |
Color Filter Functions. | |
void | applyColorFilterShader (void) |
void | getShaderUniforms (glslUniforms &uniforms, GLhandleARB &prog) |
OpenGL Helper Functions. | |
void | createTexture (GLuint &texture, unsigned int width, unsigned int height) |
void | copyFrameBuffer (GLuint &texture, unsigned int width, unsigned int height) |
void | createNoiseTexture (GLuint &texture) |
bool | checkError (void) |
void | checkShaderError (GLhandleARB shader) |
void | drawOrthoQuad (unsigned int width, unsigned int height, QuadType type) |
void | viewOrthogonal (unsigned int width, unsigned int height) |
void | changeOrthogonal (unsigned int width, unsigned int height) |
void | viewPerspective (void) |
void | textureBlendReplace (void) |
void | textureBlendAdd (void) |
void | textureBlendSubtract (void) |
void | textureBlendAddSigned (void) |
void | textureBlendAlpha (void) |
void | textureBlendMultiply (void) |
void | textureBlendMultiplyX2 (void) |
Private Attributes | |
std::string | mShaderErrorString |
read in from file | |
unsigned int | screenW |
unsigned int | screenH |
float | noiseTextureScale |
glslUniforms | nightVisionUniforms |
Shader Uniforms. | |
glslUniforms | bloomExtractUniforms |
glslUniforms | bloomBlurUniforms |
glslUniforms | colorFilterUniforms |
LLString | mSelectedEffectName |
Classes | |
struct | PostProcessTweaks |
Definition at line 40 of file llpostprocess.h.
typedef enum LLPostProcess::_QuadType LLPostProcess::QuadType |
typedef std::map<const char *, GLuint> LLPostProcess::glslUniforms |
Definition at line 44 of file llpostprocess.h.
LLPostProcess::LLPostProcess | ( | void | ) |
NVG Defaults
Bloom Defaults
Color Filter Defaults
Definition at line 54 of file llpostprocess.cpp.
References LLSD::append(), LLSD::emptyArray(), LLSD::emptyMap(), gDirUtilp, LLDir::getExpandedFilename(), LLSD::has(), LL_DEBUGS2, LL_ENDL, LL_PATH_APP_SETTINGS, llifstream, mAllEffects, noiseTextureScale, setSelectedEffect(), LLSDSerialize::SIZE_UNLIMITED, and XML_FILENAME.
Referenced by initClass().
LLPostProcess::~LLPostProcess | ( | void | ) |
Definition at line 110 of file llpostprocess.cpp.
References noiseTexture, sceneRenderTexture, and tempBloomTexture.
void LLPostProcess::apply | ( | unsigned int | width, | |
unsigned int | height | |||
) |
Definition at line 158 of file llpostprocess.cpp.
References doEffects(), initialize(), initialized, screenH, screenW, and shadersEnabled().
void LLPostProcess::initClass | ( | void | ) | [static] |
Perform global initialization for this class.
Definition at line 118 of file llpostprocess.cpp.
References LLPostProcess().
Referenced by idle_startup().
void LLPostProcess::cleanupClass | ( | ) | [static] |
Definition at line 132 of file llpostprocess.cpp.
References NULL.
Referenced by LLAppViewer::cleanup().
void LLPostProcess::setSelectedEffect | ( | std::string const & | effectName | ) |
Definition at line 138 of file llpostprocess.cpp.
References mAllEffects, mSelectedEffectName, and tweaks.
Referenced by LLPostProcess(), and LLFloaterPostProcess::onLoadEffect().
LLString const& LLPostProcess::getSelectedEffect | ( | void | ) | const [inline] |
Definition at line 210 of file llpostprocess.h.
References mSelectedEffectName.
Referenced by LLFloaterPostProcess::syncMenu().
void LLPostProcess::saveEffect | ( | std::string const & | effectName | ) |
Definition at line 144 of file llpostprocess.cpp.
References gDirUtilp, LLDir::getExpandedFilename(), LL_PATH_APP_SETTINGS, llofstream, mAllEffects, tweaks, and XML_FILENAME.
Referenced by LLFloaterPostProcess::onSaveEffect(), and LLFloaterPostProcess::saveAlertCallback().
void LLPostProcess::initialize | ( | unsigned int | width, | |
unsigned int | height | |||
) | [private] |
General functions.
Definition at line 168 of file llpostprocess.cpp.
References checkError(), createBloomShader(), createColorFilterShader(), createNightVisionShader(), createTexture(), initialized, sceneRenderTexture, screenH, and screenW.
Referenced by apply().
void LLPostProcess::doEffects | ( | void | ) | [private] |
Save GL State
Copy the screen buffer to the render texture
Clear the frame buffer.
Change to an orthogonal view
Change to a perspective view
Reset GL State
Definition at line 336 of file llpostprocess.cpp.
References applyShaders(), checkError(), copyFrameBuffer(), sceneRenderTexture, screenH, screenW, viewOrthogonal(), and viewPerspective().
Referenced by apply().
void LLPostProcess::applyShaders | ( | void | ) | [private] |
If any of the above shaders have been called update the frame buffer;
If any of the above shaders have been called update the frame buffer;
Definition at line 190 of file llpostprocess.cpp.
References applyBloomShader(), applyColorFilterShader(), applyNightVisionShader(), LLSD::asBoolean(), checkError(), copyFrameBuffer(), sceneRenderTexture, screenH, screenW, tweaks, LLPostProcess::PostProcessTweaks::useBloomShader(), LLPostProcess::PostProcessTweaks::useColorFilter(), and LLPostProcess::PostProcessTweaks::useNightVisionShader().
Referenced by doEffects().
bool LLPostProcess::shadersEnabled | ( | void | ) | [inline, private] |
Definition at line 182 of file llpostprocess.cpp.
References LLSD::asBoolean(), tweaks, LLPostProcess::PostProcessTweaks::useBloomShader(), LLPostProcess::PostProcessTweaks::useColorFilter(), and LLPostProcess::PostProcessTweaks::useNightVisionShader().
Referenced by apply().
void LLPostProcess::createNightVisionShader | ( | void | ) | [private] |
Night Vision Functions.
Define uniform names
Definition at line 292 of file llpostprocess.cpp.
References createNoiseTexture(), nightVisionUniforms, and noiseTexture.
Referenced by initialize().
void LLPostProcess::applyNightVisionShader | ( | void | ) | [private] |
Draw a screen space quad
Definition at line 256 of file llpostprocess.cpp.
References LLGLSLShader::bind(), LLGLImmediate::blendFunc(), drawOrthoQuad(), LLPostProcess::PostProcessTweaks::getBrightMult(), LLPostProcess::PostProcessTweaks::getNoiseSize(), LLPostProcess::PostProcessTweaks::getNoiseStrength(), getShaderUniforms(), gGL, gPostNightVisionProgram, LUMINANCE_B, LUMINANCE_G, LUMINANCE_R, LLGLSLShader::mProgramObject, nightVisionUniforms, NOISE_SIZE, noiseTexture, noiseTextureScale, QUAD_NOISE, sceneRenderTexture, screenH, screenW, tweaks, and LLGLSLShader::unbind().
Referenced by applyShaders().
void LLPostProcess::createBloomShader | ( | void | ) | [private] |
Bloom Functions.
Create Bloom Extract Shader
Create Bloom Blur Shader
Definition at line 309 of file llpostprocess.cpp.
References bloomBlurUniforms, bloomExtractUniforms, createTexture(), screenH, screenW, and tempBloomTexture.
Referenced by initialize().
void LLPostProcess::applyBloomShader | ( | void | ) | [private] |
Definition at line 304 of file llpostprocess.cpp.
Referenced by applyShaders().
void LLPostProcess::createColorFilterShader | ( | void | ) | [private] |
Color Filter Functions.
Define uniform names
Definition at line 245 of file llpostprocess.cpp.
References colorFilterUniforms.
Referenced by initialize().
void LLPostProcess::applyColorFilterShader | ( | void | ) | [private] |
Draw a screen space quad
Definition at line 214 of file llpostprocess.cpp.
References LLGLSLShader::bind(), LLGLImmediate::blendFunc(), colorFilterUniforms, drawOrthoQuad(), LLPostProcess::PostProcessTweaks::getBrightness(), LLPostProcess::PostProcessTweaks::getContrast(), LLPostProcess::PostProcessTweaks::getContrastBaseB(), LLPostProcess::PostProcessTweaks::getContrastBaseG(), LLPostProcess::PostProcessTweaks::getContrastBaseIntensity(), LLPostProcess::PostProcessTweaks::getContrastBaseR(), LLPostProcess::PostProcessTweaks::getSaturation(), getShaderUniforms(), gGL, gPostColorFilterProgram, LUMINANCE_B, LUMINANCE_G, LUMINANCE_R, LLGLSLShader::mProgramObject, QUAD_NORMAL, sceneRenderTexture, screenH, screenW, tweaks, and LLGLSLShader::unbind().
Referenced by applyShaders().
void LLPostProcess::getShaderUniforms | ( | glslUniforms & | uniforms, | |
GLhandleARB & | prog | |||
) | [private] |
OpenGL Helper Functions.
Find uniform locations and insert into map
Definition at line 327 of file llpostprocess.cpp.
References i.
Referenced by applyColorFilterShader(), and applyNightVisionShader().
void LLPostProcess::createTexture | ( | GLuint & | texture, | |
unsigned int | width, | |||
unsigned int | height | |||
) | [private] |
Definition at line 474 of file llpostprocess.cpp.
Referenced by createBloomShader(), and initialize().
void LLPostProcess::copyFrameBuffer | ( | GLuint & | texture, | |
unsigned int | width, | |||
unsigned int | height | |||
) | [private] |
Definition at line 367 of file llpostprocess.cpp.
Referenced by applyShaders(), and doEffects().
void LLPostProcess::createNoiseTexture | ( | GLuint & | texture | ) | [private] |
Definition at line 492 of file llpostprocess.cpp.
References i, and NOISE_SIZE.
Referenced by createNightVisionShader().
bool LLPostProcess::checkError | ( | void | ) | [private] |
Definition at line 513 of file llpostprocess.cpp.
References mShaderErrorString, and NULL.
Referenced by applyShaders(), checkShaderError(), doEffects(), and initialize().
void LLPostProcess::checkShaderError | ( | GLhandleARB | shader | ) | [private] |
Could not allocate infolog buffer
Definition at line 541 of file llpostprocess.cpp.
References checkError(), mShaderErrorString, and NULL.
void LLPostProcess::drawOrthoQuad | ( | unsigned int | width, | |
unsigned int | height, | |||
QuadType | type | |||
) | [private] |
Definition at line 373 of file llpostprocess.cpp.
References noiseTextureScale, QUAD_BLOOM_COMBINE, QUAD_BLOOM_EXTRACT, QUAD_NOISE, and screenH.
Referenced by applyColorFilterShader(), and applyNightVisionShader().
void LLPostProcess::viewOrthogonal | ( | unsigned int | width, | |
unsigned int | height | |||
) | [private] |
Definition at line 449 of file llpostprocess.cpp.
Referenced by changeOrthogonal(), and doEffects().
void LLPostProcess::changeOrthogonal | ( | unsigned int | width, | |
unsigned int | height | |||
) | [private] |
Definition at line 468 of file llpostprocess.cpp.
References viewOrthogonal(), and viewPerspective().
void LLPostProcess::viewPerspective | ( | void | ) | [private] |
Definition at line 460 of file llpostprocess.cpp.
Referenced by changeOrthogonal(), and doEffects().
void LLPostProcess::textureBlendReplace | ( | void | ) | [private] |
Definition at line 569 of file llpostprocess.cpp.
void LLPostProcess::textureBlendAdd | ( | void | ) | [private] |
Definition at line 577 of file llpostprocess.cpp.
void LLPostProcess::textureBlendSubtract | ( | void | ) | [private] |
Definition at line 597 of file llpostprocess.cpp.
void LLPostProcess::textureBlendAddSigned | ( | void | ) | [private] |
Definition at line 587 of file llpostprocess.cpp.
void LLPostProcess::textureBlendAlpha | ( | void | ) | [private] |
Definition at line 607 of file llpostprocess.cpp.
void LLPostProcess::textureBlendMultiply | ( | void | ) | [private] |
Definition at line 619 of file llpostprocess.cpp.
void LLPostProcess::textureBlendMultiplyX2 | ( | void | ) | [private] |
Definition at line 629 of file llpostprocess.cpp.
Definition at line 186 of file llpostprocess.h.
Referenced by applyColorFilterShader(), applyNightVisionShader(), applyShaders(), doEffects(), initialize(), and ~LLPostProcess().
GLuint LLPostProcess::noiseTexture |
Definition at line 187 of file llpostprocess.h.
Referenced by applyNightVisionShader(), createNightVisionShader(), and ~LLPostProcess().
Definition at line 188 of file llpostprocess.h.
Referenced by createBloomShader(), and ~LLPostProcess().
Definition at line 190 of file llpostprocess.h.
Referenced by applyColorFilterShader(), applyNightVisionShader(), applyShaders(), LLFloaterPostProcess::onBoolToggle(), LLFloaterPostProcess::onColorControlBMoved(), LLFloaterPostProcess::onColorControlGMoved(), LLFloaterPostProcess::onColorControlIMoved(), LLFloaterPostProcess::onColorControlRMoved(), LLFloaterPostProcess::onFloatControlMoved(), saveEffect(), setSelectedEffect(), shadersEnabled(), and LLFloaterPostProcess::syncMenu().
Definition at line 193 of file llpostprocess.h.
Referenced by LLPostProcess(), LLFloaterPostProcess::onSaveEffect(), saveEffect(), setSelectedEffect(), and LLFloaterPostProcess::syncMenu().
std::string LLPostProcess::mShaderErrorString [private] |
read in from file
Definition at line 218 of file llpostprocess.h.
Referenced by checkError(), and checkShaderError().
unsigned int LLPostProcess::screenW [private] |
Definition at line 219 of file llpostprocess.h.
Referenced by apply(), applyColorFilterShader(), applyNightVisionShader(), applyShaders(), createBloomShader(), doEffects(), and initialize().
unsigned int LLPostProcess::screenH [private] |
Definition at line 220 of file llpostprocess.h.
Referenced by apply(), applyColorFilterShader(), applyNightVisionShader(), applyShaders(), createBloomShader(), doEffects(), drawOrthoQuad(), and initialize().
float LLPostProcess::noiseTextureScale [private] |
Definition at line 222 of file llpostprocess.h.
Referenced by applyNightVisionShader(), drawOrthoQuad(), and LLPostProcess().
Shader Uniforms.
Definition at line 225 of file llpostprocess.h.
Referenced by applyNightVisionShader(), and createNightVisionShader().
glslUniforms LLPostProcess::bloomBlurUniforms [private] |
Definition at line 228 of file llpostprocess.h.
Referenced by applyColorFilterShader(), and createColorFilterShader().
LLString LLPostProcess::mSelectedEffectName [private] |
Definition at line 232 of file llpostprocess.h.
Referenced by getSelectedEffect(), and setSelectedEffect().