From d5a2b6bca9f9cc57dcca19962d5ba9b83d26da3e Mon Sep 17 00:00:00 2001 From: Frederico Linhares Date: Thu, 16 May 2024 14:22:35 -0300 Subject: refa Move BluCan initialization to BluCat folder --- src/blucat/graphics_pipeline_3d.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/blucat/graphics_pipeline_3d.cpp') diff --git a/src/blucat/graphics_pipeline_3d.cpp b/src/blucat/graphics_pipeline_3d.cpp index c1b60a6..bd64ebc 100644 --- a/src/blucat/graphics_pipeline_3d.cpp +++ b/src/blucat/graphics_pipeline_3d.cpp @@ -19,8 +19,8 @@ #include #include -#include "../core.hpp" #include "core.hpp" +#include "vulkan.hpp" #include "static_mesh_vertex.hpp" #include "uniform_data_object.hpp" @@ -39,7 +39,7 @@ load_pipeline(void *obj) vert_shader_stage_info.flags = 0; vert_shader_stage_info.stage = VK_SHADER_STAGE_VERTEX_BIT; vert_shader_stage_info.module = - cg_core.vk_device_with_swapchain->vert3d_shader_module; + BluCat::core.vk_device_with_swapchain->vert3d_shader_module; vert_shader_stage_info.pName = "main"; vert_shader_stage_info.pSpecializationInfo = nullptr; @@ -50,7 +50,7 @@ load_pipeline(void *obj) frag_shader_stage_info.flags = 0; frag_shader_stage_info.stage = VK_SHADER_STAGE_FRAGMENT_BIT; frag_shader_stage_info.module = - cg_core.vk_device_with_swapchain->frag3d_shader_module; + BluCat::core.vk_device_with_swapchain->frag3d_shader_module; frag_shader_stage_info.pName = "main"; frag_shader_stage_info.pSpecializationInfo = nullptr; @@ -103,14 +103,14 @@ load_pipeline(void *obj) VkViewport viewport = {}; viewport.x = 0; viewport.y = 0; - viewport.width = cg_core.display_width; - viewport.height = cg_core.display_height; + viewport.width = BluCat::core.display_width; + viewport.height = BluCat::core.display_height; viewport.minDepth = 0.0f; viewport.maxDepth = 1.0f; VkRect2D scissor = {}; scissor.offset = {0, 0}; - scissor.extent = {cg_core.display_width, cg_core.display_height}; + scissor.extent = {BluCat::core.display_width, BluCat::core.display_height}; VkPipelineViewportStateCreateInfo viewport_state = {}; viewport_state.sType = @@ -213,14 +213,14 @@ load_pipeline(void *obj) pipeline_info.pDepthStencilState = &depth_stencil; pipeline_info.pColorBlendState = &color_blending; pipeline_info.pDynamicState = &dynamic_state_info; - pipeline_info.layout = cg_core.vk_graphics_pipeline_3d_layout->pipeline; - pipeline_info.renderPass = cg_core.vk_render_pass->pipeline_3d; + pipeline_info.layout = BluCat::core.vk_graphics_pipeline_3d_layout->pipeline; + pipeline_info.renderPass = BluCat::core.vk_render_pass->pipeline_3d; pipeline_info.subpass = 0; pipeline_info.basePipelineHandle = VK_NULL_HANDLE; pipeline_info.basePipelineIndex = -1; if(vkCreateGraphicsPipelines( - cg_core.vk_device_with_swapchain->device, VK_NULL_HANDLE, 1, + BluCat::core.vk_device_with_swapchain->device, VK_NULL_HANDLE, 1, &pipeline_info, nullptr, &self->graphic_pipeline) != VK_SUCCESS) throw CommandError{"Failed to create graphics pipeline."}; @@ -232,7 +232,8 @@ unload_pipeline(void *obj) auto self = static_cast(obj); vkDestroyPipeline( - cg_core.vk_device_with_swapchain->device, self->graphic_pipeline, nullptr); + BluCat::core.vk_device_with_swapchain->device, self->graphic_pipeline, + nullptr); } const CommandChain loader{ @@ -265,7 +266,7 @@ GraphicsPipeline3D::draw( // Draw models for(auto& [static_mesh, instances]: - cg_core.vk_renderer->static_models_to_draw[current_frame]) + core.vk_renderer->static_models_to_draw[current_frame]) { VkBuffer vertex_buffers[]{static_mesh->vertex_buffer->buffer}; VkDeviceSize offsets[]{0}; @@ -284,14 +285,14 @@ GraphicsPipeline3D::draw( glm::mat4 rotation_matrix{glm::toMat4(*instance->orientation)}; std::array vk_descriptor_sets{ - cg_core.vk_light->descriptor_sets_world[image_index], + core.vk_light->descriptor_sets_world[image_index], view->descriptor_sets_3d[image_index], instance->descriptor_sets[image_index], instance->texture->descriptor_sets[image_index]}; vkCmdBindDescriptorSets( draw_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, - cg_core.vk_graphics_pipeline_3d_layout->pipeline, 0, + core.vk_graphics_pipeline_3d_layout->pipeline, 0, vk_descriptor_sets.size(), vk_descriptor_sets.data(), 0, nullptr); vkCmdDrawIndexed( -- cgit v1.2.3