void Bloom::Render(const ITexture* input, RenderTarget* output) const { RenderTarget* downsampled_rt = Assets<RenderTarget>::Get(s_RTName); RenderTarget* downsampled_rt_blur_x = Assets<RenderTarget>::Get(s_RTNameBlurX); RenderTarget* downsampled_rt_blur_y = Assets<RenderTarget>::Get(s_RTNameBlurY); const Model* model = m_Object->GetModel(); const Mesh& mesh = *model->GetMesh(); Effect* effect = model->GetEffect(); effect->SetTexture(input, TextureIndex::Texture0); m_Object->PopulateObjectBuffer(); // The bloom effect needs a downsampled texture, so we first render into that. downsampled_rt->Set(); effect->RenderPass(bloom_downsample_pass, mesh); // Render from downsampled to x-blurred downsampled_rt_blur_x->Set(); effect->SetTexture(downsampled_rt, TextureIndex::Texture0); effect->RenderPass(bloom_blur_pass_1, mesh); // Render from x-blurred to xy-blurred downsampled_rt_blur_y->Set(); effect->SetTexture(downsampled_rt_blur_x, TextureIndex::Texture0); effect->RenderPass(bloom_blur_pass_2, mesh); // Then combine the original and the downsampled copy. output->Set(); effect->SetTexture(input, TextureIndex::Texture0); effect->SetTexture(downsampled_rt_blur_y, TextureIndex::Texture1); effect->RenderPass(bloom_postprocess_pass, mesh); }
void IPostProcess::Render(const ITexture* input, RenderTarget* output) const { output->Clear(Engine::instance->m_Config.background_color); output->Set(); Effect* effect = m_Object->GetModel()->GetEffect(); if (input != NULL) { effect->SetTexture(input, TextureIndex::Texture0); } m_Object->Render(); }