diff --git a/README.md b/README.md index 6e28c7bb4..972109cc0 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,10 @@ To Build SuperTuxKart on Windows, follow these instructions: 1. Download and install Visual Studio from here: [Visual Studio - Download](https://www.visualstudio.com/downloads/). The free Visual Studio Community edition works fine. 2. Download the SuperTuxKart source package from either [SuperTuxKart download area - SourceForge.net](https://sourceforge.net/projects/supertuxkart/files/SuperTuxKart/0.9.2) or [SuperTuxKart.net - Source Control](https://supertuxkart.net/Source_control), and unpack it. *Note: If you downloaded the source package from here: [SuperTuxKart.net - Source Control](https://supertuxkart.net/Source_control), then both `stk-code` and `stk-assets` **must** be in the same directory, otherwise the build can result in failure* -3. Download the Windows dependencies package from either [SuperTuxKart download area: Dependecies - SourceForge.net](https://sourceforge.net/projects/supertuxkart/files/SuperTuxKart%20Dependencies/Windows/) +3. Download the Windows dependencies package from either [SuperTuxKart download area: Dependencies - SourceForge.net](https://sourceforge.net/projects/supertuxkart/files/SuperTuxKart%20Dependencies/Windows/) or [SuperTuxKart on GitHub - Dependencies](https://github.com/supertuxkart/dependencies), and unpack it; then, copy the `dependencies` directory from either the `windows` or the `windows_64bit` directories into the `stk-code` directory, rename it to `dependencies-64bit` if you want to compile a 64bit build. 4. Download CMake from here: [CMake - download page](https://cmake.org/download/), install it; once CMake is installed, double click on the CMake icon on your desktop, and point it towards your `stk-code` directory in the 'Where is the source code' field, and point it to a directory called `build` or `bld` inside the stk-code directory. -5. Press 'Configure'; CMake will ask you if it is OK to create the aformentioned directory, press `Yes`. CMake will then ask you about your version of Visual Studio. +5. Press 'Configure'; CMake will ask you if it is OK to create the aforementioned directory, press `Yes`. CMake will then ask you about your version of Visual Studio. Confirm your selection; *Please look at the table below to avoid confusion between version numbers and releases of Visual Studio*; CMake will begin creating the required files for the build in the directory. 6. Navigate to your build directory and open the `SuperTuxKart.sln` file; Visual Studio will now load the solution. diff --git a/data/shaders/simple_particle.frag b/data/shaders/simple_particle.frag index 144f42dac..89748d6c4 100644 --- a/data/shaders/simple_particle.frag +++ b/data/shaders/simple_particle.frag @@ -10,12 +10,16 @@ out vec4 FragColor; void main(void) { + float billboard_alpha = mix(1.0, texture(tex, tc).a, billboard_mix); +#if defined(Advanced_Lighting_Enabled) vec2 xy = gl_FragCoord.xy / u_screen; float FragZ = gl_FragCoord.z; vec4 FragmentPos = getPosFromUVDepth(vec3(xy, FragZ), u_inverse_projection_matrix); float EnvZ = texture(dtex, xy).x; vec4 EnvPos = getPosFromUVDepth(vec3(xy, EnvZ), u_inverse_projection_matrix); float alpha = clamp((EnvPos.z - FragmentPos.z) * 0.3, 0., 1.); - float billboard_alpha = mix(1.0, texture(tex, tc).a, billboard_mix); +#else + float alpha = 1.0; +#endif FragColor = texture(tex, tc) * billboard_alpha * pc * alpha; } diff --git a/data/shaders/sps_0_solid.xml b/data/shaders/sps_0_solid.xml index 41e07c969..477691b17 100644 --- a/data/shaders/sps_0_solid.xml +++ b/data/shaders/sps_0_solid.xml @@ -100,18 +100,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - setTextureUnits (cur_mat->getTexture()->getOpenGLTextureName(), - irr_driver->getDepthStencilTexture()); + CVS->isDeferredEnabled() ? + irr_driver->getDepthStencilTexture() : 0); ParticleRenderer::getInstance()->setUniforms(flips, billboard); } else diff --git a/src/graphics/large_mesh_buffer.hpp b/src/graphics/large_mesh_buffer.hpp deleted file mode 100644 index 0350b6c17..000000000 --- a/src/graphics/large_mesh_buffer.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2002-2015 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#ifndef __LARGE_MESH_BUFFER_H_INCLUDED__ -#define __LARGE_MESH_BUFFER_H_INCLUDED__ - -#include "irrArray.h" -#include "IMeshBuffer.h" -#include "CMeshBuffer.h" - -namespace irr -{ -namespace scene -{ - //! A SMeshBuffer with 32-bit indices - class LargeMeshBuffer : public SMeshBuffer - { - public: - //! Get type of index data which is stored in this meshbuffer. - /** \return Index type of this buffer. */ - virtual video::E_INDEX_TYPE getIndexType() const - { - return video::EIT_32BIT; - } - - //! Get pointer to indices - /** \return Pointer to indices. */ - virtual const u16* getIndices() const - { - return (u16 *) Indices.const_pointer(); - } - - - //! Get pointer to indices - /** \return Pointer to indices. */ - virtual u16* getIndices() - { - return (u16 *) Indices.pointer(); - } - - - //! Get number of indices - /** \return Number of indices. */ - virtual u32 getIndexCount() const - { - return Indices.size(); - } - - //! Indices into the vertices of this buffer. - core::array Indices; - }; -} // end namespace scene -} // end namespace irr - -#endif - - diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index eafe401ed..b39d2d28e 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -1134,7 +1134,8 @@ void PostProcessing::renderGodRays(scene::ICameraSceneNode * const camnode, SP::SPUniformAssigner* glow_color_assigner = glow_shader ->getUniformAssigner("col"); assert(glow_color_assigner != NULL); - glow_color_assigner->setValue(video::SColorf(track->getGodRaysColor())); + video::SColorf cf(track->getGodRaysColor()); + glow_color_assigner->setValue(core::vector3df(cf.r, cf.g, cf.b)); sun->draw(); glow_shader->unuse(); glDisable(GL_DEPTH_TEST); diff --git a/src/graphics/referee.cpp b/src/graphics/referee.cpp index 9a0f7002b..b9de4a69c 100644 --- a/src/graphics/referee.cpp +++ b/src/graphics/referee.cpp @@ -162,7 +162,7 @@ Referee::Referee() m_scene_node->setFrameLoop(m_st_first_start_frame, m_st_last_start_frame); #ifndef SERVER_ONLY - if (CVS->isGLSL() && CVS->isDefferedEnabled()) + if (CVS->isGLSL() && CVS->isDeferredEnabled()) { m_light = irr_driver->addLight(core::vector3df(0.0f, 0.0f, 0.6f), 0.7f, 2.0f, 0.7f /* r */, 0.0 /* g */, 0.0f /* b */, false /* sun */, m_scene_node); diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 1eb0e929d..24342547c 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -53,11 +53,12 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G return result; } -RTT::RTT(unsigned int width, unsigned int height, float rtt_scale) +RTT::RTT(unsigned int width, unsigned int height, float rtt_scale, + bool use_default_fbo_only) { m_width = (unsigned int)(width * rtt_scale); - m_height = (unsigned int)(height * rtt_scale); - m_shadow_FBO = NULL; + m_height = (unsigned int)(height * rtt_scale); + m_shadow_fbo = NULL; using namespace video; using namespace core; @@ -75,7 +76,10 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale) unsigned linear_depth_mip_levels = int(ceilf(log2f( float(max_(res.Width, res.Height)) ))); - DepthStencilTexture = generateRTT(res, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8); + if (!use_default_fbo_only) + { + m_depth_stencil_tex = generateRTT(res, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8); + } // All RTTs are currently RGBA16F mostly with stencil. The four tmp RTTs are the same size // as the screen, for use in post-processing. @@ -89,7 +93,7 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale) GLint diffuse_specular_internal_format = GL_R11F_G11F_B10F; GLint type = GL_FLOAT; GLint rgb_internal_format = GL_RGBA8; - + #if defined(USE_GLES2) if (!CVS->isEXTColorBufferFloatUsable()) { @@ -103,190 +107,193 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale) type = GL_UNSIGNED_BYTE; } #endif - - RenderTargetTextures[RTT_TMP1] = generateRTT(res, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_TMP2] = generateRTT(res, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_TMP3] = generateRTT(res, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_TMP4] = generateRTT(res, red_internal_format, red_format, type); - RenderTargetTextures[RTT_LINEAR_DEPTH] = generateRTT(res, red32_internal_format, red_format, type, linear_depth_mip_levels); - RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV); - RenderTargetTextures[RTT_COLOR] = generateRTT(res, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE); - RenderTargetTextures[RTT_MLAA_TMP] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE); - RenderTargetTextures[RTT_MLAA_BLEND] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE); - RenderTargetTextures[RTT_SSAO] = generateRTT(res, red_internal_format, red_format, type); - RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_DIFFUSE] = generateRTT(res, diffuse_specular_internal_format, rgb_format, type); - RenderTargetTextures[RTT_SPECULAR] = generateRTT(res, diffuse_specular_internal_format, rgb_format, type); - - RenderTargetTextures[RTT_HALF1] = generateRTT(half, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_QUARTER1] = generateRTT(quarter, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_EIGHTH1] = generateRTT(eighth, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_HALF1_R] = generateRTT(half, red_internal_format, red_format, type); - - RenderTargetTextures[RTT_HALF2] = generateRTT(half, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_QUARTER2] = generateRTT(quarter, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_EIGHTH2] = generateRTT(eighth, rgba_internal_format, rgba_format, type); - RenderTargetTextures[RTT_HALF2_R] = generateRTT(half, red_internal_format, red_format, type); - - RenderTargetTextures[RTT_BLOOM_1024] = generateRTT(shadowsize0, rgba_internal_format, rgb_format, type); - - RenderTargetTextures[RTT_BLOOM_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type); - RenderTargetTextures[RTT_TMP_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type); - RenderTargetTextures[RTT_LENS_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type); - - RenderTargetTextures[RTT_BLOOM_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type); - RenderTargetTextures[RTT_TMP_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type); - RenderTargetTextures[RTT_LENS_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type); - - RenderTargetTextures[RTT_BLOOM_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type); - RenderTargetTextures[RTT_TMP_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type); - RenderTargetTextures[RTT_LENS_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type); - - RenderTargetTextures[RTT_SP_GLOSS] = generateRTT(res, GL_RG8, GL_RG, GL_UNSIGNED_BYTE); - RenderTargetTextures[RTT_SP_DIFF_COLOR] = generateRTT(res, GL_RGBA8, rgb_format, GL_UNSIGNED_BYTE); - - std::vector somevector; - somevector.push_back(RenderTargetTextures[RTT_SSAO]); - FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_NORMAL_AND_DEPTH]); - FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_DIFFUSE]); - somevector.push_back(RenderTargetTextures[RTT_SPECULAR]); - FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_COLOR]); - FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_DIFFUSE]); - FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_SPECULAR]); - FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_MLAA_COLORS]); - FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_MLAA_BLEND]); - FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_MLAA_TMP]); - FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_TMP1]); - FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_TMP2]); - FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_TMP4]); - FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_LINEAR_DEPTH]); - FrameBuffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); - somevector.clear(); - - somevector.push_back(RenderTargetTextures[RTT_HALF1]); - FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_HALF1_R]); - FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_HALF2]); - FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_HALF2_R]); - FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_QUARTER1]); - FrameBuffers.push_back(new FrameBuffer(somevector, quarter.Width, quarter.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_QUARTER2]); - FrameBuffers.push_back(new FrameBuffer(somevector, quarter.Width, quarter.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_EIGHTH1]); - FrameBuffers.push_back(new FrameBuffer(somevector, eighth.Width, eighth.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_EIGHTH2]); - FrameBuffers.push_back(new FrameBuffer(somevector, eighth.Width, eighth.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_DISPLACE]); - FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height)); - somevector.clear(); - - somevector.push_back(RenderTargetTextures[RTT_BLOOM_1024]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize0.Width, shadowsize0.Height)); - somevector.clear(); - - somevector.push_back(RenderTargetTextures[RTT_BLOOM_512]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_TMP_512]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_LENS_512]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height)); - somevector.clear(); - - somevector.push_back(RenderTargetTextures[RTT_BLOOM_256]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_TMP_256]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_LENS_256]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height)); - somevector.clear(); - - somevector.push_back(RenderTargetTextures[RTT_BLOOM_128]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_TMP_128]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height)); - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_LENS_128]); - FrameBuffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height)); - - somevector.clear(); - somevector.push_back(RenderTargetTextures[RTT_SP_DIFF_COLOR]); - somevector.push_back(RenderTargetTextures[RTT_NORMAL_AND_DEPTH]); - somevector.push_back(RenderTargetTextures[RTT_SP_GLOSS]); - FrameBuffers.push_back(new FrameBuffer(somevector, DepthStencilTexture, res.Width, res.Height)); - - if (CVS->isShadowEnabled()) + if (!CVS->isDeferredEnabled()) { - shadowDepthTex = generateRTT3D(GL_TEXTURE_2D_ARRAY, UserConfigParams::m_shadows_resolution, UserConfigParams::m_shadows_resolution, 4, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 1); - somevector.clear(); - m_shadow_FBO = new FrameBufferLayer(somevector, shadowDepthTex, UserConfigParams::m_shadows_resolution, UserConfigParams::m_shadows_resolution, 4); + // RTT is used in only deferred shading which need hdr framebuffer + rgba_internal_format = GL_RGBA8; + type = GL_UNSIGNED_BYTE; } - // Clear this FBO to 1s so that if no SSAO is computed we can still use it. - getFBO(FBO_HALF1_R).bind(); - glClearColor(1., 1., 1., 1.); - glClear(GL_COLOR_BUFFER_BIT); + if (!use_default_fbo_only) + { + m_render_target_textures[RTT_COLOR] = generateRTT(res, rgba_internal_format, rgba_format, type); + } + if (CVS->isDeferredEnabled()) + { + m_render_target_textures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV); + m_render_target_textures[RTT_TMP1] = generateRTT(res, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_TMP2] = generateRTT(res, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_TMP3] = generateRTT(res, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_TMP4] = generateRTT(res, red_internal_format, red_format, type); + m_render_target_textures[RTT_LINEAR_DEPTH] = generateRTT(res, red32_internal_format, red_format, type, linear_depth_mip_levels); + m_render_target_textures[RTT_MLAA_COLORS] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE); + m_render_target_textures[RTT_MLAA_TMP] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE); + m_render_target_textures[RTT_MLAA_BLEND] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE); + m_render_target_textures[RTT_SSAO] = generateRTT(res, red_internal_format, red_format, type); + m_render_target_textures[RTT_DISPLACE] = generateRTT(res, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_DIFFUSE] = generateRTT(res, diffuse_specular_internal_format, rgb_format, type); + m_render_target_textures[RTT_SPECULAR] = generateRTT(res, diffuse_specular_internal_format, rgb_format, type); - getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).bind(); - float color = 0.5; -#if defined(USE_GLES2) - if (!CVS->isDefferedEnabled()) - color = pow(color, 1. / 2.2); -#endif - glClearColor(color, color, color, color); - glClear(GL_COLOR_BUFFER_BIT); + m_render_target_textures[RTT_HALF1] = generateRTT(half, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_QUARTER1] = generateRTT(quarter, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_EIGHTH1] = generateRTT(eighth, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_HALF1_R] = generateRTT(half, red_internal_format, red_format, type); + + m_render_target_textures[RTT_HALF2] = generateRTT(half, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_QUARTER2] = generateRTT(quarter, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_EIGHTH2] = generateRTT(eighth, rgba_internal_format, rgba_format, type); + m_render_target_textures[RTT_HALF2_R] = generateRTT(half, red_internal_format, red_format, type); + + m_render_target_textures[RTT_BLOOM_1024] = generateRTT(shadowsize0, rgba_internal_format, rgb_format, type); + + m_render_target_textures[RTT_BLOOM_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type); + m_render_target_textures[RTT_TMP_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type); + m_render_target_textures[RTT_LENS_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type); + + m_render_target_textures[RTT_BLOOM_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type); + m_render_target_textures[RTT_TMP_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type); + m_render_target_textures[RTT_LENS_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type); + + m_render_target_textures[RTT_BLOOM_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type); + m_render_target_textures[RTT_TMP_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type); + m_render_target_textures[RTT_LENS_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type); + + m_render_target_textures[RTT_SP_GLOSS] = generateRTT(res, GL_RG8, GL_RG, GL_UNSIGNED_BYTE); + m_render_target_textures[RTT_SP_DIFF_COLOR] = generateRTT(res, GL_RGBA8, rgb_format, GL_UNSIGNED_BYTE); + } + + std::vector somevector; + if (!use_default_fbo_only) + { + somevector.push_back(m_render_target_textures[RTT_COLOR]); + m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height)); + } + + if (CVS->isDeferredEnabled()) + { + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_NORMAL_AND_DEPTH]); + m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_SSAO]); + m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_DIFFUSE]); + somevector.push_back(m_render_target_textures[RTT_SPECULAR]); + m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_MLAA_COLORS]); + m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_MLAA_BLEND]); + m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_MLAA_TMP]); + m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_TMP1]); + m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_TMP2]); + m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_TMP4]); + m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_LINEAR_DEPTH]); + m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height)); + somevector.clear(); + + somevector.push_back(m_render_target_textures[RTT_HALF1]); + m_frame_buffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_HALF1_R]); + m_frame_buffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_HALF2]); + m_frame_buffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_HALF2_R]); + m_frame_buffers.push_back(new FrameBuffer(somevector, half.Width, half.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_QUARTER1]); + m_frame_buffers.push_back(new FrameBuffer(somevector, quarter.Width, quarter.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_QUARTER2]); + m_frame_buffers.push_back(new FrameBuffer(somevector, quarter.Width, quarter.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_EIGHTH1]); + m_frame_buffers.push_back(new FrameBuffer(somevector, eighth.Width, eighth.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_EIGHTH2]); + m_frame_buffers.push_back(new FrameBuffer(somevector, eighth.Width, eighth.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_DISPLACE]); + m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height)); + somevector.clear(); + + somevector.push_back(m_render_target_textures[RTT_BLOOM_1024]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize0.Width, shadowsize0.Height)); + somevector.clear(); + + somevector.push_back(m_render_target_textures[RTT_BLOOM_512]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_TMP_512]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_LENS_512]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height)); + somevector.clear(); + + somevector.push_back(m_render_target_textures[RTT_BLOOM_256]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_TMP_256]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_LENS_256]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height)); + somevector.clear(); + + somevector.push_back(m_render_target_textures[RTT_BLOOM_128]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_TMP_128]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height)); + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_LENS_128]); + m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height)); + + somevector.clear(); + somevector.push_back(m_render_target_textures[RTT_SP_DIFF_COLOR]); + somevector.push_back(m_render_target_textures[RTT_NORMAL_AND_DEPTH]); + somevector.push_back(m_render_target_textures[RTT_SP_GLOSS]); + m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height)); + + if (CVS->isShadowEnabled()) + { + m_shadow_depth_tex = generateRTT3D(GL_TEXTURE_2D_ARRAY, UserConfigParams::m_shadows_resolution, UserConfigParams::m_shadows_resolution, 4, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 1); + somevector.clear(); + m_shadow_fbo = new FrameBufferLayer(somevector, m_shadow_depth_tex, UserConfigParams::m_shadows_resolution, UserConfigParams::m_shadows_resolution, 4); + } + // Clear this FBO to 1s so that if no SSAO is computed we can still use it. + getFBO(FBO_HALF1_R).bind(); + glClearColor(1., 1., 1., 1.); + glClear(GL_COLOR_BUFFER_BIT); + } glBindFramebuffer(GL_FRAMEBUFFER, 0); } RTT::~RTT() { glBindFramebuffer(GL_FRAMEBUFFER, 0); - glDeleteTextures(RTT_COUNT, RenderTargetTextures); - glDeleteTextures(1, &DepthStencilTexture); + glDeleteTextures(RTT_COUNT, m_render_target_textures); + glDeleteTextures(1, &m_depth_stencil_tex); if (CVS->isShadowEnabled()) { - delete m_shadow_FBO; - glDeleteTextures(1, &shadowDepthTex); + delete m_shadow_fbo; + glDeleteTextures(1, &m_shadow_depth_tex); } } diff --git a/src/graphics/rtts.hpp b/src/graphics/rtts.hpp index 66ec08628..f8493d342 100644 --- a/src/graphics/rtts.hpp +++ b/src/graphics/rtts.hpp @@ -39,12 +39,10 @@ using irr::video::ITexture; enum TypeFBO { - FBO_SSAO, - FBO_NORMAL_AND_DEPTHS, - FBO_COMBINED_DIFFUSE_SPECULAR, FBO_COLORS, - FBO_DIFFUSE, - FBO_SPECULAR, + FBO_NORMAL_AND_DEPTHS, + FBO_SSAO, + FBO_COMBINED_DIFFUSE_SPECULAR, FBO_MLAA_COLORS, FBO_MLAA_BLEND, FBO_MLAA_TMP, @@ -79,13 +77,13 @@ enum TypeFBO enum TypeRTT : unsigned int { - RTT_TMP1 = 0, + RTT_COLOR = 0, + RTT_NORMAL_AND_DEPTH, + RTT_TMP1, RTT_TMP2, RTT_TMP3, RTT_TMP4, RTT_LINEAR_DEPTH, - RTT_NORMAL_AND_DEPTH, - RTT_COLOR, RTT_DIFFUSE, RTT_SPECULAR, @@ -143,27 +141,36 @@ enum TypeRTT : unsigned int class RTT { public: - RTT(unsigned int width, unsigned int height, float rtt_scale = 1.0f); + RTT(unsigned int width, unsigned int height, float rtt_scale = 1.0f, + bool use_default_fbo_only = false); ~RTT(); - + unsigned int getWidth () const { return m_width ; } unsigned int getHeight() const { return m_height; } - FrameBufferLayer* getShadowFrameBuffer() { return m_shadow_FBO; } - unsigned getDepthStencilTexture() const { return DepthStencilTexture; } - unsigned getRenderTarget(enum TypeRTT target) const { return RenderTargetTextures[target]; } - FrameBuffer& getFBO(enum TypeFBO fbo) { return FrameBuffers[fbo]; } + FrameBufferLayer* getShadowFrameBuffer() { return m_shadow_fbo; } + unsigned getDepthStencilTexture() const + { + assert(m_depth_stencil_tex != 0); + return m_depth_stencil_tex; + } + unsigned getRenderTarget(enum TypeRTT target) const + { + assert(m_render_target_textures[target] != 0); + return m_render_target_textures[target]; + } + FrameBuffer& getFBO(enum TypeFBO fbo) { return m_frame_buffers[fbo]; } private: - unsigned RenderTargetTextures[RTT_COUNT]; - PtrVector FrameBuffers; - unsigned DepthStencilTexture; + unsigned m_render_target_textures[RTT_COUNT] = {}; + PtrVector m_frame_buffers; + unsigned m_depth_stencil_tex = 0; unsigned int m_width; unsigned int m_height; - unsigned shadowDepthTex; - FrameBufferLayer* m_shadow_FBO; + unsigned m_shadow_depth_tex = 0; + FrameBufferLayer* m_shadow_fbo; LEAK_CHECK(); }; diff --git a/src/graphics/screen_quad.cpp b/src/graphics/screen_quad.cpp deleted file mode 100644 index 16c94a515..000000000 --- a/src/graphics/screen_quad.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2014-2015 SuperTuxKart-Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#include "graphics/screen_quad.hpp" - -// Just the static parts to our screenquad - -const u16 ScreenQuad::indices[4] = {0, 1, 2, 3}; - -static const SColor white(255, 255, 255, 255); - -const S3DVertex ScreenQuad::vertices[4] = { - S3DVertex(-1, 1, 0, 0, 1, 0, white, 0, 1), - S3DVertex(1, 1, 0, 0, 1, 0, white, 1, 1), - S3DVertex(-1, -1, 0, 0, 1, 0, white, 0, 0), - S3DVertex(1, -1, 0, 0, 1, 0, white, 1, 0), - }; diff --git a/src/graphics/screen_quad.hpp b/src/graphics/screen_quad.hpp deleted file mode 100644 index 87c11dfce..000000000 --- a/src/graphics/screen_quad.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2014-2015 SuperTuxKart-Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#ifndef HEADER_SCREENQUAD_H -#define HEADER_SCREENQUAD_H - -#include -#include - -using namespace irr; -using namespace video; - -class ScreenQuad { - -public: - ScreenQuad(IVideoDriver *xy) - { - vd = xy; - - mat.Lighting = false; - mat.ZBuffer = video::ECFN_ALWAYS; - mat.ZWriteEnable = false; - - for(u32 c = 0; c < MATERIAL_MAX_TEXTURES; c++) - { - mat.TextureLayer[c].TextureWrapU = video::ETC_CLAMP_TO_EDGE; - mat.TextureLayer[c].TextureWrapV = video::ETC_CLAMP_TO_EDGE; - } - } - - SMaterial& getMaterial() { return mat; } - - //Set the texture to render with the quad - void setTexture(ITexture* tex, u32 layer = 0) - { - mat.TextureLayer[layer].Texture = tex; - } - - ITexture* getTexture(u32 layer = 0) const { return mat.TextureLayer[layer].Texture; } - - void setMaterialType(E_MATERIAL_TYPE mt) { mat.MaterialType = mt; } - - void render(bool setRTToFrameBuff = true) const - { - if(setRTToFrameBuff) - vd->setRenderTarget(video::ERT_FRAME_BUFFER); - - sq_dorender(); - } - - void render(ITexture* rt) const - { - vd->setRenderTarget(rt); - - sq_dorender(); - } - -protected: - static const S3DVertex vertices[4]; - static const u16 indices[4]; - SMaterial mat; - - IVideoDriver* vd; - - void sq_dorender() const - { - vd->setMaterial(mat); - vd->setTransform(ETS_WORLD, core::IdentityMatrix); - vd->setTransform(ETS_VIEW, core::IdentityMatrix); - vd->setTransform(ETS_PROJECTION, core::IdentityMatrix); - vd->drawVertexPrimitiveList(vertices, 4, indices, 2, EVT_STANDARD, - scene::EPT_TRIANGLE_STRIP); - } -}; - -#endif diff --git a/src/graphics/shader_based_renderer.cpp b/src/graphics/shader_based_renderer.cpp index d64bed82c..d3c070728 100644 --- a/src/graphics/shader_based_renderer.cpp +++ b/src/graphics/shader_based_renderer.cpp @@ -50,9 +50,6 @@ #include // ---------------------------------------------------------------------------- - - - void ShaderBasedRenderer::setRTT(RTT* rtts) { m_rtts = rtts; @@ -111,8 +108,7 @@ void ShaderBasedRenderer::computeMatrixesAndCameras(scene::ICameraSceneNode *con unsigned int width, unsigned int height) { m_current_screen_size = core::vector2df((float)width, (float)height); - m_shadow_matrices.computeMatrixesAndCameras(camnode, width, height, - m_rtts->getDepthStencilTexture()); + m_shadow_matrices.computeMatrixesAndCameras(camnode, width, height); } // computeMatrixesAndCameras // ---------------------------------------------------------------------------- @@ -440,27 +436,6 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode, glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - if (!forceRTT) - { - // We need a cleared depth buffer for some effect (eg particles depth blending) - m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind(); - // Bind() modifies the viewport. In order not to affect anything else, - // the viewport is just reset here and not removed in Bind(). - const core::recti &vp = Camera::getActiveCamera()->getViewport(); - glViewport(vp.UpperLeftCorner.X, - irr_driver->getActualScreenSize().Height - vp.LowerRightCorner.Y, - vp.LowerRightCorner.X - vp.UpperLeftCorner.X, - vp.LowerRightCorner.Y - vp.UpperLeftCorner.Y); - glClear(GL_DEPTH_BUFFER_BIT); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - } - else - { - m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind(); - glClearColor(0., 0., 0., 0.); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - } - if (forceRTT) { m_rtts->getFBO(FBO_COLORS).bind(); @@ -471,6 +446,8 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode, glClearColor(clearColor.getRed() / 255.f, clearColor.getGreen() / 255.f, clearColor.getBlue() / 255.f, clearColor.getAlpha() / 255.f); glClear(GL_COLOR_BUFFER_BIT); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } { @@ -511,7 +488,7 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode, // Now all instancing data from mesh and particle are done drawing m_draw_calls.setFenceSync(); - if (!CVS->isDefferedEnabled() && !forceRTT) + if (!CVS->isDeferredEnabled() && !forceRTT) { glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); @@ -650,8 +627,9 @@ void ShaderBasedRenderer::onLoadWorld() const core::recti &viewport = Camera::getCamera(0)->getViewport(); unsigned int width = viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X; unsigned int height = viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y; - RTT* rtts = new RTT(width, height, CVS->isDefferedEnabled() ? - UserConfigParams::m_scale_rtts_factor : 1.0f); + RTT* rtts = new RTT(width, height, CVS->isDeferredEnabled() ? + UserConfigParams::m_scale_rtts_factor : 1.0f, + !CVS->isDeferredEnabled()); setRTT(rtts); } @@ -746,7 +724,7 @@ void ShaderBasedRenderer::render(float dt) RaceGUIBase *rg = world->getRaceGUI(); if (rg) rg->update(dt); - if (!CVS->isDefferedEnabled()) + if (!CVS->isDeferredEnabled()) { prepareForwardRenderer(); } @@ -770,12 +748,12 @@ void ShaderBasedRenderer::render(float dt) oss << "drawAll() for kart " << cam; PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (cam+1)*60, 0x00, 0x00); - camera->activate(!CVS->isDefferedEnabled()); + camera->activate(!CVS->isDeferredEnabled()); rg->preRenderCallback(camera); // adjusts start referee irr_driver->getSceneManager()->setActiveCamera(camnode); computeMatrixesAndCameras(camnode, m_rtts->getWidth(), m_rtts->getHeight()); - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { renderSceneDeferred(camnode, dt, track->hasShadows(), false); } @@ -794,7 +772,7 @@ void ShaderBasedRenderer::render(float dt) debugPhysics(); - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { renderPostProcessing(camera); } @@ -883,7 +861,7 @@ void ShaderBasedRenderer::renderToTexture(GL3RenderTarget *render_target, if (CVS->isARBUniformBufferObjectUsable()) uploadLightingData(); - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { renderSceneDeferred(camera, dt, false, true); render_target->setFrameBuffer(m_post_processing diff --git a/src/graphics/shader_files_manager.cpp b/src/graphics/shader_files_manager.cpp index ecf037ec3..dea661fe9 100644 --- a/src/graphics/shader_files_manager.cpp +++ b/src/graphics/shader_files_manager.cpp @@ -18,9 +18,11 @@ #ifndef SERVER_ONLY #include "graphics/shader_files_manager.hpp" +#include "config/user_config.hpp" #include "config/stk_config.hpp" #include "graphics/central_settings.hpp" #include "graphics/graphics_restrictions.hpp" +#include "guiengine/message_queue.hpp" #include "io/file_manager.hpp" #include "utils/log.hpp" @@ -171,7 +173,7 @@ ShaderFilesManager::SharedShader ShaderFilesManager::loadShader code << "#define UBO_DISABLED\n"; if (CVS->needsVertexIdWorkaround()) code << "#define Needs_Vertex_Id_Workaround\n"; - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) code << "#define Advanced_Lighting_Enabled\n"; #if !defined(USE_GLES2) @@ -227,6 +229,13 @@ ShaderFilesManager::SharedShader ShaderFilesManager::loadShader glGetShaderInfoLog(*ss, info_length, NULL, error_message); Log::error("ShaderFilesManager", error_message); delete[] error_message; + if (UserConfigParams::m_artist_debug_mode) + { + core::stringw err = StringUtils::insertValues(L"Shader file %s" + " failed to compile, check stdout.log or console for details", + full_path.c_str()); + MessageQueue::add(MessageQueue::MT_ERROR, err); + } return NULL; } glGetError(); diff --git a/src/graphics/shadow_matrices.cpp b/src/graphics/shadow_matrices.cpp index 390807258..949804694 100644 --- a/src/graphics/shadow_matrices.cpp +++ b/src/graphics/shadow_matrices.cpp @@ -193,8 +193,7 @@ core::matrix4 ShadowMatrices::getTighestFitOrthoProj(const core::matrix4 &transf * \param height of the rendering viewport */ void ShadowMatrices::computeMatrixesAndCameras(scene::ICameraSceneNode *const camnode, - unsigned int width, unsigned int height, - GLuint depth_stencil_texture) + unsigned int width, unsigned int height) { camnode->render(); irr_driver->setProjMatrix(irr_driver->getVideoDriver() diff --git a/src/graphics/shadow_matrices.hpp b/src/graphics/shadow_matrices.hpp index a7ad04134..793107977 100644 --- a/src/graphics/shadow_matrices.hpp +++ b/src/graphics/shadow_matrices.hpp @@ -62,8 +62,7 @@ public: ~ShadowMatrices(); void computeMatrixesAndCameras(scene::ICameraSceneNode *const camnode, - unsigned int width, unsigned int height, - GLuint depth_stencil_texture); + unsigned int width, unsigned int height); void addLight(const core::vector3df &pos); void updateSunOrthoMatrices(); void renderShadowsDebug(const FrameBuffer* shadow_framebuffer, diff --git a/src/graphics/skid_marks.cpp b/src/graphics/skid_marks.cpp index f7fcadcac..3933eb0f1 100644 --- a/src/graphics/skid_marks.cpp +++ b/src/graphics/skid_marks.cpp @@ -220,7 +220,7 @@ SkidMarks::SkidMarkQuads::SkidMarkQuads(const Vec3 &left, video::SColor(255, SkidMarks::m_start_grey, SkidMarks::m_start_grey, SkidMarks::m_start_grey)); - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { m_start_color.setRed(SP::srgb255ToLinear(m_start_color.getRed())); m_start_color.setGreen(SP::srgb255ToLinear(m_start_color.getGreen())); diff --git a/src/graphics/skybox.cpp b/src/graphics/skybox.cpp index 3ec540b80..2f8b2ecb7 100644 --- a/src/graphics/skybox.cpp +++ b/src/graphics/skybox.cpp @@ -179,7 +179,7 @@ void Skybox::generateCubeMapFromTextures() glBindTexture(GL_TEXTURE_CUBE_MAP, m_cube_map); - bool needs_srgb_format = CVS->isDefferedEnabled(); + bool needs_srgb_format = CVS->isDeferredEnabled(); GLint format = GL_RGBA; GLint internal_format = needs_srgb_format ? GL_SRGB8_ALPHA8 : GL_RGBA8; @@ -218,7 +218,7 @@ void Skybox::generateSpecularCubemap() } glGenerateMipmap(GL_TEXTURE_CUBE_MAP); - if (!CVS->isDefferedEnabled()) + if (!CVS->isDeferredEnabled()) return; #if !defined(USE_GLES2) diff --git a/src/graphics/sp/sp_base.cpp b/src/graphics/sp/sp_base.cpp index 470eff3a2..902f039a7 100644 --- a/src/graphics/sp/sp_base.cpp +++ b/src/graphics/sp/sp_base.cpp @@ -83,7 +83,7 @@ std::vector, std::vector > > > > > g_final_draw_calls[DCT_FOR_VAO]; // ---------------------------------------------------------------------------- -std::unordered_map > > g_glow_meshes; // ---------------------------------------------------------------------------- std::unordered_set g_instances; @@ -186,7 +186,7 @@ void displaceShaderInit(SPShader* shader) shader->linkShaderFiles(RP_RESERVED); shader->use(RP_RESERVED); shader->addBasicUniforms(RP_RESERVED); - shader->addUniform("direction", typeid(std::array), RP_RESERVED); + shader->addAllUniforms(RP_RESERVED); shader->setUseFunction([]()->void { glEnable(GL_DEPTH_TEST); @@ -199,12 +199,9 @@ void displaceShaderInit(SPShader* shader) g_stk_sbr->getRTTs()->getFBO(FBO_DISPLACE).bind(), glClear(GL_COLOR_BUFFER_BIT); }, RP_RESERVED); - shader->addCustomPrefilledTextures(ST_BILINEAR, - GL_TEXTURE_2D, "displacement_tex", []()->GLuint - { - return irr_driver->getTexture(FileManager::TEXTURE, - "displace.png")->getOpenGLTextureName(); - }, RP_RESERVED); + SPShaderManager::addPrefilledTexturesToShader(shader, + {{ "displacement_tex", "displace.png", false/*srgb*/, ST_BILINEAR }}, + RP_RESERVED); shader->addCustomPrefilledTextures(ST_BILINEAR, GL_TEXTURE_2D, "mask_tex", []()->GLuint { @@ -327,7 +324,7 @@ void loadShaders() // Displace shader is not specifiable in XML due to complex callback std::shared_ptr sps; - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { // This displace shader will be drawn the last in transparent pass sps = std::make_shared("displace", displaceShaderInit, @@ -345,7 +342,7 @@ void loadShaders() // ======================================================================== // Glow shader // ======================================================================== - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { sps = std::make_shared ("sp_glow_shader", [](SPShader* shader) @@ -357,7 +354,7 @@ void loadShaders() shader->linkShaderFiles(RP_1ST); shader->use(RP_1ST); shader->addBasicUniforms(RP_1ST); - shader->addUniform("col", typeid(irr::video::SColorf), RP_1ST); + shader->addAllUniforms(RP_1ST); }); SPShaderManager::get()->addSPShader(sps->getName(), sps); g_glow_shader = sps.get(); @@ -740,7 +737,7 @@ void prepareDrawCalls() g_skinning_mesh.clear(); mathPlaneFrustumf(g_frustums[0], irr_driver->getProjViewMatrix()); g_handle_shadow = Track::getCurrentTrack() && - Track::getCurrentTrack()->hasShadows() && CVS->isDefferedEnabled() && + Track::getCurrentTrack()->hasShadows() && CVS->isDeferredEnabled() && CVS->isShadowEnabled(); if (g_handle_shadow) @@ -922,14 +919,15 @@ void addObject(SPMeshNode* node) } mb->addInstanceData(id, (DrawCallType)dc_type); if (UserConfigParams::m_glow && node->hasGlowColor() && - CVS->isDefferedEnabled() && dc_type == DCT_NORMAL) + CVS->isDeferredEnabled() && dc_type == DCT_NORMAL) { video::SColorf gc = node->getGlowColor(); unsigned key = gc.toSColor().color; auto ret = g_glow_meshes.find(key); if (ret == g_glow_meshes.end()) { - g_glow_meshes[key] = std::make_pair(gc, + g_glow_meshes[key] = std::make_pair( + core::vector3df(gc.r, gc.g, gc.b), std::unordered_set()); } g_glow_meshes.at(key).second.insert(mb); diff --git a/src/graphics/sp/sp_mesh_buffer.cpp b/src/graphics/sp/sp_mesh_buffer.cpp index 124ecabd5..cd4fde30f 100644 --- a/src/graphics/sp/sp_mesh_buffer.cpp +++ b/src/graphics/sp/sp_mesh_buffer.cpp @@ -167,7 +167,7 @@ void SPMeshBuffer::uploadGLMesh() offset += 4; video::SColor vc = m_vertices[i].m_color; - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { vc.setRed(srgb255ToLinear(vc.getRed())); vc.setGreen(srgb255ToLinear(vc.getGreen())); diff --git a/src/graphics/sp/sp_shader.cpp b/src/graphics/sp/sp_shader.cpp index 0101a3cde..c72aaa3bd 100644 --- a/src/graphics/sp/sp_shader.cpp +++ b/src/graphics/sp/sp_shader.cpp @@ -16,15 +16,19 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "graphics/sp/sp_shader.hpp" +#include "config/user_config.hpp" #include "graphics/central_settings.hpp" #include "graphics/shader_files_manager.hpp" #include "graphics/sp/sp_base.hpp" #include "graphics/sp/sp_uniform_assigner.hpp" +#include "guiengine/message_queue.hpp" #include "utils/string_utils.hpp" +#include + namespace SP { -std::unordered_map > +const std::map > g_prefilled_names = { #ifdef USE_GLES2 @@ -81,6 +85,13 @@ void SPShader::linkShaderFiles(RenderPass rp) } if (result == GL_FALSE) { + if (UserConfigParams::m_artist_debug_mode) + { + core::stringw err = StringUtils::insertValues(L"Shader %s failed" + " to link, check stdout.log or console for details", + m_name.c_str()); + MessageQueue::add(MessageQueue::MT_ERROR, err); + } glDeleteProgram(m_program[rp]); m_program[rp] = 0; } @@ -194,20 +205,49 @@ void SPShader::bindTextures(const std::array& tex, } // bindTextures // ---------------------------------------------------------------------------- -void SPShader::addUniform(const std::string& name, const std::type_index& ti, - RenderPass rp) +void SPShader::addAllUniforms(RenderPass rp) { #ifndef SERVER_ONLY - const char* s = name.c_str(); - GLuint location = glGetUniformLocation(m_program[rp], s); - if (location == GL_INVALID_INDEX) + GLint total_uniforms; + glGetProgramiv(m_program[rp], GL_ACTIVE_UNIFORMS, &total_uniforms); + static const std::map supported_types = + { + { GL_INT, std::type_index(typeid(int)) }, + { GL_FLOAT, std::type_index(typeid(float)) }, + { GL_FLOAT_MAT4, std::type_index(typeid(irr::core::matrix4)) }, + { GL_FLOAT_VEC4, std::type_index(typeid(std::array)) }, + { GL_FLOAT_VEC3, std::type_index(typeid(irr::core::vector3df)) }, + { GL_FLOAT_VEC2, std::type_index(typeid(irr::core::vector2df)) } + }; + + for (int i = 0; i < total_uniforms; i++) { - Log::warn("SPShader", "Missing uniform %s in shader files.", s); - return; + GLint size; + GLenum type; + char name[100] = {}; + glGetActiveUniform(m_program[rp], i, 99, NULL, &size, &type, name); + if (size != 1) + { + Log::debug("SPShader", "Array of uniforms is not supported in" + " shader %s for %s.", m_name.c_str(), name); + continue; + } + auto ret = supported_types.find(type); + if (ret == supported_types.end()) + { + Log::debug("SPShader", "%d type not supported", (unsigned)type); + continue; + } + GLuint location = glGetUniformLocation(m_program[rp], name); + if (location == GL_INVALID_INDEX) + { + Log::debug("SPShader", "%s uniform not found", name); + continue; + } + m_uniforms[rp][name] = new SPUniformAssigner(ret->second, location); } - m_uniforms[rp][name] = new SPUniformAssigner(ti, location); #endif -} // addUniform +} // addAllUniforms // ---------------------------------------------------------------------------- void SPShader::setUniformsPerObject(SPPerObjectUniform* sppou, @@ -271,7 +311,7 @@ void SPShader::unload() bool SPShader::isSrgbForTextureLayer(unsigned layer) const { #ifndef SERVER_ONLY - if (!CVS->isDefferedEnabled()) + if (!CVS->isDeferredEnabled()) { return false; } diff --git a/src/graphics/sp/sp_shader.hpp b/src/graphics/sp/sp_shader.hpp index c1b8ba48d..c4c02ed65 100644 --- a/src/graphics/sp/sp_shader.hpp +++ b/src/graphics/sp/sp_shader.hpp @@ -161,6 +161,8 @@ public: // ------------------------------------------------------------------------ void addAllTextures(RenderPass rp = RP_1ST); // ------------------------------------------------------------------------ + void addAllUniforms(RenderPass rp = RP_1ST); + // ------------------------------------------------------------------------ void addCustomPrefilledTextures(SamplerType st, GLuint texture_type, const std::string& name, std::function func, @@ -190,9 +192,6 @@ public: SPUniformAssigner* getUniformAssigner(const std::string& name, RenderPass rp = RP_1ST) const; // ------------------------------------------------------------------------ - void addUniform(const std::string& name, const std::type_index& ti, - RenderPass rp = RP_1ST); - // ------------------------------------------------------------------------ void setUniformsPerObject(SPPerObjectUniform* sppou, std::vector* ua_used, RenderPass rp = RP_1ST); diff --git a/src/graphics/sp/sp_shader_manager.cpp b/src/graphics/sp/sp_shader_manager.cpp index 631faf42a..e4b491583 100644 --- a/src/graphics/sp/sp_shader_manager.cpp +++ b/src/graphics/sp/sp_shader_manager.cpp @@ -37,16 +37,6 @@ SPShaderManager* SPShaderManager::m_spsm = NULL; SPShaderManager::SPShaderManager() { #ifndef SERVER_ONLY - m_official_types = - { - { "int", std::type_index(typeid(int)) }, - { "float", std::type_index(typeid(float)) }, - { "mat4", std::type_index(typeid(irr::core::matrix4)) }, - { "vec4", std::type_index(typeid(std::array)) }, - { "vec3", std::type_index(typeid(irr::core::vector3df)) }, - { "vec2", std::type_index(typeid(irr::core::vector2df)) } - }; - m_official_sampler_types = { { "nearest", ST_NEAREST }, @@ -138,13 +128,7 @@ SPShaderManager::SPShaderManager() SPShaderManager::~SPShaderManager() { m_official_shaders.clear(); - removeUnusedShaders(); -#ifdef DEBUG - for (auto p : m_shaders) - { - Log::error("SPShaderManager", "%s > 1 ref_count", p.first.c_str()); - } -#endif + m_shaders.clear(); } // ~SPShaderManager // ---------------------------------------------------------------------------- @@ -211,7 +195,7 @@ void SPShaderManager::loadEachShader(const std::string& file_name) std::array pi; loadPassInfo(xml->getNode("first-pass"), pi[0]); - if (!si.m_transparent_shader && CVS->isDefferedEnabled()) + if (!si.m_transparent_shader && CVS->isDeferredEnabled()) { loadPassInfo(xml->getNode("shadow-pass"), pi[1]); } @@ -221,7 +205,7 @@ void SPShaderManager::loadEachShader(const std::string& file_name) " file %s", file_name.c_str()); return; } - if (!si.m_fallback_name.empty() && !CVS->isDefferedEnabled()) + if (!si.m_fallback_name.empty() && !CVS->isDeferredEnabled()) { std::shared_ptr fallback_shader = getSPShader(si.m_fallback_name); @@ -319,32 +303,6 @@ void SPShaderManager::loadPassInfo(const XMLNode* pass, PassInfo& pi) pass->get("skinned-mesh-shader", &pi.m_skinned_mesh_shader); pi.m_skinned_mesh_shader = getShaderFullPath(pi.m_skinned_mesh_shader); - const XMLNode* uniforms = pass->getNode("uniforms"); - if (uniforms) - { - for (unsigned i = 0; i < uniforms->getNumNodes(); i++) - { - const XMLNode* uniform = uniforms->getNode(i); - if (uniform->getName() == "uniform") - { - std::string name, type; - uniform->get("name", &name); - uniform->get("type", &type); - if (!name.empty() && !type.empty() && - m_official_types.find(type) != m_official_types.end()) - { - pi.m_uniforms.emplace_back(name, - m_official_types.at(type)); - } - else - { - Log::error("SPShaderManager", "Invalid uniform type %s", - type.c_str()); - } - } - } - } - const XMLNode* prefilled_textures = pass->getNode("prefilled-textures"); if (prefilled_textures) { @@ -362,7 +320,7 @@ void SPShaderManager::loadPassInfo(const XMLNode* pass, PassInfo& pi) #ifndef SERVER_ONLY if (!srgb_props.empty()) { - srgb = srgb_props == "Y" && CVS->isDefferedEnabled(); + srgb = srgb_props == "Y" && CVS->isDeferredEnabled(); } #endif prefilled_texture->get("sampler", &sampler_props); @@ -414,7 +372,7 @@ std::shared_ptr SPShaderManager::buildSPShader(const ShaderInfo& si, std::shared_ptr sps; #ifndef SERVER_ONLY sps = std::make_shared(si.m_shader_name, - [pi, ua, skinned](SPShader* shader) + [this, pi, ua, skinned](SPShader* shader) { // First pass assert(!pi[0].m_vertex_shader.empty() || @@ -437,7 +395,7 @@ std::shared_ptr SPShaderManager::buildSPShader(const ShaderInfo& si, shader->linkShaderFiles(RP_1ST); shader->use(RP_1ST); shader->addBasicUniforms(RP_1ST); - addUniformsToShader(shader, pi[0].m_uniforms, RP_1ST); + shader->addAllUniforms(RP_1ST); if (pi[0].m_use_function) { shader->setUseFunction(pi[0].m_use_function, RP_1ST); @@ -472,7 +430,7 @@ std::shared_ptr SPShaderManager::buildSPShader(const ShaderInfo& si, shader->linkShaderFiles(RP_SHADOW); shader->use(RP_SHADOW); shader->addBasicUniforms(RP_SHADOW); - addUniformsToShader(shader, pi[1].m_uniforms, RP_SHADOW); + shader->addAllUniforms(RP_SHADOW); if (pi[1].m_use_function) { shader->setUseFunction(pi[1].m_use_function, RP_SHADOW); @@ -490,17 +448,6 @@ std::shared_ptr SPShaderManager::buildSPShader(const ShaderInfo& si, return sps; } // buildSPShader -// ---------------------------------------------------------------------------- -void SPShaderManager::addUniformsToShader(SPShader* s, - const std::vector >& u, - RenderPass rp) -{ - for (auto& p : u) - { - s->addUniform(p.first, p.second, rp); - } -} // addUniformsToShader - // ---------------------------------------------------------------------------- void SPShaderManager::addPrefilledTexturesToShader(SPShader* s, const std::vector > diff --git a/src/graphics/sp/sp_shader_manager.hpp b/src/graphics/sp/sp_shader_manager.hpp index 3695a2e6c..dca4aeb50 100644 --- a/src/graphics/sp/sp_shader_manager.hpp +++ b/src/graphics/sp/sp_shader_manager.hpp @@ -41,7 +41,6 @@ enum RenderPass: unsigned int; class SPShaderManager : public NoCopy { public: - struct PassInfo { std::function m_use_function; @@ -54,8 +53,6 @@ public: std::string m_skinned_mesh_shader; - std::vector > m_uniforms; - std::vector > m_prefilled_textures; }; @@ -87,8 +84,6 @@ private: std::vector > m_official_shaders; - std::unordered_map m_official_types; - std::unordered_map m_official_sampler_types; std::unordered_map > @@ -113,14 +108,6 @@ private: const std::array& pi, const UniformAssigners& ua, bool skinned); - // ------------------------------------------------------------------------ - static void addUniformsToShader(SPShader* s, - const std::vector >& u, - RenderPass rp); - // ------------------------------------------------------------------------ - static void addPrefilledTexturesToShader(SPShader* s, - const std::vector >& t, RenderPass rp); public: // ------------------------------------------------------------------------ @@ -139,6 +126,10 @@ public: m_spsm = NULL; } // ------------------------------------------------------------------------ + static void addPrefilledTexturesToShader(SPShader* s, + const std::vector >& t, RenderPass rp); + // ------------------------------------------------------------------------ SPShaderManager(); // ------------------------------------------------------------------------ ~SPShaderManager(); diff --git a/src/graphics/sp/sp_uniform_assigner.hpp b/src/graphics/sp/sp_uniform_assigner.hpp index f37089d93..da120cfdf 100644 --- a/src/graphics/sp/sp_uniform_assigner.hpp +++ b/src/graphics/sp/sp_uniform_assigner.hpp @@ -84,17 +84,6 @@ public: #ifndef SERVER_ONLY glUniform4f(m_location, v[0], v[1], v[2], v[3]); m_assigned = true; -#endif - } - } - // ------------------------------------------------------------------------ - void setValue(const irr::video::SColorf& col) const - { - if (rumtimeChecking(typeid(col))) - { -#ifndef SERVER_ONLY - glUniform3f(m_location, col.r, col.g, col.b); - m_assigned = true; #endif } } @@ -117,17 +106,6 @@ public: #ifndef SERVER_ONLY glUniform2f(m_location, v.X, v.Y); m_assigned = true; -#endif - } - } - // ------------------------------------------------------------------------ - void setValue(const irr::core::dimension2df& v) const - { - if (rumtimeChecking(typeid(v))) - { -#ifndef SERVER_ONLY - glUniform2f(m_location, v.Width, v.Height); - m_assigned = true; #endif } } @@ -160,37 +138,31 @@ public: { m_assigned = false; #ifndef SERVER_ONLY - if (m_type == typeid(irr::core::matrix4)) + if (m_type == typeid(int)) { - static const char zeroes[64] = {}; - glUniformMatrix4fv(m_location, 1, GL_FALSE, (float*)zeroes); - } - else if (m_type == typeid(irr::video::SColor)) - { - glUniform4i(m_location, 0, 0, 0, 0); - } - else if (m_type == typeid(irr::video::SColorf) || - m_type == typeid(irr::core::vector3df)) - { - glUniform3f(m_location, 0.0f, 0.0f, 0.0f); - } - else if (m_type == typeid(irr::core::vector2df) || - m_type == typeid(irr::core::dimension2df)) - { - glUniform2f(m_location, 0.0f, 0.0f); + glUniform1i(m_location, 0); } else if (m_type == typeid(float)) { glUniform1f(m_location, 0.0f); } - else if (m_type == typeid(int)) + else if (m_type == typeid(irr::core::matrix4)) { - glUniform1i(m_location, 0); + static const char zeroes[64] = {}; + glUniformMatrix4fv(m_location, 1, GL_FALSE, (float*)zeroes); } else if (m_type == typeid(std::array)) { glUniform4f(m_location, 0.0f, 0.0f, 0.0f,0.0f); } + else if (m_type == typeid(irr::core::vector3df)) + { + glUniform3f(m_location, 0.0f, 0.0f, 0.0f); + } + else if (m_type == typeid(irr::core::vector2df)) + { + glUniform2f(m_location, 0.0f, 0.0f); + } #endif } } diff --git a/src/graphics/stk_text_billboard.cpp b/src/graphics/stk_text_billboard.cpp index 583f32705..765dd6631 100644 --- a/src/graphics/stk_text_billboard.cpp +++ b/src/graphics/stk_text_billboard.cpp @@ -35,14 +35,14 @@ STKTextBillboard::STKTextBillboard(const video::SColor& color_top, { using namespace SP; m_color_top = color_top; - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { m_color_top.setRed(srgb255ToLinear(m_color_top.getRed())); m_color_top.setGreen(srgb255ToLinear(m_color_top.getGreen())); m_color_top.setBlue(srgb255ToLinear(m_color_top.getBlue())); } m_color_bottom = color_bottom; - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { video::SColorf tmp(m_color_bottom); m_color_bottom.setRed(srgb255ToLinear(m_color_bottom.getRed())); diff --git a/src/graphics/stk_texture.cpp b/src/graphics/stk_texture.cpp index 3c4c6d747..efe8cb877 100644 --- a/src/graphics/stk_texture.cpp +++ b/src/graphics/stk_texture.cpp @@ -42,7 +42,7 @@ STKTexture::STKTexture(const std::string& path, TexConfig* tc, bool no_upload) if (m_tex_config) { if (ProfileWorld::isNoGraphics() || - (!CVS->isDefferedEnabled()) || !CVS->isGLSL()) + (!CVS->isDeferredEnabled()) || !CVS->isGLSL()) { m_tex_config->m_srgb = false; } @@ -217,7 +217,7 @@ void STKTexture::formatConversion(uint8_t* data, unsigned int* format, { alpha /= 255.0f; - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { alpha = pow(alpha, 1.0f / 2.2f); } diff --git a/src/items/rubber_band.cpp b/src/items/rubber_band.cpp index aa1a8289f..8818d2f52 100644 --- a/src/items/rubber_band.cpp +++ b/src/items/rubber_band.cpp @@ -52,7 +52,7 @@ RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart) return; } video::SColor color(77, 179, 0, 0); - if (CVS->isDefferedEnabled()) + if (CVS->isDeferredEnabled()) { color.setRed(SP::srgb255ToLinear(color.getRed())); color.setGreen(SP::srgb255ToLinear(color.getGreen())); diff --git a/src/karts/kart_model.cpp b/src/karts/kart_model.cpp index 9f8271b2b..14aae2ec0 100644 --- a/src/karts/kart_model.cpp +++ b/src/karts/kart_model.cpp @@ -504,7 +504,7 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool human_playe irr_driver->addMesh(obj.getModel(), "kart_headlight", parent, getRenderInfo()); #ifndef SERVER_ONLY - if (human_player && CVS->isGLSL() && CVS->isDefferedEnabled()) + if (human_player && CVS->isGLSL() && CVS->isDeferredEnabled()) { obj.setLight(headlight_model, each_energy, each_radius); } diff --git a/src/tracks/graph.cpp b/src/tracks/graph.cpp index a566bbd8c..5ef0876dc 100644 --- a/src/tracks/graph.cpp +++ b/src/tracks/graph.cpp @@ -350,7 +350,7 @@ void Graph::createMeshSP(bool show_invisible, bool enable_transparency, spmb->recalculateBoundingBox(); std::string shader_name = enable_transparency ? "alphablend" : "unlit"; #ifndef SERVER_ONLY - if (!CVS->isDefferedEnabled()) + if (!CVS->isDeferredEnabled()) { shader_name = "solid"; }