From 8bedf8a366cb6c1179bc89678c863517b9356d48 Mon Sep 17 00:00:00 2001 From: Frederico Linhares Date: Sat, 21 Jun 2025 16:51:22 -0300 Subject: refa Remove View2D View2D is almost useless and add too much complexity for the engine, so I am removing it. --- src/blu_cat/gra/graphics_pipeline_2d_solid.cpp | 36 ++++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src/blu_cat/gra/graphics_pipeline_2d_solid.cpp') 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 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(BluCat::INT::core.display_width); + vk_viewport.height = static_cast(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(view->region.x); - vk_scissor.offset.y = static_cast(view->region.y); - vk_scissor.extent.width = static_cast(view->region.z); - vk_scissor.extent.height = static_cast(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 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(); } } -- cgit v1.2.3