Commit 7e44c363 authored by Florian Oetke's avatar Florian Oetke

added clear pass

parent 337cdf74
Pipeline #2988 passed with stage
in 20 minutes and 44 seconds
......@@ -46,6 +46,7 @@ add_library(mirrage_renderer STATIC
src/pass/billboard_pass.cpp
src/pass/blit_pass.cpp
src/pass/bloom_pass.cpp
src/pass/clear_pass.cpp
src/pass/debug_draw_pass.cpp
src/pass/deferred_geometry_subpass.cpp
src/pass/deferred_lighting_subpass.cpp
......
#pragma once
#include <mirrage/renderer/deferred_renderer.hpp>
#include <mirrage/graphic/render_pass.hpp>
namespace mirrage::renderer {
class Clear_pass_factory;
class Clear_pass : public Render_pass {
public:
using Factory = Clear_pass_factory;
Clear_pass(Deferred_renderer&);
void update(util::Time dt) override;
void draw(Frame_data&) override;
auto name() const noexcept -> const char* override { return "Clear"; }
private:
Deferred_renderer& _renderer;
};
class Clear_pass_factory : public Render_pass_factory {
public:
auto id() const noexcept -> Render_pass_id override
{
return render_pass_id_of<Clear_pass_factory>();
}
auto create_pass(Deferred_renderer&,
util::maybe<ecs::Entity_manager&>,
Engine&,
bool& write_first_pp_buffer) -> std::unique_ptr<Render_pass> override;
auto rank_device(vk::PhysicalDevice, util::maybe<std::uint32_t> graphics_queue, int current_score)
-> int override;
void configure_device(vk::PhysicalDevice,
util::maybe<std::uint32_t> graphics_queue,
graphic::Device_create_info&) override;
};
} // namespace mirrage::renderer
#include <mirrage/renderer/pass/clear_pass.hpp>
namespace mirrage::renderer {
Clear_pass::Clear_pass(Deferred_renderer& renderer) : _renderer(renderer) {}
void Clear_pass::update(util::Time) {}
void Clear_pass::draw(Frame_data& frame)
{
auto image = _renderer.swapchain().get_images().at(frame.swapchain_image);
graphic::clear_texture(frame.main_command_buffer,
image,
_renderer.swapchain().image_width(),
_renderer.swapchain().image_height(),
util::Rgba{0, 0, 0, 1},
vk::ImageLayout::eUndefined,
vk::ImageLayout::ePresentSrcKHR,
0,
1);
}
auto Clear_pass_factory::create_pass(Deferred_renderer& renderer,
util::maybe<ecs::Entity_manager&>,
Engine&,
bool&) -> std::unique_ptr<Render_pass>
{
return std::make_unique<Clear_pass>(renderer);
}
auto Clear_pass_factory::rank_device(vk::PhysicalDevice, util::maybe<std::uint32_t>, int current_score)
-> int
{
return current_score;
}
void Clear_pass_factory::configure_device(vk::PhysicalDevice,
util::maybe<std::uint32_t>,
graphic::Device_create_info&)
{
}
} // namespace mirrage::renderer
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment