summaryrefslogtreecommitdiff
path: root/src/blu_cat/gra/graphics_pipeline_2d_solid.cpp
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2025-06-21 16:51:22 -0300
committerFrederico Linhares <fred@linhares.blue>2025-06-21 16:51:22 -0300
commit8bedf8a366cb6c1179bc89678c863517b9356d48 (patch)
tree4a285592f804802d59f2af090113f607344ffdce /src/blu_cat/gra/graphics_pipeline_2d_solid.cpp
parentb3428170ac0a1837d3568f7b49312cbb01179f5d (diff)
refa Remove View2DHEADmaster
View2D is almost useless and add too much complexity for the engine, so I am removing it.
Diffstat (limited to 'src/blu_cat/gra/graphics_pipeline_2d_solid.cpp')
-rw-r--r--src/blu_cat/gra/graphics_pipeline_2d_solid.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/blu_cat/gra/graphics_pipeline_2d_solid.cpp b/src/blu_cat/gra/graphics_pipeline_2d_solid.cpp
index 7acca09..05dcbe1 100644
--- a/src/blu_cat/gra/graphics_pipeline_2d_solid.cpp
+++ b/src/blu_cat/gra/graphics_pipeline_2d_solid.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.
@@ -235,26 +235,25 @@ GraphicsPipeline2DSolid::~GraphicsPipeline2DSolid()
void
GraphicsPipeline2DSolid::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)
{
// 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);
}
@@ -264,14 +263,17 @@ GraphicsPipeline2DSolid::draw(
// FIXME: I know sorting is expensive, but I need to figure out better what
// to do here.
- std::sort(view->sprites_to_draw[current_frame].begin(),
- view->sprites_to_draw[current_frame].end());
+ std::sort(BluCat::INT::core.vk_renderer->sprites_to_draw[
+ current_frame].begin(),
+ BluCat::INT::core.vk_renderer->sprites_to_draw[
+ current_frame].end());
// Draw sprites
- for(auto& sprite_to_draw: view->sprites_to_draw[current_frame])
+ for(auto& sprite_to_draw:
+ BluCat::INT::core.vk_renderer->sprites_to_draw[current_frame])
{
std::array<VkDescriptorSet, 2> vk_descriptor_sets{
- view->descriptor_sets_2d[image_index],
+ BluCat::INT::core.vk_renderer->descriptor_sets_2d[image_index],
sprite_to_draw.sprite->texture->descriptor_sets[image_index]};
VkDeviceSize offsets[]{0};
@@ -292,7 +294,7 @@ GraphicsPipeline2DSolid::draw(
}
// Prepare for the next frame.
- view->sprites_to_draw[next_frame].clear();
+ BluCat::INT::core.vk_renderer->sprites_to_draw[next_frame].clear();
}
}