Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src.cmake b/src.cmake
- index 54ad95a45..33c2a1a95 100644
- --- a/src.cmake
- +++ b/src.cmake
- @@ -188,6 +188,8 @@ set(GLSLSOURCELIST
- ${ENGINE_DIR}/renderer/glsl_source/liquid_vp.glsl
- ${ENGINE_DIR}/renderer/glsl_source/motionblur_fp.glsl
- ${ENGINE_DIR}/renderer/glsl_source/motionblur_vp.glsl
- + ${ENGINE_DIR}/renderer/glsl_source/overBright_fp.glsl
- + ${ENGINE_DIR}/renderer/glsl_source/overBright_vp.glsl
- ${ENGINE_DIR}/renderer/glsl_source/portal_fp.glsl
- ${ENGINE_DIR}/renderer/glsl_source/portal_vp.glsl
- ${ENGINE_DIR}/renderer/glsl_source/reflection_CB_fp.glsl
- diff --git a/src/engine/renderer/gl_shader.cpp b/src/engine/renderer/gl_shader.cpp
- index 099452671..b508eb48b 100644
- --- a/src/engine/renderer/gl_shader.cpp
- +++ b/src/engine/renderer/gl_shader.cpp
- @@ -35,6 +35,7 @@ ShaderKind shaderKind = ShaderKind::Unknown;
- // *INDENT-OFF*
- +GLShader_overBright *gl_overBrightShader = nullptr;
- GLShader_generic2D *gl_generic2DShader = nullptr;
- GLShader_generic *gl_genericShader = nullptr;
- GLShader_lightMapping *gl_lightMappingShader = nullptr;
- @@ -1545,6 +1546,12 @@ void GLShader::SetRequiredVertexPointers()
- GL_VertexAttribsState( ( _vertexAttribsRequired | _vertexAttribs | macroVertexAttribs ) ); // & ~_vertexAttribsUnsupported);
- }
- +GLShader_overBright::GLShader_overBright( GLShaderManager *manager ) :
- + GLShader( "overBright", "overBright", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ),
- + u_LightFactor( this )
- +{
- +}
- +
- GLShader_generic2D::GLShader_generic2D( GLShaderManager *manager ) :
- GLShader( "generic2D", "generic", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ),
- u_TextureMatrix( this ),
- diff --git a/src/engine/renderer/gl_shader.h b/src/engine/renderer/gl_shader.h
- index f2b7c9e88..66cc94cf4 100644
- --- a/src/engine/renderer/gl_shader.h
- +++ b/src/engine/renderer/gl_shader.h
- @@ -2393,6 +2393,14 @@ class u_Lights :
- }
- };
- +class GLShader_overBright :
- + public GLShader,
- + public u_LightFactor
- +{
- +public:
- + GLShader_overBright( GLShaderManager *manager );
- +};
- +
- // This is just a copy of the GLShader_generic, but with a special
- // define for RmlUI transforms. It probably has a lot of unnecessary
- // code that could be pruned.
- @@ -2903,6 +2911,7 @@ std::string GetShaderPath();
- extern ShaderKind shaderKind;
- +extern GLShader_overBright *gl_overBrightShader;
- extern GLShader_generic2D *gl_generic2DShader;
- extern GLShader_generic *gl_genericShader;
- extern GLShader_lightMapping *gl_lightMappingShader;
- diff --git a/src/engine/renderer/glsl_source/overBright_fp.glsl b/src/engine/renderer/glsl_source/overBright_fp.glsl
- new file mode 100644
- index 000000000..739f3c733
- --- /dev/null
- +++ b/src/engine/renderer/glsl_source/overBright_fp.glsl
- @@ -0,0 +1,8 @@
- +DECLARE_OUTPUT(vec4)
- +
- +uniform float u_LightFactor;
- +
- +void main()
- +{
- + outputColor = vec4( u_LightFactor, u_LightFactor, u_LightFactor, 1 );
- +}
- diff --git a/src/engine/renderer/glsl_source/overBright_vp.glsl b/src/engine/renderer/glsl_source/overBright_vp.glsl
- new file mode 100644
- index 000000000..b13f0ada0
- --- /dev/null
- +++ b/src/engine/renderer/glsl_source/overBright_vp.glsl
- @@ -0,0 +1,3 @@
- +void main ()
- +{
- +}
- diff --git a/src/engine/renderer/shaders.cpp b/src/engine/renderer/shaders.cpp
- index 35f6d3a97..17ad5a2e1 100644
- --- a/src/engine/renderer/shaders.cpp
- +++ b/src/engine/renderer/shaders.cpp
- @@ -47,6 +47,8 @@
- #include "liquid_vp.glsl.h"
- #include "motionblur_fp.glsl.h"
- #include "motionblur_vp.glsl.h"
- +#include "overBright_fp.glsl.h"
- +#include "overBright_vp.glsl.h"
- #include "portal_fp.glsl.h"
- #include "portal_vp.glsl.h"
- #include "reflection_CB_fp.glsl.h"
- @@ -101,6 +103,8 @@ std::unordered_map<std::string, std::string> shadermap({
- { "glsl/liquid_vp.glsl", std::string(reinterpret_cast<const char*>(liquid_vp_glsl), sizeof(liquid_vp_glsl)) },
- { "glsl/motionblur_fp.glsl", std::string(reinterpret_cast<const char*>(motionblur_fp_glsl), sizeof(motionblur_fp_glsl)) },
- { "glsl/motionblur_vp.glsl", std::string(reinterpret_cast<const char*>(motionblur_vp_glsl), sizeof(motionblur_vp_glsl)) },
- + { "glsl/overBright_fp.glsl", std::string(reinterpret_cast<const char*>(overBright_fp_glsl), sizeof(overBright_fp_glsl)) },
- + { "glsl/overBright_vp.glsl", std::string(reinterpret_cast<const char*>(overBright_vp_glsl), sizeof(overBright_vp_glsl)) },
- { "glsl/portal_fp.glsl", std::string(reinterpret_cast<const char*>(portal_fp_glsl), sizeof(portal_fp_glsl)) },
- { "glsl/portal_vp.glsl", std::string(reinterpret_cast<const char*>(portal_vp_glsl), sizeof(portal_vp_glsl)) },
- { "glsl/reflection_CB_fp.glsl", std::string(reinterpret_cast<const char*>(reflection_CB_fp_glsl), sizeof(reflection_CB_fp_glsl)) },
- diff --git a/src/engine/renderer/tr_shade.cpp b/src/engine/renderer/tr_shade.cpp
- index 6975277b3..d46ae5246 100644
- --- a/src/engine/renderer/tr_shade.cpp
- +++ b/src/engine/renderer/tr_shade.cpp
- @@ -58,6 +58,9 @@ static void GLSL_InitGPUShadersOrError()
- gl_shaderManager.GenerateBuiltinHeaders();
- + // overBright light multiplication
- + gl_shaderManager.load( gl_overBrightShader );
- +
- // single texture rendering
- gl_shaderManager.load( gl_generic2DShader );
- gl_shaderManager.load( gl_genericShader );
- @@ -2353,6 +2356,17 @@ static void Render_liquid( shaderStage_t *pStage )
- GL_CheckErrors();
- }
- +static void Render_overBright()
- +{
- + GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
- + gl_overBrightShader->BindProgram( 0 );
- + gl_overBrightShader->SetUniform_LightFactor( 1 );
- +
- + Tess_DrawElements();
- +
- + GL_CheckErrors();
- +}
- +
- static void Render_fog()
- {
- fog_t *fog;
- @@ -2887,6 +2901,8 @@ void Tess_StageIteratorGeneric()
- }
- }
- + Render_overBright();
- +
- if ( !r_noFog->integer && tess.fogNum >= 1 && tess.surfaceShader->fogPass != fogPass_t::FP_NONE )
- {
- Render_fog();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement