26 using backend_type = Backend;
27 using device_type =
typename backend_type::device_type;
28 using buffer_type =
typename device_type::buffer_type;
29 using command_buffer_type =
typename device_type::command_buffer_type;
30 using descriptor_set_type =
typename command_buffer_type::descriptor_set_type;
31 using adapter_type =
typename device_type::adapter_type;
32 using surface_type =
typename backend_type::surface_type;
33 using render_pass_type =
typename backend_type::render_pass_type;
34 using render_pipeline_type =
typename backend_type::render_pipeline_type;
35 using pipeline_layout_type =
typename backend_type::pipeline_layout_type;
36 using shader_program_type =
typename backend_type::shader_program_type;
37 using shader_module_type =
typename shader_program_type::shader_module_type;
38 using input_assembler_type =
typename backend_type::input_assembler_type;
39 using rasterizer_type =
typename backend_type::rasterizer_type;
40 using factory_type =
typename device_type::factory_type;
41 using vertex_buffer_layout_type =
typename factory_type::vertex_buffer_layout_type;
42 using vertex_buffer_type =
typename factory_type::vertex_buffer_type;
43 using index_buffer_layout_type =
typename factory_type::index_buffer_layout_type;
44 using index_buffer_type =
typename factory_type::index_buffer_type;
54 std::function<
typename surface_type::handle_type(
const typename backend_type::handle_type&)> surface_factory,
55 std::span<std::string> required_extensions);
98 void initRenderGraph();
112 inline static constexpr std::array s_rectangleVertices = {
113 glm::vec3(-0.5f, -0.5f, 0.f),
114 glm::vec3(-0.5f, 0.5f, 0.f),
115 glm::vec3(0.5f, 0.5f, 0.f),
116 glm::vec3(0.5f, -0.5f, 0.f)
119 inline static constexpr std::array<uint16_t, 6> s_rectangleIndices = {0, 1, 2, 0, 2, 3};
121 device_type* m_device;
122 std::unique_ptr<backend_type> m_renderBackend;
123 std::shared_ptr<input_assembler_type> m_inputAssembler;
124 std::unique_ptr<render::IViewport> m_viewport;
125 std::unique_ptr<render::IScissor> m_scissor;
126 std::vector<std::size_t> m_transferFences;
129 SPARK_DISABLE_MSVC_WARNING(4324)
131 struct alignas(sizeof(glm::vec4)) InstanceBuffer
140 inline static constexpr std::size_t s_maxInstances = 1024 * 8;
141 std::vector<InstanceBuffer> m_instanceData;
void drawQuad(const glm::mat4 &transform_matrix, const spark::math::Vector4< float > &color={1.f, 1.f, 1.f, 1.f})
Draws a 1x1 quad with the given transformation_matrix.
Definition Renderer2D.h:286
void drawCircle(const glm::mat4 &transform_matrix, float radius, const spark::math::Vector4< float > &color={1.f, 1.f, 1.f, 1.f})
Draws a circle with the given transformation_matrix and radius.
Definition Renderer2D.h:295
Renderer2D(const math::Vector2< unsigned > &render_area, std::function< typename surface_type::handle_type(const typename backend_type::handle_type &)> surface_factory, std::span< std::string > required_extensions)
Creates a new 2D renderer.
Definition Renderer2D.h:24