Merge branch 'master' of github.com:supertuxkart/stk-code
This commit is contained in:
commit
5a67fa50a9
@ -19,22 +19,20 @@ before_install:
|
|||||||
# so we try to use trusty (precise which is what traiv uses a too old mesa version which doesn't link)
|
# so we try to use trusty (precise which is what traiv uses a too old mesa version which doesn't link)
|
||||||
- sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu trusty main restricted"
|
- sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu trusty main restricted"
|
||||||
- sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
|
- sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
|
||||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
- sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
|
- sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
|
||||||
- sudo apt-get -qq install g++-4.8
|
|
||||||
script:
|
script:
|
||||||
# First a debug build:
|
# First a debug build:
|
||||||
- mkdir build-debug
|
- mkdir build-debug
|
||||||
- cd build-debug
|
- cd build-debug
|
||||||
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DCHECK_ASSETS=off -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.8 -DCMAKE_C_COMPILER=/usr/bin/gcc-4.8
|
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DCHECK_ASSETS=off
|
||||||
- make VERBOSE=1 -j 4
|
- make VERBOSE=1 -j 4
|
||||||
|
|
||||||
# Then a release build:
|
# Then a release build:
|
||||||
- cd ..
|
- cd ..
|
||||||
- mkdir build-release
|
- mkdir build-release
|
||||||
- cd build-release
|
- cd build-release
|
||||||
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCHECK_ASSETS=off -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.8 -DCMAKE_C_COMPILER=/usr/bin/gcc-4.8
|
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCHECK_ASSETS=off
|
||||||
- make VERBOSE=1 -j 4
|
- make VERBOSE=1 -j 4
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
|
@ -30,6 +30,7 @@ endif()
|
|||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
option(USE_XRANDR "Use xrandr instead of vidmode" ON)
|
option(USE_XRANDR "Use xrandr instead of vidmode" ON)
|
||||||
|
option(USE_ASAN "Build with Leak/Address sanitizer" OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(STK_SOURCE_DIR "src")
|
set(STK_SOURCE_DIR "src")
|
||||||
@ -254,6 +255,11 @@ if(UNIX AND NOT APPLE)
|
|||||||
else()
|
else()
|
||||||
target_link_libraries(supertuxkart ${IRRLICHT_XF86VM_LIBRARY})
|
target_link_libraries(supertuxkart ${IRRLICHT_XF86VM_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
if(USE_ASAN)
|
||||||
|
add_definitions("-fsanitize=address")
|
||||||
|
add_definitions("-fno-omit-frame-pointer")
|
||||||
|
target_link_libraries(supertuxkart "-fsanitize=address")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
|
#if __VERSION__ >= 330
|
||||||
|
layout(location = 0) in vec2 Position;
|
||||||
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
#else
|
||||||
in vec2 Position;
|
in vec2 Position;
|
||||||
in vec2 Texcoord;
|
in vec2 Texcoord;
|
||||||
|
|
||||||
#if __VERSION__ >= 130
|
|
||||||
out vec2 uv;
|
|
||||||
#else
|
|
||||||
varying vec2 uv;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
out vec2 uv;
|
||||||
|
|
||||||
void main() {
|
void main()
|
||||||
uv = Texcoord;
|
{
|
||||||
gl_Position = vec4(Position, 0., 1.);
|
uv = Texcoord;
|
||||||
|
gl_Position = vec4(Position, 0., 1.);
|
||||||
}
|
}
|
||||||
|
@ -204,16 +204,20 @@ void PostProcessing::update(float dt)
|
|||||||
}
|
}
|
||||||
} // update
|
} // update
|
||||||
|
|
||||||
|
template<typename T,typename... Args>
|
||||||
|
static void DrawFullScreenEffect(Args...args)
|
||||||
|
{
|
||||||
|
glUseProgram(T::getInstance()->Program);
|
||||||
|
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||||
|
T::getInstance()->setUniforms(args...);
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void renderBloom(GLuint in)
|
void renderBloom(GLuint in)
|
||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::BloomShader::Program);
|
setTexture(FullScreenShader::BloomShader::getInstance()->TU_tex, in, GL_NEAREST, GL_NEAREST);
|
||||||
glBindVertexArray(FullScreenShader::BloomShader::vao);
|
DrawFullScreenEffect<FullScreenShader::BloomShader>();
|
||||||
|
|
||||||
setTexture(0, in, GL_NEAREST, GL_NEAREST);
|
|
||||||
FullScreenShader::BloomShader::setUniforms(0);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::renderDiffuseEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff)
|
void PostProcessing::renderDiffuseEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff)
|
||||||
@ -224,7 +228,7 @@ void PostProcessing::renderDiffuseEnvMap(const float *bSHCoeff, const float *gSH
|
|||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::DiffuseEnvMapShader::Program);
|
glUseProgram(FullScreenShader::DiffuseEnvMapShader::Program);
|
||||||
glBindVertexArray(FullScreenShader::DiffuseEnvMapShader::vao);
|
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||||
|
|
||||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST);
|
setTexture(0, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST);
|
||||||
core::matrix4 TVM = irr_driver->getViewMatrix().getTransposed();
|
core::matrix4 TVM = irr_driver->getViewMatrix().getTransposed();
|
||||||
@ -238,13 +242,27 @@ void PostProcessing::renderDiffuseEnvMap(const float *bSHCoeff, const float *gSH
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PostProcessing::renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB, const core::matrix4 &rh_matrix, const core::vector3df &rh_extend)
|
||||||
|
{
|
||||||
|
glEnable(GL_PROGRAM_POINT_SIZE);
|
||||||
|
glUseProgram(FullScreenShader::RHDebug::getInstance()->Program);
|
||||||
|
glActiveTexture(GL_TEXTURE0 + FullScreenShader::RHDebug::getInstance()->TU_SHR);
|
||||||
|
glBindTexture(GL_TEXTURE_3D, SHR);
|
||||||
|
glActiveTexture(GL_TEXTURE0 + FullScreenShader::RHDebug::getInstance()->TU_SHG);
|
||||||
|
glBindTexture(GL_TEXTURE_3D, SHG);
|
||||||
|
glActiveTexture(GL_TEXTURE0 + FullScreenShader::RHDebug::getInstance()->TU_SHB);
|
||||||
|
glBindTexture(GL_TEXTURE_3D, SHB);
|
||||||
|
FullScreenShader::RHDebug::getInstance()->setUniforms(rh_matrix, rh_extend);
|
||||||
|
glDrawArrays(GL_POINTS, 0, 32 * 16 * 32);
|
||||||
|
glDisable(GL_PROGRAM_POINT_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
void PostProcessing::renderGI(const core::matrix4 &RHMatrix, const core::vector3df &rh_extend, GLuint shr, GLuint shg, GLuint shb)
|
void PostProcessing::renderGI(const core::matrix4 &RHMatrix, const core::vector3df &rh_extend, GLuint shr, GLuint shg, GLuint shb)
|
||||||
{
|
{
|
||||||
core::matrix4 InvRHMatrix;
|
core::matrix4 InvRHMatrix;
|
||||||
RHMatrix.getInverse(InvRHMatrix);
|
RHMatrix.getInverse(InvRHMatrix);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glUseProgram(FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->vao);
|
|
||||||
glActiveTexture(GL_TEXTURE0 + FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->TU_SHR);
|
glActiveTexture(GL_TEXTURE0 + FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->TU_SHR);
|
||||||
glBindTexture(GL_TEXTURE_3D, shr);
|
glBindTexture(GL_TEXTURE_3D, shr);
|
||||||
{
|
{
|
||||||
@ -265,8 +283,7 @@ void PostProcessing::renderGI(const core::matrix4 &RHMatrix, const core::vector3
|
|||||||
}
|
}
|
||||||
setTexture(FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->TU_ntex, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->TU_ntex, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST);
|
||||||
setTexture(FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->TU_dtex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->TU_dtex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::GlobalIlluminationReconstructionShader::getInstance()->setUniforms(RHMatrix, InvRHMatrix, rh_extend);
|
DrawFullScreenEffect<FullScreenShader::GlobalIlluminationReconstructionShader>(RHMatrix, InvRHMatrix, rh_extend);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::renderSunlight()
|
void PostProcessing::renderSunlight()
|
||||||
@ -278,13 +295,9 @@ void PostProcessing::renderSunlight()
|
|||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::SunLightShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::SunLightShader::getInstance()->vao);
|
|
||||||
setTexture(FullScreenShader::SunLightShader::getInstance()->TU_ntex, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::SunLightShader::getInstance()->TU_ntex, irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), GL_NEAREST, GL_NEAREST);
|
||||||
setTexture(FullScreenShader::SunLightShader::getInstance()->TU_dtex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::SunLightShader::getInstance()->TU_dtex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::SunLightShader::getInstance()->setUniforms(cb->getPosition(), video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
DrawFullScreenEffect<FullScreenShader::SunLightShader>(cb->getPosition(), video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
glBindVertexArray(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::renderShadowedSunlight(const std::vector<core::matrix4> &sun_ortho_matrix, GLuint depthtex)
|
void PostProcessing::renderShadowedSunlight(const std::vector<core::matrix4> &sun_ortho_matrix, GLuint depthtex)
|
||||||
@ -307,12 +320,7 @@ void PostProcessing::renderShadowedSunlight(const std::vector<core::matrix4> &su
|
|||||||
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
|
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
|
||||||
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::ShadowedSunLightShader::getInstance()->Program);
|
DrawFullScreenEffect<FullScreenShader::ShadowedSunLightShader>(cb->getPosition(), video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
||||||
glBindVertexArray(FullScreenShader::ShadowedSunLightShader::getInstance()->vao);
|
|
||||||
FullScreenShader::ShadowedSunLightShader::getInstance()->setUniforms(cb->getPosition(), video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
glBindVertexArray(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -322,31 +330,19 @@ void PostProcessing::renderGaussian3Blur(FrameBuffer &in_fbo, FrameBuffer &auxil
|
|||||||
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
|
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
|
||||||
{
|
{
|
||||||
auxiliary.Bind();
|
auxiliary.Bind();
|
||||||
glUseProgram(FullScreenShader::Gaussian3VBlurShader::Program);
|
|
||||||
glBindVertexArray(FullScreenShader::Gaussian3VBlurShader::vao);
|
|
||||||
|
|
||||||
glUniform2f(FullScreenShader::Gaussian3VBlurShader::uniform_pixel, inv_width, inv_height);
|
setTexture(FullScreenShader::Gaussian3VBlurShader::getInstance()->TU_tex, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
|
|
||||||
setTexture(0, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glUniform1i(FullScreenShader::Gaussian3VBlurShader::uniform_tex, 0);
|
DrawFullScreenEffect<FullScreenShader::Gaussian3VBlurShader>(core::vector2df(inv_width, inv_height));
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
in_fbo.Bind();
|
in_fbo.Bind();
|
||||||
glUseProgram(FullScreenShader::Gaussian3HBlurShader::Program);
|
|
||||||
glBindVertexArray(FullScreenShader::Gaussian3HBlurShader::vao);
|
|
||||||
|
|
||||||
glUniform2f(FullScreenShader::Gaussian3HBlurShader::uniform_pixel, inv_width, inv_height);
|
setTexture(FullScreenShader::Gaussian3HBlurShader::getInstance()->TU_tex, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
|
|
||||||
setTexture(0, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glUniform1i(FullScreenShader::Gaussian3HBlurShader::uniform_tex, 0);
|
DrawFullScreenEffect<FullScreenShader::Gaussian3HBlurShader>(core::vector2df(inv_width, inv_height));
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,31 +352,19 @@ void PostProcessing::renderGaussian6Blur(FrameBuffer &in_fbo, FrameBuffer &auxil
|
|||||||
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
|
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
|
||||||
{
|
{
|
||||||
auxiliary.Bind();
|
auxiliary.Bind();
|
||||||
glUseProgram(FullScreenShader::Gaussian6VBlurShader::Program);
|
|
||||||
glBindVertexArray(FullScreenShader::Gaussian6VBlurShader::vao);
|
|
||||||
|
|
||||||
glUniform2f(FullScreenShader::Gaussian6VBlurShader::uniform_pixel, inv_width, inv_height);
|
setTexture(FullScreenShader::Gaussian6VBlurShader::getInstance()->TU_tex, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
|
|
||||||
setTexture(0, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glUniform1i(FullScreenShader::Gaussian6VBlurShader::uniform_tex, 0);
|
DrawFullScreenEffect<FullScreenShader::Gaussian6VBlurShader>(core::vector2df(inv_width, inv_height));
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
in_fbo.Bind();
|
in_fbo.Bind();
|
||||||
glUseProgram(FullScreenShader::Gaussian6HBlurShader::Program);
|
|
||||||
glBindVertexArray(FullScreenShader::Gaussian6HBlurShader::vao);
|
|
||||||
|
|
||||||
glUniform2f(FullScreenShader::Gaussian6HBlurShader::uniform_pixel, inv_width, inv_height);
|
setTexture(FullScreenShader::Gaussian6HBlurShader::getInstance()->TU_tex, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
|
|
||||||
setTexture(0, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glUniform1i(FullScreenShader::Gaussian6HBlurShader::uniform_tex, 0);
|
DrawFullScreenEffect<FullScreenShader::Gaussian6HBlurShader>(core::vector2df(inv_width, inv_height));
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,33 +378,24 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
auxiliary.Bind();
|
auxiliary.Bind();
|
||||||
glUseProgram(FullScreenShader::Gaussian17TapHShader::Program);
|
|
||||||
glBindVertexArray(FullScreenShader::Gaussian17TapHShader::vao);
|
|
||||||
|
|
||||||
glUniform2f(FullScreenShader::Gaussian17TapHShader::uniform_pixel, inv_width, inv_height);
|
setTexture(FullScreenShader::Gaussian17TapHShader::getInstance()->TU_tex, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
|
|
||||||
setTexture(0, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
setTexture(1, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::Gaussian17TapHShader::getInstance()->TU_depth, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glUniform1i(FullScreenShader::Gaussian17TapHShader::uniform_tex, 0);
|
DrawFullScreenEffect<FullScreenShader::Gaussian17TapHShader>(core::vector2df(inv_width, inv_height));
|
||||||
glUniform1i(FullScreenShader::Gaussian17TapHShader::uniform_depth, 1);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
#if WIN32
|
#if WIN32
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program);
|
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->Program);
|
||||||
glBindImageTexture(0, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_source, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
||||||
glBindImageTexture(1, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_depth, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
||||||
glBindImageTexture(2, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_dest, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_source, 0);
|
FullScreenShader::ComputeGaussian17TapHShader::getInstance()->setUniforms();
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_depth, 1);
|
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_dest, 2);
|
|
||||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -431,32 +406,23 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
in_fbo.Bind();
|
in_fbo.Bind();
|
||||||
glUseProgram(FullScreenShader::Gaussian17TapVShader::Program);
|
|
||||||
glBindVertexArray(FullScreenShader::Gaussian17TapVShader::vao);
|
|
||||||
|
|
||||||
glUniform2f(FullScreenShader::Gaussian17TapVShader::uniform_pixel, inv_width, inv_height);
|
setTexture(FullScreenShader::Gaussian17TapVShader::getInstance()->TU_tex, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
|
|
||||||
setTexture(0, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
setTexture(1, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::Gaussian17TapVShader::getInstance()->TU_depth, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glUniform1i(FullScreenShader::Gaussian17TapVShader::uniform_tex, 0);
|
DrawFullScreenEffect<FullScreenShader::Gaussian17TapVShader>(core::vector2df(inv_width, inv_height));
|
||||||
glUniform1i(FullScreenShader::Gaussian17TapVShader::uniform_depth, 1);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
#if WIN32
|
#if WIN32
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::Program);
|
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->Program);
|
||||||
glBindImageTexture(0, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_source, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
||||||
glBindImageTexture(1, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_depth, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
||||||
glBindImageTexture(2, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_dest, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_source, 0);
|
FullScreenShader::ComputeGaussian17TapVShader::getInstance()->setUniforms();
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_depth, 1);
|
|
||||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_dest, 2);
|
|
||||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -465,48 +431,40 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
|
|
||||||
void PostProcessing::renderPassThrough(GLuint tex)
|
void PostProcessing::renderPassThrough(GLuint tex)
|
||||||
{
|
{
|
||||||
|
glUseProgram(FullScreenShader::PassThroughShader::getInstance()->Program);
|
||||||
|
glBindVertexArray(FullScreenShader::PassThroughShader::getInstance()->vao);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::PassThroughShader::Program);
|
setTexture(FullScreenShader::PassThroughShader::getInstance()->TU_tex, tex, GL_LINEAR, GL_LINEAR);
|
||||||
glBindVertexArray(FullScreenShader::PassThroughShader::vao);
|
FullScreenShader::PassThroughShader::getInstance()->setUniforms();
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
glUniform1i(FullScreenShader::PassThroughShader::uniform_texture, 0);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::renderTextureLayer(unsigned tex, unsigned layer)
|
void PostProcessing::renderTextureLayer(unsigned tex, unsigned layer)
|
||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::LayerPassThroughShader::Program);
|
glUseProgram(FullScreenShader::LayerPassThroughShader::getInstance()->Program);
|
||||||
glBindVertexArray(FullScreenShader::LayerPassThroughShader::vao);
|
glBindVertexArray(FullScreenShader::LayerPassThroughShader::getInstance()->vao);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0 + FullScreenShader::LayerPassThroughShader::getInstance()->TU_texture);
|
||||||
glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
|
glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
|
||||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glUniform1i(FullScreenShader::LayerPassThroughShader::uniform_texture, 0);
|
FullScreenShader::LayerPassThroughShader::getInstance()->setUniforms(layer);
|
||||||
glUniform1i(FullScreenShader::LayerPassThroughShader::uniform_layer, layer);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::renderGlow(unsigned tex)
|
void PostProcessing::renderGlow(unsigned tex)
|
||||||
{
|
{
|
||||||
|
glUseProgram(FullScreenShader::GlowShader::getInstance()->Program);
|
||||||
|
glBindVertexArray(FullScreenShader::GlowShader::getInstance()->vao);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::GlowShader::Program);
|
setTexture(FullScreenShader::GlowShader::getInstance()->TU_tex, tex, GL_LINEAR, GL_LINEAR);
|
||||||
glBindVertexArray(FullScreenShader::GlowShader::vao);
|
FullScreenShader::GlowShader::getInstance()->setUniforms();
|
||||||
|
|
||||||
setTexture(0, tex, GL_LINEAR, GL_LINEAR);
|
|
||||||
glUniform1i(FullScreenShader::GlowShader::uniform_tex, 0);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
ITexture *noise_tex = 0;
|
|
||||||
|
|
||||||
void PostProcessing::renderSSAO()
|
void PostProcessing::renderSSAO()
|
||||||
{
|
{
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
@ -515,25 +473,14 @@ void PostProcessing::renderSSAO()
|
|||||||
|
|
||||||
// Generate linear depth buffer
|
// Generate linear depth buffer
|
||||||
irr_driver->getFBO(FBO_LINEAR_DEPTH).Bind();
|
irr_driver->getFBO(FBO_LINEAR_DEPTH).Bind();
|
||||||
glUseProgram(FullScreenShader::LinearizeDepthShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::LinearizeDepthShader::getInstance()->vao);
|
|
||||||
setTexture(FullScreenShader::LinearizeDepthShader::getInstance()->TU_tex, irr_driver->getDepthStencilTexture(), GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::LinearizeDepthShader::getInstance()->TU_tex, irr_driver->getDepthStencilTexture(), GL_LINEAR, GL_LINEAR);
|
||||||
FullScreenShader::LinearizeDepthShader::getInstance()->setUniforms(irr_driver->getSceneManager()->getActiveCamera()->getNearValue(), irr_driver->getSceneManager()->getActiveCamera()->getFarValue());
|
DrawFullScreenEffect<FullScreenShader::LinearizeDepthShader>(irr_driver->getSceneManager()->getActiveCamera()->getNearValue(), irr_driver->getSceneManager()->getActiveCamera()->getFarValue());
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
irr_driver->getFBO(FBO_SSAO).Bind();
|
irr_driver->getFBO(FBO_SSAO).Bind();
|
||||||
|
|
||||||
if (!noise_tex)
|
|
||||||
noise_tex = irr_driver->getTexture(file_manager->getAsset("textures/noise.png").c_str());
|
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::SSAOShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::SSAOShader::getInstance()->vao);
|
|
||||||
|
|
||||||
setTexture(FullScreenShader::SSAOShader::getInstance()->TU_dtex, irr_driver->getRenderTargetTexture(RTT_LINEAR_DEPTH), GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST);
|
setTexture(FullScreenShader::SSAOShader::getInstance()->TU_dtex, irr_driver->getRenderTargetTexture(RTT_LINEAR_DEPTH), GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST);
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|
||||||
FullScreenShader::SSAOShader::getInstance()->setUniforms(irr_driver->getSSAORadius(), irr_driver->getSSAOK(), irr_driver->getSSAOSigma());
|
DrawFullScreenEffect<FullScreenShader::SSAOShader>(irr_driver->getSSAORadius(), irr_driver->getSSAOK(), irr_driver->getSSAOSigma());
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::renderFog()
|
void PostProcessing::renderFog()
|
||||||
@ -557,16 +504,10 @@ void PostProcessing::renderFog()
|
|||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::FogShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::FogShader::getInstance()->vao);
|
|
||||||
|
|
||||||
setTexture(FullScreenShader::FogShader::getInstance()->TU_tex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::FogShader::getInstance()->TU_tex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::FogShader::getInstance()->setUniforms(fogmax, startH, endH, start, end, col);
|
DrawFullScreenEffect<FullScreenShader::FogShader>(fogmax, startH, endH, start, end, col);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
glBindVertexArray(0);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
@ -592,40 +533,34 @@ void PostProcessing::renderMotionBlur(unsigned cam, FrameBuffer &in_fbo, FrameBu
|
|||||||
out_fbo.Bind();
|
out_fbo.Bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::MotionBlurShader::Program);
|
setTexture(FullScreenShader::MotionBlurShader::getInstance()->TU_cb, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
glBindVertexArray(FullScreenShader::MotionBlurShader::vao);
|
|
||||||
|
|
||||||
setTexture(0, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
setTexture(1, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::MotionBlurShader::getInstance()->TU_dtex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::MotionBlurShader
|
DrawFullScreenEffect<FullScreenShader::MotionBlurShader>(
|
||||||
::setUniforms(cb->getBoostTime(0) * 10, // Todo : should be framerate dependent
|
|
||||||
// Todo : use a previousPVMatrix per cam, not global
|
// Todo : use a previousPVMatrix per cam, not global
|
||||||
irr_driver->getPreviousPVMatrix(),
|
irr_driver->getPreviousPVMatrix(),
|
||||||
cb->getCenter(cam),
|
cb->getCenter(cam),
|
||||||
0.15f,
|
cb->getBoostTime(0) * 10, // Todo : should be framerate dependent
|
||||||
0, 1);
|
0.15f);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void renderGodFade(GLuint tex, const SColor &col)
|
static void renderGodFade(GLuint tex, const SColor &col)
|
||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::GodFadeShader::Program);
|
glUseProgram(FullScreenShader::GodFadeShader::getInstance()->Program);
|
||||||
glBindVertexArray(FullScreenShader::GodFadeShader::vao);
|
glBindVertexArray(FullScreenShader::GodFadeShader::getInstance()->vao);
|
||||||
setTexture(0, tex, GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::GodFadeShader::getInstance()->TU_tex, tex, GL_LINEAR, GL_LINEAR);
|
||||||
FullScreenShader::GodFadeShader::setUniforms(col, 0);
|
FullScreenShader::GodFadeShader::getInstance()->setUniforms(col);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void renderGodRay(GLuint tex, const core::vector2df &sunpos)
|
static void renderGodRay(GLuint tex, const core::vector2df &sunpos)
|
||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::GodRayShader::Program);
|
glUseProgram(FullScreenShader::GodRayShader::getInstance()->Program);
|
||||||
glBindVertexArray(FullScreenShader::GodRayShader::vao);
|
glBindVertexArray(FullScreenShader::GodRayShader::getInstance()->vao);
|
||||||
setTexture(0, tex, GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::GodRayShader::getInstance()->TU_tex, tex, GL_LINEAR, GL_LINEAR);
|
||||||
FullScreenShader::GodRayShader::setUniforms(sunpos, 0);
|
FullScreenShader::GodRayShader::getInstance()->setUniforms(sunpos);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
}
|
}
|
||||||
@ -633,31 +568,16 @@ static void renderGodRay(GLuint tex, const core::vector2df &sunpos)
|
|||||||
static void toneMap(FrameBuffer &fbo, GLuint rtt)
|
static void toneMap(FrameBuffer &fbo, GLuint rtt)
|
||||||
{
|
{
|
||||||
fbo.Bind();
|
fbo.Bind();
|
||||||
glUseProgram(FullScreenShader::ToneMapShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::ToneMapShader::getInstance()->vao);
|
|
||||||
setTexture(FullScreenShader::ToneMapShader::getInstance()->TU_tex, rtt, GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::ToneMapShader::getInstance()->TU_tex, rtt, GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::ToneMapShader::getInstance()->setUniforms();
|
DrawFullScreenEffect<FullScreenShader::ToneMapShader>();
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void renderDoF(FrameBuffer &fbo, GLuint rtt)
|
static void renderDoF(FrameBuffer &fbo, GLuint rtt)
|
||||||
{
|
{
|
||||||
fbo.Bind();
|
fbo.Bind();
|
||||||
glUseProgram(FullScreenShader::DepthOfFieldShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::DepthOfFieldShader::getInstance()->vao);
|
|
||||||
setTexture(FullScreenShader::DepthOfFieldShader::getInstance()->TU_tex, rtt, GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::DepthOfFieldShader::getInstance()->TU_tex, rtt, GL_LINEAR, GL_LINEAR);
|
||||||
setTexture(FullScreenShader::DepthOfFieldShader::getInstance()->TU_depth, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::DepthOfFieldShader::getInstance()->TU_depth, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::DepthOfFieldShader::getInstance()->setUniforms();
|
DrawFullScreenEffect<FullScreenShader::DepthOfFieldShader>();
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void averageTexture(GLuint tex)
|
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::applyMLAA()
|
void PostProcessing::applyMLAA()
|
||||||
@ -672,11 +592,11 @@ void PostProcessing::applyMLAA()
|
|||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||||
|
|
||||||
// Pass 1: color edge detection
|
// Pass 1: color edge detection
|
||||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_MLAA_COLORS), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::MLAAColorEdgeDetectionSHader::getInstance()->TU_colorMapG, irr_driver->getRenderTargetTexture(RTT_MLAA_COLORS), GL_NEAREST, GL_NEAREST);
|
||||||
glUseProgram(FullScreenShader::MLAAColorEdgeDetectionSHader::Program);
|
glUseProgram(FullScreenShader::MLAAColorEdgeDetectionSHader::getInstance()->Program);
|
||||||
FullScreenShader::MLAAColorEdgeDetectionSHader::setUniforms(PIXEL_SIZE, 0);
|
FullScreenShader::MLAAColorEdgeDetectionSHader::getInstance()->setUniforms(PIXEL_SIZE);
|
||||||
|
|
||||||
glBindVertexArray(FullScreenShader::MLAAColorEdgeDetectionSHader::vao);
|
glBindVertexArray(FullScreenShader::MLAAColorEdgeDetectionSHader::getInstance()->vao);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
glStencilFunc(GL_EQUAL, 1, ~0);
|
glStencilFunc(GL_EQUAL, 1, ~0);
|
||||||
@ -686,12 +606,12 @@ void PostProcessing::applyMLAA()
|
|||||||
irr_driver->getFBO(FBO_MLAA_BLEND).Bind();
|
irr_driver->getFBO(FBO_MLAA_BLEND).Bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::MLAABlendWeightSHader::Program);
|
glUseProgram(FullScreenShader::MLAABlendWeightSHader::getInstance()->Program);
|
||||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_MLAA_TMP), GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::MLAABlendWeightSHader::getInstance()->TU_edgesMap, irr_driver->getRenderTargetTexture(RTT_MLAA_TMP), GL_LINEAR, GL_LINEAR);
|
||||||
setTexture(1, getTextureGLuint(m_areamap), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::MLAABlendWeightSHader::getInstance()->TU_areaMap, getTextureGLuint(m_areamap), GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::MLAABlendWeightSHader::setUniforms(PIXEL_SIZE, 0, 1);
|
FullScreenShader::MLAABlendWeightSHader::getInstance()->setUniforms(PIXEL_SIZE);
|
||||||
|
|
||||||
glBindVertexArray(FullScreenShader::MLAABlendWeightSHader::vao);
|
glBindVertexArray(FullScreenShader::MLAABlendWeightSHader::getInstance()->vao);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
// Blit in to tmp1
|
// Blit in to tmp1
|
||||||
@ -700,12 +620,12 @@ void PostProcessing::applyMLAA()
|
|||||||
// Pass 3: gather
|
// Pass 3: gather
|
||||||
irr_driver->getFBO(FBO_MLAA_COLORS).Bind();
|
irr_driver->getFBO(FBO_MLAA_COLORS).Bind();
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::MLAAGatherSHader::Program);
|
glUseProgram(FullScreenShader::MLAAGatherSHader::getInstance()->Program);
|
||||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_MLAA_TMP), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::MLAAGatherSHader::getInstance()->TU_colorMap, irr_driver->getRenderTargetTexture(RTT_MLAA_TMP), GL_NEAREST, GL_NEAREST);
|
||||||
setTexture(1, irr_driver->getRenderTargetTexture(RTT_MLAA_BLEND), GL_NEAREST, GL_NEAREST);
|
setTexture(FullScreenShader::MLAAGatherSHader::getInstance()->TU_blendMap, irr_driver->getRenderTargetTexture(RTT_MLAA_BLEND), GL_NEAREST, GL_NEAREST);
|
||||||
FullScreenShader::MLAAGatherSHader::setUniforms(PIXEL_SIZE, 0, 1);
|
FullScreenShader::MLAAGatherSHader::getInstance()->setUniforms(PIXEL_SIZE);
|
||||||
|
|
||||||
glBindVertexArray(FullScreenShader::MLAAGatherSHader::vao);
|
glBindVertexArray(FullScreenShader::MLAAGatherSHader::getInstance()->vao);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
// Done.
|
// Done.
|
||||||
@ -833,13 +753,10 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
|
|||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
setTexture(0, irr_driver->getRenderTargetTexture(RTT_BLOOM_128), GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::BloomBlendShader::getInstance()->TU_tex_128, irr_driver->getRenderTargetTexture(RTT_BLOOM_128), GL_LINEAR, GL_LINEAR);
|
||||||
setTexture(1, irr_driver->getRenderTargetTexture(RTT_BLOOM_256), GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::BloomBlendShader::getInstance()->TU_tex_256, irr_driver->getRenderTargetTexture(RTT_BLOOM_256), GL_LINEAR, GL_LINEAR);
|
||||||
setTexture(2, irr_driver->getRenderTargetTexture(RTT_BLOOM_512), GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::BloomBlendShader::getInstance()->TU_tex_512, irr_driver->getRenderTargetTexture(RTT_BLOOM_512), GL_LINEAR, GL_LINEAR);
|
||||||
glUseProgram(FullScreenShader::BloomBlendShader::Program);
|
DrawFullScreenEffect<FullScreenShader::BloomBlendShader>();
|
||||||
FullScreenShader::BloomBlendShader::setUniforms(0, 1, 2);
|
|
||||||
glBindVertexArray(FullScreenShader::BloomBlendShader::vao);
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
@ -81,6 +81,7 @@ public:
|
|||||||
void renderFog();
|
void renderFog();
|
||||||
void renderSSAO();
|
void renderSSAO();
|
||||||
void renderDiffuseEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff);
|
void renderDiffuseEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff);
|
||||||
|
void renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB, const core::matrix4 &rh_matrix, const core::vector3df &rh_extend);
|
||||||
void renderGI(const core::matrix4 &RHMatrix, const core::vector3df &rh_extend, unsigned shr, unsigned shg, unsigned shb);
|
void renderGI(const core::matrix4 &RHMatrix, const core::vector3df &rh_extend, unsigned shr, unsigned shg, unsigned shb);
|
||||||
|
|
||||||
/** Blur the in texture */
|
/** Blur the in texture */
|
||||||
|
@ -340,18 +340,8 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
|||||||
|
|
||||||
if (getRH())
|
if (getRH())
|
||||||
{
|
{
|
||||||
glEnable(GL_PROGRAM_POINT_SIZE);
|
|
||||||
m_rtts->getFBO(FBO_COLORS).Bind();
|
m_rtts->getFBO(FBO_COLORS).Bind();
|
||||||
glUseProgram(FullScreenShader::RHDebug::Program);
|
m_post_processing->renderRHDebug(m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2], rh_matrix, rh_extend);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, m_rtts->getRH().getRTT()[0]);
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, m_rtts->getRH().getRTT()[1]);
|
|
||||||
glActiveTexture(GL_TEXTURE2);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, m_rtts->getRH().getRTT()[2]);
|
|
||||||
FullScreenShader::RHDebug::setUniforms(rh_matrix, rh_extend, 0, 1, 2);
|
|
||||||
glDrawArrays(GL_POINTS, 0, 32 * 16 * 32);
|
|
||||||
glDisable(GL_PROGRAM_POINT_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGI())
|
if (getGI())
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "utils/tuple.hpp"
|
#include "utils/tuple.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
namespace RenderGeometry
|
namespace RenderGeometry
|
||||||
{
|
{
|
||||||
@ -79,6 +78,7 @@ namespace RenderGeometry
|
|||||||
}
|
}
|
||||||
using namespace RenderGeometry;
|
using namespace RenderGeometry;
|
||||||
|
|
||||||
|
|
||||||
template<typename T, typename...uniforms>
|
template<typename T, typename...uniforms>
|
||||||
void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
||||||
{
|
{
|
||||||
@ -92,73 +92,37 @@ void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<int...List>
|
template<int...List>
|
||||||
struct remap_tuple;
|
struct custom_unroll_args;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct remap_tuple<>
|
struct custom_unroll_args<>
|
||||||
{
|
{
|
||||||
template<typename...OriginalTuples, typename...Args>
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
static STK::Tuple <Args...> exec(const STK::Tuple<OriginalTuples...> &oldt, Args... args)
|
static void exec(const T *Shader, const STK::Tuple<TupleTypes...> &t, Args... args)
|
||||||
{
|
{
|
||||||
return STK::make_tuple(args...);
|
draw<T>(Shader, STK::tuple_get<0>(t), args...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int N, int...List>
|
template<int N, int...List>
|
||||||
struct remap_tuple<N, List...>
|
struct custom_unroll_args<N, List...>
|
||||||
{
|
{
|
||||||
template<typename...OriginalTuples, typename...Args>
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
static auto exec(const STK::Tuple<OriginalTuples...> &oldt, Args...args)
|
static void exec(const T *Shader, const STK::Tuple<TupleTypes...> &t, Args... args)
|
||||||
-> decltype(remap_tuple<List...>::template exec(oldt, STK::tuple_get<N>(oldt), args...))
|
|
||||||
{
|
{
|
||||||
return remap_tuple<List...>::template exec(oldt, STK::tuple_get<N>(oldt), args...);
|
custom_unroll_args<List...>::template exec<T>(Shader, t, STK::tuple_get<N>(t), args...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int N>
|
|
||||||
struct unroll_args_impl;
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct unroll_args_impl<0>
|
|
||||||
{
|
|
||||||
template<typename ...Args>
|
|
||||||
static void exec(std::function<void (Args...)> f, const STK::Tuple<Args...> &t, Args... args)
|
|
||||||
{
|
|
||||||
f(args...);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<int N>
|
|
||||||
struct unroll_args_impl
|
|
||||||
{
|
|
||||||
template<typename ...TupleType, typename ...Args>
|
|
||||||
static void exec(std::function<void (TupleType...)> f, const STK::Tuple<TupleType...> &t, Args... args)
|
|
||||||
{
|
|
||||||
unroll_args_impl<N - 1>::exec(f, t, STK::tuple_get<N - 1>(t), args...);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename...Args>
|
|
||||||
static void unroll_args(std::function<void (Args...)> f, const STK::Tuple<Args...> &t)
|
|
||||||
{
|
|
||||||
unroll_args_impl<sizeof...(Args) >::exec(f, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
|
||||||
void apply_instance(const T *Shader, const GLMesh *mesh, const STK::Tuple<Args...> &t)
|
|
||||||
{
|
|
||||||
std::function<void (Args...)> lambda = [&](Args...args) { draw<T>(Shader, mesh, args...); };
|
|
||||||
unroll_args(lambda, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Shader, enum E_VERTEX_TYPE VertexType, int ...List, typename... TupleType>
|
template<typename Shader, enum E_VERTEX_TYPE VertexType, int ...List, typename... TupleType>
|
||||||
void renderMeshes1stPass(const std::vector<TexUnit> &TexUnits, std::vector<STK::Tuple<TupleType...> > &meshes)
|
void renderMeshes1stPass(const std::vector<TexUnit> &TexUnits, std::vector<STK::Tuple<TupleType...> > *meshes)
|
||||||
{
|
{
|
||||||
glUseProgram(Shader::getInstance()->Program);
|
glUseProgram(Shader::getInstance()->Program);
|
||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < meshes.size(); i++)
|
for (unsigned i = 0; i < meshes->size(); i++)
|
||||||
{
|
{
|
||||||
GLMesh &mesh = *(STK::tuple_get<0>(meshes[i]));
|
GLMesh &mesh = *(STK::tuple_get<0>(meshes->at(i)));
|
||||||
for (unsigned j = 0; j < TexUnits.size(); j++)
|
for (unsigned j = 0; j < TexUnits.size(); j++)
|
||||||
{
|
{
|
||||||
if (!mesh.textures[j])
|
if (!mesh.textures[j])
|
||||||
@ -173,8 +137,7 @@ void renderMeshes1stPass(const std::vector<TexUnit> &TexUnits, std::vector<STK::
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto remapped_tuple = remap_tuple<List...>::exec(meshes[i]);
|
custom_unroll_args<List...>::template exec(Shader::getInstance(), meshes->at(i));
|
||||||
apply_instance<Shader>(Shader::getInstance(), &mesh, remapped_tuple);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,14 +154,14 @@ void IrrDriver::renderSolidFirstPass()
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
irr_driver->setPhase(SOLID_NORMAL_AND_DEPTH_PASS);
|
irr_driver->setPhase(SOLID_NORMAL_AND_DEPTH_PASS);
|
||||||
ListMatDefault::Arguments.clear();
|
ListMatDefault::getInstance()->clear();
|
||||||
ListMatAlphaRef::Arguments.clear();
|
ListMatAlphaRef::getInstance()->clear();
|
||||||
ListMatSphereMap::Arguments.clear();
|
ListMatSphereMap::getInstance()->clear();
|
||||||
ListMatDetails::Arguments.clear();
|
ListMatDetails::getInstance()->clear();
|
||||||
ListMatUnlit::Arguments.clear();
|
ListMatUnlit::getInstance()->clear();
|
||||||
ListMatNormalMap::Arguments.clear();
|
ListMatNormalMap::getInstance()->clear();
|
||||||
ListMatGrass::Arguments.clear();
|
ListMatGrass::getInstance()->clear();
|
||||||
ListMatSplatting::Arguments.clear();
|
ListMatSplatting::getInstance()->clear();
|
||||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||||
|
|
||||||
if (!UserConfigParams::m_dynamic_lights)
|
if (!UserConfigParams::m_dynamic_lights)
|
||||||
@ -208,28 +171,28 @@ void IrrDriver::renderSolidFirstPass()
|
|||||||
ScopedGPUTimer Timer(getGPUTimer(Q_SOLID_PASS1));
|
ScopedGPUTimer Timer(getGPUTimer(Q_SOLID_PASS1));
|
||||||
|
|
||||||
std::vector<TexUnit> object_pass1_texunits = TexUnits(TexUnit(MeshShader::ObjectPass1Shader::getInstance()->TU_tex, true) );
|
std::vector<TexUnit> object_pass1_texunits = TexUnits(TexUnit(MeshShader::ObjectPass1Shader::getInstance()->TU_tex, true) );
|
||||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>(object_pass1_texunits, ListMatDefault::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>(object_pass1_texunits, ListMatDefault::getInstance());
|
||||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>(object_pass1_texunits, ListMatSphereMap::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>(object_pass1_texunits, ListMatSphereMap::getInstance());
|
||||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS, 2, 1>(object_pass1_texunits, ListMatDetails::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS, 2, 1>(object_pass1_texunits, ListMatDetails::getInstance());
|
||||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS, 2, 1>(object_pass1_texunits, ListMatSplatting::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS, 2, 1>(object_pass1_texunits, ListMatSplatting::getInstance());
|
||||||
renderMeshes1stPass<MeshShader::ObjectRefPass1Shader, video::EVT_STANDARD, 3, 2, 1>(object_pass1_texunits, ListMatUnlit::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectRefPass1Shader, video::EVT_STANDARD, 3, 2, 1>(object_pass1_texunits, ListMatUnlit::getInstance());
|
||||||
renderMeshes1stPass<MeshShader::ObjectRefPass1Shader, video::EVT_STANDARD, 3, 2, 1>(TexUnits(TexUnit(MeshShader::ObjectRefPass1Shader::getInstance()->TU_tex, true)), ListMatAlphaRef::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectRefPass1Shader, video::EVT_STANDARD, 3, 2, 1>(TexUnits(TexUnit(MeshShader::ObjectRefPass1Shader::getInstance()->TU_tex, true)), ListMatAlphaRef::getInstance());
|
||||||
renderMeshes1stPass<MeshShader::GrassPass1Shader, video::EVT_STANDARD, 3, 2, 1>(TexUnits(TexUnit(MeshShader::GrassPass1Shader::getInstance()->TU_tex, true)), ListMatGrass::Arguments);
|
renderMeshes1stPass<MeshShader::GrassPass1Shader, video::EVT_STANDARD, 3, 2, 1>(TexUnits(TexUnit(MeshShader::GrassPass1Shader::getInstance()->TU_tex, true)), ListMatGrass::getInstance());
|
||||||
renderMeshes1stPass<MeshShader::NormalMapShader, video::EVT_TANGENTS, 2, 1>(TexUnits(
|
renderMeshes1stPass<MeshShader::NormalMapShader, video::EVT_TANGENTS, 2, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::NormalMapShader::getInstance()->TU_glossy, true),
|
TexUnit(MeshShader::NormalMapShader::getInstance()->TU_glossy, true),
|
||||||
TexUnit(MeshShader::NormalMapShader::getInstance()->TU_normalmap, false)
|
TexUnit(MeshShader::NormalMapShader::getInstance()->TU_normalmap, false)
|
||||||
), ListMatNormalMap::Arguments);
|
), ListMatNormalMap::getInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Shader, enum E_VERTEX_TYPE VertexType, int...List, typename... TupleType>
|
template<typename Shader, enum E_VERTEX_TYPE VertexType, int...List, typename... TupleType>
|
||||||
void renderMeshes2ndPass(const std::vector<TexUnit> &TexUnits, std::vector<STK::Tuple<TupleType...> > &meshes)
|
void renderMeshes2ndPass(const std::vector<TexUnit> &TexUnits, std::vector<STK::Tuple<TupleType...> > *meshes)
|
||||||
{
|
{
|
||||||
glUseProgram(Shader::getInstance()->Program);
|
glUseProgram(Shader::getInstance()->Program);
|
||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < meshes.size(); i++)
|
for (unsigned i = 0; i < meshes->size(); i++)
|
||||||
{
|
{
|
||||||
GLMesh &mesh = *(STK::tuple_get<0>(meshes[i]));
|
GLMesh &mesh = *(STK::tuple_get<0>(meshes->at(i)));
|
||||||
for (unsigned j = 0; j < TexUnits.size(); j++)
|
for (unsigned j = 0; j < TexUnits.size(); j++)
|
||||||
{
|
{
|
||||||
if (!mesh.textures[j])
|
if (!mesh.textures[j])
|
||||||
@ -255,8 +218,7 @@ void renderMeshes2ndPass(const std::vector<TexUnit> &TexUnits, std::vector<STK::
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto remapped_tuple = remap_tuple<List...>::exec(meshes[i]);
|
custom_unroll_args<List...>::template exec(Shader::getInstance(), meshes->at(i));
|
||||||
apply_instance<Shader>(Shader::getInstance(), &mesh, remapped_tuple);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,28 +255,28 @@ void IrrDriver::renderSolidSecondPass()
|
|||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::ObjectPass2Shader, video::EVT_STANDARD, 3, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::ObjectPass2Shader, video::EVT_STANDARD, 3, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::ObjectPass2Shader::getInstance()->TU_Albedo, true)
|
TexUnit(MeshShader::ObjectPass2Shader::getInstance()->TU_Albedo, true)
|
||||||
), ListMatDefault::Arguments);
|
), ListMatDefault::getInstance());
|
||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::ObjectRefPass2Shader, video::EVT_STANDARD, 3, 1 >(TexUnits(
|
renderMeshes2ndPass<MeshShader::ObjectRefPass2Shader, video::EVT_STANDARD, 3, 1 >(TexUnits(
|
||||||
TexUnit(MeshShader::ObjectRefPass2Shader::getInstance()->TU_Albedo, true)
|
TexUnit(MeshShader::ObjectRefPass2Shader::getInstance()->TU_Albedo, true)
|
||||||
), ListMatAlphaRef::Arguments);
|
), ListMatAlphaRef::getInstance());
|
||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::SphereMapShader, video::EVT_STANDARD, 2, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::SphereMapShader, video::EVT_STANDARD, 2, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::SphereMapShader::getInstance()->TU_tex, true)
|
TexUnit(MeshShader::SphereMapShader::getInstance()->TU_tex, true)
|
||||||
), ListMatSphereMap::Arguments);
|
), ListMatSphereMap::getInstance());
|
||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::DetailledObjectPass2Shader, video::EVT_2TCOORDS, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::DetailledObjectPass2Shader, video::EVT_2TCOORDS, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::DetailledObjectPass2Shader::getInstance()->TU_Albedo, true),
|
TexUnit(MeshShader::DetailledObjectPass2Shader::getInstance()->TU_Albedo, true),
|
||||||
TexUnit(MeshShader::DetailledObjectPass2Shader::getInstance()->TU_detail, true)
|
TexUnit(MeshShader::DetailledObjectPass2Shader::getInstance()->TU_detail, true)
|
||||||
), ListMatDetails::Arguments);
|
), ListMatDetails::getInstance());
|
||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::GrassPass2Shader, video::EVT_STANDARD, 3, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::GrassPass2Shader, video::EVT_STANDARD, 3, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::GrassPass2Shader::getInstance()->TU_Albedo, true)
|
TexUnit(MeshShader::GrassPass2Shader::getInstance()->TU_Albedo, true)
|
||||||
), ListMatGrass::Arguments);
|
), ListMatGrass::getInstance());
|
||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::ObjectUnlitShader, video::EVT_STANDARD, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::ObjectUnlitShader, video::EVT_STANDARD, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::ObjectUnlitShader::getInstance()->TU_tex, true)
|
TexUnit(MeshShader::ObjectUnlitShader::getInstance()->TU_tex, true)
|
||||||
), ListMatUnlit::Arguments);
|
), ListMatUnlit::getInstance());
|
||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::SplattingShader, video::EVT_2TCOORDS, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::SplattingShader, video::EVT_2TCOORDS, 1>(TexUnits(
|
||||||
TexUnit(8, true),
|
TexUnit(8, true),
|
||||||
@ -323,22 +285,22 @@ void IrrDriver::renderSolidSecondPass()
|
|||||||
TexUnit(MeshShader::SplattingShader::getInstance()->TU_tex_detail1, true),
|
TexUnit(MeshShader::SplattingShader::getInstance()->TU_tex_detail1, true),
|
||||||
TexUnit(MeshShader::SplattingShader::getInstance()->TU_tex_detail2, true),
|
TexUnit(MeshShader::SplattingShader::getInstance()->TU_tex_detail2, true),
|
||||||
TexUnit(MeshShader::SplattingShader::getInstance()->TU_tex_detail3, true)
|
TexUnit(MeshShader::SplattingShader::getInstance()->TU_tex_detail3, true)
|
||||||
), ListMatSplatting::Arguments);
|
), ListMatSplatting::getInstance());
|
||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::ObjectPass2Shader, video::EVT_TANGENTS, 3, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::ObjectPass2Shader, video::EVT_TANGENTS, 3, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::ObjectPass2Shader::getInstance()->TU_Albedo, true)
|
TexUnit(MeshShader::ObjectPass2Shader::getInstance()->TU_Albedo, true)
|
||||||
), ListMatNormalMap::Arguments);
|
), ListMatNormalMap::getInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<enum E_VERTEX_TYPE VertexType, typename... TupleType>
|
template<enum E_VERTEX_TYPE VertexType, typename... TupleType>
|
||||||
static void renderMeshNormals(std::vector<STK::Tuple<TupleType...> > &meshes)
|
static void renderMeshNormals(std::vector<STK::Tuple<TupleType...> > *meshes)
|
||||||
{
|
{
|
||||||
glUseProgram(MeshShader::NormalVisualizer::getInstance()->Program);
|
glUseProgram(MeshShader::NormalVisualizer::getInstance()->Program);
|
||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < meshes.size(); i++)
|
for (unsigned i = 0; i < meshes->size(); i++)
|
||||||
{
|
{
|
||||||
GLMesh &mesh = *(STK::tuple_get<0>(meshes[i]));
|
GLMesh &mesh = *(STK::tuple_get<0>(meshes->at(i)));
|
||||||
|
|
||||||
if (mesh.VAOType != VertexType)
|
if (mesh.VAOType != VertexType)
|
||||||
{
|
{
|
||||||
@ -347,20 +309,20 @@ static void renderMeshNormals(std::vector<STK::Tuple<TupleType...> > &meshes)
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
draw(MeshShader::NormalVisualizer::getInstance(), STK::tuple_get<0>(meshes[i]), STK::tuple_get<1>(meshes[i]), STK::tuple_get<2>(meshes[i]), video::SColor(255, 0, 255, 0));
|
draw(MeshShader::NormalVisualizer::getInstance(), STK::tuple_get<0>(meshes->at(i)), STK::tuple_get<1>(meshes->at(i)), STK::tuple_get<2>(meshes->at(i)), video::SColor(255, 0, 255, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IrrDriver::renderNormalsVisualisation()
|
void IrrDriver::renderNormalsVisualisation()
|
||||||
{
|
{
|
||||||
renderMeshNormals<video::EVT_STANDARD>(ListMatDefault::Arguments);
|
renderMeshNormals<video::EVT_STANDARD>(ListMatDefault::getInstance());
|
||||||
renderMeshNormals<video::EVT_STANDARD>(ListMatAlphaRef::Arguments);
|
renderMeshNormals<video::EVT_STANDARD>(ListMatAlphaRef::getInstance());
|
||||||
renderMeshNormals<video::EVT_STANDARD>(ListMatSphereMap::Arguments);
|
renderMeshNormals<video::EVT_STANDARD>(ListMatSphereMap::getInstance());
|
||||||
// renderMeshNormals<video::EVT_STANDARD>(ListMatGrass::Arguments);
|
// renderMeshNormals<video::EVT_STANDARD>(ListMatGrass::getInstance());
|
||||||
renderMeshNormals<video::EVT_2TCOORDS>(ListMatDetails::Arguments);
|
renderMeshNormals<video::EVT_2TCOORDS>(ListMatDetails::getInstance());
|
||||||
renderMeshNormals<video::EVT_STANDARD>(ListMatUnlit::Arguments);
|
renderMeshNormals<video::EVT_STANDARD>(ListMatUnlit::getInstance());
|
||||||
renderMeshNormals<video::EVT_2TCOORDS>(ListMatSplatting::Arguments);
|
renderMeshNormals<video::EVT_2TCOORDS>(ListMatSplatting::getInstance());
|
||||||
renderMeshNormals<video::EVT_TANGENTS>(ListMatNormalMap::Arguments);
|
renderMeshNormals<video::EVT_TANGENTS>(ListMatNormalMap::getInstance());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,11 +339,11 @@ void IrrDriver::renderTransparent()
|
|||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
ListBlendTransparent::Arguments.clear();
|
ListBlendTransparent::getInstance()->clear();
|
||||||
ListAdditiveTransparent::Arguments.clear();
|
ListAdditiveTransparent::getInstance()->clear();
|
||||||
ListBlendTransparentFog::Arguments.clear();
|
ListBlendTransparentFog::getInstance()->clear();
|
||||||
ListAdditiveTransparentFog::Arguments.clear();
|
ListAdditiveTransparentFog::getInstance()->clear();
|
||||||
ListDisplacement::Arguments.clear();
|
ListDisplacement::getInstance()->clear();
|
||||||
m_scene_manager->drawAll(scene::ESNRP_TRANSPARENT);
|
m_scene_manager->drawAll(scene::ESNRP_TRANSPARENT);
|
||||||
|
|
||||||
glBindVertexArray(getVAO(EVT_STANDARD));
|
glBindVertexArray(getVAO(EVT_STANDARD));
|
||||||
@ -391,22 +353,22 @@ void IrrDriver::renderTransparent()
|
|||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
renderMeshes2ndPass<MeshShader::TransparentFogShader, video::EVT_STANDARD, 8, 7, 6, 5, 4, 3, 2, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::TransparentFogShader, video::EVT_STANDARD, 8, 7, 6, 5, 4, 3, 2, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::TransparentFogShader::getInstance()->TU_tex, true)
|
TexUnit(MeshShader::TransparentFogShader::getInstance()->TU_tex, true)
|
||||||
), ListBlendTransparentFog::Arguments);
|
), ListBlendTransparentFog::getInstance());
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
renderMeshes2ndPass<MeshShader::TransparentFogShader, video::EVT_STANDARD, 8, 7, 6, 5, 4, 3, 2, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::TransparentFogShader, video::EVT_STANDARD, 8, 7, 6, 5, 4, 3, 2, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::TransparentFogShader::getInstance()->TU_tex, true)
|
TexUnit(MeshShader::TransparentFogShader::getInstance()->TU_tex, true)
|
||||||
), ListAdditiveTransparentFog::Arguments);
|
), ListAdditiveTransparentFog::getInstance());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
renderMeshes2ndPass<MeshShader::TransparentShader, video::EVT_STANDARD, 2, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::TransparentShader, video::EVT_STANDARD, 2, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::TransparentShader::getInstance()->TU_tex, true)
|
TexUnit(MeshShader::TransparentShader::getInstance()->TU_tex, true)
|
||||||
), ListBlendTransparent::Arguments);
|
), ListBlendTransparent::getInstance());
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
renderMeshes2ndPass<MeshShader::TransparentShader, video::EVT_STANDARD, 2, 1>(TexUnits(
|
renderMeshes2ndPass<MeshShader::TransparentShader, video::EVT_STANDARD, 2, 1>(TexUnits(
|
||||||
TexUnit(MeshShader::TransparentShader::getInstance()->TU_tex, true)
|
TexUnit(MeshShader::TransparentShader::getInstance()->TU_tex, true)
|
||||||
), ListAdditiveTransparent::Arguments);
|
), ListAdditiveTransparent::getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UserConfigParams::m_dynamic_lights)
|
if (!UserConfigParams::m_dynamic_lights)
|
||||||
@ -434,10 +396,10 @@ void IrrDriver::renderTransparent()
|
|||||||
// Generate displace mask
|
// Generate displace mask
|
||||||
// Use RTT_TMP4 as displace mask
|
// Use RTT_TMP4 as displace mask
|
||||||
irr_driver->getFBO(FBO_TMP1_WITH_DS).Bind();
|
irr_driver->getFBO(FBO_TMP1_WITH_DS).Bind();
|
||||||
for (unsigned i = 0; i < ListDisplacement::Arguments.size(); i++)
|
for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++)
|
||||||
{
|
{
|
||||||
const GLMesh &mesh = *(STK::tuple_get<0>(ListDisplacement::Arguments[i]));
|
const GLMesh &mesh = *(STK::tuple_get<0>(ListDisplacement::getInstance()->at(i)));
|
||||||
const core::matrix4 &AbsoluteTransformation = STK::tuple_get<1>(ListDisplacement::Arguments[i]);
|
const core::matrix4 &AbsoluteTransformation = STK::tuple_get<1>(ListDisplacement::getInstance()->at(i));
|
||||||
if (mesh.VAOType != video::EVT_2TCOORDS)
|
if (mesh.VAOType != video::EVT_2TCOORDS)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -458,10 +420,10 @@ void IrrDriver::renderTransparent()
|
|||||||
irr_driver->getFBO(FBO_DISPLACE).Bind();
|
irr_driver->getFBO(FBO_DISPLACE).Bind();
|
||||||
if (!displaceTex)
|
if (!displaceTex)
|
||||||
displaceTex = irr_driver->getTexture(FileManager::TEXTURE, "displace.png");
|
displaceTex = irr_driver->getTexture(FileManager::TEXTURE, "displace.png");
|
||||||
for (unsigned i = 0; i < ListDisplacement::Arguments.size(); i++)
|
for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++)
|
||||||
{
|
{
|
||||||
const GLMesh &mesh = *(STK::tuple_get<0>(ListDisplacement::Arguments[i]));
|
const GLMesh &mesh = *(STK::tuple_get<0>(ListDisplacement::getInstance()->at(i)));
|
||||||
const core::matrix4 &AbsoluteTransformation = STK::tuple_get<1>(ListDisplacement::Arguments[i]);
|
const core::matrix4 &AbsoluteTransformation = STK::tuple_get<1>(ListDisplacement::getInstance()->at(i));
|
||||||
if (mesh.VAOType != video::EVT_2TCOORDS)
|
if (mesh.VAOType != video::EVT_2TCOORDS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -500,48 +462,81 @@ void drawShadow(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
|||||||
glDrawElementsInstancedBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, 4, mesh->vaoBaseVertex);
|
glDrawElementsInstancedBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, 4, mesh->vaoBaseVertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<int...List>
|
||||||
|
struct shadow_custom_unroll_args;
|
||||||
|
|
||||||
template<typename T, typename...Args>
|
template<>
|
||||||
void drawShadowTuple(const T *Shader, const GLMesh *mesh, const STK::Tuple<Args...> &t)
|
struct shadow_custom_unroll_args<>
|
||||||
{
|
{
|
||||||
std::function<void (Args...)> lambda = [&](Args...args) { drawShadow<T>(Shader, mesh, args...); };
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
unroll_args(lambda, t);
|
static void exec(const T *Shader, const STK::Tuple<TupleTypes...> &t, Args... args)
|
||||||
}
|
{
|
||||||
|
drawShadow<T>(Shader, STK::tuple_get<0>(t), args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int N, int...List>
|
||||||
|
struct shadow_custom_unroll_args<N, List...>
|
||||||
|
{
|
||||||
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
|
static void exec(const T *Shader, const STK::Tuple<TupleTypes...> &t, Args... args)
|
||||||
|
{
|
||||||
|
shadow_custom_unroll_args<List...>::template exec<T>(Shader, t, STK::tuple_get<N>(t), args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<typename T, enum E_VERTEX_TYPE VertexType, int...List, typename... Args>
|
template<typename T, enum E_VERTEX_TYPE VertexType, int...List, typename... Args>
|
||||||
void renderShadow(const std::vector<GLuint> TextureUnits, const std::vector<STK::Tuple<GLMesh *, core::matrix4, Args...> >&t)
|
void renderShadow(const std::vector<GLuint> TextureUnits, const std::vector<STK::Tuple<GLMesh *, core::matrix4, Args...> > *t)
|
||||||
{
|
{
|
||||||
glUseProgram(T::getInstance()->Program);
|
glUseProgram(T::getInstance()->Program);
|
||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < t.size(); i++)
|
for (unsigned i = 0; i < t->size(); i++)
|
||||||
{
|
{
|
||||||
const GLMesh *mesh = STK::tuple_get<0>(t[i]);
|
const GLMesh *mesh = STK::tuple_get<0>(t->at(i));
|
||||||
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
||||||
{
|
{
|
||||||
compressTexture(mesh->textures[j], true);
|
compressTexture(mesh->textures[j], true);
|
||||||
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto remapped_tuple = remap_tuple<List...>::exec(t[i]);
|
shadow_custom_unroll_args<List...>::template exec<T>(T::getInstance(), t->at(i));
|
||||||
drawShadowTuple<T>(T::getInstance(), mesh, remapped_tuple);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
template<int...List>
|
||||||
void drawRSMTuple(const core::matrix4 &rsm_matrix, const GLMesh *mesh, const STK::Tuple<Args...> &t)
|
struct rsm_custom_unroll_args;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct rsm_custom_unroll_args<>
|
||||||
{
|
{
|
||||||
std::function<void (Args...)> lambda = [&](Args...args) {draw<T>(T::getInstance(), mesh, rsm_matrix, args...); };
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
unroll_args(lambda, t);
|
static void exec(const core::matrix4 &rsm_matrix, const STK::Tuple<TupleTypes...> &t, Args... args)
|
||||||
}
|
{
|
||||||
|
draw<T>(T::getInstance(), STK::tuple_get<0>(t), rsm_matrix, args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int N, int...List>
|
||||||
|
struct rsm_custom_unroll_args<N, List...>
|
||||||
|
{
|
||||||
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
|
static void exec(const core::matrix4 &rsm_matrix, const STK::Tuple<TupleTypes...> &t, Args... args)
|
||||||
|
{
|
||||||
|
rsm_custom_unroll_args<List...>::template exec<T>(rsm_matrix, t, STK::tuple_get<N>(t), args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T, enum E_VERTEX_TYPE VertexType, int... Selector, typename... Args>
|
template<typename T, enum E_VERTEX_TYPE VertexType, int... Selector, typename... Args>
|
||||||
void drawRSM(const core::matrix4 & rsm_matrix, const std::vector<GLuint> TextureUnits, const std::vector<STK::Tuple<GLMesh *, core::matrix4, Args...> >&t)
|
void drawRSM(const core::matrix4 & rsm_matrix, const std::vector<GLuint> TextureUnits, const std::vector<STK::Tuple<GLMesh *, core::matrix4, Args...> > *t)
|
||||||
{
|
{
|
||||||
glUseProgram(T::getInstance()->Program);
|
glUseProgram(T::getInstance()->Program);
|
||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < t.size(); i++)
|
for (unsigned i = 0; i < t->size(); i++)
|
||||||
{
|
{
|
||||||
GLMesh *mesh = STK::tuple_get<0>(t[i]);
|
GLMesh *mesh = STK::tuple_get<0>(t->at(i));
|
||||||
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
||||||
{
|
{
|
||||||
if (!mesh->textures[j])
|
if (!mesh->textures[j])
|
||||||
@ -549,8 +544,7 @@ void drawRSM(const core::matrix4 & rsm_matrix, const std::vector<GLuint> Texture
|
|||||||
compressTexture(mesh->textures[j], true);
|
compressTexture(mesh->textures[j], true);
|
||||||
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
}
|
}
|
||||||
auto remapped_tuple = remap_tuple<Selector...>::template exec(t[i]);
|
rsm_custom_unroll_args<Selector...>::template exec<T>(rsm_matrix, t->at(i));
|
||||||
drawRSMTuple<T>(rsm_matrix, mesh, remapped_tuple);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,25 +562,25 @@ void IrrDriver::renderShadows()
|
|||||||
glDrawBuffer(GL_NONE);
|
glDrawBuffer(GL_NONE);
|
||||||
|
|
||||||
irr_driver->setPhase(SHADOW_PASS);
|
irr_driver->setPhase(SHADOW_PASS);
|
||||||
ListMatDefault::Arguments.clear();
|
ListMatDefault::getInstance()->clear();
|
||||||
ListMatAlphaRef::Arguments.clear();
|
ListMatAlphaRef::getInstance()->clear();
|
||||||
ListMatSphereMap::Arguments.clear();
|
ListMatSphereMap::getInstance()->clear();
|
||||||
ListMatDetails::Arguments.clear();
|
ListMatDetails::getInstance()->clear();
|
||||||
ListMatUnlit::Arguments.clear();
|
ListMatUnlit::getInstance()->clear();
|
||||||
ListMatNormalMap::Arguments.clear();
|
ListMatNormalMap::getInstance()->clear();
|
||||||
ListMatGrass::Arguments.clear();
|
ListMatGrass::getInstance()->clear();
|
||||||
ListMatSplatting::Arguments.clear();
|
ListMatSplatting::getInstance()->clear();
|
||||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||||
|
|
||||||
std::vector<GLuint> noTexUnits;
|
std::vector<GLuint> noTexUnits;
|
||||||
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(noTexUnits, ListMatDefault::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(noTexUnits, ListMatDefault::getInstance());
|
||||||
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(noTexUnits, ListMatSphereMap::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(noTexUnits, ListMatSphereMap::getInstance());
|
||||||
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(noTexUnits, ListMatDetails::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(noTexUnits, ListMatDetails::getInstance());
|
||||||
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(noTexUnits, ListMatSplatting::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(noTexUnits, ListMatSplatting::getInstance());
|
||||||
renderShadow<MeshShader::ShadowShader, EVT_TANGENTS, 1>(noTexUnits, ListMatNormalMap::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_TANGENTS, 1>(noTexUnits, ListMatNormalMap::getInstance());
|
||||||
renderShadow<MeshShader::RefShadowShader, EVT_STANDARD, 1>(std::vector<GLuint>{ MeshShader::RefShadowShader::getInstance()->TU_tex }, ListMatAlphaRef::Arguments);
|
renderShadow<MeshShader::RefShadowShader, EVT_STANDARD, 1>(std::vector<GLuint>{ MeshShader::RefShadowShader::getInstance()->TU_tex }, ListMatAlphaRef::getInstance());
|
||||||
renderShadow<MeshShader::RefShadowShader, EVT_STANDARD, 1>(std::vector<GLuint>{ MeshShader::RefShadowShader::getInstance()->TU_tex }, ListMatUnlit::Arguments);
|
renderShadow<MeshShader::RefShadowShader, EVT_STANDARD, 1>(std::vector<GLuint>{ MeshShader::RefShadowShader::getInstance()->TU_tex }, ListMatUnlit::getInstance());
|
||||||
renderShadow<MeshShader::GrassShadowShader, EVT_STANDARD, 3, 1>(std::vector<GLuint>{ MeshShader::GrassShadowShader::getInstance()->TU_tex }, ListMatGrass::Arguments);
|
renderShadow<MeshShader::GrassShadowShader, EVT_STANDARD, 3, 1>(std::vector<GLuint>{ MeshShader::GrassShadowShader::getInstance()->TU_tex }, ListMatGrass::getInstance());
|
||||||
|
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
@ -596,11 +590,11 @@ void IrrDriver::renderShadows()
|
|||||||
m_rtts->getRSM().Bind();
|
m_rtts->getRSM().Bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
drawRSM<MeshShader::RSMShader, EVT_STANDARD, 3, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatDefault::Arguments);
|
drawRSM<MeshShader::RSMShader, EVT_STANDARD, 3, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatDefault::getInstance());
|
||||||
drawRSM<MeshShader::RSMShader, EVT_STANDARD, 3, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatAlphaRef::Arguments);
|
drawRSM<MeshShader::RSMShader, EVT_STANDARD, 3, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatAlphaRef::getInstance());
|
||||||
// drawRSM<EVT_STANDARD, 2, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatSphereMap::Arguments);
|
// drawRSM<EVT_STANDARD, 2, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatSphereMap::getInstance());
|
||||||
drawRSM<MeshShader::RSMShader, EVT_STANDARD, 3, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatUnlit::Arguments);
|
drawRSM<MeshShader::RSMShader, EVT_STANDARD, 3, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatUnlit::getInstance());
|
||||||
drawRSM<MeshShader::RSMShader, EVT_2TCOORDS, 3, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatDetails::Arguments);
|
drawRSM<MeshShader::RSMShader, EVT_2TCOORDS, 3, 1>(rsm_matrix, std::vector<GLuint>{ MeshShader::RSMShader::getInstance()->TU_tex }, ListMatDetails::getInstance());
|
||||||
drawRSM<MeshShader::SplattingRSMShader, EVT_2TCOORDS, 1>(rsm_matrix,
|
drawRSM<MeshShader::SplattingRSMShader, EVT_2TCOORDS, 1>(rsm_matrix,
|
||||||
std::vector<GLuint>{
|
std::vector<GLuint>{
|
||||||
8,
|
8,
|
||||||
@ -609,5 +603,5 @@ void IrrDriver::renderShadows()
|
|||||||
MeshShader::SplattingRSMShader::getInstance()->TU_detail1,
|
MeshShader::SplattingRSMShader::getInstance()->TU_detail1,
|
||||||
MeshShader::SplattingRSMShader::getInstance()->TU_detail2,
|
MeshShader::SplattingRSMShader::getInstance()->TU_detail2,
|
||||||
MeshShader::SplattingRSMShader::getInstance()->TU_detail3},
|
MeshShader::SplattingRSMShader::getInstance()->TU_detail3},
|
||||||
ListMatSplatting::Arguments);
|
ListMatSplatting::getInstance());
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ void IrrDriver::renderLights(unsigned pointlightcount)
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
m_rtts->getRH().Bind();
|
m_rtts->getRH().Bind();
|
||||||
glUseProgram(FullScreenShader::RadianceHintsConstructionShader::getInstance()->Program);
|
glUseProgram(FullScreenShader::RadianceHintsConstructionShader::getInstance()->Program);
|
||||||
glBindVertexArray(FullScreenShader::RadianceHintsConstructionShader::getInstance()->vao);
|
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||||
setTexture(FullScreenShader::RadianceHintsConstructionShader::getInstance()->TU_ctex, m_rtts->getRSM().getRTT()[0], GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::RadianceHintsConstructionShader::getInstance()->TU_ctex, m_rtts->getRSM().getRTT()[0], GL_LINEAR, GL_LINEAR);
|
||||||
setTexture(FullScreenShader::RadianceHintsConstructionShader::getInstance()->TU_ntex, m_rtts->getRSM().getRTT()[1], GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::RadianceHintsConstructionShader::getInstance()->TU_ntex, m_rtts->getRSM().getRTT()[1], GL_LINEAR, GL_LINEAR);
|
||||||
setTexture(FullScreenShader::RadianceHintsConstructionShader::getInstance()->TU_dtex, m_rtts->getRSM().getDepthTexture(), GL_LINEAR, GL_LINEAR);
|
setTexture(FullScreenShader::RadianceHintsConstructionShader::getInstance()->TU_dtex, m_rtts->getRSM().getDepthTexture(), GL_LINEAR, GL_LINEAR);
|
||||||
|
@ -132,6 +132,8 @@ Shaders::Shaders()
|
|||||||
|
|
||||||
GLuint quad_vbo, tri_vbo;
|
GLuint quad_vbo, tri_vbo;
|
||||||
|
|
||||||
|
GLuint SharedObject::FullScreenQuadVAO = 0;
|
||||||
|
|
||||||
static void initQuadVBO()
|
static void initQuadVBO()
|
||||||
{
|
{
|
||||||
const float quad_vertex[] = {
|
const float quad_vertex[] = {
|
||||||
@ -154,6 +156,13 @@ static void initQuadVBO()
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, tri_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, tri_vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), tri_vertex, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), tri_vertex, GL_STATIC_DRAW);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
glGenVertexArrays(1, &SharedObject::FullScreenQuadVAO);
|
||||||
|
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, tri_vbo);
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), 0);
|
||||||
|
glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// It should be possible to merge it with previous one...
|
// It should be possible to merge it with previous one...
|
||||||
@ -373,27 +382,7 @@ void Shaders::loadShaders()
|
|||||||
initCubeVBO();
|
initCubeVBO();
|
||||||
initFrustrumVBO();
|
initFrustrumVBO();
|
||||||
initShadowVPMUBO();
|
initShadowVPMUBO();
|
||||||
FullScreenShader::BloomBlendShader::init();
|
|
||||||
FullScreenShader::BloomShader::init();
|
|
||||||
FullScreenShader::Gaussian17TapHShader::init();
|
|
||||||
FullScreenShader::ComputeGaussian17TapHShader::init();
|
|
||||||
FullScreenShader::Gaussian3HBlurShader::init();
|
|
||||||
FullScreenShader::Gaussian3VBlurShader::init();
|
|
||||||
FullScreenShader::Gaussian17TapVShader::init();
|
|
||||||
FullScreenShader::ComputeGaussian17TapVShader::init();
|
|
||||||
FullScreenShader::Gaussian6HBlurShader::init();
|
|
||||||
FullScreenShader::Gaussian6VBlurShader::init();
|
|
||||||
FullScreenShader::GlowShader::init();
|
|
||||||
FullScreenShader::PassThroughShader::init();
|
|
||||||
FullScreenShader::LayerPassThroughShader::init();
|
|
||||||
FullScreenShader::DiffuseEnvMapShader::init();
|
FullScreenShader::DiffuseEnvMapShader::init();
|
||||||
FullScreenShader::RHDebug::init();
|
|
||||||
FullScreenShader::MotionBlurShader::init();
|
|
||||||
FullScreenShader::GodFadeShader::init();
|
|
||||||
FullScreenShader::GodRayShader::init();
|
|
||||||
FullScreenShader::MLAAColorEdgeDetectionSHader::init();
|
|
||||||
FullScreenShader::MLAABlendWeightSHader::init();
|
|
||||||
FullScreenShader::MLAAGatherSHader::init();
|
|
||||||
MeshShader::BubbleShader::init();
|
MeshShader::BubbleShader::init();
|
||||||
LightShader::PointLightShader::init();
|
LightShader::PointLightShader::init();
|
||||||
MeshShader::SkyboxShader::init();
|
MeshShader::SkyboxShader::init();
|
||||||
@ -582,6 +571,11 @@ void glUniform1fWrapper(GLuint a, float b)
|
|||||||
glUniform1f(a, b);
|
glUniform1f(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void glUniform1iWrapper(GLuint a, int b)
|
||||||
|
{
|
||||||
|
glUniform1i(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
bool needsUBO()
|
bool needsUBO()
|
||||||
{
|
{
|
||||||
return irr_driver->needUBOWorkaround();
|
return irr_driver->needUBOWorkaround();
|
||||||
@ -1529,19 +1523,6 @@ namespace ParticleShader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint createFullScreenVAO(GLuint Program)
|
|
||||||
{
|
|
||||||
GLuint vao;
|
|
||||||
glGenVertexArrays(1, &vao);
|
|
||||||
glBindVertexArray(vao);
|
|
||||||
GLuint attrib_position = glGetAttribLocation(Program, "Position");
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, tri_vbo);
|
|
||||||
glEnableVertexAttribArray(attrib_position);
|
|
||||||
glVertexAttribPointer(attrib_position, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), 0);
|
|
||||||
glBindVertexArray(0);
|
|
||||||
return vao;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GLuint createVAO(GLuint Program)
|
static GLuint createVAO(GLuint Program)
|
||||||
{
|
{
|
||||||
GLuint vao;
|
GLuint vao;
|
||||||
@ -1560,46 +1541,27 @@ static GLuint createVAO(GLuint Program)
|
|||||||
|
|
||||||
namespace FullScreenShader
|
namespace FullScreenShader
|
||||||
{
|
{
|
||||||
GLuint BloomShader::Program;
|
BloomShader::BloomShader()
|
||||||
GLuint BloomShader::uniform_texture;
|
|
||||||
GLuint BloomShader::vao;
|
|
||||||
void BloomShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bloom.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bloom.frag").c_str());
|
||||||
uniform_texture = glGetUniformLocation(Program, "tex");
|
AssignUniforms();
|
||||||
vao = createFullScreenVAO(Program);
|
TU_tex = 0;
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BloomShader::setUniforms(unsigned TU_tex)
|
BloomBlendShader::BloomBlendShader()
|
||||||
{
|
|
||||||
glUniform1i(FullScreenShader::BloomShader::uniform_texture, TU_tex);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint BloomBlendShader::Program;
|
|
||||||
GLuint BloomBlendShader::uniform_tex_128;
|
|
||||||
GLuint BloomBlendShader::uniform_tex_256;
|
|
||||||
GLuint BloomBlendShader::uniform_tex_512;
|
|
||||||
GLuint BloomBlendShader::vao;
|
|
||||||
|
|
||||||
void BloomBlendShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bloomblend.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bloomblend.frag").c_str());
|
||||||
uniform_tex_128 = glGetUniformLocation(Program, "tex_128");
|
AssignUniforms();
|
||||||
uniform_tex_256 = glGetUniformLocation(Program, "tex_256");
|
TU_tex_128 = 0;
|
||||||
uniform_tex_512 = glGetUniformLocation(Program, "tex_512");
|
TU_tex_256 = 1;
|
||||||
vao = createFullScreenVAO(Program);
|
TU_tex_512 = 2;
|
||||||
}
|
AssignTextureUnit(Program, TexUnit(TU_tex_128, "tex_128"), TexUnit(TU_tex_256, "tex_256"), TexUnit(TU_tex_512, "tex_512"));
|
||||||
|
|
||||||
void BloomBlendShader::setUniforms(unsigned TU_tex_128, unsigned TU_tex_256, unsigned TU_tex_512)
|
|
||||||
{
|
|
||||||
glUniform1i(uniform_tex_128, TU_tex_128);
|
|
||||||
glUniform1i(uniform_tex_256, TU_tex_256);
|
|
||||||
glUniform1i(uniform_tex_512, TU_tex_512);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ToneMapShader::ToneMapShader()
|
ToneMapShader::ToneMapShader()
|
||||||
@ -1612,7 +1574,6 @@ namespace FullScreenShader
|
|||||||
AssignUniforms();
|
AssignUniforms();
|
||||||
TU_tex = 0;
|
TU_tex = 0;
|
||||||
AssignTextureUnit(Program, TexUnit(TU_tex, "text"));
|
AssignTextureUnit(Program, TexUnit(TU_tex, "text"));
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DepthOfFieldShader::DepthOfFieldShader()
|
DepthOfFieldShader::DepthOfFieldShader()
|
||||||
@ -1624,7 +1585,7 @@ namespace FullScreenShader
|
|||||||
TU_depth = 1;
|
TU_depth = 1;
|
||||||
AssignUniforms();
|
AssignUniforms();
|
||||||
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"), TexUnit(TU_depth, "dtex"));
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"), TexUnit(TU_depth, "dtex"));
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
}
|
}
|
||||||
@ -1641,7 +1602,6 @@ namespace FullScreenShader
|
|||||||
TU_dtex = 1;
|
TU_dtex = 1;
|
||||||
AssignTextureUnit(Program, TexUnit(TU_ntex, "ntex"), TexUnit(TU_dtex, "dtex"));
|
AssignTextureUnit(Program, TexUnit(TU_ntex, "ntex"), TexUnit(TU_dtex, "dtex"));
|
||||||
AssignUniforms("direction", "col");
|
AssignUniforms("direction", "col");
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
|
|
||||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
@ -1653,7 +1613,6 @@ namespace FullScreenShader
|
|||||||
GLuint DiffuseEnvMapShader::uniform_greenLmn;
|
GLuint DiffuseEnvMapShader::uniform_greenLmn;
|
||||||
GLuint DiffuseEnvMapShader::uniform_redLmn;
|
GLuint DiffuseEnvMapShader::uniform_redLmn;
|
||||||
GLuint DiffuseEnvMapShader::uniform_TVM;
|
GLuint DiffuseEnvMapShader::uniform_TVM;
|
||||||
GLuint DiffuseEnvMapShader::vao;
|
|
||||||
|
|
||||||
void DiffuseEnvMapShader::init()
|
void DiffuseEnvMapShader::init()
|
||||||
{
|
{
|
||||||
@ -1666,7 +1625,6 @@ namespace FullScreenShader
|
|||||||
uniform_greenLmn = glGetUniformLocation(Program, "greenLmn[0]");
|
uniform_greenLmn = glGetUniformLocation(Program, "greenLmn[0]");
|
||||||
uniform_redLmn = glGetUniformLocation(Program, "redLmn[0]");
|
uniform_redLmn = glGetUniformLocation(Program, "redLmn[0]");
|
||||||
uniform_TVM = glGetUniformLocation(Program, "TransposeViewMatrix");
|
uniform_TVM = glGetUniformLocation(Program, "TransposeViewMatrix");
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiffuseEnvMapShader::setUniforms(const core::matrix4 &TransposeViewMatrix, const float *blueSHCoeff, const float *greenSHCoeff, const float *redSHCoeff, unsigned TU_ntex)
|
void DiffuseEnvMapShader::setUniforms(const core::matrix4 &TransposeViewMatrix, const float *blueSHCoeff, const float *greenSHCoeff, const float *redSHCoeff, unsigned TU_ntex)
|
||||||
@ -1691,7 +1649,6 @@ namespace FullScreenShader
|
|||||||
TU_shadowtex = 2;
|
TU_shadowtex = 2;
|
||||||
AssignTextureUnit(Program, TexUnit(TU_ntex, "ntex"), TexUnit(TU_dtex, "dtex"), TexUnit(TU_shadowtex, "shadowtex"));
|
AssignTextureUnit(Program, TexUnit(TU_ntex, "ntex"), TexUnit(TU_dtex, "dtex"), TexUnit(TU_shadowtex, "shadowtex"));
|
||||||
AssignUniforms("direction", "col");
|
AssignUniforms("direction", "col");
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
|
|
||||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
@ -1720,39 +1677,22 @@ namespace FullScreenShader
|
|||||||
TU_ntex = 1;
|
TU_ntex = 1;
|
||||||
TU_dtex = 2;
|
TU_dtex = 2;
|
||||||
AssignTextureUnit(Program, TexUnit(TU_ctex, "ctex"), TexUnit(TU_ntex, "ntex"), TexUnit(TU_dtex, "dtex"));
|
AssignTextureUnit(Program, TexUnit(TU_ctex, "ctex"), TexUnit(TU_ntex, "ntex"), TexUnit(TU_dtex, "dtex"));
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint RHDebug::Program;
|
RHDebug::RHDebug()
|
||||||
GLuint RHDebug::uniform_extents;
|
|
||||||
GLuint RHDebug::uniform_SHR;
|
|
||||||
GLuint RHDebug::uniform_SHG;
|
|
||||||
GLuint RHDebug::uniform_SHB;
|
|
||||||
GLuint RHDebug::uniform_RHMatrix;
|
|
||||||
|
|
||||||
void RHDebug::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/rhdebug.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/rhdebug.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/rhdebug.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/rhdebug.frag").c_str());
|
||||||
uniform_extents = glGetUniformLocation(Program, "extents");
|
AssignUniforms("RHMatrix", "extents");
|
||||||
uniform_SHR = glGetUniformLocation(Program, "SHR");
|
TU_SHR = 0;
|
||||||
uniform_SHG = glGetUniformLocation(Program, "SHG");
|
TU_SHG = 1;
|
||||||
uniform_SHB = glGetUniformLocation(Program, "SHB");
|
TU_SHB = 2;
|
||||||
uniform_RHMatrix = glGetUniformLocation(Program, "RHMatrix");
|
AssignTextureUnit(Program, TexUnit(TU_SHR, "SHR"), TexUnit(TU_SHG, "SHG"), TexUnit(TU_SHB, "SHB"));
|
||||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RHDebug::setUniforms(const core::matrix4 &RHMatrix, const core::vector3df &extents, unsigned TU_SHR, unsigned TU_SHG, unsigned TU_SHB)
|
|
||||||
{
|
|
||||||
glUniformMatrix4fv(uniform_RHMatrix, 1, GL_FALSE, RHMatrix.pointer());
|
|
||||||
glUniform3f(uniform_extents, extents.X, extents.Y, extents.Z);
|
|
||||||
glUniform1i(uniform_SHR, TU_SHR);
|
|
||||||
glUniform1i(uniform_SHG, TU_SHG);
|
|
||||||
glUniform1i(uniform_SHB, TU_SHB);
|
|
||||||
}
|
|
||||||
|
|
||||||
GlobalIlluminationReconstructionShader::GlobalIlluminationReconstructionShader()
|
GlobalIlluminationReconstructionShader::GlobalIlluminationReconstructionShader()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
@ -1768,156 +1708,120 @@ namespace FullScreenShader
|
|||||||
TU_SHG = 3;
|
TU_SHG = 3;
|
||||||
TU_SHB = 4;
|
TU_SHB = 4;
|
||||||
AssignTextureUnit(Program, TexUnit(TU_ntex, "ntex"), TexUnit(TU_dtex, "dtex"), TexUnit(TU_SHR, "SHR"), TexUnit(TU_SHG, "SHG"), TexUnit(TU_SHB, "SHB"));
|
AssignTextureUnit(Program, TexUnit(TU_ntex, "ntex"), TexUnit(TU_dtex, "dtex"), TexUnit(TU_SHR, "SHR"), TexUnit(TU_SHG, "SHG"), TexUnit(TU_SHB, "SHB"));
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Gaussian17TapHShader::Program;
|
Gaussian17TapHShader::Gaussian17TapHShader()
|
||||||
GLuint Gaussian17TapHShader::uniform_tex;
|
|
||||||
GLuint Gaussian17TapHShader::uniform_depth;
|
|
||||||
GLuint Gaussian17TapHShader::uniform_pixel;
|
|
||||||
GLuint Gaussian17TapHShader::vao;
|
|
||||||
void Gaussian17TapHShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bilateralH.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bilateralH.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
AssignUniforms("pixel");
|
||||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
TU_tex = 0;
|
||||||
uniform_depth = glGetUniformLocation(Program, "depth");
|
TU_depth = 1;
|
||||||
vao = createFullScreenVAO(Program);
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"), TexUnit(TU_depth, "depth"));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint ComputeGaussian17TapHShader::Program;
|
ComputeGaussian17TapHShader::ComputeGaussian17TapHShader()
|
||||||
GLuint ComputeGaussian17TapHShader::uniform_source;
|
|
||||||
GLuint ComputeGaussian17TapHShader::uniform_depth;
|
|
||||||
GLuint ComputeGaussian17TapHShader::uniform_dest;
|
|
||||||
void ComputeGaussian17TapHShader::init()
|
|
||||||
{
|
{
|
||||||
#if WIN32
|
#if WIN32
|
||||||
if (irr_driver->getGLSLVersion() < 420)
|
if (irr_driver->getGLSLVersion() < 420)
|
||||||
return;
|
return;
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/bilateralH.comp").c_str());
|
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/bilateralH.comp").c_str());
|
||||||
uniform_source = glGetUniformLocation(Program, "source");
|
TU_source = 0;
|
||||||
uniform_depth = glGetUniformLocation(Program, "depth");
|
TU_depth = 1;
|
||||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
TU_dest = 2;
|
||||||
|
AssignUniforms();
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_source, "source"), TexUnit(TU_depth, "depth"), TexUnit(TU_dest, "dest"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Gaussian6HBlurShader::Program;
|
Gaussian6HBlurShader::Gaussian6HBlurShader()
|
||||||
GLuint Gaussian6HBlurShader::uniform_tex;
|
|
||||||
GLuint Gaussian6HBlurShader::uniform_pixel;
|
|
||||||
GLuint Gaussian6HBlurShader::vao;
|
|
||||||
void Gaussian6HBlurShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian6h.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian6h.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
AssignUniforms("pixel");
|
||||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
TU_tex = 0;
|
||||||
vao = createFullScreenVAO(Program);
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Gaussian3HBlurShader::Program;
|
Gaussian3HBlurShader::Gaussian3HBlurShader()
|
||||||
GLuint Gaussian3HBlurShader::uniform_tex;
|
|
||||||
GLuint Gaussian3HBlurShader::uniform_pixel;
|
|
||||||
GLuint Gaussian3HBlurShader::vao;
|
|
||||||
void Gaussian3HBlurShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian3h.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian3h.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
AssignUniforms("pixel");
|
||||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
TU_tex = 0;
|
||||||
vao = createFullScreenVAO(Program);
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Gaussian17TapVShader::Program;
|
Gaussian17TapVShader::Gaussian17TapVShader()
|
||||||
GLuint Gaussian17TapVShader::uniform_tex;
|
|
||||||
GLuint Gaussian17TapVShader::uniform_depth;
|
|
||||||
GLuint Gaussian17TapVShader::uniform_pixel;
|
|
||||||
GLuint Gaussian17TapVShader::vao;
|
|
||||||
void Gaussian17TapVShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bilateralV.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bilateralV.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
AssignUniforms("pixel");
|
||||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
TU_tex = 0;
|
||||||
uniform_depth = glGetUniformLocation(Program, "depth");
|
TU_depth = 1;
|
||||||
vao = createFullScreenVAO(Program);
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"), TexUnit(TU_depth, "depth"));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint ComputeGaussian17TapVShader::Program;
|
ComputeGaussian17TapVShader::ComputeGaussian17TapVShader()
|
||||||
GLuint ComputeGaussian17TapVShader::uniform_source;
|
|
||||||
GLuint ComputeGaussian17TapVShader::uniform_depth;
|
|
||||||
GLuint ComputeGaussian17TapVShader::uniform_dest;
|
|
||||||
void ComputeGaussian17TapVShader::init()
|
|
||||||
{
|
{
|
||||||
#if WIN32
|
#if WIN32
|
||||||
if (irr_driver->getGLSLVersion() < 420)
|
if (irr_driver->getGLSLVersion() < 420)
|
||||||
return;
|
return;
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/bilateralV.comp").c_str());
|
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/bilateralV.comp").c_str());
|
||||||
uniform_source = glGetUniformLocation(Program, "source");
|
TU_source = 0;
|
||||||
uniform_depth = glGetUniformLocation(Program, "depth");
|
TU_depth = 1;
|
||||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
TU_dest = 2;
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_source, "source"), TexUnit(TU_depth, "depth"), TexUnit(TU_dest, "dest"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Gaussian6VBlurShader::Program;
|
Gaussian6VBlurShader::Gaussian6VBlurShader()
|
||||||
GLuint Gaussian6VBlurShader::uniform_tex;
|
|
||||||
GLuint Gaussian6VBlurShader::uniform_pixel;
|
|
||||||
GLuint Gaussian6VBlurShader::vao;
|
|
||||||
void Gaussian6VBlurShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian6v.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian6v.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
AssignUniforms("pixel");
|
||||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
TU_tex = 0;
|
||||||
vao = createFullScreenVAO(Program);
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Gaussian3VBlurShader::Program;
|
Gaussian3VBlurShader::Gaussian3VBlurShader()
|
||||||
GLuint Gaussian3VBlurShader::uniform_tex;
|
|
||||||
GLuint Gaussian3VBlurShader::uniform_pixel;
|
|
||||||
GLuint Gaussian3VBlurShader::vao;
|
|
||||||
void Gaussian3VBlurShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian3v.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/gaussian3v.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
AssignUniforms("pixel");
|
||||||
uniform_pixel = glGetUniformLocation(Program, "pixel");
|
TU_tex = 0;
|
||||||
vao = createFullScreenVAO(Program);
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint PassThroughShader::Program;
|
PassThroughShader::PassThroughShader()
|
||||||
GLuint PassThroughShader::uniform_texture;
|
|
||||||
GLuint PassThroughShader::vao;
|
|
||||||
void PassThroughShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/texturedquad.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/texturedquad.frag").c_str());
|
||||||
uniform_texture = glGetUniformLocation(Program, "texture");
|
TU_tex = 0;
|
||||||
|
AssignUniforms();
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_tex, "texture"));
|
||||||
vao = createVAO(Program);
|
vao = createVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint LayerPassThroughShader::Program;
|
LayerPassThroughShader::LayerPassThroughShader()
|
||||||
GLuint LayerPassThroughShader::uniform_texture;
|
|
||||||
GLuint LayerPassThroughShader::uniform_layer;
|
|
||||||
GLuint LayerPassThroughShader::vao;
|
|
||||||
void LayerPassThroughShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/layertexturequad.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/layertexturequad.frag").c_str());
|
||||||
uniform_texture = glGetUniformLocation(Program, "tex");
|
TU_texture = 0;
|
||||||
uniform_layer = glGetUniformLocation(Program, "layer");
|
AssignUniforms("layer");
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_texture, "tex"));
|
||||||
vao = createVAO(Program);
|
vao = createVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1929,18 +1833,16 @@ namespace FullScreenShader
|
|||||||
AssignUniforms("zn", "zf");
|
AssignUniforms("zn", "zf");
|
||||||
TU_tex = 0;
|
TU_tex = 0;
|
||||||
AssignTextureUnit(Program, TexUnit(TU_tex, "texture"));
|
AssignTextureUnit(Program, TexUnit(TU_tex, "texture"));
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint GlowShader::Program;
|
GlowShader::GlowShader()
|
||||||
GLuint GlowShader::uniform_tex;
|
|
||||||
GLuint GlowShader::vao;
|
|
||||||
void GlowShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/glow.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/glow.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
AssignUniforms();
|
||||||
|
TU_tex = 0;
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
vao = createVAO(Program);
|
vao = createVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1954,7 +1856,6 @@ namespace FullScreenShader
|
|||||||
TU_dtex = 0;
|
TU_dtex = 0;
|
||||||
AssignTextureUnit(Program, TexUnit(TU_dtex, "dtex"));
|
AssignTextureUnit(Program, TexUnit(TU_dtex, "dtex"));
|
||||||
AssignUniforms("radius", "k", "sigma");
|
AssignUniforms("radius", "k", "sigma");
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
|
|
||||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
@ -1969,156 +1870,79 @@ namespace FullScreenShader
|
|||||||
TU_tex = 0;
|
TU_tex = 0;
|
||||||
AssignUniforms("fogmax", "startH", "endH", "start", "end", "col");
|
AssignUniforms("fogmax", "startH", "endH", "start", "end", "col");
|
||||||
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
|
|
||||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint MotionBlurShader::Program;
|
MotionBlurShader::MotionBlurShader()
|
||||||
GLuint MotionBlurShader::uniform_boost_amount;
|
|
||||||
GLuint MotionBlurShader::uniform_center;
|
|
||||||
GLuint MotionBlurShader::uniform_color_buffer;
|
|
||||||
GLuint MotionBlurShader::uniform_dtex;
|
|
||||||
GLuint MotionBlurShader::uniform_previous_viewproj;
|
|
||||||
GLuint MotionBlurShader::uniform_mask_radius;
|
|
||||||
GLuint MotionBlurShader::vao;
|
|
||||||
|
|
||||||
void MotionBlurShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/motion_blur.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/motion_blur.frag").c_str());
|
||||||
uniform_boost_amount = glGetUniformLocation(Program, "boost_amount");
|
AssignUniforms("previous_viewproj", "center", "boost_amount", "mask_radius");
|
||||||
uniform_center = glGetUniformLocation(Program, "center");
|
TU_cb = 0;
|
||||||
uniform_color_buffer = glGetUniformLocation(Program, "color_buffer");
|
TU_dtex = 1;
|
||||||
uniform_mask_radius = glGetUniformLocation(Program, "mask_radius");
|
AssignTextureUnit(Program, TexUnit(TU_dtex, "dtex"), TexUnit(TU_cb, "color_buffer"));
|
||||||
uniform_dtex = glGetUniformLocation(Program, "dtex");
|
|
||||||
uniform_previous_viewproj = glGetUniformLocation(Program, "previous_viewproj");
|
|
||||||
vao = createFullScreenVAO(Program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionBlurShader::setUniforms(float boost_amount, const core::matrix4 &previousVP, const core::vector2df ¢er, float mask_radius, unsigned TU_cb, unsigned TU_dtex)
|
GodFadeShader::GodFadeShader()
|
||||||
{
|
|
||||||
glUniformMatrix4fv(uniform_previous_viewproj, 1, GL_FALSE, previousVP.pointer());
|
|
||||||
glUniform1f(uniform_boost_amount, boost_amount);
|
|
||||||
glUniform2f(uniform_center, center.X, center.Y);
|
|
||||||
glUniform1f(uniform_mask_radius, mask_radius);
|
|
||||||
glUniform1i(uniform_color_buffer, TU_cb);
|
|
||||||
glUniform1i(uniform_dtex, TU_dtex);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint GodFadeShader::Program;
|
|
||||||
GLuint GodFadeShader::uniform_tex;
|
|
||||||
GLuint GodFadeShader::uniform_col;
|
|
||||||
GLuint GodFadeShader::vao;
|
|
||||||
|
|
||||||
void GodFadeShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/godfade.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/godfade.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
AssignUniforms("col");
|
||||||
uniform_col = glGetUniformLocation(Program, "col");
|
TU_tex = 0;
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
vao = createVAO(Program);
|
vao = createVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GodFadeShader::setUniforms(const SColor &col, unsigned TU_tex)
|
GodRayShader::GodRayShader()
|
||||||
{
|
|
||||||
glUniform3f(uniform_col, col.getRed() / 255.f, col.getGreen() / 255.f, col.getBlue() / 255.f);
|
|
||||||
glUniform1i(uniform_tex, TU_tex);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint GodRayShader::Program;
|
|
||||||
GLuint GodRayShader::uniform_tex;
|
|
||||||
GLuint GodRayShader::uniform_sunpos;
|
|
||||||
GLuint GodRayShader::vao;
|
|
||||||
|
|
||||||
void GodRayShader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/godray.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/godray.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
TU_tex = 0;
|
||||||
uniform_sunpos = glGetUniformLocation(Program, "sunpos");
|
AssignUniforms("sunpos");
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||||
vao = createVAO(Program);
|
vao = createVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GodRayShader::setUniforms(const core::vector2df &sunpos, unsigned TU_tex)
|
MLAAColorEdgeDetectionSHader::MLAAColorEdgeDetectionSHader()
|
||||||
{
|
|
||||||
glUniform2f(uniform_sunpos, sunpos.X, sunpos.Y);
|
|
||||||
glUniform1i(uniform_tex, TU_tex);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint MLAAColorEdgeDetectionSHader::Program;
|
|
||||||
GLuint MLAAColorEdgeDetectionSHader::uniform_colorMapG;
|
|
||||||
GLuint MLAAColorEdgeDetectionSHader::uniform_PIXEL_SIZE;
|
|
||||||
GLuint MLAAColorEdgeDetectionSHader::vao;
|
|
||||||
|
|
||||||
void MLAAColorEdgeDetectionSHader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/mlaa_offset.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/mlaa_offset.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/mlaa_color1.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/mlaa_color1.frag").c_str());
|
||||||
uniform_colorMapG = glGetUniformLocation(Program, "colorMapG");
|
AssignUniforms("PIXEL_SIZE");
|
||||||
uniform_PIXEL_SIZE = glGetUniformLocation(Program, "PIXEL_SIZE");
|
TU_colorMapG = 0;
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_colorMapG, "colorMapG"));
|
||||||
vao = createVAO(Program);
|
vao = createVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MLAAColorEdgeDetectionSHader::setUniforms(const core::vector2df &PIXEL_SIZE, unsigned TU_colorMapG)
|
MLAABlendWeightSHader::MLAABlendWeightSHader()
|
||||||
{
|
|
||||||
glUniform1i(uniform_colorMapG, TU_colorMapG);
|
|
||||||
glUniform2f(uniform_PIXEL_SIZE, PIXEL_SIZE.X, PIXEL_SIZE.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint MLAABlendWeightSHader::Program;
|
|
||||||
GLuint MLAABlendWeightSHader::uniform_edgesMap;
|
|
||||||
GLuint MLAABlendWeightSHader::uniform_areaMap;
|
|
||||||
GLuint MLAABlendWeightSHader::uniform_PIXEL_SIZE;
|
|
||||||
GLuint MLAABlendWeightSHader::vao;
|
|
||||||
|
|
||||||
void MLAABlendWeightSHader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/mlaa_blend2.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/mlaa_blend2.frag").c_str());
|
||||||
uniform_edgesMap = glGetUniformLocation(Program, "edgesMap");
|
AssignUniforms("PIXEL_SIZE");
|
||||||
uniform_areaMap = glGetUniformLocation(Program, "areaMap");
|
TU_edgesMap = 0;
|
||||||
uniform_PIXEL_SIZE = glGetUniformLocation(Program, "PIXEL_SIZE");
|
TU_areaMap = 1;
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_edgesMap, "edgesMap"), TexUnit(TU_areaMap, "areaMap"));
|
||||||
vao = createVAO(Program);
|
vao = createVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MLAABlendWeightSHader::setUniforms(const core::vector2df &PIXEL_SIZE, unsigned TU_edgesMap, unsigned TU_areaMap)
|
MLAAGatherSHader::MLAAGatherSHader()
|
||||||
{
|
|
||||||
glUniform1i(uniform_edgesMap, TU_edgesMap);
|
|
||||||
glUniform1i(uniform_areaMap, TU_areaMap);
|
|
||||||
glUniform2f(uniform_PIXEL_SIZE, PIXEL_SIZE.X, PIXEL_SIZE.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint MLAAGatherSHader::Program;
|
|
||||||
GLuint MLAAGatherSHader::uniform_colorMap;
|
|
||||||
GLuint MLAAGatherSHader::uniform_blendMap;
|
|
||||||
GLuint MLAAGatherSHader::uniform_PIXEL_SIZE;
|
|
||||||
GLuint MLAAGatherSHader::vao;
|
|
||||||
|
|
||||||
void MLAAGatherSHader::init()
|
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/mlaa_offset.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/mlaa_offset.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/mlaa_neigh3.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/mlaa_neigh3.frag").c_str());
|
||||||
uniform_colorMap = glGetUniformLocation(Program, "colorMap");
|
AssignUniforms("PIXEL_SIZE");
|
||||||
uniform_blendMap = glGetUniformLocation(Program, "blendMap");
|
TU_blendMap = 0;
|
||||||
uniform_PIXEL_SIZE = glGetUniformLocation(Program, "PIXEL_SIZE");
|
TU_colorMap = 1;
|
||||||
|
AssignTextureUnit(Program, TexUnit(TU_blendMap, "blendMap"), TexUnit(TU_colorMap, "colorMap"));
|
||||||
vao = createVAO(Program);
|
vao = createVAO(Program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MLAAGatherSHader::setUniforms(const core::vector2df &PIXEL_SIZE, unsigned TU_colormap, unsigned TU_blendmap)
|
|
||||||
{
|
|
||||||
glUniform1i(uniform_colorMap, TU_colormap);
|
|
||||||
glUniform1i(uniform_blendMap, TU_blendmap);
|
|
||||||
glUniform2f(uniform_PIXEL_SIZE, PIXEL_SIZE.X, PIXEL_SIZE.Y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace UIShader
|
namespace UIShader
|
||||||
|
@ -33,6 +33,7 @@ public:
|
|||||||
static GLuint billboardvbo;
|
static GLuint billboardvbo;
|
||||||
static GLuint cubevbo, cubeindexes, frustrumvbo, frustrumindexes;
|
static GLuint cubevbo, cubeindexes, frustrumvbo, frustrumindexes;
|
||||||
static GLuint ViewProjectionMatrixesUBO;
|
static GLuint ViewProjectionMatrixesUBO;
|
||||||
|
static GLuint FullScreenQuadVAO;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace UtilShader
|
namespace UtilShader
|
||||||
@ -54,6 +55,7 @@ void glUniform3fWraper(GLuint, float, float, float);
|
|||||||
void glUniform4iWraper(GLuint, int, int, int, int);
|
void glUniform4iWraper(GLuint, int, int, int, int);
|
||||||
void glUniform2fWraper(GLuint a, float b, float c);
|
void glUniform2fWraper(GLuint a, float b, float c);
|
||||||
void glUniform1fWrapper(GLuint, float);
|
void glUniform1fWrapper(GLuint, float);
|
||||||
|
void glUniform1iWrapper(GLuint, int);
|
||||||
bool needsUBO();
|
bool needsUBO();
|
||||||
|
|
||||||
struct UniformHelper
|
struct UniformHelper
|
||||||
@ -116,6 +118,13 @@ struct UniformHelper
|
|||||||
setUniformsHelper<N + 1>(uniforms, arg...);
|
setUniformsHelper<N + 1>(uniforms, arg...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<unsigned N = 0, typename... Args>
|
||||||
|
static void setUniformsHelper(const std::vector<GLuint> &uniforms, int f, Args... arg)
|
||||||
|
{
|
||||||
|
glUniform1iWrapper(uniforms[N], f);
|
||||||
|
setUniformsHelper<N + 1>(uniforms, arg...);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void bypassUBO(GLuint Program);
|
void bypassUBO(GLuint Program);
|
||||||
@ -146,7 +155,6 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
friend class Singleton<class ObjectPass1Shader>;
|
|
||||||
GLuint Program;
|
GLuint Program;
|
||||||
|
|
||||||
void setUniforms(const Args & ... args) const
|
void setUniforms(const Args & ... args) const
|
||||||
@ -520,33 +528,26 @@ public:
|
|||||||
namespace FullScreenShader
|
namespace FullScreenShader
|
||||||
{
|
{
|
||||||
|
|
||||||
class BloomShader
|
class BloomShader : public ShaderHelperSingleton<BloomShader>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_texture;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
BloomShader();
|
||||||
static void setUniforms(unsigned TU_tex);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BloomBlendShader
|
class BloomBlendShader : public ShaderHelperSingleton<BloomBlendShader>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex_128, TU_tex_256, TU_tex_512;
|
||||||
static GLuint uniform_tex_128, uniform_tex_256, uniform_tex_512;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
BloomBlendShader();
|
||||||
static void setUniforms(unsigned TU_tex_128, unsigned TU_tex_256, unsigned TU_tex_512);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ToneMapShader : public ShaderHelperSingleton<ToneMapShader>
|
class ToneMapShader : public ShaderHelperSingleton<ToneMapShader>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex;
|
GLuint TU_tex;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
ToneMapShader();
|
ToneMapShader();
|
||||||
};
|
};
|
||||||
@ -555,7 +556,6 @@ class DepthOfFieldShader : public ShaderHelperSingleton<DepthOfFieldShader>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex, TU_depth;
|
GLuint TU_tex, TU_depth;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
DepthOfFieldShader();
|
DepthOfFieldShader();
|
||||||
};
|
};
|
||||||
@ -564,7 +564,6 @@ class SunLightShader : public ShaderHelperSingleton<SunLightShader, core::vector
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_ntex, TU_dtex;
|
GLuint TU_ntex, TU_dtex;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
SunLightShader();
|
SunLightShader();
|
||||||
};
|
};
|
||||||
@ -574,7 +573,6 @@ class DiffuseEnvMapShader
|
|||||||
public:
|
public:
|
||||||
static GLuint Program;
|
static GLuint Program;
|
||||||
static GLuint uniform_ntex, uniform_TVM, uniform_blueLmn, uniform_greenLmn, uniform_redLmn;
|
static GLuint uniform_ntex, uniform_TVM, uniform_blueLmn, uniform_greenLmn, uniform_redLmn;
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
static void setUniforms(const core::matrix4 &TransposeViewMatrix, const float *blueSHCoeff, const float *greenSHCoeff, const float *redSHCoeff, unsigned TU_ntex);
|
static void setUniforms(const core::matrix4 &TransposeViewMatrix, const float *blueSHCoeff, const float *greenSHCoeff, const float *redSHCoeff, unsigned TU_ntex);
|
||||||
@ -584,7 +582,6 @@ class ShadowedSunLightShader : public ShaderHelperSingleton<ShadowedSunLightShad
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_ntex, TU_dtex, TU_shadowtex;
|
GLuint TU_ntex, TU_dtex, TU_shadowtex;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
ShadowedSunLightShader();
|
ShadowedSunLightShader();
|
||||||
};
|
};
|
||||||
@ -593,153 +590,129 @@ class RadianceHintsConstructionShader : public ShaderHelperSingleton<RadianceHin
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_ctex, TU_ntex, TU_dtex;
|
GLuint TU_ctex, TU_ntex, TU_dtex;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
RadianceHintsConstructionShader();
|
RadianceHintsConstructionShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class RHDebug
|
class RHDebug : public ShaderHelperSingleton<RHDebug, core::matrix4, core::vector3df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_SHR, TU_SHG, TU_SHB;
|
||||||
static GLuint uniform_extents, uniform_SHR, uniform_SHG, uniform_SHB, uniform_RHMatrix;
|
|
||||||
|
|
||||||
static void init();
|
RHDebug();
|
||||||
static void setUniforms(const core::matrix4 &RHMatrix, const core::vector3df &extents, unsigned TU_SHR, unsigned TU_SHG, unsigned TU_SHB);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GlobalIlluminationReconstructionShader : public ShaderHelperSingleton<GlobalIlluminationReconstructionShader, core::matrix4, core::matrix4, core::vector3df>
|
class GlobalIlluminationReconstructionShader : public ShaderHelperSingleton<GlobalIlluminationReconstructionShader, core::matrix4, core::matrix4, core::vector3df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_ntex, TU_dtex, TU_SHR, TU_SHG, TU_SHB, uniform_RHMatrix;
|
GLuint TU_ntex, TU_dtex, TU_SHR, TU_SHG, TU_SHB, uniform_RHMatrix;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
GlobalIlluminationReconstructionShader();
|
GlobalIlluminationReconstructionShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Gaussian17TapHShader
|
class Gaussian17TapHShader : public ShaderHelperSingleton<Gaussian17TapHShader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex, TU_depth;
|
||||||
static GLuint uniform_tex, uniform_depth, uniform_pixel;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
Gaussian17TapHShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ComputeGaussian17TapHShader
|
class ComputeGaussian17TapHShader : public ShaderHelperSingleton<ComputeGaussian17TapHShader>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_source, TU_dest, TU_depth;
|
||||||
static GLuint uniform_source, uniform_depth, uniform_dest;
|
ComputeGaussian17TapHShader();
|
||||||
|
|
||||||
static void init();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Gaussian6HBlurShader
|
class Gaussian6HBlurShader : public ShaderHelperSingleton<Gaussian6HBlurShader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_tex, uniform_pixel;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
Gaussian6HBlurShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Gaussian3HBlurShader
|
class Gaussian3HBlurShader : public ShaderHelperSingleton<Gaussian3HBlurShader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_tex, uniform_pixel;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
Gaussian3HBlurShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Gaussian17TapVShader
|
class Gaussian17TapVShader : public ShaderHelperSingleton<Gaussian17TapVShader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex, TU_depth;
|
||||||
static GLuint uniform_tex, uniform_depth, uniform_pixel;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
Gaussian17TapVShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ComputeGaussian17TapVShader
|
class ComputeGaussian17TapVShader : public ShaderHelperSingleton<ComputeGaussian17TapVShader>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_source, TU_depth, TU_dest;
|
||||||
static GLuint uniform_source, uniform_depth, uniform_dest;
|
|
||||||
|
|
||||||
static void init();
|
ComputeGaussian17TapVShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Gaussian6VBlurShader
|
class Gaussian6VBlurShader : public ShaderHelperSingleton<Gaussian6VBlurShader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_tex, uniform_pixel;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
Gaussian6VBlurShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Gaussian3VBlurShader
|
class Gaussian3VBlurShader : public ShaderHelperSingleton<Gaussian3VBlurShader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_tex, uniform_pixel;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
Gaussian3VBlurShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class PassThroughShader
|
class PassThroughShader : public ShaderHelperSingleton<PassThroughShader>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_texture;
|
GLuint vao;
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
PassThroughShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class LayerPassThroughShader
|
class LayerPassThroughShader : public ShaderHelperSingleton<LayerPassThroughShader, int>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_texture;
|
||||||
static GLuint uniform_layer, uniform_texture;
|
GLuint vao;
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
LayerPassThroughShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class LinearizeDepthShader : public ShaderHelperSingleton<LinearizeDepthShader, float, float>
|
class LinearizeDepthShader : public ShaderHelperSingleton<LinearizeDepthShader, float, float>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex;
|
GLuint TU_tex;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
LinearizeDepthShader();
|
LinearizeDepthShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class GlowShader
|
class GlowShader : public ShaderHelperSingleton<GlowShader>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_tex;
|
GLuint vao;
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
GlowShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SSAOShader : public ShaderHelperSingleton<SSAOShader, float, float, float>
|
class SSAOShader : public ShaderHelperSingleton<SSAOShader, float, float, float>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_dtex;
|
GLuint TU_dtex;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
SSAOShader();
|
SSAOShader();
|
||||||
};
|
};
|
||||||
@ -748,77 +721,61 @@ class FogShader : public ShaderHelperSingleton<FogShader, float, float, float, f
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex;
|
GLuint TU_tex;
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
FogShader();
|
FogShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class MotionBlurShader
|
class MotionBlurShader : public ShaderHelperSingleton<MotionBlurShader, core::matrix4, core::vector2df, float, float>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_cb, TU_dtex;
|
||||||
static GLuint uniform_boost_amount, uniform_color_buffer, uniform_dtex, uniform_previous_viewproj, uniform_center, uniform_mask_radius;
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
MotionBlurShader();
|
||||||
static void setUniforms(float boost_amount, const core::matrix4 &previousVP, const core::vector2df ¢er, float mask_radius, unsigned TU_cb, unsigned TU_dtex);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GodFadeShader
|
class GodFadeShader : public ShaderHelperSingleton<GodFadeShader, video::SColorf>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_tex, uniform_col;
|
GLuint vao;
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
GodFadeShader();
|
||||||
static void setUniforms(const video::SColor &col, unsigned TU_tex);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GodRayShader
|
class GodRayShader : public ShaderHelperSingleton<GodRayShader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_tex;
|
||||||
static GLuint uniform_tex, uniform_sunpos;
|
GLuint vao;
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
GodRayShader();
|
||||||
static void setUniforms(const core::vector2df &sunpos, unsigned TU_tex);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MLAAColorEdgeDetectionSHader
|
class MLAAColorEdgeDetectionSHader : public ShaderHelperSingleton<MLAAColorEdgeDetectionSHader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_colorMapG;
|
||||||
static GLuint uniform_colorMapG, uniform_PIXEL_SIZE;
|
GLuint vao;
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
MLAAColorEdgeDetectionSHader();
|
||||||
static void setUniforms(const core::vector2df &PIXEL_SIZE, unsigned TU_colorMapG);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MLAABlendWeightSHader
|
class MLAABlendWeightSHader : public ShaderHelperSingleton<MLAABlendWeightSHader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_edgesMap, TU_areaMap;
|
||||||
static GLuint uniform_PIXEL_SIZE, uniform_edgesMap, uniform_areaMap;
|
GLuint vao;
|
||||||
|
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
|
||||||
static void setUniforms(const core::vector2df &PIXEL_SIZE, unsigned TU_edgesMap, unsigned TU_areaMap);
|
|
||||||
|
|
||||||
|
MLAABlendWeightSHader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class MLAAGatherSHader
|
class MLAAGatherSHader : public ShaderHelperSingleton<MLAAGatherSHader, core::vector2df>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
GLuint TU_colorMap, TU_blendMap;
|
||||||
static GLuint uniform_PIXEL_SIZE, uniform_colorMap, uniform_blendMap;
|
GLuint vao;
|
||||||
static GLuint vao;
|
|
||||||
|
|
||||||
static void init();
|
MLAAGatherSHader();
|
||||||
static void setUniforms(const core::vector2df &PIXEL_SIZE, unsigned TU_colormap, unsigned TU_blendmap);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -142,16 +142,16 @@ void STKAnimatedMesh::render()
|
|||||||
|
|
||||||
GLMesh* mesh;
|
GLMesh* mesh;
|
||||||
for_in(mesh, MeshSolidMaterial[MAT_DEFAULT])
|
for_in(mesh, MeshSolidMaterial[MAT_DEFAULT])
|
||||||
pushVector(ListMatDefault::Arguments, mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
pushVector(ListMatDefault::getInstance(), mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterial[MAT_ALPHA_REF])
|
for_in(mesh, MeshSolidMaterial[MAT_ALPHA_REF])
|
||||||
pushVector(ListMatAlphaRef::Arguments, mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
pushVector(ListMatAlphaRef::getInstance(), mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterial[MAT_DETAIL])
|
for_in(mesh, MeshSolidMaterial[MAT_DETAIL])
|
||||||
pushVector(ListMatDetails::Arguments, mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
pushVector(ListMatDetails::getInstance(), mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterial[MAT_UNLIT])
|
for_in(mesh, MeshSolidMaterial[MAT_UNLIT])
|
||||||
pushVector(ListMatUnlit::Arguments, mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY, mesh->TextureMatrix);
|
pushVector(ListMatUnlit::getInstance(), mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY, mesh->TextureMatrix);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -181,21 +181,21 @@ void STKAnimatedMesh::render()
|
|||||||
tmpcol.getBlue() / 255.0f);
|
tmpcol.getBlue() / 255.0f);
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
ListBlendTransparentFog::Arguments.push_back(
|
ListBlendTransparentFog::getInstance()->push_back(
|
||||||
STK::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
STK::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
||||||
fogmax, startH, endH, start, end, col));
|
fogmax, startH, endH, start, end, col));
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
ListAdditiveTransparentFog::Arguments.push_back(
|
ListAdditiveTransparentFog::getInstance()->push_back(
|
||||||
STK::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
STK::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
||||||
fogmax, startH, endH, start, end, col));
|
fogmax, startH, endH, start, end, col));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
pushVector(ListBlendTransparent::Arguments, mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
pushVector(ListBlendTransparent::getInstance(), mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
pushVector(ListAdditiveTransparent::Arguments, mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
pushVector(ListAdditiveTransparent::getInstance(), mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -291,19 +291,4 @@ bool isObject(video::E_MATERIAL_TYPE type)
|
|||||||
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatDefault::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatAlphaRef::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatSphereMap::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatDetails::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::vector3df> > ListMatGrass::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatUnlit::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > ListMatSplatting::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatNormalMap::Arguments;
|
|
||||||
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > ListBlendTransparent::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > ListAdditiveTransparent::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf> > ListBlendTransparentFog::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf> > ListAdditiveTransparentFog::Arguments;
|
|
||||||
std::vector<STK::Tuple<GLMesh *, core::matrix4> > ListDisplacement::Arguments;
|
|
@ -58,85 +58,49 @@ bool isObject(video::E_MATERIAL_TYPE type);
|
|||||||
|
|
||||||
core::vector3df getWind();
|
core::vector3df getWind();
|
||||||
|
|
||||||
// Pass 1 shader (ie shaders that outputs normals and depth)
|
template<typename T, typename... Args>
|
||||||
class ListMatDefault
|
class MeshList : public Singleton<T>, public std::vector<STK::Tuple<Args...> >
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListMatAlphaRef
|
class ListMatDefault : public MeshList<ListMatDefault, GLMesh *, core::matrix4, core::matrix4, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListMatNormalMap
|
class ListMatAlphaRef : public MeshList<ListMatAlphaRef, GLMesh *, core::matrix4, core::matrix4, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListMatGrass
|
class ListMatNormalMap : public MeshList<ListMatNormalMap, GLMesh *, core::matrix4, core::matrix4, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::vector3df> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListMatSphereMap
|
class ListMatGrass : public MeshList<ListMatGrass, GLMesh *, core::matrix4, core::matrix4, core::vector3df>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListMatSplatting
|
class ListMatSphereMap : public MeshList<ListMatSphereMap, GLMesh *, core::matrix4, core::matrix4, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListMatUnlit
|
class ListMatSplatting : public MeshList<ListMatSplatting, GLMesh *, core::matrix4, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListMatDetails
|
class ListMatUnlit : public MeshList<ListMatUnlit, GLMesh *, core::matrix4, core::matrix4, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > Arguments;
|
class ListMatDetails : public MeshList<ListMatDetails, GLMesh *, core::matrix4, core::matrix4, core::matrix4>
|
||||||
};
|
{};
|
||||||
|
|
||||||
|
|
||||||
class ListBlendTransparent
|
class ListBlendTransparent : public MeshList<ListBlendTransparent, GLMesh *, core::matrix4, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListAdditiveTransparent
|
class ListAdditiveTransparent : public MeshList<ListAdditiveTransparent, GLMesh *, core::matrix4, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListBlendTransparentFog
|
class ListBlendTransparentFog : public MeshList<ListBlendTransparentFog, GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListAdditiveTransparentFog
|
class ListAdditiveTransparentFog : public MeshList<ListAdditiveTransparentFog, GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListDisplacement
|
class ListDisplacement : public MeshList<ListDisplacement, GLMesh *, core::matrix4>
|
||||||
{
|
{};
|
||||||
public:
|
|
||||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Forward pass (for transparents meshes)
|
// Forward pass (for transparents meshes)
|
||||||
void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
|
void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
|
||||||
|
@ -249,29 +249,29 @@ void STKMeshSceneNode::render()
|
|||||||
|
|
||||||
GLMesh* mesh;
|
GLMesh* mesh;
|
||||||
for_in(mesh, MeshSolidMaterials[MAT_DEFAULT])
|
for_in(mesh, MeshSolidMaterials[MAT_DEFAULT])
|
||||||
pushVector(ListMatDefault::Arguments, mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
pushVector(ListMatDefault::getInstance(), mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterials[MAT_ALPHA_REF])
|
for_in(mesh, MeshSolidMaterials[MAT_ALPHA_REF])
|
||||||
pushVector(ListMatAlphaRef::Arguments, mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
pushVector(ListMatAlphaRef::getInstance(), mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterials[MAT_SPHEREMAP])
|
for_in(mesh, MeshSolidMaterials[MAT_SPHEREMAP])
|
||||||
pushVector(ListMatSphereMap::Arguments, mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
pushVector(ListMatSphereMap::getInstance(), mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterials[MAT_DETAIL])
|
for_in(mesh, MeshSolidMaterials[MAT_DETAIL])
|
||||||
pushVector(ListMatDetails::Arguments, mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
pushVector(ListMatDetails::getInstance(), mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
||||||
|
|
||||||
windDir = getWind();
|
windDir = getWind();
|
||||||
for_in(mesh, MeshSolidMaterials[MAT_GRASS])
|
for_in(mesh, MeshSolidMaterials[MAT_GRASS])
|
||||||
pushVector(ListMatGrass::Arguments, mesh, AbsoluteTransformation, invmodel, windDir);
|
pushVector(ListMatGrass::getInstance(), mesh, AbsoluteTransformation, invmodel, windDir);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterials[MAT_UNLIT])
|
for_in(mesh, MeshSolidMaterials[MAT_UNLIT])
|
||||||
pushVector(ListMatUnlit::Arguments, mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY, mesh->TextureMatrix);
|
pushVector(ListMatUnlit::getInstance(), mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterials[MAT_SPLATTING])
|
for_in(mesh, MeshSolidMaterials[MAT_SPLATTING])
|
||||||
pushVector(ListMatSplatting::Arguments, mesh, AbsoluteTransformation, invmodel);
|
pushVector(ListMatSplatting::getInstance(), mesh, AbsoluteTransformation, invmodel);
|
||||||
|
|
||||||
for_in(mesh, MeshSolidMaterials[MAT_NORMAL_MAP])
|
for_in(mesh, MeshSolidMaterials[MAT_NORMAL_MAP])
|
||||||
pushVector( ListMatNormalMap::Arguments, mesh, AbsoluteTransformation, invmodel, core::matrix4::EM4CONST_IDENTITY);
|
pushVector(ListMatNormalMap::getInstance(), mesh, AbsoluteTransformation, invmodel, core::matrix4::EM4CONST_IDENTITY);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -411,23 +411,23 @@ void STKMeshSceneNode::render()
|
|||||||
tmpcol.getBlue() / 255.0f);
|
tmpcol.getBlue() / 255.0f);
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
pushVector(ListBlendTransparentFog::Arguments, mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
pushVector(ListBlendTransparentFog::getInstance(), mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
||||||
fogmax, startH, endH, start, end, col);
|
fogmax, startH, endH, start, end, col);
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
pushVector(ListAdditiveTransparentFog::Arguments, mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
pushVector(ListAdditiveTransparentFog::getInstance(), mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
||||||
fogmax, startH, endH, start, end, col);
|
fogmax, startH, endH, start, end, col);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
pushVector(ListBlendTransparent::Arguments, mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
pushVector(ListBlendTransparent::getInstance(), mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
pushVector(ListAdditiveTransparent::Arguments, mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
pushVector(ListAdditiveTransparent::getInstance(), mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_DISPLACEMENT])
|
for_in(mesh, TransparentMesh[TM_DISPLACEMENT])
|
||||||
pushVector(ListDisplacement::Arguments, mesh, AbsoluteTransformation);
|
pushVector(ListDisplacement::getInstance(), mesh, AbsoluteTransformation);
|
||||||
|
|
||||||
if (!TransparentMesh[TM_BUBBLE].empty())
|
if (!TransparentMesh[TM_BUBBLE].empty())
|
||||||
glUseProgram(MeshShader::BubbleShader::Program);
|
glUseProgram(MeshShader::BubbleShader::Program);
|
||||||
|
@ -83,7 +83,7 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
|
|||||||
shadows->addLabel( _("Disabled") ); // 0
|
shadows->addLabel( _("Disabled") ); // 0
|
||||||
shadows->addLabel( _("low") ); // 1
|
shadows->addLabel( _("low") ); // 1
|
||||||
shadows->addLabel( _("high") ); // 2
|
shadows->addLabel( _("high") ); // 2
|
||||||
if (irr_driver->needUBOWorkaround())
|
if (!irr_driver->needUBOWorkaround())
|
||||||
shadows->setValue(UserConfigParams::m_shadows);
|
shadows->setValue(UserConfigParams::m_shadows);
|
||||||
else
|
else
|
||||||
shadows->setValue(0);
|
shadows->setValue(0);
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
template<typename T, typename... Args>
|
||||||
void pushVector(std::vector<T> &vec, Args ...args)
|
void pushVector(std::vector<T> *vec, Args ...args)
|
||||||
{
|
{
|
||||||
#ifdef STDCPP2003
|
#ifdef STDCPP2003
|
||||||
vec.push_back(T(args...));
|
vec->push_back(T(args...));
|
||||||
#else
|
#else
|
||||||
vec.emplace_back(args...);
|
vec->emplace_back(args...);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user