Clean up rtts and framebuffers
Use rgba framebuffer for tonemap and later, don't create unnecessary rtts.
This commit is contained in:
parent
f6f051e85b
commit
ccc83a28f2
@ -431,6 +431,7 @@ public:
|
||||
void render(const FrameBuffer &fbo, GLuint rtt, float vignette_weight)
|
||||
{
|
||||
fbo.bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
setTextureUnits(rtt);
|
||||
drawFullScreenEffect(vignette_weight);
|
||||
} // render
|
||||
@ -1088,7 +1089,7 @@ void PostProcessing::renderSSAO(const FrameBuffer& linear_depth_framebuffer,
|
||||
} // renderSSAO
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void PostProcessing::renderMotionBlur(unsigned , const FrameBuffer &in_fbo,
|
||||
void PostProcessing::renderMotionBlur(const FrameBuffer &in_fbo,
|
||||
FrameBuffer &out_fbo,
|
||||
GLuint depth_stencil_texture)
|
||||
{
|
||||
@ -1353,14 +1354,15 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
//computeLogLuminance(in_rtt);
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Tonemap", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_TONEMAP));
|
||||
// only enable vignette during race
|
||||
|
||||
out_fbo = &rtts->getFBO(FBO_RGBA_1);
|
||||
ToneMapShader::getInstance()->render(*out_fbo, in_fbo->getRTT()[0],
|
||||
isRace ? 1.0f : 0.0f);
|
||||
std::swap(in_fbo, out_fbo);
|
||||
in_fbo = &rtts->getFBO(FBO_RGBA_2);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
@ -1371,8 +1373,9 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
|
||||
if (isRace && UserConfigParams::m_motionblur && World::getWorld() &&
|
||||
m_boost_time.at(Camera::getActiveCamera()->getIndex()) > 0.0f) // motion blur
|
||||
{
|
||||
renderMotionBlur(0, *in_fbo, *out_fbo, irr_driver->getDepthStencilTexture());
|
||||
std::swap(in_fbo, out_fbo);
|
||||
in_fbo = &rtts->getFBO(FBO_RGBA_1);
|
||||
out_fbo = &rtts->getFBO(FBO_RGBA_2);
|
||||
renderMotionBlur(*in_fbo, *out_fbo, irr_driver->getDepthStencilTexture());
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
@ -1382,25 +1385,19 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
|
||||
PROFILER_PUSH_CPU_MARKER("- Lightning", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_LIGHTNING));
|
||||
Weather* weather = Weather::getInstance();
|
||||
if ( weather && weather->shouldLightning() )
|
||||
if (weather && weather->shouldLightning())
|
||||
{
|
||||
renderLightning(weather->getIntensity());
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
out_fbo = &rtts->getFBO(FBO_MLAA_COLORS);
|
||||
out_fbo->bind();
|
||||
renderPassThrough(in_fbo->getRTT()[0],
|
||||
out_fbo->getWidth(),
|
||||
out_fbo->getHeight());
|
||||
|
||||
if (UserConfigParams::m_mlaa) // MLAA. Must be the last pp filter.
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- MLAA", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_MLAA));
|
||||
applyMLAA(rtts->getFBO(FBO_MLAA_TMP),
|
||||
rtts->getFBO(FBO_MLAA_BLEND),
|
||||
applyMLAA(*in_fbo,
|
||||
rtts->getFBO(FBO_RGBA_3),
|
||||
*out_fbo);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
const FrameBuffer& mlaa_blend_framebuffer,
|
||||
const FrameBuffer& mlaa_colors_framebuffer);
|
||||
|
||||
void renderMotionBlur(unsigned cam, const FrameBuffer &in_fbo,
|
||||
void renderMotionBlur(const FrameBuffer &in_fbo,
|
||||
FrameBuffer &out_fbo,
|
||||
GLuint depth_stencil_texture);
|
||||
void renderGlow(const FrameBuffer& glow_framebuffer,
|
||||
|
@ -59,14 +59,13 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale,
|
||||
m_width = (unsigned int)(width * rtt_scale);
|
||||
m_height = (unsigned int)(height * rtt_scale);
|
||||
m_shadow_fbo = NULL;
|
||||
using namespace video;
|
||||
|
||||
using namespace core;
|
||||
|
||||
dimension2du res(m_width, m_height);
|
||||
|
||||
const dimension2du half = res/2;
|
||||
const dimension2du quarter = res/4;
|
||||
const dimension2du eighth = res/8;
|
||||
|
||||
const u16 shadowside = u16(1024 * rtt_scale);
|
||||
const dimension2du shadowsize0(shadowside, shadowside);
|
||||
@ -92,7 +91,6 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale,
|
||||
GLint rgb_format = GL_BGR;
|
||||
GLint diffuse_specular_internal_format = GL_R11F_G11F_B10F;
|
||||
GLint type = GL_FLOAT;
|
||||
GLint rgb_internal_format = GL_RGBA8;
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
if (!CVS->isEXTColorBufferFloatUsable())
|
||||
@ -121,155 +119,184 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale,
|
||||
if (CVS->isDeferredEnabled())
|
||||
{
|
||||
m_render_target_textures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV);
|
||||
m_render_target_textures[RTT_TMP1] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_TMP2] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_TMP3] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_TMP4] = generateRTT(res, red_internal_format, red_format, type);
|
||||
m_render_target_textures[RTT_LINEAR_DEPTH] = generateRTT(res, red32_internal_format, red_format, type, linear_depth_mip_levels);
|
||||
m_render_target_textures[RTT_MLAA_COLORS] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
|
||||
m_render_target_textures[RTT_MLAA_TMP] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
|
||||
m_render_target_textures[RTT_MLAA_BLEND] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
|
||||
m_render_target_textures[RTT_SSAO] = generateRTT(res, red_internal_format, red_format, type);
|
||||
m_render_target_textures[RTT_DISPLACE] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_SP_GLOSS] = generateRTT(res, GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
|
||||
m_render_target_textures[RTT_SP_DIFF_COLOR] = generateRTT(res, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE);
|
||||
m_render_target_textures[RTT_RGBA_2] = generateRTT(res, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE);
|
||||
m_render_target_textures[RTT_DIFFUSE] = generateRTT(res, diffuse_specular_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_SPECULAR] = generateRTT(res, diffuse_specular_internal_format, rgb_format, type);
|
||||
|
||||
m_render_target_textures[RTT_TMP1] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_HALF1] = generateRTT(half, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_QUARTER1] = generateRTT(quarter, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_EIGHTH1] = generateRTT(eighth, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_HALF1_R] = generateRTT(half, red_internal_format, red_format, type);
|
||||
|
||||
m_render_target_textures[RTT_HALF2] = generateRTT(half, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_QUARTER2] = generateRTT(quarter, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_EIGHTH2] = generateRTT(eighth, rgba_internal_format, rgba_format, type);
|
||||
m_render_target_textures[RTT_HALF2_R] = generateRTT(half, red_internal_format, red_format, type);
|
||||
m_render_target_textures[RTT_DISPLACE] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
|
||||
m_render_target_textures[RTT_BLOOM_1024] = generateRTT(shadowsize0, rgba_internal_format, rgb_format, type);
|
||||
if (UserConfigParams::m_mlaa)
|
||||
{
|
||||
m_render_target_textures[RTT_RGBA_3] = generateRTT(res, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
m_render_target_textures[RTT_BLOOM_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_TMP_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_LENS_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type);
|
||||
if (UserConfigParams::m_ssao)
|
||||
{
|
||||
m_render_target_textures[RTT_SSAO] = generateRTT(res, red_internal_format, red_format, type);
|
||||
m_render_target_textures[RTT_LINEAR_DEPTH] = generateRTT(res, red32_internal_format, red_format, type, linear_depth_mip_levels);
|
||||
m_render_target_textures[RTT_HALF2_R] = generateRTT(half, red_internal_format, red_format, type);
|
||||
}
|
||||
|
||||
m_render_target_textures[RTT_BLOOM_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_TMP_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_LENS_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type);
|
||||
if (UserConfigParams::m_light_shaft || UserConfigParams::m_glow)
|
||||
{
|
||||
m_render_target_textures[RTT_QUARTER1] = generateRTT(quarter, rgba_internal_format, rgba_format, type);
|
||||
}
|
||||
if (UserConfigParams::m_light_shaft)
|
||||
{
|
||||
m_render_target_textures[RTT_QUARTER2] = generateRTT(quarter, rgba_internal_format, rgba_format, type);
|
||||
}
|
||||
|
||||
m_render_target_textures[RTT_BLOOM_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_TMP_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_LENS_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type);
|
||||
|
||||
m_render_target_textures[RTT_SP_GLOSS] = generateRTT(res, GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
|
||||
m_render_target_textures[RTT_SP_DIFF_COLOR] = generateRTT(res, GL_RGBA8, rgb_format, GL_UNSIGNED_BYTE);
|
||||
if (UserConfigParams::m_bloom)
|
||||
{
|
||||
m_render_target_textures[RTT_BLOOM_1024] = generateRTT(shadowsize0, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_BLOOM_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_TMP_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_LENS_512] = generateRTT(shadowsize1, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_BLOOM_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_TMP_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_LENS_256] = generateRTT(shadowsize2, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_BLOOM_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_TMP_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type);
|
||||
m_render_target_textures[RTT_LENS_128] = generateRTT(shadowsize3, rgba_internal_format, rgb_format, type);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<GLuint> somevector;
|
||||
if (!use_default_fbo_only)
|
||||
{
|
||||
somevector.push_back(m_render_target_textures[RTT_COLOR]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height));
|
||||
m_frame_buffers[FBO_COLORS] = new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height);
|
||||
}
|
||||
|
||||
if (CVS->isDeferredEnabled())
|
||||
{
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_NORMAL_AND_DEPTH]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_SSAO]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_DIFFUSE]);
|
||||
somevector.push_back(m_render_target_textures[RTT_SPECULAR]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_MLAA_COLORS]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_MLAA_BLEND]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_MLAA_TMP]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP1]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP2]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP4]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_LINEAR_DEPTH]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF1]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, half.Width, half.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF1_R]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, half.Width, half.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF2]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, half.Width, half.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF2_R]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, half.Width, half.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_QUARTER1]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, quarter.Width, quarter.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_QUARTER2]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, quarter.Width, quarter.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_EIGHTH1]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, eighth.Width, eighth.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_EIGHTH2]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, eighth.Width, eighth.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_DISPLACE]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height));
|
||||
somevector.clear();
|
||||
|
||||
somevector.push_back(m_render_target_textures[RTT_BLOOM_1024]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize0.Width, shadowsize0.Height));
|
||||
somevector.clear();
|
||||
|
||||
somevector.push_back(m_render_target_textures[RTT_BLOOM_512]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP_512]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_LENS_512]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height));
|
||||
somevector.clear();
|
||||
|
||||
somevector.push_back(m_render_target_textures[RTT_BLOOM_256]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP_256]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_LENS_256]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height));
|
||||
somevector.clear();
|
||||
|
||||
somevector.push_back(m_render_target_textures[RTT_BLOOM_128]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP_128]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height));
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_LENS_128]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height));
|
||||
m_frame_buffers[FBO_NORMAL_AND_DEPTHS] = new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_SP_DIFF_COLOR]);
|
||||
somevector.push_back(m_render_target_textures[RTT_NORMAL_AND_DEPTH]);
|
||||
somevector.push_back(m_render_target_textures[RTT_SP_GLOSS]);
|
||||
m_frame_buffers.push_back(new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height));
|
||||
m_frame_buffers[FBO_SP] = new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_SP_DIFF_COLOR]);
|
||||
m_frame_buffers[FBO_RGBA_1] = new FrameBuffer(somevector, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_RGBA_2]);
|
||||
m_frame_buffers[FBO_RGBA_2] = new FrameBuffer(somevector, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_DIFFUSE]);
|
||||
somevector.push_back(m_render_target_textures[RTT_SPECULAR]);
|
||||
m_frame_buffers[FBO_COMBINED_DIFFUSE_SPECULAR] = new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP1]);
|
||||
m_frame_buffers[FBO_TMP1_WITH_DS] = new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF1_R]);
|
||||
m_frame_buffers[FBO_HALF1_R] = new FrameBuffer(somevector, half.Width, half.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF1]);
|
||||
m_frame_buffers[FBO_HALF1] = new FrameBuffer(somevector, half.Width, half.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF2]);
|
||||
m_frame_buffers[FBO_HALF2] = new FrameBuffer(somevector, half.Width, half.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_DISPLACE]);
|
||||
m_frame_buffers[FBO_DISPLACE] = new FrameBuffer(somevector, m_depth_stencil_tex, res.Width, res.Height);
|
||||
|
||||
if (m_render_target_textures[RTT_RGBA_3] != 0)
|
||||
{
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_RGBA_3]);
|
||||
m_frame_buffers[FBO_RGBA_3] = new FrameBuffer(somevector, res.Width, res.Height);
|
||||
}
|
||||
|
||||
if (m_render_target_textures[RTT_SSAO] != 0 &&
|
||||
m_render_target_textures[RTT_LINEAR_DEPTH] != 0 &&
|
||||
m_render_target_textures[RTT_HALF2_R] != 0)
|
||||
{
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_SSAO]);
|
||||
m_frame_buffers[FBO_SSAO] = new FrameBuffer(somevector, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_LINEAR_DEPTH]);
|
||||
m_frame_buffers[FBO_LINEAR_DEPTH] = new FrameBuffer(somevector, res.Width, res.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_HALF2_R]);
|
||||
m_frame_buffers[FBO_HALF2_R] = new FrameBuffer(somevector, half.Width, half.Height);
|
||||
}
|
||||
|
||||
if (m_render_target_textures[RTT_QUARTER1] != 0)
|
||||
{
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_QUARTER1]);
|
||||
m_frame_buffers[FBO_QUARTER1] = new FrameBuffer(somevector, quarter.Width, quarter.Height);
|
||||
}
|
||||
if (m_render_target_textures[RTT_QUARTER2] != 0)
|
||||
{
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_QUARTER2]);
|
||||
m_frame_buffers[FBO_QUARTER2] = new FrameBuffer(somevector, quarter.Width, quarter.Height);
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_bloom)
|
||||
{
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_BLOOM_1024]);
|
||||
m_frame_buffers[FBO_BLOOM_1024] = new FrameBuffer(somevector, shadowsize0.Width, shadowsize0.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_BLOOM_512]);
|
||||
m_frame_buffers[FBO_BLOOM_512] = new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP_512]);
|
||||
m_frame_buffers[FBO_TMP_512] = new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_LENS_512]);
|
||||
m_frame_buffers[FBO_LENS_512] = new FrameBuffer(somevector, shadowsize1.Width, shadowsize1.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_BLOOM_256]);
|
||||
m_frame_buffers[FBO_BLOOM_256] = new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP_256]);
|
||||
m_frame_buffers[FBO_TMP_256] = new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_LENS_256]);
|
||||
m_frame_buffers[FBO_LENS_256] = new FrameBuffer(somevector, shadowsize2.Width, shadowsize2.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_BLOOM_128]);
|
||||
m_frame_buffers[FBO_BLOOM_128] = new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_TMP_128]);
|
||||
m_frame_buffers[FBO_TMP_128] = new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height);
|
||||
|
||||
somevector.clear();
|
||||
somevector.push_back(m_render_target_textures[RTT_LENS_128]);
|
||||
m_frame_buffers[FBO_LENS_128] = new FrameBuffer(somevector, shadowsize3.Width, shadowsize3.Height);
|
||||
}
|
||||
|
||||
if (CVS->isShadowEnabled())
|
||||
{
|
||||
@ -289,6 +316,10 @@ RTT::~RTT()
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glDeleteTextures(RTT_COUNT, m_render_target_textures);
|
||||
for (FrameBuffer* fb : m_frame_buffers)
|
||||
{
|
||||
delete fb;
|
||||
}
|
||||
glDeleteTextures(1, &m_depth_stencil_tex);
|
||||
if (CVS->isShadowEnabled())
|
||||
{
|
||||
|
@ -19,47 +19,35 @@
|
||||
#define HEADER_RTTS_HPP
|
||||
|
||||
#include "utils/leak_check.hpp"
|
||||
#include "utils/ptr_vector.hpp"
|
||||
#include "utils/types.hpp"
|
||||
#include <stddef.h>
|
||||
#include <cassert>
|
||||
|
||||
class FrameBuffer;
|
||||
class FrameBufferLayer;
|
||||
|
||||
namespace irr {
|
||||
namespace video {
|
||||
class ITexture;
|
||||
};
|
||||
namespace scene {
|
||||
class ICameraSceneNode;
|
||||
}
|
||||
};
|
||||
|
||||
using irr::video::ITexture;
|
||||
|
||||
enum TypeFBO
|
||||
{
|
||||
FBO_COLORS,
|
||||
FBO_NORMAL_AND_DEPTHS,
|
||||
FBO_SSAO,
|
||||
FBO_SP,
|
||||
FBO_RGBA_1,
|
||||
FBO_RGBA_2,
|
||||
FBO_COMBINED_DIFFUSE_SPECULAR,
|
||||
FBO_MLAA_COLORS,
|
||||
FBO_MLAA_BLEND,
|
||||
FBO_MLAA_TMP,
|
||||
FBO_TMP1_WITH_DS,
|
||||
FBO_TMP2_WITH_DS,
|
||||
FBO_TMP4,
|
||||
FBO_LINEAR_DEPTH,
|
||||
FBO_HALF1,
|
||||
FBO_HALF1_R,
|
||||
FBO_HALF1,
|
||||
FBO_HALF2,
|
||||
FBO_HALF2_R,
|
||||
FBO_QUARTER1,
|
||||
FBO_QUARTER2,
|
||||
FBO_EIGHTH1,
|
||||
FBO_EIGHTH2,
|
||||
FBO_DISPLACE,
|
||||
FBO_BLOOM_1024,
|
||||
|
||||
FBO_RGBA_3, // MLAA
|
||||
|
||||
FBO_SSAO, // SSAO
|
||||
FBO_LINEAR_DEPTH, // SSAO
|
||||
FBO_HALF2_R, // SSAO
|
||||
|
||||
FBO_QUARTER1, // Glow || God Ray
|
||||
FBO_QUARTER2, // God Ray
|
||||
|
||||
FBO_BLOOM_1024, // The reset is for bloom only (may be optimized layer)
|
||||
FBO_BLOOM_512,
|
||||
FBO_TMP_512,
|
||||
FBO_LENS_512,
|
||||
@ -71,7 +59,6 @@ enum TypeFBO
|
||||
FBO_BLOOM_128,
|
||||
FBO_TMP_128,
|
||||
FBO_LENS_128,
|
||||
FBO_SP,
|
||||
FBO_COUNT
|
||||
};
|
||||
|
||||
@ -79,47 +66,25 @@ enum TypeRTT : unsigned int
|
||||
{
|
||||
RTT_COLOR = 0,
|
||||
RTT_NORMAL_AND_DEPTH,
|
||||
RTT_TMP1,
|
||||
RTT_TMP2,
|
||||
RTT_TMP3,
|
||||
RTT_TMP4,
|
||||
RTT_LINEAR_DEPTH,
|
||||
RTT_SP_GLOSS,
|
||||
RTT_SP_DIFF_COLOR, // RGBA
|
||||
RTT_RGBA_2,
|
||||
RTT_DIFFUSE,
|
||||
RTT_SPECULAR,
|
||||
|
||||
|
||||
RTT_TMP1,
|
||||
RTT_HALF1,
|
||||
RTT_HALF2,
|
||||
RTT_HALF1_R,
|
||||
RTT_HALF2,
|
||||
RTT_DISPLACE,
|
||||
|
||||
RTT_RGBA_3,
|
||||
|
||||
RTT_SSAO,
|
||||
RTT_LINEAR_DEPTH,
|
||||
RTT_HALF2_R,
|
||||
|
||||
RTT_QUARTER1,
|
||||
RTT_QUARTER2,
|
||||
// RTT_QUARTER3,
|
||||
// RTT_QUARTER4,
|
||||
|
||||
RTT_EIGHTH1,
|
||||
RTT_EIGHTH2,
|
||||
|
||||
// RTT_SIXTEENTH1,
|
||||
// RTT_SIXTEENTH2,
|
||||
|
||||
RTT_SSAO,
|
||||
|
||||
// RTT_COLLAPSE,
|
||||
// RTT_COLLAPSEH,
|
||||
// RTT_COLLAPSEV,
|
||||
// RTT_COLLAPSEH2,
|
||||
// RTT_COLLAPSEV2,
|
||||
// RTT_WARPH,
|
||||
// RTT_WARPV,
|
||||
|
||||
// RTT_HALF_SOFT,
|
||||
|
||||
RTT_DISPLACE,
|
||||
RTT_MLAA_COLORS,
|
||||
RTT_MLAA_BLEND,
|
||||
RTT_MLAA_TMP,
|
||||
|
||||
RTT_BLOOM_1024,
|
||||
RTT_BLOOM_512,
|
||||
@ -132,9 +97,6 @@ enum TypeRTT : unsigned int
|
||||
RTT_TMP_128,
|
||||
RTT_LENS_128,
|
||||
|
||||
RTT_SP_GLOSS,
|
||||
RTT_SP_DIFF_COLOR,
|
||||
|
||||
RTT_COUNT
|
||||
};
|
||||
|
||||
@ -159,11 +121,15 @@ public:
|
||||
assert(m_render_target_textures[target] != 0);
|
||||
return m_render_target_textures[target];
|
||||
}
|
||||
FrameBuffer& getFBO(enum TypeFBO fbo) { return m_frame_buffers[fbo]; }
|
||||
FrameBuffer& getFBO(enum TypeFBO fbo)
|
||||
{
|
||||
assert(m_frame_buffers[fbo] != NULL);
|
||||
return *m_frame_buffers[fbo];
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned m_render_target_textures[RTT_COUNT] = {};
|
||||
PtrVector<FrameBuffer> m_frame_buffers;
|
||||
FrameBuffer* m_frame_buffers[FBO_COUNT] = {};
|
||||
unsigned m_depth_stencil_tex = 0;
|
||||
|
||||
unsigned int m_width;
|
||||
|
Loading…
Reference in New Issue
Block a user