summaryrefslogtreecommitdiff
path: root/src/blu_cat/gra/graphics_pipeline_2d_wired.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/blu_cat/gra/graphics_pipeline_2d_wired.cpp')
-rw-r--r--src/blu_cat/gra/graphics_pipeline_2d_wired.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/blu_cat/gra/graphics_pipeline_2d_wired.cpp b/src/blu_cat/gra/graphics_pipeline_2d_wired.cpp
index 20491ed..1273c67 100644
--- a/src/blu_cat/gra/graphics_pipeline_2d_wired.cpp
+++ b/src/blu_cat/gra/graphics_pipeline_2d_wired.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2024 Frederico de Oliveira Linhares
+ * Copyright 2022-2025 Frederico de Oliveira Linhares
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -247,33 +247,32 @@ GraphicsPipeline2DWired::~GraphicsPipeline2DWired()
void
GraphicsPipeline2DWired::draw(
- std::shared_ptr<View2D> view, const VkCommandBuffer draw_command_buffer,
- const size_t current_frame, const size_t next_frame,
- const uint32_t image_index)
+ const VkCommandBuffer draw_command_buffer, const size_t current_frame,
+ const size_t next_frame, const uint32_t image_index)
{
- // Set viewport
- {
+ // TODO set viewport just once per view, not once per pipeline.
+ { // Set viewport
VkViewport vk_viewport{};
- vk_viewport.x = view->region.x;
- vk_viewport.y = view->region.y;
- vk_viewport.width = view->region.z;
- vk_viewport.height = view->region.w;
+ vk_viewport.x = 0;
+ vk_viewport.y = 0;
+ vk_viewport.width = static_cast<float>(BluCat::INT::core.display_width);
+ vk_viewport.height = static_cast<float>(BluCat::INT::core.display_height);
vk_viewport.minDepth = 0.0f;
vk_viewport.maxDepth = 1.0f;
vkCmdSetViewport(draw_command_buffer, 0, 1, &vk_viewport);
VkRect2D vk_scissor{};
- vk_scissor.offset.x = static_cast<int32_t>(view->region.x);
- vk_scissor.offset.y = static_cast<int32_t>(view->region.y);
- vk_scissor.extent.width = static_cast<uint32_t>(view->region.z);
- vk_scissor.extent.height = static_cast<uint32_t>(view->region.w);
+ vk_scissor.offset.x = 0;
+ vk_scissor.offset.y = 0;
+ vk_scissor.extent.width = BluCat::INT::core.display_width;
+ vk_scissor.extent.height = BluCat::INT::core.display_height;
vkCmdSetScissor(draw_command_buffer, 0, 1, &vk_scissor);
}
// Draw rectangles
{
std::array<VkDescriptorSet, 1> vk_descriptor_sets{
- view->descriptor_sets_2d[image_index]};
+ BluCat::INT::core.vk_renderer->descriptor_sets_2d[image_index]};
VkDeviceSize offsets[]{0};
vkCmdBindDescriptorSets(
@@ -287,9 +286,11 @@ GraphicsPipeline2DWired::draw(
draw_command_buffer, this->index_buffer->buffer, 0,
VK_INDEX_TYPE_UINT32);
- for(auto i{0}; i < view->rectangles_to_draw[current_frame].size(); i++)
+ for(auto i{0}; i < BluCat::INT::core.vk_renderer->rectangles_to_draw[
+ current_frame].size(); i++)
{
- auto &rect{view->rectangles_to_draw[current_frame][i]};
+ auto &rect{BluCat::INT::core.vk_renderer->rectangles_to_draw[
+ current_frame][i]};
UDOVector4D position{rect.position};
UDOVector3D color{rect.color};
@@ -308,7 +309,7 @@ GraphicsPipeline2DWired::draw(
}
// Prepare for the next frame.
- view->rectangles_to_draw[next_frame].clear();
+ BluCat::INT::core.vk_renderer->rectangles_to_draw[next_frame].clear();
}
}