diff options
author | Frederico Linhares <fred@linhares.blue> | 2024-05-08 17:56:29 -0300 |
---|---|---|
committer | Frederico Linhares <fred@linhares.blue> | 2024-05-08 17:56:29 -0300 |
commit | 43821b0cffc5aa419c0218992f06f8962ae54a13 (patch) | |
tree | 97bdbbf710a78e6dcb181d92dd83e98d8b329c6d /src | |
parent | 70e156d47346ae3198c623e0af75e5703f894db3 (diff) |
refa Rename graphical engine to BluCat
Diffstat (limited to 'src')
-rw-r--r-- | src/binary_reader.hpp | 4 | ||||
-rw-r--r-- | src/blucat/animation.cpp (renamed from src/vk/animation.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/animation.hpp (renamed from src/vk/animation.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/animation/frame.hpp (renamed from src/vk/animation/frame.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/base_buffer.cpp (renamed from src/vk/base_buffer.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/base_buffer.hpp (renamed from src/vk/base_buffer.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/character.cpp (renamed from src/vk/character.cpp) | 22 | ||||
-rw-r--r-- | src/blucat/character.hpp (renamed from src/vk/character.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/command_pool.cpp (renamed from src/vk/command_pool.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/command_pool.hpp (renamed from src/vk/command_pool.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/core.hpp (renamed from src/vk/core.hpp) | 8 | ||||
-rw-r--r-- | src/blucat/descriptor_set_layout.cpp (renamed from src/vk/descriptor_set_layout.cpp) | 20 | ||||
-rw-r--r-- | src/blucat/descriptor_set_layout.hpp (renamed from src/vk/descriptor_set_layout.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/destination_buffer.cpp (renamed from src/vk/destination_buffer.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/destination_buffer.hpp (renamed from src/vk/destination_buffer.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/device.cpp (renamed from src/vk/device.cpp) | 2 | ||||
-rw-r--r-- | src/blucat/device.hpp (renamed from src/vk/device.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/font.cpp (renamed from src/vk/font.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/font.hpp (renamed from src/vk/font.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/framebuffer.cpp (renamed from src/vk/framebuffer.cpp) | 28 | ||||
-rw-r--r-- | src/blucat/framebuffer.hpp (renamed from src/vk/framebuffer.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_2d_solid.cpp (renamed from src/vk/graphics_pipeline_2d_solid.cpp) | 8 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_2d_solid.hpp (renamed from src/vk/graphics_pipeline_2d_solid.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_2d_solid_layout.cpp (renamed from src/vk/graphics_pipeline_2d_solid_layout.cpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_2d_solid_layout.hpp (renamed from src/vk/graphics_pipeline_2d_solid_layout.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_2d_wired.cpp (renamed from src/vk/graphics_pipeline_2d_wired.cpp) | 16 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_2d_wired.hpp (renamed from src/vk/graphics_pipeline_2d_wired.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_2d_wired_layout.cpp (renamed from src/vk/graphics_pipeline_2d_wired_layout.cpp) | 14 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_2d_wired_layout.hpp (renamed from src/vk/graphics_pipeline_2d_wired_layout.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_3d.cpp (renamed from src/vk/graphics_pipeline_3d.cpp) | 16 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_3d.hpp (renamed from src/vk/graphics_pipeline_3d.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_3d_layout.cpp (renamed from src/vk/graphics_pipeline_3d_layout.cpp) | 8 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_3d_layout.hpp (renamed from src/vk/graphics_pipeline_3d_layout.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_3d_skeletal.cpp (renamed from src/vk/graphics_pipeline_3d_skeletal.cpp) | 20 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_3d_skeletal.hpp (renamed from src/vk/graphics_pipeline_3d_skeletal.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_sprite_3d.cpp (renamed from src/vk/graphics_pipeline_sprite_3d.cpp) | 12 | ||||
-rw-r--r-- | src/blucat/graphics_pipeline_sprite_3d.hpp (renamed from src/vk/graphics_pipeline_sprite_3d.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/image.cpp (renamed from src/vk/image.cpp) | 8 | ||||
-rw-r--r-- | src/blucat/image.hpp (renamed from src/vk/image.hpp) | 14 | ||||
-rw-r--r-- | src/blucat/light.cpp (renamed from src/vk/light.cpp) | 28 | ||||
-rw-r--r-- | src/blucat/light.hpp (renamed from src/vk/light.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/qoi.cpp (renamed from src/vk/qoi.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/qoi.hpp (renamed from src/vk/qoi.hpp) | 4 | ||||
-rw-r--r-- | src/blucat/queue.cpp (renamed from src/vk/queue.cpp) | 6 | ||||
-rw-r--r-- | src/blucat/queue.hpp (renamed from src/vk/queue.hpp) | 16 | ||||
-rw-r--r-- | src/blucat/queue_family.cpp (renamed from src/vk/queue_family.cpp) | 6 | ||||
-rw-r--r-- | src/blucat/queue_family.hpp (renamed from src/vk/queue_family.hpp) | 14 | ||||
-rw-r--r-- | src/blucat/rectangle.cpp (renamed from src/vk/rectangle.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/rectangle.hpp (renamed from src/vk/rectangle.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/render_pass.cpp (renamed from src/vk/render_pass.cpp) | 12 | ||||
-rw-r--r-- | src/blucat/render_pass.hpp (renamed from src/vk/render_pass.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/renderer.cpp (renamed from src/vk/renderer.cpp) | 20 | ||||
-rw-r--r-- | src/blucat/renderer.hpp (renamed from src/vk/renderer.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/skeletal_mesh.cpp (renamed from src/vk/skeletal_mesh.cpp) | 36 | ||||
-rw-r--r-- | src/blucat/skeletal_mesh.hpp (renamed from src/vk/skeletal_mesh.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/skeletal_mesh_vertex.hpp (renamed from src/vk/skeletal_mesh_vertex.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/skeletal_model.cpp (renamed from src/vk/skeletal_model.cpp) | 26 | ||||
-rw-r--r-- | src/blucat/skeletal_model.hpp (renamed from src/vk/skeletal_model.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/source_buffer.cpp (renamed from src/vk/source_buffer.cpp) | 8 | ||||
-rw-r--r-- | src/blucat/source_buffer.hpp (renamed from src/vk/source_buffer.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/sprite.cpp (renamed from src/vk/sprite.cpp) | 18 | ||||
-rw-r--r-- | src/blucat/sprite.hpp (renamed from src/vk/sprite.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/sprite_3d.cpp (renamed from src/vk/sprite_3d.cpp) | 22 | ||||
-rw-r--r-- | src/blucat/sprite_3d.hpp (renamed from src/vk/sprite_3d.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/sprite_to_draw.cpp (renamed from src/vk/sprite_to_draw.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/sprite_to_draw.hpp (renamed from src/vk/sprite_to_draw.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/static_mesh.cpp (renamed from src/vk/static_mesh.cpp) | 24 | ||||
-rw-r--r-- | src/blucat/static_mesh.hpp (renamed from src/vk/static_mesh.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/static_mesh_vertex.hpp (renamed from src/vk/static_mesh_vertex.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/static_model.cpp (renamed from src/vk/static_model.cpp) | 18 | ||||
-rw-r--r-- | src/blucat/static_model.hpp (renamed from src/vk/static_model.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/swapchain.cpp (renamed from src/vk/swapchain.cpp) | 16 | ||||
-rw-r--r-- | src/blucat/swapchain.hpp (renamed from src/vk/swapchain.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/texture.cpp (renamed from src/vk/texture.cpp) | 60 | ||||
-rw-r--r-- | src/blucat/texture.hpp (renamed from src/vk/texture.hpp) | 8 | ||||
-rw-r--r-- | src/blucat/uniform_buffer.cpp (renamed from src/vk/uniform_buffer.cpp) | 4 | ||||
-rw-r--r-- | src/blucat/uniform_buffer.hpp (renamed from src/vk/uniform_buffer.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/uniform_data_object.hpp (renamed from src/vk/uniform_data_object.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/view_2d.cpp (renamed from src/vk/view_2d.cpp) | 18 | ||||
-rw-r--r-- | src/blucat/view_2d.hpp (renamed from src/vk/view_2d.hpp) | 10 | ||||
-rw-r--r-- | src/blucat/view_3d.cpp (renamed from src/vk/view_3d.cpp) | 20 | ||||
-rw-r--r-- | src/blucat/view_3d.hpp (renamed from src/vk/view_3d.hpp) | 10 | ||||
-rw-r--r-- | src/candy_gear.cpp | 12 | ||||
-rw-r--r-- | src/core.cpp | 148 | ||||
-rw-r--r-- | src/core.hpp | 64 | ||||
-rw-r--r-- | src/font.cpp | 14 | ||||
-rw-r--r-- | src/skeletal_mesh.cpp | 18 | ||||
-rw-r--r-- | src/skeletal_model.cpp | 28 | ||||
-rw-r--r-- | src/sprite.cpp | 24 | ||||
-rw-r--r-- | src/sprite_3d.cpp | 20 | ||||
-rw-r--r-- | src/static_mesh.cpp | 16 | ||||
-rw-r--r-- | src/static_model.cpp | 30 | ||||
-rw-r--r-- | src/texture.cpp | 36 | ||||
-rw-r--r-- | src/vector_4d.cpp | 6 | ||||
-rw-r--r-- | src/view_2d.cpp | 30 | ||||
-rw-r--r-- | src/view_2d.hpp | 6 | ||||
-rw-r--r-- | src/view_3d.cpp | 26 |
97 files changed, 737 insertions, 737 deletions
diff --git a/src/binary_reader.hpp b/src/binary_reader.hpp index 5dbff54..e09c13a 100644 --- a/src/binary_reader.hpp +++ b/src/binary_reader.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -17,7 +17,7 @@ #include <cstdint> #include <string> -#include "vk/core.hpp" +#include "blucat/core.hpp" class BinaryReader { diff --git a/src/vk/animation.cpp b/src/blucat/animation.cpp index fec038e..b4daeef 100644 --- a/src/vk/animation.cpp +++ b/src/blucat/animation.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -16,7 +16,7 @@ #include "animation.hpp" -namespace VK +namespace BluCat { Bone::Bone(glm::mat4 offset_matrix): diff --git a/src/vk/animation.hpp b/src/blucat/animation.hpp index 46dd5bc..c789c5e 100644 --- a/src/vk/animation.hpp +++ b/src/blucat/animation.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,15 +14,15 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_ANIMATION_H -#define CANDY_GEAR_VK_ANIMATION_H 1 +#ifndef CANDY_GEAR_BLUCAT_ANIMATION_H +#define CANDY_GEAR_BLUCAT_ANIMATION_H 1 #include <vector> #include "core.hpp" #include "animation/frame.hpp" -namespace VK +namespace BluCat { struct Bone @@ -48,4 +48,4 @@ struct Animation } -#endif /* CANDY_GEAR_VK_ANIMATION_H */ +#endif /* CANDY_GEAR_BLUCAT_ANIMATION_H */ diff --git a/src/vk/animation/frame.hpp b/src/blucat/animation/frame.hpp index 953a6a6..a1d5f39 100644 --- a/src/vk/animation/frame.hpp +++ b/src/blucat/animation/frame.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,14 +14,14 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_FRAME_H -#define CANDY_GEAR_VK_FRAME_H 1 +#ifndef CANDY_GEAR_BLUCAT_FRAME_H +#define CANDY_GEAR_BLUCAT_FRAME_H 1 #include <vector> #include "../core.hpp" -namespace VK +namespace BluCat { template<typename T> @@ -82,4 +82,4 @@ struct Channel }; } -#endif /* CANDY_GEAR_VK_FRAME_H */ +#endif /* CANDY_GEAR_BLUCAT_FRAME_H */ diff --git a/src/vk/base_buffer.cpp b/src/blucat/base_buffer.cpp index 0846b20..762c89a 100644 --- a/src/vk/base_buffer.cpp +++ b/src/blucat/base_buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -16,7 +16,7 @@ #include "base_buffer.hpp" -namespace VK +namespace BluCat { const CommandChain BaseBuffer::loader{ diff --git a/src/vk/base_buffer.hpp b/src/blucat/base_buffer.hpp index 0f3e513..03b838c 100644 --- a/src/vk/base_buffer.hpp +++ b/src/blucat/base_buffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,14 +14,14 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_BASE_BUFFER_H -#define CANDY_GEAR_VK_BASE_BUFFER_H 1 +#ifndef CANDY_GEAR_BLUCAT_BASE_BUFFER_H +#define CANDY_GEAR_BLUCAT_BASE_BUFFER_H 1 #include "../command.hpp" #include "core.hpp" #include "device.hpp" -namespace VK +namespace BluCat { class BaseBuffer @@ -53,4 +53,4 @@ class BaseBuffer } -#endif /* CANDY_GEAR_VK_BASE_BUFFER_H */ +#endif /* CANDY_GEAR_BLUCAT_BASE_BUFFER_H */ diff --git a/src/vk/character.cpp b/src/blucat/character.cpp index e5eb87f..c13ffef 100644 --- a/src/vk/character.cpp +++ b/src/blucat/character.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -27,16 +27,16 @@ namespace struct CharacterBuilder { - VK::Character *character; + BluCat::Character *character; FT_Face face; uint32_t character_code; CharacterBuilder( - VK::Character *character, FT_Face face, uint32_t character_code); + BluCat::Character *character, FT_Face face, uint32_t character_code); }; CharacterBuilder::CharacterBuilder( - VK::Character *character, FT_Face face, uint32_t character_code): + BluCat::Character *character, FT_Face face, uint32_t character_code): character{character}, face{face}, character_code{character_code} @@ -104,7 +104,7 @@ load_image(void *obj) } } - VK::SourceBuffer source_image_buffer{ + BluCat::SourceBuffer source_image_buffer{ cg_core.vk_device_with_swapchain, source_image_raw.data(), image_size}; @@ -116,7 +116,7 @@ load_image(void *obj) vk_extent3d.height = self->face->glyph->bitmap.rows; vk_extent3d.depth = 1; - VK::Image::create( + BluCat::Image::create( cg_core.vk_device_with_swapchain, &self->character->image, &self->character->device_memory, @@ -126,7 +126,7 @@ load_image(void *obj) VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT); } - catch(VK::Image::Error error) + catch(BluCat::Image::Error error) { throw CommandError{error.what()}; } @@ -136,11 +136,11 @@ load_image(void *obj) auto queue_family{cg_core.vk_device_with_swapchain-> get_queue_family_with_presentation()}; auto queue{queue_family->get_queue()}; - VK::CommandPool command_pool{queue_family, 1}; + BluCat::CommandPool command_pool{queue_family, 1}; VkCommandBuffer vk_command_buffer{command_pool.command_buffers[0]}; queue.submit_one_time_command(vk_command_buffer, [&](){ - VK::Image::move_image_state( + BluCat::Image::move_image_state( vk_command_buffer, self->character->image, VK_FORMAT_R8G8B8A8_UNORM, 0, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_PIPELINE_STAGE_HOST_BIT, @@ -162,7 +162,7 @@ load_image(void *obj) vk_command_buffer, source_image_buffer.buffer, self->character->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &image_copy); - VK::Image::move_image_state( + BluCat::Image::move_image_state( vk_command_buffer, self->character->image, VK_FORMAT_R8G8B8A8_UNORM, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, @@ -191,7 +191,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { Character::Character(FT_Face face, uint32_t character_code) diff --git a/src/vk/character.hpp b/src/blucat/character.hpp index 82ada49..43cc765 100644 --- a/src/vk/character.hpp +++ b/src/blucat/character.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_CHARACTER_H -#define CANDY_GEAR_VK_CHARACTER_H 1 +#ifndef CANDY_GEAR_BLUCAT_CHARACTER_H +#define CANDY_GEAR_BLUCAT_CHARACTER_H 1 #include <ft2build.h> #include FT_FREETYPE_H @@ -24,7 +24,7 @@ #include <vector> -namespace VK +namespace BluCat { struct Character @@ -46,4 +46,4 @@ struct Character } -#endif /* CANDY_GEAR_VK_CHARACTER_H */ +#endif /* CANDY_GEAR_BLUCAT_CHARACTER_H */ diff --git a/src/vk/command_pool.cpp b/src/blucat/command_pool.cpp index 3af62c1..898d7ae 100644 --- a/src/vk/command_pool.cpp +++ b/src/blucat/command_pool.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -16,7 +16,7 @@ #include "command_pool.hpp" -namespace VK +namespace BluCat { const CommandChain CommandPool::loader{ diff --git a/src/vk/command_pool.hpp b/src/blucat/command_pool.hpp index 68ab7a6..aa23387 100644 --- a/src/vk/command_pool.hpp +++ b/src/blucat/command_pool.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_COMMAND_POOL_H -#define CANDY_GEAR_VK_COMMAND_POOL_H 1 +#ifndef CANDY_GEAR_BLUCAT_COMMAND_POOL_H +#define CANDY_GEAR_BLUCAT_COMMAND_POOL_H 1 #include <vector> @@ -23,7 +23,7 @@ #include "core.hpp" #include "device.hpp" -namespace VK +namespace BluCat { class CommandPool @@ -56,4 +56,4 @@ private: } -#endif /* CANDY_GEAR_VK_COMMAND_POOL_H */ +#endif /* CANDY_GEAR_BLUCAT_COMMAND_POOL_H */ diff --git a/src/vk/core.hpp b/src/blucat/core.hpp index 736b8bb..169e3bc 100644 --- a/src/vk/core.hpp +++ b/src/blucat/core.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_CORE_H -#define CANDY_GEAR_VK_CORE_H 1 +#ifndef CANDY_GEAR_BLUCAT_CORE_H +#define CANDY_GEAR_BLUCAT_CORE_H 1 // GLM uses some definitions to control their behavior, so you should not // include it directly. Instead, use this header. @@ -31,4 +31,4 @@ #include <vulkan/vulkan.h> -#endif /* CANDY_GEAR_VK_CORE_H */ +#endif /* CANDY_GEAR_BLUCAT_CORE_H */ diff --git a/src/vk/descriptor_set_layout.cpp b/src/blucat/descriptor_set_layout.cpp index 8a2f4ef..0fc5208 100644 --- a/src/vk/descriptor_set_layout.cpp +++ b/src/blucat/descriptor_set_layout.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -26,7 +26,7 @@ namespace void load_world(void *obj) { - auto self = static_cast<VK::DescriptorSetLayout*>(obj); + auto self = static_cast<BluCat::DescriptorSetLayout*>(obj); std::array<VkDescriptorSetLayoutBinding, 2> set_layouts{}; set_layouts[0].binding = 0; @@ -58,7 +58,7 @@ load_world(void *obj) void unload_world(void *obj) { - auto self = static_cast<VK::DescriptorSetLayout*>(obj); + auto self = static_cast<BluCat::DescriptorSetLayout*>(obj); vkDestroyDescriptorSetLayout( cg_core.vk_device_with_swapchain->device, self->world, nullptr); @@ -67,7 +67,7 @@ unload_world(void *obj) void load_view(void *obj) { - auto self = static_cast<VK::DescriptorSetLayout*>(obj); + auto self = static_cast<BluCat::DescriptorSetLayout*>(obj); std::array<VkDescriptorSetLayoutBinding, 1> layout_bindings{}; @@ -94,7 +94,7 @@ load_view(void *obj) void unload_view(void *obj) { - auto self = static_cast<VK::DescriptorSetLayout*>(obj); + auto self = static_cast<BluCat::DescriptorSetLayout*>(obj); vkDestroyDescriptorSetLayout( cg_core.vk_device_with_swapchain->device, self->view, nullptr); @@ -103,7 +103,7 @@ unload_view(void *obj) void load_texture(void *obj) { - auto self = static_cast<VK::DescriptorSetLayout*>(obj); + auto self = static_cast<BluCat::DescriptorSetLayout*>(obj); std::array<VkDescriptorSetLayoutBinding, 1> layout_bindings{}; @@ -131,7 +131,7 @@ load_texture(void *obj) void unload_texture(void *obj) { - auto self = static_cast<VK::DescriptorSetLayout*>(obj); + auto self = static_cast<BluCat::DescriptorSetLayout*>(obj); vkDestroyDescriptorSetLayout( cg_core.vk_device_with_swapchain->device, self->texture, nullptr); @@ -140,7 +140,7 @@ unload_texture(void *obj) void load_model(void *obj) { - auto self = static_cast<VK::DescriptorSetLayout*>(obj); + auto self = static_cast<BluCat::DescriptorSetLayout*>(obj); std::array<VkDescriptorSetLayoutBinding, 1> layout_bindings; layout_bindings[0].binding = 0; @@ -166,7 +166,7 @@ load_model(void *obj) void unload_model(void *obj) { - auto self = static_cast<VK::DescriptorSetLayout*>(obj); + auto self = static_cast<BluCat::DescriptorSetLayout*>(obj); vkDestroyDescriptorSetLayout( cg_core.vk_device_with_swapchain->device, self->model, nullptr); @@ -181,7 +181,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { DescriptorSetLayout::DescriptorSetLayout() diff --git a/src/vk/descriptor_set_layout.hpp b/src/blucat/descriptor_set_layout.hpp index 242d2fa..144a137 100644 --- a/src/vk/descriptor_set_layout.hpp +++ b/src/blucat/descriptor_set_layout.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_DESCRIPTOR_SET_LAYOUT_H -#define CANDY_GEAR_VK_DESCRIPTOR_SET_LAYOUT_H 1 +#ifndef CANDY_GEAR_BLUCAT_DESCRIPTOR_SET_LAYOUT_H +#define CANDY_GEAR_BLUCAT_DESCRIPTOR_SET_LAYOUT_H 1 #include "core.hpp" -namespace VK +namespace BluCat { struct DescriptorSetLayout @@ -35,4 +35,4 @@ struct DescriptorSetLayout } -#endif /* CANDY_GEAR_VK_DESCRIPTOR_SET_LAYOUT_H */ +#endif /* CANDY_GEAR_BLUCAT_DESCRIPTOR_SET_LAYOUT_H */ diff --git a/src/vk/destination_buffer.cpp b/src/blucat/destination_buffer.cpp index 5c55fd2..ea5f31e 100644 --- a/src/vk/destination_buffer.cpp +++ b/src/blucat/destination_buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -18,7 +18,7 @@ #include "command_pool.hpp" -namespace VK +namespace BluCat { DestinationBuffer::DestinationBuffer( diff --git a/src/vk/destination_buffer.hpp b/src/blucat/destination_buffer.hpp index 9b42af3..8c098ab 100644 --- a/src/vk/destination_buffer.hpp +++ b/src/blucat/destination_buffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,15 +14,15 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_DESTINATION_BUFFER_H -#define CANDY_GEAR_VK_DESTINATION_BUFFER_H 1 +#ifndef CANDY_GEAR_BLUCAT_DESTINATION_BUFFER_H +#define CANDY_GEAR_BLUCAT_DESTINATION_BUFFER_H 1 #include "base_buffer.hpp" #include "core.hpp" #include "source_buffer.hpp" #include "queue_family.hpp" -namespace VK +namespace BluCat { struct DestinationBuffer: public BaseBuffer @@ -51,4 +51,4 @@ struct DestinationBuffer: public BaseBuffer } -#endif /* CANDY_GEAR_VK_DESTINATION_BUFFER_H */ +#endif /* CANDY_GEAR_BLUCAT_DESTINATION_BUFFER_H */ diff --git a/src/vk/device.cpp b/src/blucat/device.cpp index 78baa53..cf21fa4 100644 --- a/src/vk/device.cpp +++ b/src/blucat/device.cpp @@ -61,7 +61,7 @@ create_shader_module(VkDevice vk_device, const char *filename) } } -namespace VK +namespace BluCat { Device::Device(VkPhysicalDevice vk_physical_device, bool with_swapchain) diff --git a/src/vk/device.hpp b/src/blucat/device.hpp index e52a143..bcfca4d 100644 --- a/src/vk/device.hpp +++ b/src/blucat/device.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_DEVICE_H -#define CANDY_GEAR_VK_DEVICE_H 1 +#ifndef CANDY_GEAR_BLUCAT_DEVICE_H +#define CANDY_GEAR_BLUCAT_DEVICE_H 1 #include <cstdlib> #include <vector> @@ -23,7 +23,7 @@ #include "core.hpp" #include "queue_family.hpp" -namespace VK +namespace BluCat { struct Device @@ -66,4 +66,4 @@ public: } -#endif /* CANDY_GEAR_VK_DEVICE_H */ +#endif /* CANDY_GEAR_BLUCAT_DEVICE_H */ diff --git a/src/vk/font.cpp b/src/blucat/font.cpp index cb01a51..4195b57 100644 --- a/src/vk/font.cpp +++ b/src/blucat/font.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -18,7 +18,7 @@ #include "../core.hpp" -namespace VK +namespace BluCat { Font::Font(const char* font_path, int font_size) diff --git a/src/vk/font.hpp b/src/blucat/font.hpp index b654183..1b9be69 100644 --- a/src/vk/font.hpp +++ b/src/blucat/font.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,15 +14,15 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_FONT_H -#define CANDY_GEAR_VK_FONT_H 1 +#ifndef CANDY_GEAR_BLUCAT_FONT_H +#define CANDY_GEAR_BLUCAT_FONT_H 1 #include <memory> #include <unordered_map> #include "character.hpp" -namespace VK +namespace BluCat { struct Font @@ -39,4 +39,4 @@ struct Font } -#endif /* CANDY_GEAR_VK_FONT_H */ +#endif /* CANDY_GEAR_BLUCAT_FONT_H */ diff --git a/src/vk/framebuffer.cpp b/src/blucat/framebuffer.cpp index 4104554..e761ff2 100644 --- a/src/vk/framebuffer.cpp +++ b/src/blucat/framebuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -24,7 +24,7 @@ namespace void load_depth_image(void *obj) { - auto self = static_cast<VK::Framebuffer*>(obj); + auto self = static_cast<BluCat::Framebuffer*>(obj); VkExtent3D extent3d{}; extent3d.width = cg_core.display_width; @@ -33,7 +33,7 @@ load_depth_image(void *obj) try { - VK::Image::create( + BluCat::Image::create( cg_core.vk_device_with_swapchain, &self->depth_image, &self->depth_image_memory, @@ -44,7 +44,7 @@ load_depth_image(void *obj) VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT ); } - catch(VK::Image::Error error) + catch(BluCat::Image::Error error) { std::string error_message{"Failed to create depth image → "}; error_message += error.what(); @@ -55,7 +55,7 @@ load_depth_image(void *obj) void unload_depth_image(void *obj) { - auto self = static_cast<VK::Framebuffer*>(obj); + auto self = static_cast<BluCat::Framebuffer*>(obj); vkDestroyImage( cg_core.vk_device_with_swapchain->device, self->depth_image, @@ -68,16 +68,16 @@ unload_depth_image(void *obj) void load_depth_image_view(void *obj) { - auto self = static_cast<VK::Framebuffer*>(obj); + auto self = static_cast<BluCat::Framebuffer*>(obj); try { - VK::Image::create_view( + BluCat::Image::create_view( cg_core.vk_device_with_swapchain, &self->depth_image_view, self->depth_image, VK_FORMAT_D32_SFLOAT, VK_IMAGE_ASPECT_DEPTH_BIT); } - catch(VK::Image::Error error) + catch(BluCat::Image::Error error) { std::string error_message{"Failed to create depth image view → "}; error_message += error.what(); @@ -88,7 +88,7 @@ load_depth_image_view(void *obj) void unload_depth_image_view(void *obj) { - auto self = static_cast<VK::Framebuffer*>(obj); + auto self = static_cast<BluCat::Framebuffer*>(obj); vkDestroyImageView( cg_core.vk_device_with_swapchain->device, self->depth_image_view, nullptr); @@ -97,7 +97,7 @@ unload_depth_image_view(void *obj) void load_3d(void *obj) { - auto self = static_cast<VK::Framebuffer*>(obj); + auto self = static_cast<BluCat::Framebuffer*>(obj); self->pipeline_3d.resize(cg_core.vk_swapchain->images_count); for (auto i{0}; i < cg_core.vk_swapchain->images_count; i++) @@ -127,7 +127,7 @@ load_3d(void *obj) void unload_3d(void *obj) { - auto self = static_cast<VK::Framebuffer*>(obj); + auto self = static_cast<BluCat::Framebuffer*>(obj); for(auto framebuffer: self->pipeline_3d) vkDestroyFramebuffer( @@ -137,7 +137,7 @@ unload_3d(void *obj) void load_2d(void *obj) { - auto self = static_cast<VK::Framebuffer*>(obj); + auto self = static_cast<BluCat::Framebuffer*>(obj); self->pipeline_2d.resize(cg_core.vk_swapchain->images_count); for (auto i{0}; i < cg_core.vk_swapchain->images_count; i++) @@ -166,7 +166,7 @@ load_2d(void *obj) void unload_2d(void *obj) { - auto self = static_cast<VK::Framebuffer*>(obj); + auto self = static_cast<BluCat::Framebuffer*>(obj); for(auto framebuffer: self->pipeline_2d) vkDestroyFramebuffer( @@ -182,7 +182,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { Framebuffer::Framebuffer() diff --git a/src/vk/framebuffer.hpp b/src/blucat/framebuffer.hpp index 2867fa1..32968a6 100644 --- a/src/vk/framebuffer.hpp +++ b/src/blucat/framebuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,14 +14,14 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_FRAMEBUFFER_H -#define CANDY_GEAR_VK_FRAMEBUFFER_H 1 +#ifndef CANDY_GEAR_BLUCAT_FRAMEBUFFER_H +#define CANDY_GEAR_BLUCAT_FRAMEBUFFER_H 1 #include <vector> #include "core.hpp" -namespace VK +namespace BluCat { struct Framebuffer @@ -40,4 +40,4 @@ struct Framebuffer } -#endif /* CANDY_GEAR_VK_FRAMEBUFFER_H */ +#endif /* CANDY_GEAR_BLUCAT_FRAMEBUFFER_H */ diff --git a/src/vk/graphics_pipeline_2d_solid.cpp b/src/blucat/graphics_pipeline_2d_solid.cpp index f914594..28b19b6 100644 --- a/src/vk/graphics_pipeline_2d_solid.cpp +++ b/src/blucat/graphics_pipeline_2d_solid.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -28,7 +28,7 @@ namespace void load_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DSolid*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DSolid*>(obj); VkPipelineShaderStageCreateInfo vert_shader_stage_info{}; vert_shader_stage_info.sType = @@ -207,7 +207,7 @@ load_pipeline(void *obj) void unload_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DSolid*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DSolid*>(obj); vkDestroyPipeline( cg_core.vk_device_with_swapchain->device, self->graphic_pipeline, nullptr); @@ -219,7 +219,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { GraphicsPipeline2DSolid::GraphicsPipeline2DSolid() diff --git a/src/vk/graphics_pipeline_2d_solid.hpp b/src/blucat/graphics_pipeline_2d_solid.hpp index eac825f..eae54ae 100644 --- a/src/vk/graphics_pipeline_2d_solid.hpp +++ b/src/blucat/graphics_pipeline_2d_solid.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_SOLID_H -#define CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_SOLID_H 1 +#ifndef CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_SOLID_H +#define CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_SOLID_H 1 #include <memory> @@ -23,7 +23,7 @@ #include "command_pool.hpp" #include "view_2d.hpp" -namespace VK +namespace BluCat { struct GraphicsPipeline2DSolid @@ -41,4 +41,4 @@ struct GraphicsPipeline2DSolid } -#endif /* CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_SOLID_H */ +#endif /* CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_SOLID_H */ diff --git a/src/vk/graphics_pipeline_2d_solid_layout.cpp b/src/blucat/graphics_pipeline_2d_solid_layout.cpp index 11d080b..7b537a2 100644 --- a/src/vk/graphics_pipeline_2d_solid_layout.cpp +++ b/src/blucat/graphics_pipeline_2d_solid_layout.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -27,7 +27,7 @@ namespace void load_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DSolidLayout*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DSolidLayout*>(obj); std::array<VkDescriptorSetLayout, 2> set_layouts{ cg_core.vk_descriptor_set_layout->view, @@ -37,7 +37,7 @@ load_pipeline(void *obj) std::array<VkPushConstantRange, 1> push_constants; push_constants[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT; push_constants[0].offset = 0; - push_constants[0].size = sizeof(VK::UDOVector4D); + push_constants[0].size = sizeof(BluCat::UDOVector4D); VkPipelineLayoutCreateInfo pipeline_layout_info{}; pipeline_layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; @@ -55,7 +55,7 @@ load_pipeline(void *obj) void unload_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DSolidLayout*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DSolidLayout*>(obj); vkDestroyPipelineLayout( cg_core.vk_device_with_swapchain->device, self->pipeline, nullptr); @@ -67,7 +67,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { GraphicsPipeline2DSolidLayout::GraphicsPipeline2DSolidLayout() diff --git a/src/vk/graphics_pipeline_2d_solid_layout.hpp b/src/blucat/graphics_pipeline_2d_solid_layout.hpp index 0bb9de8..77172be 100644 --- a/src/vk/graphics_pipeline_2d_solid_layout.hpp +++ b/src/blucat/graphics_pipeline_2d_solid_layout.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_LAYOUT_H -#define CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_LAYOUT_H 1 +#ifndef CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_LAYOUT_H +#define CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_LAYOUT_H 1 #include "core.hpp" -namespace VK +namespace BluCat { struct GraphicsPipeline2DSolidLayout @@ -32,4 +32,4 @@ struct GraphicsPipeline2DSolidLayout } -#endif /* CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_LAYOUT_H */ +#endif /* CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_LAYOUT_H */ diff --git a/src/vk/graphics_pipeline_2d_wired.cpp b/src/blucat/graphics_pipeline_2d_wired.cpp index ef43cd1..192a9d6 100644 --- a/src/vk/graphics_pipeline_2d_wired.cpp +++ b/src/blucat/graphics_pipeline_2d_wired.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -29,7 +29,7 @@ namespace void load_indexes(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DWired*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DWired*>(obj); self->queue_family = cg_core.vk_device_with_swapchain->get_queue_family_with_graphics(); @@ -37,9 +37,9 @@ load_indexes(void *obj) std::array<uint32_t, 4> indexes{0, 1, 2, 3}; void *indexes_data{indexes.data()}; size_t indexes_size{sizeof(indexes[0]) * indexes.size()}; - VK::SourceBuffer source_index_buffer{ + BluCat::SourceBuffer source_index_buffer{ self->queue_family->device, indexes_data, indexes_size}; - self->index_buffer = new VK::DestinationBuffer{ + self->index_buffer = new BluCat::DestinationBuffer{ self->queue_family, &source_index_buffer, VK_BUFFER_USAGE_INDEX_BUFFER_BIT}; } @@ -47,7 +47,7 @@ load_indexes(void *obj) void unload_indexes(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DWired*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DWired*>(obj); delete self->index_buffer; } @@ -55,7 +55,7 @@ unload_indexes(void *obj) void load_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DWired*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DWired*>(obj); VkPipelineShaderStageCreateInfo vert_shader_stage_info{}; vert_shader_stage_info.sType = @@ -218,7 +218,7 @@ load_pipeline(void *obj) void unload_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DWired*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DWired*>(obj); vkDestroyPipeline( cg_core.vk_device_with_swapchain->device, self->graphic_pipeline, nullptr); @@ -231,7 +231,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { GraphicsPipeline2DWired::GraphicsPipeline2DWired() diff --git a/src/vk/graphics_pipeline_2d_wired.hpp b/src/blucat/graphics_pipeline_2d_wired.hpp index 932ed61..32d965b 100644 --- a/src/vk/graphics_pipeline_2d_wired.hpp +++ b/src/blucat/graphics_pipeline_2d_wired.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,15 +14,15 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_WIRED_H -#define CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_WIRED_H 1 +#ifndef CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_WIRED_H +#define CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_WIRED_H 1 #include <memory> #include "core.hpp" #include "view_2d.hpp" -namespace VK +namespace BluCat { struct GraphicsPipeline2DWired @@ -44,4 +44,4 @@ struct GraphicsPipeline2DWired } -#endif /* CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_WIRED_H */ +#endif /* CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_WIRED_H */ diff --git a/src/vk/graphics_pipeline_2d_wired_layout.cpp b/src/blucat/graphics_pipeline_2d_wired_layout.cpp index 10e2b50..eaa6af7 100644 --- a/src/vk/graphics_pipeline_2d_wired_layout.cpp +++ b/src/blucat/graphics_pipeline_2d_wired_layout.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -28,7 +28,7 @@ namespace void load_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DWiredLayout*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DWiredLayout*>(obj); std::array<VkDescriptorSetLayout, 1> set_layouts{ cg_core.vk_descriptor_set_layout->view @@ -37,11 +37,11 @@ load_pipeline(void *obj) std::array<VkPushConstantRange, 2> push_constants; push_constants[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT; push_constants[0].offset = 0; - push_constants[0].size = sizeof(VK::UDOVector4D); + push_constants[0].size = sizeof(BluCat::UDOVector4D); push_constants[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; - push_constants[1].offset = sizeof(VK::UDOVector4D); - push_constants[1].size = sizeof(VK::UDOVector3D); + push_constants[1].offset = sizeof(BluCat::UDOVector4D); + push_constants[1].size = sizeof(BluCat::UDOVector3D); VkPipelineLayoutCreateInfo pipeline_layout_info{}; pipeline_layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; @@ -59,7 +59,7 @@ load_pipeline(void *obj) void unload_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline2DWiredLayout*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline2DWiredLayout*>(obj); vkDestroyPipelineLayout( cg_core.vk_device_with_swapchain->device, self->pipeline, nullptr); @@ -71,7 +71,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { GraphicsPipeline2DWiredLayout::GraphicsPipeline2DWiredLayout() diff --git a/src/vk/graphics_pipeline_2d_wired_layout.hpp b/src/blucat/graphics_pipeline_2d_wired_layout.hpp index 004f009..d447230 100644 --- a/src/vk/graphics_pipeline_2d_wired_layout.hpp +++ b/src/blucat/graphics_pipeline_2d_wired_layout.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_WIRED_LAYOUT_H -#define CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_WIRED_LAYOUT_H 1 +#ifndef CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_WIRED_LAYOUT_H +#define CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_WIRED_LAYOUT_H 1 #include "core.hpp" -namespace VK +namespace BluCat { struct GraphicsPipeline2DWiredLayout @@ -32,4 +32,4 @@ struct GraphicsPipeline2DWiredLayout } -#endif /* CANDY_GEAR_VK_GRAPHICS_PIPELINE_2D_LAYOUT_H */ +#endif /* CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_2D_LAYOUT_H */ diff --git a/src/vk/graphics_pipeline_3d.cpp b/src/blucat/graphics_pipeline_3d.cpp index 2a1fec1..c1b60a6 100644 --- a/src/vk/graphics_pipeline_3d.cpp +++ b/src/blucat/graphics_pipeline_3d.cpp @@ -30,7 +30,7 @@ namespace void load_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline3D*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline3D*>(obj); VkPipelineShaderStageCreateInfo vert_shader_stage_info = {}; vert_shader_stage_info.sType = @@ -61,7 +61,7 @@ load_pipeline(void *obj) VkVertexInputBindingDescription vertex_input_binding{}; vertex_input_binding.binding = 0; - vertex_input_binding.stride = sizeof(VK::StaticMeshVertex); + vertex_input_binding.stride = sizeof(BluCat::StaticMeshVertex); vertex_input_binding.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; std::array<VkVertexInputAttributeDescription, 3> vertex_attribute{}; @@ -69,17 +69,17 @@ load_pipeline(void *obj) vertex_attribute[0].location = 0; vertex_attribute[0].binding = 0; vertex_attribute[0].format = VK_FORMAT_R32G32B32_SFLOAT; - vertex_attribute[0].offset = offsetof(VK::StaticMeshVertex, position); + vertex_attribute[0].offset = offsetof(BluCat::StaticMeshVertex, position); // Normal. vertex_attribute[1].location = 1; vertex_attribute[1].binding = 0; vertex_attribute[1].format = VK_FORMAT_R32G32B32_SFLOAT; - vertex_attribute[1].offset = offsetof(VK::StaticMeshVertex, normal); + vertex_attribute[1].offset = offsetof(BluCat::StaticMeshVertex, normal); // Texture coordinate. vertex_attribute[2].location = 2; vertex_attribute[2].binding = 0; vertex_attribute[2].format = VK_FORMAT_R32G32_SFLOAT; - vertex_attribute[2].offset = offsetof(VK::StaticMeshVertex, texture_coord); + vertex_attribute[2].offset = offsetof(BluCat::StaticMeshVertex, texture_coord); VkPipelineVertexInputStateCreateInfo vertex_input_info = {}; vertex_input_info.sType = @@ -229,7 +229,7 @@ load_pipeline(void *obj) void unload_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline3D*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline3D*>(obj); vkDestroyPipeline( cg_core.vk_device_with_swapchain->device, self->graphic_pipeline, nullptr); @@ -241,7 +241,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { GraphicsPipeline3D::GraphicsPipeline3D() @@ -297,7 +297,7 @@ GraphicsPipeline3D::draw( vkCmdDrawIndexed( draw_command_buffer, static_mesh->index_count, 1, 0, 0, 0); - VK::UDOStaticModel udo_static_model{}; + BluCat::UDOStaticModel udo_static_model{}; udo_static_model.base_matrix = translation_matrix * rotation_matrix; instance->uniform_buffers[image_index].copy_data(&udo_static_model); } diff --git a/src/vk/graphics_pipeline_3d.hpp b/src/blucat/graphics_pipeline_3d.hpp index bfe034d..de0c422 100644 --- a/src/vk/graphics_pipeline_3d.hpp +++ b/src/blucat/graphics_pipeline_3d.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_GRAPHICS_PIPELINE_3D_H -#define CANDY_GEAR_VK_GRAPHICS_PIPELINE_3D_H 1 +#ifndef CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_3D_H +#define CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_3D_H 1 #include <memory> @@ -23,7 +23,7 @@ #include "command_pool.hpp" #include "view_3d.hpp" -namespace VK +namespace BluCat { struct GraphicsPipeline3D @@ -40,4 +40,4 @@ struct GraphicsPipeline3D } -#endif /* CANDY_GEAR_VK_GRAPHICS_PIPELINE_3D_H */ +#endif /* CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_3D_H */ diff --git a/src/vk/graphics_pipeline_3d_layout.cpp b/src/blucat/graphics_pipeline_3d_layout.cpp index c316518..b2a54d6 100644 --- a/src/vk/graphics_pipeline_3d_layout.cpp +++ b/src/blucat/graphics_pipeline_3d_layout.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -27,7 +27,7 @@ namespace void load_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline3DLayout*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline3DLayout*>(obj); std::array<VkDescriptorSetLayout, 4> set_layouts{ cg_core.vk_descriptor_set_layout->world, @@ -51,7 +51,7 @@ load_pipeline(void *obj) void unload_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline3DLayout*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline3DLayout*>(obj); vkDestroyPipelineLayout( cg_core.vk_device_with_swapchain->device, self->pipeline, nullptr); @@ -63,7 +63,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { GraphicsPipeline3DLayout::GraphicsPipeline3DLayout() diff --git a/src/vk/graphics_pipeline_3d_layout.hpp b/src/blucat/graphics_pipeline_3d_layout.hpp index 4b2b9b9..2b44dac 100644 --- a/src/vk/graphics_pipeline_3d_layout.hpp +++ b/src/blucat/graphics_pipeline_3d_layout.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_GRAPHICS_PIPELINE_3D_LAYOUT_H -#define CANDY_GEAR_VK_GRAPHICS_PIPELINE_3D_LAYOUT_H 1 +#ifndef CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_3D_LAYOUT_H +#define CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_3D_LAYOUT_H 1 #include "core.hpp" -namespace VK +namespace BluCat { struct GraphicsPipeline3DLayout @@ -32,4 +32,4 @@ struct GraphicsPipeline3DLayout } -#endif /* CANDY_GEAR_VK_GRAPHICS_PIPELINE_3D_LAYOUT_H */ +#endif /* CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_3D_LAYOUT_H */ diff --git a/src/vk/graphics_pipeline_3d_skeletal.cpp b/src/blucat/graphics_pipeline_3d_skeletal.cpp index 6bd1713..b039c00 100644 --- a/src/vk/graphics_pipeline_3d_skeletal.cpp +++ b/src/blucat/graphics_pipeline_3d_skeletal.cpp @@ -30,7 +30,7 @@ namespace void load_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline3DSkeletal*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline3DSkeletal*>(obj); VkPipelineShaderStageCreateInfo vert_shader_stage_info = {}; vert_shader_stage_info.sType = @@ -61,7 +61,7 @@ load_pipeline(void *obj) VkVertexInputBindingDescription vertex_input_binding{}; vertex_input_binding.binding = 0; - vertex_input_binding.stride = sizeof(VK::SkeletalMeshVertex); + vertex_input_binding.stride = sizeof(BluCat::SkeletalMeshVertex); vertex_input_binding.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; std::array<VkVertexInputAttributeDescription, 5> vertex_attribute{}; @@ -69,27 +69,27 @@ load_pipeline(void *obj) vertex_attribute[0].location = 0; vertex_attribute[0].binding = 0; vertex_attribute[0].format = VK_FORMAT_R32G32B32_SFLOAT; - vertex_attribute[0].offset = offsetof(VK::SkeletalMeshVertex, position); + vertex_attribute[0].offset = offsetof(BluCat::SkeletalMeshVertex, position); // Normal. vertex_attribute[1].location = 1; vertex_attribute[1].binding = 0; vertex_attribute[1].format = VK_FORMAT_R32G32B32_SFLOAT; - vertex_attribute[1].offset = offsetof(VK::SkeletalMeshVertex, normal); + vertex_attribute[1].offset = offsetof(BluCat::SkeletalMeshVertex, normal); // Texture coordinate. vertex_attribute[2].location = 2; vertex_attribute[2].binding = 0; vertex_attribute[2].format = VK_FORMAT_R32G32_SFLOAT; - vertex_attribute[2].offset = offsetof(VK::SkeletalMeshVertex, texture_coord); + vertex_attribute[2].offset = offsetof(BluCat::SkeletalMeshVertex, texture_coord); // Bones ids. vertex_attribute[3].location = 3; vertex_attribute[3].binding = 0; vertex_attribute[3].format = VK_FORMAT_R32G32B32A32_SINT; - vertex_attribute[3].offset = offsetof(VK::SkeletalMeshVertex, bone_ids); + vertex_attribute[3].offset = offsetof(BluCat::SkeletalMeshVertex, bone_ids); // Bones weights. vertex_attribute[4].location = 4; vertex_attribute[4].binding = 0; vertex_attribute[4].format = VK_FORMAT_R32G32B32A32_SFLOAT; - vertex_attribute[4].offset = offsetof(VK::SkeletalMeshVertex, bone_weights); + vertex_attribute[4].offset = offsetof(BluCat::SkeletalMeshVertex, bone_weights); VkPipelineVertexInputStateCreateInfo vertex_input_info = {}; vertex_input_info.sType = @@ -239,7 +239,7 @@ load_pipeline(void *obj) void unload_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipeline3DSkeletal*>(obj); + auto self = static_cast<BluCat::GraphicsPipeline3DSkeletal*>(obj); vkDestroyPipeline( cg_core.vk_device_with_swapchain->device, self->graphic_pipeline, nullptr); @@ -251,7 +251,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { GraphicsPipeline3DSkeletal::GraphicsPipeline3DSkeletal() @@ -307,7 +307,7 @@ GraphicsPipeline3DSkeletal::draw( vkCmdDrawIndexed( draw_command_buffer, skeletal_mesh->index_count, 1, 0, 0, 0); - VK::UDOSkeletalModel udo_skeletal_model{}; + BluCat::UDOSkeletalModel udo_skeletal_model{}; instance->tick(cg_core.delta_time); udo_skeletal_model.base_matrix = translation_matrix * rotation_matrix; std::copy(instance->bone_transforms.begin(), diff --git a/src/vk/graphics_pipeline_3d_skeletal.hpp b/src/blucat/graphics_pipeline_3d_skeletal.hpp index 027b42e..430d2ec 100644 --- a/src/vk/graphics_pipeline_3d_skeletal.hpp +++ b/src/blucat/graphics_pipeline_3d_skeletal.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_GRAPHICS_PIPELINE_3D_SKELETAL_H -#define CANDY_GEAR_VK_GRAPHICS_PIPELINE_3D_SKELETAL_H 1 +#ifndef CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_3D_SKELETAL_H +#define CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_3D_SKELETAL_H 1 #include <memory> @@ -23,7 +23,7 @@ #include "command_pool.hpp" #include "view_3d.hpp" -namespace VK +namespace BluCat { struct GraphicsPipeline3DSkeletal @@ -40,4 +40,4 @@ struct GraphicsPipeline3DSkeletal } -#endif /* CANDY_GEAR_VK_GRAPHICS_PIPELINE_SKELETAL_3D_H */ +#endif /* CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_SKELETAL_3D_H */ diff --git a/src/vk/graphics_pipeline_sprite_3d.cpp b/src/blucat/graphics_pipeline_sprite_3d.cpp index 0a4d520..a71e8bc 100644 --- a/src/vk/graphics_pipeline_sprite_3d.cpp +++ b/src/blucat/graphics_pipeline_sprite_3d.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -28,7 +28,7 @@ namespace struct Sprite3DOrder { - std::shared_ptr<VK::Sprite3D> sprite_3d; + std::shared_ptr<BluCat::Sprite3D> sprite_3d; float distance; }; @@ -47,7 +47,7 @@ operator>(const Sprite3DOrder &a, const Sprite3DOrder &b) void load_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipelineSprite3D*>(obj); + auto self = static_cast<BluCat::GraphicsPipelineSprite3D*>(obj); VkPipelineShaderStageCreateInfo vert_shader_stage_info{}; vert_shader_stage_info.sType = @@ -238,7 +238,7 @@ load_pipeline(void *obj) void unload_pipeline(void *obj) { - auto self = static_cast<VK::GraphicsPipelineSprite3D*>(obj); + auto self = static_cast<BluCat::GraphicsPipelineSprite3D*>(obj); vkDestroyPipeline( cg_core.vk_device_with_swapchain->device, self->graphic_pipeline, nullptr); @@ -250,7 +250,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { GraphicsPipelineSprite3D::GraphicsPipelineSprite3D() @@ -277,7 +277,7 @@ GraphicsPipelineSprite3D::draw( sprite_3d_order.reserve( cg_core.vk_renderer->sprites_3d_to_draw[current_frame].size()); - for(std::shared_ptr<VK::Sprite3D> sprite: + for(std::shared_ptr<BluCat::Sprite3D> sprite: cg_core.vk_renderer->sprites_3d_to_draw[current_frame]) sprite_3d_order.emplace_back( sprite, glm::distance(*view->camera_position, *sprite->position)); diff --git a/src/vk/graphics_pipeline_sprite_3d.hpp b/src/blucat/graphics_pipeline_sprite_3d.hpp index eb7aa34..969f905 100644 --- a/src/vk/graphics_pipeline_sprite_3d.hpp +++ b/src/blucat/graphics_pipeline_sprite_3d.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_GRAPHICS_PIPELINE_SPRITE_3D_H -#define CANDY_GEAR_VK_GRAPHICS_PIPELINE_SPRITE_3D_H 1 +#ifndef CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_SPRITE_3D_H +#define CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_SPRITE_3D_H 1 #include <memory> @@ -24,7 +24,7 @@ #include "sprite_3d.hpp" #include "view_3d.hpp" -namespace VK +namespace BluCat { struct GraphicsPipelineSprite3D @@ -41,4 +41,4 @@ struct GraphicsPipelineSprite3D } -#endif /* CANDY_GEAR_VK_GRAPHICS_PIPELINE_SPRITE_3D_H */ +#endif /* CANDY_GEAR_BLUCAT_GRAPHICS_PIPELINE_SPRITE_3D_H */ diff --git a/src/vk/image.cpp b/src/blucat/image.cpp index 7d751c8..7f8633f 100644 --- a/src/vk/image.cpp +++ b/src/blucat/image.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -18,7 +18,7 @@ #include "../core.hpp" -namespace VK::Image +namespace BluCat::Image { Error::Error(const std::string &m): @@ -39,7 +39,7 @@ Error::what() const noexcept void create( - VK::Device *device, + BluCat::Device *device, VkImage *image, VkDeviceMemory *image_memory, VkFormat format, @@ -117,7 +117,7 @@ void move_image_state( } void create_view( - VK::Device *device, + BluCat::Device *device, VkImageView *image_view, const VkImage &image, VkFormat format, diff --git a/src/vk/image.hpp b/src/blucat/image.hpp index 4849038..cb6cfd4 100644 --- a/src/vk/image.hpp +++ b/src/blucat/image.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef BLUE_KITTY_VK_IMAGE_H -#define BLUE_KITTY_VK_IMAGE_H 1 +#ifndef BLUE_KITTY_BLUCAT_IMAGE_H +#define BLUE_KITTY_BLUCAT_IMAGE_H 1 #include <memory> #include <string> @@ -23,7 +23,7 @@ #include "core.hpp" #include "device.hpp" -namespace VK::Image +namespace BluCat::Image { struct Error: public std::exception @@ -40,7 +40,7 @@ private: void create( - VK::Device *device, + BluCat::Device *device, VkImage *image, VkDeviceMemory *image_memory, VkFormat format, @@ -63,11 +63,11 @@ move_image_state( void create_view( - VK::Device *device, + BluCat::Device *device, VkImageView *image_view, const VkImage &image, VkFormat format, VkImageAspectFlags image_aspect_flags); } -#endif /* CANDY_GEAR_VK_IMAGE_H */ +#endif /* CANDY_GEAR_BLUCAT_IMAGE_H */ diff --git a/src/vk/light.cpp b/src/blucat/light.cpp index 5ed07ee..5efc6ec 100644 --- a/src/vk/light.cpp +++ b/src/blucat/light.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -27,14 +27,14 @@ namespace void load_world_vert_uniform_buffer(void *obj) { - auto self = static_cast<VK::Light*>(obj); + auto self = static_cast<BluCat::Light*>(obj); try { self->ub_world_vert.reserve(cg_core.vk_swapchain->images_count); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) self->ub_world_vert.emplace_back( - cg_core.vk_device_with_swapchain, sizeof(VK::UDOWorld3D_Vert)); + cg_core.vk_device_with_swapchain, sizeof(BluCat::UDOWorld3D_Vert)); } catch(const std::exception& e) { @@ -45,7 +45,7 @@ load_world_vert_uniform_buffer(void *obj) void unload_world_vert_uniform_buffer(void *obj) { - auto self = static_cast<VK::Light*>(obj); + auto self = static_cast<BluCat::Light*>(obj); self->ub_world_vert.clear(); } @@ -53,14 +53,14 @@ unload_world_vert_uniform_buffer(void *obj) void load_world_frag_uniform_buffer(void *obj) { - auto self = static_cast<VK::Light*>(obj); + auto self = static_cast<BluCat::Light*>(obj); try { self->ub_world_frag.reserve(cg_core.vk_swapchain->images_count); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) self->ub_world_frag.emplace_back( - cg_core.vk_device_with_swapchain, sizeof(VK::UDOWorld3D_Frag)); + cg_core.vk_device_with_swapchain, sizeof(BluCat::UDOWorld3D_Frag)); } catch(const std::exception& e) { @@ -71,7 +71,7 @@ load_world_frag_uniform_buffer(void *obj) void unload_world_frag_uniform_buffer(void *obj) { - auto self = static_cast<VK::Light*>(obj); + auto self = static_cast<BluCat::Light*>(obj); self->ub_world_frag.clear(); } @@ -79,7 +79,7 @@ unload_world_frag_uniform_buffer(void *obj) void load_descriptor_pool(void *obj) { - auto self = static_cast<VK::Light*>(obj); + auto self = static_cast<BluCat::Light*>(obj); uint32_t uniform_buffers_count = self->ub_world_vert.size() + self->ub_world_vert.size(); @@ -105,7 +105,7 @@ load_descriptor_pool(void *obj) void unload_descriptor_pool(void *obj) { - auto self = static_cast<VK::Light*>(obj); + auto self = static_cast<BluCat::Light*>(obj); vkDestroyDescriptorPool( cg_core.vk_device_with_swapchain->device, self->descriptor_pool, @@ -115,7 +115,7 @@ unload_descriptor_pool(void *obj) void load_descriptor_sets_world(void *obj) { - auto self = static_cast<VK::Light*>(obj); + auto self = static_cast<BluCat::Light*>(obj); std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, @@ -137,19 +137,19 @@ load_descriptor_sets_world(void *obj) void load_resources_to_descriptor_sets(void *obj) { - auto self = static_cast<VK::Light*>(obj); + auto self = static_cast<BluCat::Light*>(obj); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) { VkDescriptorBufferInfo world_vert_info{}; world_vert_info.buffer = self->ub_world_vert[i].buffer; world_vert_info.offset = 0; - world_vert_info.range = sizeof(VK::UDOWorld3D_Vert); + world_vert_info.range = sizeof(BluCat::UDOWorld3D_Vert); VkDescriptorBufferInfo world_frag_info{}; world_frag_info.buffer = self->ub_world_frag[i].buffer; world_frag_info.offset = 0; - world_frag_info.range = sizeof(VK::UDOWorld3D_Frag); + world_frag_info.range = sizeof(BluCat::UDOWorld3D_Frag); std::array<VkWriteDescriptorSet, 2> write_descriptors{}; write_descriptors[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; @@ -189,7 +189,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { Light::Light() diff --git a/src/vk/light.hpp b/src/blucat/light.hpp index 80e44c7..7e1d3a1 100644 --- a/src/vk/light.hpp +++ b/src/blucat/light.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,13 +14,13 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_LIGHT_H -#define CANDY_GEAR_VK_LIGHT_H 1 +#ifndef CANDY_GEAR_BLUCAT_LIGHT_H +#define CANDY_GEAR_BLUCAT_LIGHT_H 1 #include "core.hpp" #include "uniform_buffer.hpp" -namespace VK +namespace BluCat { struct Light @@ -38,4 +38,4 @@ struct Light } -#endif /* CANDY_GEAR_VK_LIGHT_H */ +#endif /* CANDY_GEAR_BLUCAT_LIGHT_H */ diff --git a/src/vk/qoi.cpp b/src/blucat/qoi.cpp index bc0caab..663e4e9 100644 --- a/src/vk/qoi.cpp +++ b/src/blucat/qoi.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -92,7 +92,7 @@ color_hash(const RGBA &colors) } -namespace VK::QOI +namespace BluCat::QOI { Image::Image(const char *file_path, uint8_t channels): diff --git a/src/vk/qoi.hpp b/src/blucat/qoi.hpp index 8a8688f..cd33205 100644 --- a/src/vk/qoi.hpp +++ b/src/blucat/qoi.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -16,7 +16,7 @@ #include <cstdint> -namespace VK::QOI +namespace BluCat::QOI { struct Header { diff --git a/src/vk/queue.cpp b/src/blucat/queue.cpp index deb59ba..c00d874 100644 --- a/src/vk/queue.cpp +++ b/src/blucat/queue.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -18,11 +18,11 @@ #include "queue_family.hpp" -namespace VK +namespace BluCat { Queue::Queue( - VK::QueueFamily *queue_family, VkQueue queue, int queue_index): + BluCat::QueueFamily *queue_family, VkQueue queue, int queue_index): queue_family{queue_family}, queue{queue}, queue_index{queue_index} diff --git a/src/vk/queue.hpp b/src/blucat/queue.hpp index 955daa5..a71dc9d 100644 --- a/src/vk/queue.hpp +++ b/src/blucat/queue.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,18 +14,18 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_QUEUE_H -#define CANDY_GEAR_VK_QUEUE_H 1 +#ifndef CANDY_GEAR_BLUCAT_QUEUE_H +#define CANDY_GEAR_BLUCAT_QUEUE_H 1 #include "core.hpp" -namespace VK +namespace BluCat { class QueueFamily; struct Queue { - friend class VK::QueueFamily; + friend class BluCat::QueueFamily; Queue(const Queue &t) = delete; Queue& operator=(const Queue &t) = delete; @@ -42,10 +42,10 @@ struct Queue ~Queue(); private: - VK::QueueFamily *queue_family; + BluCat::QueueFamily *queue_family; int queue_index; - Queue(VK::QueueFamily *queue_family, VkQueue queue, int queue_index); + Queue(BluCat::QueueFamily *queue_family, VkQueue queue, int queue_index); }; template<typename T> void @@ -79,4 +79,4 @@ Queue::submit_one_time_command( } -#endif /* CANDY_GEAR_VK_QUEUE_H */ +#endif /* CANDY_GEAR_BLUCAT_QUEUE_H */ diff --git a/src/vk/queue_family.cpp b/src/blucat/queue_family.cpp index d917c13..32aaf4b 100644 --- a/src/vk/queue_family.cpp +++ b/src/blucat/queue_family.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -22,11 +22,11 @@ #include "../core.hpp" -namespace VK +namespace BluCat { QueueFamily::QueueFamily( - VK::Device *device, uint32_t family_index, + BluCat::Device *device, uint32_t family_index, const VkQueueFamilyProperties &queue_family_properties): queue_mutex{} { diff --git a/src/vk/queue_family.hpp b/src/blucat/queue_family.hpp index 83efc00..2486316 100644 --- a/src/vk/queue_family.hpp +++ b/src/blucat/queue_family.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_QUEUE_FAMILY_H -#define CANDY_GEAR_VK_QUEUE_FAMILY_H 1 +#ifndef CANDY_GEAR_BLUCAT_QUEUE_FAMILY_H +#define CANDY_GEAR_BLUCAT_QUEUE_FAMILY_H 1 #include <mutex> #include <vector> @@ -23,7 +23,7 @@ #include "core.hpp" #include "queue.hpp" -namespace VK +namespace BluCat { class Device; @@ -41,12 +41,12 @@ class QueueFamily std::vector<QueueState> queue_states; public: - VK::Device *device; + BluCat::Device *device; uint32_t family_index; VkQueueFamilyProperties family_properties; - QueueFamily(VK::Device *device, uint32_t family_index, + QueueFamily(BluCat::Device *device, uint32_t family_index, const VkQueueFamilyProperties &queue_family_properties); Queue @@ -55,4 +55,4 @@ public: } -#endif /* CANDY_GEAR_VK_QUEUE_FAMILY_H */ +#endif /* CANDY_GEAR_BLUCAT_QUEUE_FAMILY_H */ diff --git a/src/vk/rectangle.cpp b/src/blucat/rectangle.cpp index dc18c45..34f844d 100644 --- a/src/vk/rectangle.cpp +++ b/src/blucat/rectangle.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -16,7 +16,7 @@ #include "rectangle.hpp" -namespace VK +namespace BluCat { const int Rectangle::VertexCount{4}; diff --git a/src/vk/rectangle.hpp b/src/blucat/rectangle.hpp index faee927..876508c 100644 --- a/src/vk/rectangle.hpp +++ b/src/blucat/rectangle.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_RECTANGLE_H -#define CANDY_GEAR_VK_RECTANGLE_H 1 +#ifndef CANDY_GEAR_BLUCAT_RECTANGLE_H +#define CANDY_GEAR_BLUCAT_RECTANGLE_H 1 #include <vector> @@ -24,7 +24,7 @@ #include "queue_family.hpp" #include "uniform_buffer.hpp" -namespace VK +namespace BluCat { struct Rectangle @@ -39,4 +39,4 @@ struct Rectangle } -#endif /* CANDY_GEAR_VK_RECTANGLE_H */ +#endif /* CANDY_GEAR_BLUCAT_RECTANGLE_H */ diff --git a/src/vk/render_pass.cpp b/src/blucat/render_pass.cpp index 799cde4..0eb30e3 100644 --- a/src/vk/render_pass.cpp +++ b/src/blucat/render_pass.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -26,7 +26,7 @@ namespace void load_3d(void *obj) { - auto self = static_cast<VK::RenderPass*>(obj); + auto self = static_cast<BluCat::RenderPass*>(obj); std::array<VkAttachmentDescription, 2> attachments{}; // Color attachment. @@ -103,7 +103,7 @@ load_3d(void *obj) void unload_3d(void *obj) { - auto self = static_cast<VK::RenderPass*>(obj); + auto self = static_cast<BluCat::RenderPass*>(obj); vkDestroyRenderPass( cg_core.vk_device_with_swapchain->device, self->pipeline_3d, nullptr); @@ -112,7 +112,7 @@ unload_3d(void *obj) void load_2d(void *obj) { - auto self = static_cast<VK::RenderPass*>(obj); + auto self = static_cast<BluCat::RenderPass*>(obj); std::array<VkAttachmentDescription, 1> attachments{}; // Color attachment. @@ -174,7 +174,7 @@ load_2d(void *obj) void unload_2d(void *obj) { - auto self = static_cast<VK::RenderPass*>(obj); + auto self = static_cast<BluCat::RenderPass*>(obj); vkDestroyRenderPass( cg_core.vk_device_with_swapchain->device, self->pipeline_2d, nullptr); @@ -187,7 +187,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { RenderPass::RenderPass() diff --git a/src/vk/render_pass.hpp b/src/blucat/render_pass.hpp index 2f96062..196ce97 100644 --- a/src/vk/render_pass.hpp +++ b/src/blucat/render_pass.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_RENDER_PASS_H -#define CANDY_GEAR_VK_RENDER_PASS_H 1 +#ifndef CANDY_GEAR_BLUCAT_RENDER_PASS_H +#define CANDY_GEAR_BLUCAT_RENDER_PASS_H 1 #include "core.hpp" -namespace VK +namespace BluCat { struct RenderPass @@ -33,4 +33,4 @@ struct RenderPass } -#endif /* CANDY_GEAR_VK_RENDER_PASS_H */ +#endif /* CANDY_GEAR_BLUCAT_RENDER_PASS_H */ diff --git a/src/vk/renderer.cpp b/src/blucat/renderer.cpp index 0f7f804..75822e0 100644 --- a/src/vk/renderer.cpp +++ b/src/blucat/renderer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -27,7 +27,7 @@ namespace void load_descriptor_pool(void *obj) { - auto self = static_cast<VK::Renderer*>(obj); + auto self = static_cast<BluCat::Renderer*>(obj); uint32_t uniform_buffer_count = 0; for(auto &view : self->views_3d) @@ -61,7 +61,7 @@ load_descriptor_pool(void *obj) void unload_descriptor_pool(void *obj) { - auto self = static_cast<VK::Renderer*>(obj); + auto self = static_cast<BluCat::Renderer*>(obj); for(auto &view : self->views_3d) view->unload_descriptor_sets(); for(auto &view : self->views_2d) view->unload_descriptor_sets(); @@ -74,7 +74,7 @@ unload_descriptor_pool(void *obj) void load_queue_family(void *obj) { - auto self = static_cast<VK::Renderer*>(obj); + auto self = static_cast<BluCat::Renderer*>(obj); self->queue_family = cg_core.vk_device_with_swapchain->get_queue_family_with_presentation(); @@ -83,7 +83,7 @@ load_queue_family(void *obj) void load_command_pool(void *obj) { - auto self = static_cast<VK::Renderer*>(obj); + auto self = static_cast<BluCat::Renderer*>(obj); VkCommandPoolCreateInfo create_info{}; create_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; @@ -99,10 +99,10 @@ load_command_pool(void *obj) void unload_command_pool(void *obj) { - auto self = static_cast<VK::Renderer*>(obj); + auto self = static_cast<BluCat::Renderer*>(obj); vkWaitForFences(cg_core.vk_device_with_swapchain->device, - VK::Swapchain::max_frames_in_flight, + BluCat::Swapchain::max_frames_in_flight, cg_core.vk_swapchain->in_flight_fences.data(), VK_TRUE, std::numeric_limits<uint64_t>::max()); vkDestroyCommandPool( @@ -112,7 +112,7 @@ unload_command_pool(void *obj) void load_draw_command_buffer(void *obj) { - auto self = static_cast<VK::Renderer*>(obj); + auto self = static_cast<BluCat::Renderer*>(obj); // FIXME: 3 is a magical number, triple buffering. self->draw_command_buffers.resize(3); @@ -139,7 +139,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { Renderer::Renderer(std::vector<std::shared_ptr<View2D>> views_2d, @@ -275,7 +275,7 @@ Renderer::draw() image_index); { // Update view uniform buffers - VK::UDOView3D ubo_view_3d{}; + BluCat::UDOView3D ubo_view_3d{}; // View matrix. glm::mat4 translation_matrix{1.0f}; diff --git a/src/vk/renderer.hpp b/src/blucat/renderer.hpp index 96d25ba..d23ebe5 100644 --- a/src/vk/renderer.hpp +++ b/src/blucat/renderer.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_RENDERER_H -#define CANDY_GEAR_VK_RENDERER_H 1 +#ifndef CANDY_GEAR_BLUCAT_RENDERER_H +#define CANDY_GEAR_BLUCAT_RENDERER_H 1 #include <initializer_list> #include <memory> @@ -31,7 +31,7 @@ #include "view_2d.hpp" #include "view_3d.hpp" -namespace VK +namespace BluCat { struct Renderer @@ -69,4 +69,4 @@ struct Renderer } -#endif /* CANDY_GEAR_VK_RENDERER_H */ +#endif /* CANDY_GEAR_BLUCAT_RENDERER_H */ diff --git a/src/vk/skeletal_mesh.cpp b/src/blucat/skeletal_mesh.cpp index b65d27d..baea635 100644 --- a/src/vk/skeletal_mesh.cpp +++ b/src/blucat/skeletal_mesh.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -29,19 +29,19 @@ namespace struct MeshBuilder { std::string mesh_path; - VK::SkeletalMesh *mesh; + BluCat::SkeletalMesh *mesh; - MeshBuilder(VK::SkeletalMesh *m, std::string mp); - MeshBuilder(VK::SkeletalMesh *m, const char* mp); + MeshBuilder(BluCat::SkeletalMesh *m, std::string mp); + MeshBuilder(BluCat::SkeletalMesh *m, const char* mp); }; -MeshBuilder::MeshBuilder(VK::SkeletalMesh *m, std::string mp): +MeshBuilder::MeshBuilder(BluCat::SkeletalMesh *m, std::string mp): mesh{m}, mesh_path{mp} { } -MeshBuilder::MeshBuilder(VK::SkeletalMesh *m, const char *mp): +MeshBuilder::MeshBuilder(BluCat::SkeletalMesh *m, const char *mp): MeshBuilder{m, std::string(mp)} { } @@ -58,7 +58,7 @@ load_mesh(void *obj) { // Load vertexes. auto vertex_count{input.read_ui32()}; - std::vector<VK::SkeletalMeshVertex> vertexes{vertex_count}; + std::vector<BluCat::SkeletalMeshVertex> vertexes{vertex_count}; for(auto i{0}; i < vertex_count; i++) { @@ -66,20 +66,20 @@ load_mesh(void *obj) vertexes[i].normal = input.read_vec3(); vertexes[i].texture_coord = input.read_vec2(); - for(auto ii{0}; ii < VK::SKELETAL_MESH_MAX_NUM_OF_INFLUENCING_BONES; + for(auto ii{0}; ii < BluCat::SKELETAL_MESH_MAX_NUM_OF_INFLUENCING_BONES; ii++) vertexes[i].bone_ids[ii] = input.read_ui32(); - for(auto ii{0}; ii < VK::SKELETAL_MESH_MAX_NUM_OF_INFLUENCING_BONES; + for(auto ii{0}; ii < BluCat::SKELETAL_MESH_MAX_NUM_OF_INFLUENCING_BONES; ii++) vertexes[i].bone_weights[ii] = input.read_float(); } void *vertexes_data{vertexes.data()}; size_t vertexes_size = sizeof(vertexes[0]) * vertexes.size(); - self->mesh->source_vertex_buffer = new VK::SourceBuffer{ + self->mesh->source_vertex_buffer = new BluCat::SourceBuffer{ self->mesh->queue_family->device, vertexes_data, vertexes_size}; - self->mesh->vertex_buffer = new VK::DestinationBuffer{ + self->mesh->vertex_buffer = new BluCat::DestinationBuffer{ self->mesh->queue_family, self->mesh->source_vertex_buffer, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT}; } @@ -93,9 +93,9 @@ load_mesh(void *obj) void *indexes_data{indexes.data()}; size_t indexes_size{sizeof(indexes[0]) * indexes.size()}; - VK::SourceBuffer source_index_buffer{ + BluCat::SourceBuffer source_index_buffer{ self->mesh->queue_family->device, indexes_data, indexes_size}; - self->mesh->index_buffer = new VK::DestinationBuffer{ + self->mesh->index_buffer = new BluCat::DestinationBuffer{ self->mesh->queue_family, &source_index_buffer, VK_BUFFER_USAGE_INDEX_BUFFER_BIT}; } @@ -118,7 +118,7 @@ load_mesh(void *obj) auto ticks_per_second{input.read_double()}; auto num_bone_transforms{input.read_ui32()}; - std::vector<VK::BoneTransform> *bone_transforms = + std::vector<BluCat::BoneTransform> *bone_transforms = &(self->mesh->animations[i].bone_transforms); bone_transforms->resize(num_bone_transforms); for(uint32_t bone_transform_index{0}; @@ -127,7 +127,7 @@ load_mesh(void *obj) auto bone_id{input.read_ui32()}; auto num_positions{input.read_ui32()}; - VK::Channel<glm::vec3> *positions = + BluCat::Channel<glm::vec3> *positions = &((*bone_transforms)[bone_transform_index].positions); for(auto position_key_index{0}; position_key_index < num_positions; position_key_index++) @@ -139,7 +139,7 @@ load_mesh(void *obj) } auto num_rotations{input.read_ui32()}; - VK::Channel<glm::quat> *rotations = + BluCat::Channel<glm::quat> *rotations = &((*bone_transforms)[bone_transform_index].rotations); for(auto rotation_key_index{0}; rotation_key_index < num_rotations; rotation_key_index++) @@ -151,7 +151,7 @@ load_mesh(void *obj) } auto num_scales{input.read_ui32()}; - VK::Channel<glm::vec3> *scales = + BluCat::Channel<glm::vec3> *scales = &((*bone_transforms)[bone_transform_index].scales); for(auto scaling_key_index{0}; scaling_key_index < num_scales; scaling_key_index++) @@ -181,7 +181,7 @@ static const CommandChain loader{ } -namespace VK +namespace BluCat { SkeletalMesh::SkeletalMesh(std::string mesh_path) diff --git a/src/vk/skeletal_mesh.hpp b/src/blucat/skeletal_mesh.hpp index 7fc8334..8b7d0fe 100644 --- a/src/vk/skeletal_mesh.hpp +++ b/src/blucat/skeletal_mesh.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_SKELETAL_MESH_H -#define CANDY_GEAR_VK_SKELETAL_MESH_H 1 +#ifndef CANDY_GEAR_BLUCAT_SKELETAL_MESH_H +#define CANDY_GEAR_BLUCAT_SKELETAL_MESH_H 1 #include <string> #include <vector> @@ -27,7 +27,7 @@ #include "uniform_buffer.hpp" #include "texture.hpp" -namespace VK +namespace BluCat { struct SkeletalMesh @@ -49,4 +49,4 @@ struct SkeletalMesh } -#endif /* CANDY_GEAR_VK_SKELETAL_MESH_H */ +#endif /* CANDY_GEAR_BLUCAT_SKELETAL_MESH_H */ diff --git a/src/vk/skeletal_mesh_vertex.hpp b/src/blucat/skeletal_mesh_vertex.hpp index b5bba3d..533c2ab 100644 --- a/src/vk/skeletal_mesh_vertex.hpp +++ b/src/blucat/skeletal_mesh_vertex.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_SKELETAL_MESH_VERTEX_H -#define CANDY_GEAR_VK_SKELETAL_MESH_VERTEX_H 1 +#ifndef CANDY_GEAR_BLUCAT_SKELETAL_MESH_VERTEX_H +#define CANDY_GEAR_BLUCAT_SKELETAL_MESH_VERTEX_H 1 #include "core.hpp" -namespace VK +namespace BluCat { // This variable define the maximum ammount of bones that can influence a @@ -39,4 +39,4 @@ struct SkeletalMeshVertex } -#endif /* CANDY_GEAR_VK_SKELETAL_MESH_VERTEX_H */ +#endif /* CANDY_GEAR_BLUCAT_SKELETAL_MESH_VERTEX_H */ diff --git a/src/vk/skeletal_model.cpp b/src/blucat/skeletal_model.cpp index d2739c4..8761bc8 100644 --- a/src/vk/skeletal_model.cpp +++ b/src/blucat/skeletal_model.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -25,14 +25,14 @@ namespace void load_uniform_buffers(void *obj) { - auto self = static_cast<VK::SkeletalModel*>(obj); + auto self = static_cast<BluCat::SkeletalModel*>(obj); try { self->uniform_buffers.reserve(cg_core.vk_swapchain->images_count); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) self->uniform_buffers.emplace_back( - cg_core.vk_device_with_swapchain, sizeof(VK::UDOSkeletalModel)); + cg_core.vk_device_with_swapchain, sizeof(BluCat::UDOSkeletalModel)); } catch(const std::exception& e) { @@ -43,7 +43,7 @@ load_uniform_buffers(void *obj) void unload_uniform_buffers(void *obj) { - auto self = static_cast<VK::SkeletalModel*>(obj); + auto self = static_cast<BluCat::SkeletalModel*>(obj); self->uniform_buffers.clear(); } @@ -51,7 +51,7 @@ unload_uniform_buffers(void *obj) void load_descriptor_set_pool(void *obj) { - auto self = static_cast<VK::SkeletalModel*>(obj); + auto self = static_cast<BluCat::SkeletalModel*>(obj); std::array<VkDescriptorPoolSize, 1> descriptor_pool_sizes{}; descriptor_pool_sizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; @@ -75,7 +75,7 @@ load_descriptor_set_pool(void *obj) void unload_descriptor_set_pool(void *obj) { - auto self = static_cast<VK::SkeletalModel*>(obj); + auto self = static_cast<BluCat::SkeletalModel*>(obj); vkDestroyDescriptorPool( self->skeletal_mesh->queue_family->device->device, self->descriptor_pool, @@ -85,7 +85,7 @@ unload_descriptor_set_pool(void *obj) void load_descriptor_sets(void *obj) { - auto self = static_cast<VK::SkeletalModel*>(obj); + auto self = static_cast<BluCat::SkeletalModel*>(obj); std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, @@ -107,14 +107,14 @@ load_descriptor_sets(void *obj) void load_buffers_to_descriptor_sets(void *obj) { - auto self = static_cast<VK::SkeletalModel*>(obj); + auto self = static_cast<BluCat::SkeletalModel*>(obj); for(auto i{0}; i < self->uniform_buffers.size(); i++) { VkDescriptorBufferInfo buffer_info{}; buffer_info.buffer = self->uniform_buffers[i].buffer; buffer_info.offset = 0; - buffer_info.range = sizeof(VK::UDOSkeletalModel); + buffer_info.range = sizeof(BluCat::UDOSkeletalModel); std::array<VkWriteDescriptorSet, 1> write_descriptors{}; write_descriptors[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; @@ -142,7 +142,7 @@ static const CommandChain loader{ } -namespace VK +namespace BluCat { SkeletalModel::SkeletalModel( @@ -171,7 +171,7 @@ SkeletalModel::~SkeletalModel() void SkeletalModel::tick(float delta) { - VK::Animation *current_animation = + BluCat::Animation *current_animation = &this->skeletal_mesh->animations[this->animation_index]; { // update time @@ -179,7 +179,7 @@ SkeletalModel::tick(float delta) if(this->animation_time > current_animation->final_time) { this->animation_time -= current_animation->final_time; - for(VK::BoneTransform &bone_transform: + for(BluCat::BoneTransform &bone_transform: current_animation->bone_transforms) { bone_transform.positions.current_index = 0; @@ -191,7 +191,7 @@ SkeletalModel::tick(float delta) for(int i{0}; i < current_animation->bone_transforms.size(); i++) { - VK::BoneTransform *bone_transform = ¤t_animation->bone_transforms[i]; + BluCat::BoneTransform *bone_transform = ¤t_animation->bone_transforms[i]; auto position{bone_transform->positions.interpolate( this->animation_time, diff --git a/src/vk/skeletal_model.hpp b/src/blucat/skeletal_model.hpp index db54ac9..cd3685e 100644 --- a/src/vk/skeletal_model.hpp +++ b/src/blucat/skeletal_model.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_SKELETAL_MODEL_H -#define CANDY_GEAR_VK_SKELETAL_MODEL_H 1 +#ifndef CANDY_GEAR_BLUCAT_SKELETAL_MODEL_H +#define CANDY_GEAR_BLUCAT_SKELETAL_MODEL_H 1 #include <memory> #include <vector> @@ -23,7 +23,7 @@ #include "core.hpp" #include "skeletal_mesh.hpp" -namespace VK +namespace BluCat { struct SkeletalModel @@ -52,4 +52,4 @@ struct SkeletalModel } -#endif /* CANDY_GEAR_VK_SKELETAL_MODEL_H */ +#endif /* CANDY_GEAR_BLUCAT_SKELETAL_MODEL_H */ diff --git a/src/vk/source_buffer.cpp b/src/blucat/source_buffer.cpp index f8f1aee..41c40b9 100644 --- a/src/vk/source_buffer.cpp +++ b/src/blucat/source_buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -18,7 +18,7 @@ #include <cstring> -namespace VK +namespace BluCat { SourceBuffer::SourceBuffer(Device *device, void *data, size_t data_size) @@ -31,7 +31,7 @@ SourceBuffer::SourceBuffer(Device *device, void *data, size_t data_size) try { - VK::BaseBuffer::loader.execute(static_cast<VK::BaseBuffer*>(this)); + BluCat::BaseBuffer::loader.execute(static_cast<BluCat::BaseBuffer*>(this)); } catch(const CommandError &command_error) { @@ -71,7 +71,7 @@ SourceBuffer::operator=(SourceBuffer &&that) SourceBuffer::~SourceBuffer() { - VK::BaseBuffer::loader.revert(static_cast<VK::BaseBuffer*>(this)); + BluCat::BaseBuffer::loader.revert(static_cast<BluCat::BaseBuffer*>(this)); } void diff --git a/src/vk/source_buffer.hpp b/src/blucat/source_buffer.hpp index 440e561..dd52acc 100644 --- a/src/vk/source_buffer.hpp +++ b/src/blucat/source_buffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_SOURCE_BUFFER_H -#define CANDY_GEAR_VK_SOURCE_BUFFER_H 1 +#ifndef CANDY_GEAR_BLUCAT_SOURCE_BUFFER_H +#define CANDY_GEAR_BLUCAT_SOURCE_BUFFER_H 1 #include "base_buffer.hpp" -namespace VK +namespace BluCat { struct SourceBuffer: public BaseBuffer @@ -42,4 +42,4 @@ struct SourceBuffer: public BaseBuffer } -#endif /* CANDY_GEAR_VK_SOURCE_BUFFER_H */ +#endif /* CANDY_GEAR_BLUCAT_SOURCE_BUFFER_H */ diff --git a/src/vk/sprite.cpp b/src/blucat/sprite.cpp index 95e11a3..a275df8 100644 --- a/src/vk/sprite.cpp +++ b/src/blucat/sprite.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -27,13 +27,13 @@ namespace struct SpriteBuilder { - VK::Sprite *sprite; + BluCat::Sprite *sprite; glm::vec4 ▭ - SpriteBuilder(VK::Sprite *sprite, glm::vec4 &rect); + SpriteBuilder(BluCat::Sprite *sprite, glm::vec4 &rect); }; -SpriteBuilder::SpriteBuilder(VK::Sprite *sprite, glm::vec4 &rect): +SpriteBuilder::SpriteBuilder(BluCat::Sprite *sprite, glm::vec4 &rect): sprite{sprite}, rect{rect} { @@ -47,7 +47,7 @@ load_mesh(void *obj) self->sprite->queue_family = cg_core.vk_device_with_swapchain->get_queue_family_with_graphics(); - glm::vec2 rect[VK::Sprite::vertex_count]{ + glm::vec2 rect[BluCat::Sprite::vertex_count]{ glm::vec2{self->rect.x, self->rect.y}, glm::vec2{self->rect.x, self->rect.w}, glm::vec2{self->rect.z, self->rect.y}, @@ -56,10 +56,10 @@ load_mesh(void *obj) void *vertexes_data{&rect}; static const size_t vertexes_size = - sizeof(glm::vec2) * VK::Sprite::vertex_count; - self->sprite->source_buffer = new VK::SourceBuffer{ + sizeof(glm::vec2) * BluCat::Sprite::vertex_count; + self->sprite->source_buffer = new BluCat::SourceBuffer{ self->sprite->queue_family->device, vertexes_data, vertexes_size}; - self->sprite->vertex_buffer = new VK::DestinationBuffer{ + self->sprite->vertex_buffer = new BluCat::DestinationBuffer{ self->sprite->queue_family, self->sprite->source_buffer, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT}; } @@ -79,7 +79,7 @@ static const CommandChain loader{ } -namespace VK +namespace BluCat { Sprite::Sprite(std::shared_ptr<Texture> texture, glm::vec4 &rect): diff --git a/src/vk/sprite.hpp b/src/blucat/sprite.hpp index 791144e..6252d00 100644 --- a/src/vk/sprite.hpp +++ b/src/blucat/sprite.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_SPRITE_H -#define CANDY_GEAR_VK_SPRITE_H 1 +#ifndef CANDY_GEAR_BLUCAT_SPRITE_H +#define CANDY_GEAR_BLUCAT_SPRITE_H 1 #include <memory> #include <unordered_map> @@ -27,7 +27,7 @@ #include "uniform_buffer.hpp" #include "texture.hpp" -namespace VK +namespace BluCat { struct Sprite @@ -47,4 +47,4 @@ struct Sprite } -#endif /* CANDY_GEAR_VK_SPRITE_H */ +#endif /* CANDY_GEAR_BLUCAT_SPRITE_H */ diff --git a/src/vk/sprite_3d.cpp b/src/blucat/sprite_3d.cpp index 66199f1..6fa6d49 100644 --- a/src/vk/sprite_3d.cpp +++ b/src/blucat/sprite_3d.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -25,14 +25,14 @@ namespace void load_uniform_buffers(void *obj) { - auto self = static_cast<VK::Sprite3D*>(obj); + auto self = static_cast<BluCat::Sprite3D*>(obj); try { self->uniform_buffers.reserve(cg_core.vk_swapchain->images_count); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) self->uniform_buffers.emplace_back( - cg_core.vk_device_with_swapchain, sizeof(VK::UDOSprite3D)); + cg_core.vk_device_with_swapchain, sizeof(BluCat::UDOSprite3D)); } catch(const std::exception& e) { @@ -43,7 +43,7 @@ load_uniform_buffers(void *obj) void unload_uniform_buffers(void *obj) { - auto self = static_cast<VK::Sprite3D*>(obj); + auto self = static_cast<BluCat::Sprite3D*>(obj); self->uniform_buffers.clear(); } @@ -51,7 +51,7 @@ unload_uniform_buffers(void *obj) void load_descriptor_set_pool(void *obj) { - auto self = static_cast<VK::Sprite3D*>(obj); + auto self = static_cast<BluCat::Sprite3D*>(obj); std::array<VkDescriptorPoolSize, 1> descriptor_pool_sizes{}; descriptor_pool_sizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; @@ -75,7 +75,7 @@ load_descriptor_set_pool(void *obj) void unload_descriptor_set_pool(void *obj) { - auto self = static_cast<VK::Sprite3D*>(obj); + auto self = static_cast<BluCat::Sprite3D*>(obj); vkDestroyDescriptorPool( self->queue_family->device->device, self->descriptor_pool, nullptr); @@ -83,7 +83,7 @@ unload_descriptor_set_pool(void *obj) void load_descriptor_sets(void *obj) { - auto self = static_cast<VK::Sprite3D*>(obj); + auto self = static_cast<BluCat::Sprite3D*>(obj); std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, @@ -105,14 +105,14 @@ load_descriptor_sets(void *obj) void load_buffers_to_descriptor_sets(void *obj) { - auto self = static_cast<VK::Sprite3D*>(obj); + auto self = static_cast<BluCat::Sprite3D*>(obj); for(auto i{0}; i < self->uniform_buffers.size(); i++) { VkDescriptorBufferInfo buffer_info{}; buffer_info.buffer = self->uniform_buffers[i].buffer; buffer_info.offset = 0; - buffer_info.range = sizeof(VK::UDOSprite3D); + buffer_info.range = sizeof(BluCat::UDOSprite3D); VkDescriptorImageInfo image_info{}; image_info.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; @@ -145,11 +145,11 @@ static const CommandChain loader{ } -namespace VK +namespace BluCat { Sprite3D::Sprite3D( - std::shared_ptr<VK::Sprite> sprite, std::shared_ptr<glm::vec3> position, + std::shared_ptr<BluCat::Sprite> sprite, std::shared_ptr<glm::vec3> position, glm::vec2 size): sprite{sprite}, position{position}, diff --git a/src/vk/sprite_3d.hpp b/src/blucat/sprite_3d.hpp index 2059606..dd0f16e 100644 --- a/src/vk/sprite_3d.hpp +++ b/src/blucat/sprite_3d.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,13 +14,13 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_SPRITE_3D_H -#define CANDY_GEAR_VK_SPRITE_3D_H 1 +#ifndef CANDY_GEAR_BLUCAT_SPRITE_3D_H +#define CANDY_GEAR_BLUCAT_SPRITE_3D_H 1 #include "core.hpp" #include "sprite.hpp" -namespace VK +namespace BluCat { struct Sprite3D @@ -43,4 +43,4 @@ struct Sprite3D } -#endif /* CANDY_GEAR_VK_SPRITE_3D_H */ +#endif /* CANDY_GEAR_BLUCAT_SPRITE_3D_H */ diff --git a/src/vk/sprite_to_draw.cpp b/src/blucat/sprite_to_draw.cpp index 76ee847..9013adb 100644 --- a/src/vk/sprite_to_draw.cpp +++ b/src/blucat/sprite_to_draw.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -16,7 +16,7 @@ #include "sprite_to_draw.hpp" -namespace VK +namespace BluCat { SpriteToDraw::SpriteToDraw( std::shared_ptr<Sprite> sprite, const glm::vec4 &position, float z_index): diff --git a/src/vk/sprite_to_draw.hpp b/src/blucat/sprite_to_draw.hpp index 84effff..fb46eac 100644 --- a/src/vk/sprite_to_draw.hpp +++ b/src/blucat/sprite_to_draw.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,15 +14,15 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_SPRITES_TO_DRAW_H -#define CANDY_GEAR_VK_SPRITES_TO_DRAW_H 1 +#ifndef CANDY_GEAR_BLUCAT_SPRITES_TO_DRAW_H +#define CANDY_GEAR_BLUCAT_SPRITES_TO_DRAW_H 1 #include <memory> #include "core.hpp" #include "sprite.hpp" -namespace VK +namespace BluCat { struct SpriteToDraw { @@ -41,4 +41,4 @@ namespace VK operator>(const SpriteToDraw &a, const SpriteToDraw &b); } -#endif /* CANDY_GEAR_VK_SPRITES_TO_DRAW_H */ +#endif /* CANDY_GEAR_BLUCAT_SPRITES_TO_DRAW_H */ diff --git a/src/vk/static_mesh.cpp b/src/blucat/static_mesh.cpp index 29034df..ab45ca9 100644 --- a/src/vk/static_mesh.cpp +++ b/src/blucat/static_mesh.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -29,19 +29,19 @@ namespace struct MeshBuilder { std::string mesh_path; - VK::StaticMesh *mesh; + BluCat::StaticMesh *mesh; - MeshBuilder(VK::StaticMesh *m, std::string mp); - MeshBuilder(VK::StaticMesh *m, const char* mp); + MeshBuilder(BluCat::StaticMesh *m, std::string mp); + MeshBuilder(BluCat::StaticMesh *m, const char* mp); }; -MeshBuilder::MeshBuilder(VK::StaticMesh *m, std::string mp): +MeshBuilder::MeshBuilder(BluCat::StaticMesh *m, std::string mp): mesh{m}, mesh_path{mp} { } -MeshBuilder::MeshBuilder(VK::StaticMesh *m, const char *mp): +MeshBuilder::MeshBuilder(BluCat::StaticMesh *m, const char *mp): MeshBuilder{m, std::string(mp)} { } @@ -58,7 +58,7 @@ load_mesh(void *obj) { // Load vertexes. auto vertex_count{input.read_ui32()}; - std::vector<VK::StaticMeshVertex> vertexes{vertex_count}; + std::vector<BluCat::StaticMeshVertex> vertexes{vertex_count}; for(auto i{0}; i < vertex_count; i++) { @@ -69,9 +69,9 @@ load_mesh(void *obj) void *vertexes_data{vertexes.data()}; size_t vertexes_size = sizeof(vertexes[0]) * vertexes.size(); - self->mesh->source_vertex_buffer = new VK::SourceBuffer{ + self->mesh->source_vertex_buffer = new BluCat::SourceBuffer{ self->mesh->queue_family->device, vertexes_data, vertexes_size}; - self->mesh->vertex_buffer = new VK::DestinationBuffer{ + self->mesh->vertex_buffer = new BluCat::DestinationBuffer{ self->mesh->queue_family, self->mesh->source_vertex_buffer, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT}; } @@ -85,9 +85,9 @@ load_mesh(void *obj) void *indexes_data{indexes.data()}; size_t indexes_size{sizeof(indexes[0]) * indexes.size()}; - VK::SourceBuffer source_index_buffer{ + BluCat::SourceBuffer source_index_buffer{ self->mesh->queue_family->device, indexes_data, indexes_size}; - self->mesh->index_buffer = new VK::DestinationBuffer{ + self->mesh->index_buffer = new BluCat::DestinationBuffer{ self->mesh->queue_family, &source_index_buffer, VK_BUFFER_USAGE_INDEX_BUFFER_BIT}; } @@ -109,7 +109,7 @@ static const CommandChain loader{ } -namespace VK +namespace BluCat { StaticMesh::StaticMesh(std::string mesh_path) diff --git a/src/vk/static_mesh.hpp b/src/blucat/static_mesh.hpp index 0ab38b2..0efcfc1 100644 --- a/src/vk/static_mesh.hpp +++ b/src/blucat/static_mesh.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_STATIC_MESH_H -#define CANDY_GEAR_VK_STATIC_MESH_H 1 +#ifndef CANDY_GEAR_BLUCAT_STATIC_MESH_H +#define CANDY_GEAR_BLUCAT_STATIC_MESH_H 1 #include <string> #include <vector> @@ -26,7 +26,7 @@ #include "uniform_buffer.hpp" #include "texture.hpp" -namespace VK +namespace BluCat { struct StaticMesh @@ -45,4 +45,4 @@ struct StaticMesh } -#endif /* CANDY_GEAR_VK_STATIC_MESH_H */ +#endif /* CANDY_GEAR_BLUCAT_STATIC_MESH_H */ diff --git a/src/vk/static_mesh_vertex.hpp b/src/blucat/static_mesh_vertex.hpp index 7a91fe4..025ad63 100644 --- a/src/vk/static_mesh_vertex.hpp +++ b/src/blucat/static_mesh_vertex.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_STATIC_MESH_VERTEX_H -#define CANDY_GEAR_VK_STATIC_MESH_VERTEX_H 1 +#ifndef CANDY_GEAR_BLUCAT_STATIC_MESH_VERTEX_H +#define CANDY_GEAR_BLUCAT_STATIC_MESH_VERTEX_H 1 #include "core.hpp" -namespace VK +namespace BluCat { struct StaticMeshVertex @@ -31,4 +31,4 @@ struct StaticMeshVertex } -#endif /* CANDY_GEAR_VK_STATIC_MESH_VERTEX_H */ +#endif /* CANDY_GEAR_BLUCAT_STATIC_MESH_VERTEX_H */ diff --git a/src/vk/static_model.cpp b/src/blucat/static_model.cpp index ef53155..e3c6482 100644 --- a/src/vk/static_model.cpp +++ b/src/blucat/static_model.cpp @@ -25,14 +25,14 @@ namespace void load_uniform_buffers(void *obj) { - auto self = static_cast<VK::StaticModel*>(obj); + auto self = static_cast<BluCat::StaticModel*>(obj); try { self->uniform_buffers.reserve(cg_core.vk_swapchain->images_count); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) self->uniform_buffers.emplace_back( - cg_core.vk_device_with_swapchain, sizeof(VK::UDOStaticModel)); + cg_core.vk_device_with_swapchain, sizeof(BluCat::UDOStaticModel)); } catch(const std::exception& e) { @@ -43,7 +43,7 @@ load_uniform_buffers(void *obj) void unload_uniform_buffers(void *obj) { - auto self = static_cast<VK::StaticModel*>(obj); + auto self = static_cast<BluCat::StaticModel*>(obj); self->uniform_buffers.clear(); } @@ -51,7 +51,7 @@ unload_uniform_buffers(void *obj) void load_descriptor_set_pool(void *obj) { - auto self = static_cast<VK::StaticModel*>(obj); + auto self = static_cast<BluCat::StaticModel*>(obj); std::array<VkDescriptorPoolSize, 1> descriptor_pool_sizes{}; descriptor_pool_sizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; @@ -75,7 +75,7 @@ load_descriptor_set_pool(void *obj) void unload_descriptor_set_pool(void *obj) { - auto self = static_cast<VK::StaticModel*>(obj); + auto self = static_cast<BluCat::StaticModel*>(obj); vkDestroyDescriptorPool( self->static_mesh->queue_family->device->device, self->descriptor_pool, @@ -85,7 +85,7 @@ unload_descriptor_set_pool(void *obj) void load_descriptor_sets(void *obj) { - auto self = static_cast<VK::StaticModel*>(obj); + auto self = static_cast<BluCat::StaticModel*>(obj); std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, @@ -107,14 +107,14 @@ load_descriptor_sets(void *obj) void load_buffers_to_descriptor_sets(void *obj) { - auto self = static_cast<VK::StaticModel*>(obj); + auto self = static_cast<BluCat::StaticModel*>(obj); for(auto i{0}; i < self->uniform_buffers.size(); i++) { VkDescriptorBufferInfo buffer_info{}; buffer_info.buffer = self->uniform_buffers[i].buffer; buffer_info.offset = 0; - buffer_info.range = sizeof(VK::UDOStaticModel); + buffer_info.range = sizeof(BluCat::UDOStaticModel); std::array<VkWriteDescriptorSet, 1> write_descriptors{}; write_descriptors[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; @@ -142,7 +142,7 @@ static const CommandChain loader{ } -namespace VK +namespace BluCat { StaticModel::StaticModel( diff --git a/src/vk/static_model.hpp b/src/blucat/static_model.hpp index 72f4fac..68c5ea1 100644 --- a/src/vk/static_model.hpp +++ b/src/blucat/static_model.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_STATIC_MODEL_H -#define CANDY_GEAR_VK_STATIC_MODEL_H 1 +#ifndef CANDY_GEAR_BLUCAT_STATIC_MODEL_H +#define CANDY_GEAR_BLUCAT_STATIC_MODEL_H 1 #include <memory> #include <vector> @@ -23,7 +23,7 @@ #include "core.hpp" #include "static_mesh.hpp" -namespace VK +namespace BluCat { struct StaticModel @@ -46,4 +46,4 @@ struct StaticModel } -#endif /* CANDY_GEAR_VK_STATIC_MODEL_H */ +#endif /* CANDY_GEAR_BLUCAT_STATIC_MODEL_H */ diff --git a/src/vk/swapchain.cpp b/src/blucat/swapchain.cpp index 2c67ebd..1e521e4 100644 --- a/src/vk/swapchain.cpp +++ b/src/blucat/swapchain.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -26,7 +26,7 @@ namespace void load_swapchain(void *obj) { - auto self = static_cast<VK::Swapchain*>(obj); + auto self = static_cast<BluCat::Swapchain*>(obj); // Surface formats. uint32_t vk_surface_format_count; @@ -80,7 +80,7 @@ load_swapchain(void *obj) void unload_swapchain(void *obj) { - auto self = static_cast<VK::Swapchain*>(obj); + auto self = static_cast<BluCat::Swapchain*>(obj); delete[] self->images; vkDestroySwapchainKHR( @@ -90,7 +90,7 @@ unload_swapchain(void *obj) void load_image_view(void *obj) { - auto self = static_cast<VK::Swapchain*>(obj); + auto self = static_cast<BluCat::Swapchain*>(obj); self->image_views = new VkImageView[self->images_count]; for(auto i{0}; i < self->images_count; i++) @@ -120,7 +120,7 @@ load_image_view(void *obj) void unload_image_view(void *obj) { - auto self = static_cast<VK::Swapchain*>(obj); + auto self = static_cast<BluCat::Swapchain*>(obj); for(auto i{0}; i < self->images_count; i++) vkDestroyImageView( @@ -130,7 +130,7 @@ unload_image_view(void *obj) void load_frame_sync(void *obj) { - auto self = static_cast<VK::Swapchain*>(obj); + auto self = static_cast<BluCat::Swapchain*>(obj); self->image_available_semaphores.resize(self->max_frames_in_flight); self->render_finished_semaphores.resize(self->max_frames_in_flight); @@ -164,7 +164,7 @@ load_frame_sync(void *obj) void unload_frame_sync(void *obj) { - auto self = static_cast<VK::Swapchain*>(obj); + auto self = static_cast<BluCat::Swapchain*>(obj); vkDeviceWaitIdle(cg_core.vk_device_with_swapchain->device); @@ -187,7 +187,7 @@ const CommandChain loader{ } -namespace VK +namespace BluCat { Swapchain::Swapchain(): diff --git a/src/vk/swapchain.hpp b/src/blucat/swapchain.hpp index a5ade81..979fe08 100644 --- a/src/vk/swapchain.hpp +++ b/src/blucat/swapchain.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,13 +14,13 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_SWAPCHAIN_H -#define CANDY_GEAR_VK_SWAPCHAIN_H 1 +#ifndef CANDY_GEAR_BLUCAT_SWAPCHAIN_H +#define CANDY_GEAR_BLUCAT_SWAPCHAIN_H 1 #include "core.hpp" #include "../command.hpp" -namespace VK +namespace BluCat { struct Swapchain @@ -44,4 +44,4 @@ struct Swapchain } -#endif /* CANDY_GEAR_VK_SWAPCHAIN_H */ +#endif /* CANDY_GEAR_BLUCAT_SWAPCHAIN_H */ diff --git a/src/vk/texture.cpp b/src/blucat/texture.cpp index a4cac40..1213528 100644 --- a/src/vk/texture.cpp +++ b/src/blucat/texture.cpp @@ -35,7 +35,7 @@ create_vulkan_image( vk_extent3d.height = height; vk_extent3d.depth = 1; - VK::Image::create( + BluCat::Image::create( cg_core.vk_device_with_swapchain, image, device_memory, @@ -48,24 +48,24 @@ create_vulkan_image( struct ImageBuilder { - VK::Texture *texture; + BluCat::Texture *texture; }; struct ImageTextureBuilder: public ImageBuilder { std::string texture_path; - ImageTextureBuilder(VK::Texture *t, std::string tp); - ImageTextureBuilder(VK::Texture *t, const char* tp); + ImageTextureBuilder(BluCat::Texture *t, std::string tp); + ImageTextureBuilder(BluCat::Texture *t, const char* tp); }; -ImageTextureBuilder::ImageTextureBuilder(VK::Texture *t, std::string tp): +ImageTextureBuilder::ImageTextureBuilder(BluCat::Texture *t, std::string tp): texture_path{tp} { this->texture = t; } -ImageTextureBuilder::ImageTextureBuilder(VK::Texture *t, const char* tp): +ImageTextureBuilder::ImageTextureBuilder(BluCat::Texture *t, const char* tp): ImageTextureBuilder{t, std::string(tp)} { } @@ -76,7 +76,7 @@ load_image(void *obj) auto self = static_cast<ImageTextureBuilder*>(obj); const int num_channels = 4; // all images are converted to RGBA - VK::QOI::Image qoi_image(self->texture_path.c_str(), num_channels); + BluCat::QOI::Image qoi_image(self->texture_path.c_str(), num_channels); uint8_t *pixels; { // Load file image from file. @@ -90,7 +90,7 @@ load_image(void *obj) // Load file image into a vulkan buffer. size_t image_size{static_cast<size_t>( qoi_image.header.width * qoi_image.header.height * num_channels)}; - VK::SourceBuffer source_image_buffer{ + BluCat::SourceBuffer source_image_buffer{ cg_core.vk_device_with_swapchain, pixels, image_size}; { // Create vulkan image. @@ -103,7 +103,7 @@ load_image(void *obj) self->texture->height, self->texture->mip_levels); } - catch(VK::Image::Error error) + catch(BluCat::Image::Error error) { throw CommandError{error.what()}; } @@ -113,11 +113,11 @@ load_image(void *obj) { auto queue_family = self->texture->queue_family; auto queue{queue_family->get_queue()}; - VK::CommandPool command_pool{queue_family, 1}; + BluCat::CommandPool command_pool{queue_family, 1}; VkCommandBuffer vk_command_buffer{command_pool.command_buffers[0]}; queue.submit_one_time_command(vk_command_buffer, [&](){ - VK::Image::move_image_state( + BluCat::Image::move_image_state( vk_command_buffer, self->texture->image, VK_FORMAT_R8G8B8A8_UNORM, 0, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, @@ -139,7 +139,7 @@ load_image(void *obj) vk_command_buffer, source_image_buffer.buffer, self->texture->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &image_copy); - VK::Image::move_image_state( + BluCat::Image::move_image_state( vk_command_buffer, self->texture->image, VK_FORMAT_R8G8B8A8_UNORM, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, @@ -209,12 +209,12 @@ load_view(void *obj) try { - VK::Image::create_view( + BluCat::Image::create_view( cg_core.vk_device_with_swapchain, &self->texture->view, self->texture->image, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_ASPECT_COLOR_BIT); } - catch(VK::Image::Error error) + catch(BluCat::Image::Error error) { throw CommandError{error.what()}; } @@ -238,9 +238,9 @@ const CommandChain image_loader{ struct CharacterToDraw { int pos_x; - std::shared_ptr<VK::Character> character; + std::shared_ptr<BluCat::Character> character; - CharacterToDraw(int x, std::shared_ptr<VK::Character> character): + CharacterToDraw(int x, std::shared_ptr<BluCat::Character> character): pos_x{x}, character{character} {}; @@ -248,12 +248,12 @@ struct CharacterToDraw struct TextTextureBuilder: public ImageBuilder { - VK::Font *font; + BluCat::Font *font; const char* str; uint32_t max_bearing_y; std::vector<CharacterToDraw> chars_to_draw; - TextTextureBuilder(VK::Texture *texture, VK::Font *font, const char* str): + TextTextureBuilder(BluCat::Texture *texture, BluCat::Font *font, const char* str): font{font}, str{str} { @@ -267,7 +267,7 @@ load_text_proportions(void *obj) auto self = static_cast<TextTextureBuilder*>(obj); uint32_t texture_width{0}, texture_descender{0}; - auto unicode_text{VK::Character::str_to_unicode(self->str)}; + auto unicode_text{BluCat::Character::str_to_unicode(self->str)}; auto first_image{self->font->character(unicode_text[0])}; if(first_image->bearing_x < 0) texture_width = - first_image->bearing_x; @@ -277,7 +277,7 @@ load_text_proportions(void *obj) // FIXME: I need to test several different fonts to find all bugs in this // code. - std::shared_ptr<VK::Character> char_image{}; + std::shared_ptr<BluCat::Character> char_image{}; { // Calculate image size int max_height; for(auto char_code : unicode_text) @@ -330,7 +330,7 @@ load_text_image(void *obj) pixels[image_coord + 3] = 0; // Alpha } } - VK::SourceBuffer source_image_buffer{ + BluCat::SourceBuffer source_image_buffer{ cg_core.vk_device_with_swapchain, pixels.data(), image_size}; { // Create vulkan image. @@ -343,7 +343,7 @@ load_text_image(void *obj) self->texture->height, self->texture->mip_levels); } - catch(VK::Image::Error error) + catch(BluCat::Image::Error error) { throw CommandError{error.what()}; } @@ -353,11 +353,11 @@ load_text_image(void *obj) auto queue_family{ cg_core.vk_device_with_swapchain->get_queue_family_with_presentation()}; auto queue{queue_family->get_queue()}; - VK::CommandPool command_pool{queue_family, 1}; + BluCat::CommandPool command_pool{queue_family, 1}; VkCommandBuffer vk_command_buffer{command_pool.command_buffers[0]}; queue.submit_one_time_command(vk_command_buffer, [&](){ - VK::Image::move_image_state( + BluCat::Image::move_image_state( vk_command_buffer, self->texture->image, VK_FORMAT_R8G8B8A8_UNORM, 0, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, @@ -410,7 +410,7 @@ load_text_image(void *obj) 1, &image_copy); } - VK::Image::move_image_state( + BluCat::Image::move_image_state( vk_command_buffer, self->texture->image, VK_FORMAT_R8G8B8A8_UNORM, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, @@ -431,7 +431,7 @@ const CommandChain text_loader{ void load_descriptor_set_pool(void *obj) { - auto self = static_cast<VK::Texture*>(obj); + auto self = static_cast<BluCat::Texture*>(obj); std::array<VkDescriptorPoolSize, 1> descriptor_pool_sizes{}; descriptor_pool_sizes[0].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; @@ -455,7 +455,7 @@ load_descriptor_set_pool(void *obj) void unload_descriptor_set_pool(void *obj) { - auto self = static_cast<VK::Texture*>(obj); + auto self = static_cast<BluCat::Texture*>(obj); vkDestroyDescriptorPool( self->queue_family->device->device, self->descriptor_pool, nullptr); @@ -464,7 +464,7 @@ unload_descriptor_set_pool(void *obj) void load_descriptor_sets(void *obj) { - auto self = static_cast<VK::Texture*>(obj); + auto self = static_cast<BluCat::Texture*>(obj); std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, @@ -486,7 +486,7 @@ load_descriptor_sets(void *obj) void load_data_to_descriptor_sets(void *obj) { - auto self = static_cast<VK::Texture*>(obj); + auto self = static_cast<BluCat::Texture*>(obj); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) { @@ -521,7 +521,7 @@ const CommandChain descriptor_loader{ } -namespace VK +namespace BluCat { Texture::Texture(Font *font, const char* str) diff --git a/src/vk/texture.hpp b/src/blucat/texture.hpp index 22711eb..bee61e6 100644 --- a/src/vk/texture.hpp +++ b/src/blucat/texture.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_TEXTURE_H -#define CANDY_GEAR_VK_TEXTURE_H 1 +#ifndef CANDY_GEAR_BLUCAT_TEXTURE_H +#define CANDY_GEAR_BLUCAT_TEXTURE_H 1 #include <string> @@ -23,7 +23,7 @@ #include "font.hpp" #include "queue_family.hpp" -namespace VK +namespace BluCat { struct Texture diff --git a/src/vk/uniform_buffer.cpp b/src/blucat/uniform_buffer.cpp index dd61898..4b6194a 100644 --- a/src/vk/uniform_buffer.cpp +++ b/src/blucat/uniform_buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -19,7 +19,7 @@ #include <cstring> #include <stdexcept> -namespace VK +namespace BluCat { UniformBuffer::UniformBuffer(Device *device, VkDeviceSize data_size) diff --git a/src/vk/uniform_buffer.hpp b/src/blucat/uniform_buffer.hpp index e978894..2131ee1 100644 --- a/src/vk/uniform_buffer.hpp +++ b/src/blucat/uniform_buffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_UNIFORM_BUFFER_H -#define CANDY_GEAR_VK_UNIFORM_BUFFER_H 1 +#ifndef CANDY_GEAR_BLUCAT_UNIFORM_BUFFER_H +#define CANDY_GEAR_BLUCAT_UNIFORM_BUFFER_H 1 #include <memory> @@ -23,7 +23,7 @@ #include "base_buffer.hpp" -namespace VK +namespace BluCat { // FIXME: this class need to delete or create custom copy constructors! @@ -46,4 +46,4 @@ public: } -#endif /* CANDY_GEAR_VK_UNIFORM_BUFFER_H */ +#endif /* CANDY_GEAR_BLUCAT_UNIFORM_BUFFER_H */ diff --git a/src/vk/uniform_data_object.hpp b/src/blucat/uniform_data_object.hpp index 5cc22cb..d2292b1 100644 --- a/src/vk/uniform_data_object.hpp +++ b/src/blucat/uniform_data_object.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,13 +14,13 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_UNIFORM_DATA_OBJECT_H -#define CANDY_GEAR_VK_UNIFORM_DATA_OBJECT_H 1 +#ifndef CANDY_GEAR_BLUCAT_UNIFORM_DATA_OBJECT_H +#define CANDY_GEAR_BLUCAT_UNIFORM_DATA_OBJECT_H 1 #include "core.hpp" #include "skeletal_mesh_vertex.hpp" -namespace VK +namespace BluCat { // UDO = "uniform data object" @@ -77,4 +77,4 @@ struct UDOSprite3D } -#endif /* CANDY_GEAR_VK_UNIFORM_DATA_OBJECT_H */ +#endif /* CANDY_GEAR_BLUCAT_UNIFORM_DATA_OBJECT_H */ diff --git a/src/vk/view_2d.cpp b/src/blucat/view_2d.cpp index c628a18..f27b4c4 100644 --- a/src/vk/view_2d.cpp +++ b/src/blucat/view_2d.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -27,14 +27,14 @@ namespace void load_2d_uniform_buffer(void *obj) { - auto self = static_cast<VK::View2D*>(obj); + auto self = static_cast<BluCat::View2D*>(obj); try { self->ub_2d.reserve(cg_core.vk_swapchain->images_count); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) self->ub_2d.emplace_back( - cg_core.vk_device_with_swapchain, sizeof(VK::UDOView2D)); + cg_core.vk_device_with_swapchain, sizeof(BluCat::UDOView2D)); } catch(const std::exception& e) { @@ -45,7 +45,7 @@ load_2d_uniform_buffer(void *obj) void unload_2d_uniform_buffer(void *obj) { - auto self = static_cast<VK::View2D*>(obj); + auto self = static_cast<BluCat::View2D*>(obj); self->ub_2d.clear(); } @@ -53,7 +53,7 @@ unload_2d_uniform_buffer(void *obj) void load_descriptor_sets_2d(void *obj) { - auto self = static_cast<VK::View2D*>(obj); + auto self = static_cast<BluCat::View2D*>(obj); std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, @@ -75,14 +75,14 @@ load_descriptor_sets_2d(void *obj) void load_resources_to_descriptor_sets_2d(void *obj) { - auto self = static_cast<VK::View2D*>(obj); + auto self = static_cast<BluCat::View2D*>(obj); for(auto i{0}; i < self->ub_2d.size(); i++) { VkDescriptorBufferInfo view_2d_info{}; view_2d_info.buffer = self->ub_2d[i].buffer; view_2d_info.offset = 0; - view_2d_info.range = sizeof(VK::UDOView2D); + view_2d_info.range = sizeof(BluCat::UDOView2D); std::array<VkWriteDescriptorSet, 1> write_descriptors{}; write_descriptors[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; @@ -99,7 +99,7 @@ load_resources_to_descriptor_sets_2d(void *obj) cg_core.vk_device_with_swapchain->device, write_descriptors.size(), write_descriptors.data(), 0, nullptr); - VK::UDOView2D ubo_view_2d; + BluCat::UDOView2D ubo_view_2d; ubo_view_2d.proj = glm::ortho( 0.0f, self->projection_width, 0.0f, self->projection_height, @@ -110,7 +110,7 @@ load_resources_to_descriptor_sets_2d(void *obj) } -namespace VK +namespace BluCat { const CommandChain View2D::loader{ diff --git a/src/vk/view_2d.hpp b/src/blucat/view_2d.hpp index ead21e2..b369334 100644 --- a/src/vk/view_2d.hpp +++ b/src/blucat/view_2d.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_VIEW_2D_H -#define CANDY_GEAR_VK_VIEW_2D_H 1 +#ifndef CANDY_GEAR_BLUCAT_VIEW_2D_H +#define CANDY_GEAR_BLUCAT_VIEW_2D_H 1 #include <memory> #include <unordered_map> @@ -25,7 +25,7 @@ #include "sprite_to_draw.hpp" #include "rectangle.hpp" -namespace VK +namespace BluCat { struct View2D @@ -57,4 +57,4 @@ protected: } -#endif /* CANDY_GEAR_VK_VIEW_2D_H */ +#endif /* CANDY_GEAR_BLUCAT_VIEW_2D_H */ diff --git a/src/vk/view_3d.cpp b/src/blucat/view_3d.cpp index 273874c..4b7b959 100644 --- a/src/vk/view_3d.cpp +++ b/src/blucat/view_3d.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -27,14 +27,14 @@ namespace void load_3d_uniform_buffer(void *obj) { - auto self = static_cast<VK::View3D*>(obj); + auto self = static_cast<BluCat::View3D*>(obj); try { self->ub_3d.reserve(cg_core.vk_swapchain->images_count); for(auto i{0}; i < cg_core.vk_swapchain->images_count; i++) self->ub_3d.emplace_back( - cg_core.vk_device_with_swapchain, sizeof(VK::UDOView3D)); + cg_core.vk_device_with_swapchain, sizeof(BluCat::UDOView3D)); } catch(const std::exception& e) { @@ -45,7 +45,7 @@ load_3d_uniform_buffer(void *obj) void unload_3d_uniform_buffer(void *obj) { - auto self = static_cast<VK::View3D*>(obj); + auto self = static_cast<BluCat::View3D*>(obj); self->ub_3d.clear(); } @@ -53,7 +53,7 @@ unload_3d_uniform_buffer(void *obj) void load_descriptor_sets_3d(void *obj) { - auto self = static_cast<VK::View3D*>(obj); + auto self = static_cast<BluCat::View3D*>(obj); std::vector<VkDescriptorSetLayout> layouts( cg_core.vk_swapchain->images_count, @@ -75,14 +75,14 @@ load_descriptor_sets_3d(void *obj) void load_resources_to_descriptor_sets_3d(void *obj) { - auto self = static_cast<VK::View3D*>(obj); + auto self = static_cast<BluCat::View3D*>(obj); for(auto i{0}; i < self->ub_3d.size(); i++) { VkDescriptorBufferInfo view_3d_info{}; view_3d_info.buffer = self->ub_3d[i].buffer; view_3d_info.offset = 0; - view_3d_info.range = sizeof(VK::UDOView3D); + view_3d_info.range = sizeof(BluCat::UDOView3D); std::array<VkWriteDescriptorSet, 1> write_descriptors{}; write_descriptors[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; @@ -112,7 +112,7 @@ const CommandChain descriptor_sets_loader{ } -namespace VK +namespace BluCat { View3D::View3D( @@ -135,7 +135,7 @@ View3D::load_descriptor_sets(VkDescriptorPool descriptor_pool) { if(this->descriptor_pool != VK_NULL_HANDLE) return; - auto parent = dynamic_cast<VK::View2D*>(this); + auto parent = dynamic_cast<BluCat::View2D*>(this); this->descriptor_pool = descriptor_pool; View2D::descriptor_sets_loader.execute(parent); ::descriptor_sets_loader.execute(this); @@ -146,7 +146,7 @@ View3D::unload_descriptor_sets() { if(this->descriptor_pool == VK_NULL_HANDLE) return; - auto parent = dynamic_cast<VK::View2D*>(this); + auto parent = dynamic_cast<BluCat::View2D*>(this); this->descriptor_pool = VK_NULL_HANDLE; ::descriptor_sets_loader.revert(this); View2D::descriptor_sets_loader.revert(parent); diff --git a/src/vk/view_3d.hpp b/src/blucat/view_3d.hpp index c5a803b..05cae6b 100644 --- a/src/vk/view_3d.hpp +++ b/src/blucat/view_3d.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef CANDY_GEAR_VK_VIEW_3D_H -#define CANDY_GEAR_VK_VIEW_3D_H 1 +#ifndef CANDY_GEAR_BLUCAT_VIEW_3D_H +#define CANDY_GEAR_BLUCAT_VIEW_3D_H 1 #include "view_2d.hpp" -namespace VK +namespace BluCat { struct View3D: public View2D @@ -45,4 +45,4 @@ struct View3D: public View2D } -#endif /* CANDY_GEAR_VK_VIEW_3D_H */ +#endif /* CANDY_GEAR_BLUCAT_VIEW_3D_H */ diff --git a/src/candy_gear.cpp b/src/candy_gear.cpp index 426db4b..78bb716 100644 --- a/src/candy_gear.cpp +++ b/src/candy_gear.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -42,8 +42,8 @@ cg_mCandyGear_set_views(mrb_state *mrb, mrb_value self) mrb_value *array; mrb_int array_len; - std::vector<std::shared_ptr<VK::View2D>> views_2d; - std::vector<std::shared_ptr<VK::View3D>> views_3d; + std::vector<std::shared_ptr<BluCat::View2D>> views_2d; + std::vector<std::shared_ptr<BluCat::View3D>> views_3d; cg_m = mrb_module_get(mrb, "CandyGear"); cg_cView2D = mrb_class_get_under(mrb, cg_m, "View2D"); @@ -54,12 +54,12 @@ cg_mCandyGear_set_views(mrb_state *mrb, mrb_value self) { if(mrb_obj_is_kind_of(mrb, array[i], cg_cView2D)) { - auto v = (std::shared_ptr<VK::View2D>*)DATA_PTR(array[i]); + auto v = (std::shared_ptr<BluCat::View2D>*)DATA_PTR(array[i]); views_2d.push_back(*v); } else if(mrb_obj_is_kind_of(mrb, array[i], cg_cView3D)) { - auto v = (std::shared_ptr<VK::View3D>*)DATA_PTR(array[i]); + auto v = (std::shared_ptr<BluCat::View3D>*)DATA_PTR(array[i]); views_3d.push_back(*v); } } @@ -68,7 +68,7 @@ cg_mCandyGear_set_views(mrb_state *mrb, mrb_value self) if(views_2d.size() > 0 || views_3d.size() > 0) { delete cg_core.vk_renderer; - cg_core.vk_renderer = new VK::Renderer({views_2d, views_3d}); + cg_core.vk_renderer = new BluCat::Renderer({views_2d, views_3d}); } return self; diff --git a/src/core.cpp b/src/core.cpp index 1aeb111..f524e36 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -258,7 +258,7 @@ unload_font_library(void *obj) } void -load_vk_instance(void *obj) +load_blucat_instance(void *obj) { std::vector<const char*> vk_extensions; std::vector<const char*> vk_required_layers_names; @@ -397,7 +397,7 @@ load_vk_instance(void *obj) } void -unload_vk_instance(void *obj) +unload_blucat_instance(void *obj) { vkDestroyInstance(cg_core.vk_instance, nullptr); } @@ -422,14 +422,14 @@ unload_window_surface(void *obj) #ifdef DEBUG void -load_vk_debug_callback(void *obj) +load_blucat_debug_callback(void *obj) { PFN_vkCreateDebugUtilsMessengerEXT debug_messenger; // A Vulkan instance extension named VK_EXT_debug_utils and a Vulkan instance // layer named VK_LAYER_LUNARG_standard_validation are required to enable // this callback. These instance extension and instance layer are loaded at - // Instance::load_vk_instance. + // Instance::load_blucat_instance. VkDebugUtilsMessengerCreateInfoEXT create_info; create_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; create_info.pNext = nullptr; @@ -455,7 +455,7 @@ load_vk_debug_callback(void *obj) } void -unload_vk_debug_callback(void *obj) +unload_blucat_debug_callback(void *obj) { PFN_vkDestroyDebugUtilsMessengerEXT debug_messenger; @@ -468,7 +468,7 @@ unload_vk_debug_callback(void *obj) #endif void -load_vk_devices(void *obj) +load_blucat_devices(void *obj) { uint32_t devices_count; std::vector<VkPhysicalDevice> vk_physical_devices; @@ -502,15 +502,15 @@ load_vk_devices(void *obj) } void -unload_vk_devices(void *obj) +unload_blucat_devices(void *obj) { cg_core.vk_devices.clear(); } static void -load_vk_swapchain(void *obj) +load_blucat_swapchain(void *obj) { - try { cg_core.vk_swapchain = new VK::Swapchain(); } + try { cg_core.vk_swapchain = new BluCat::Swapchain(); } catch(const CommandError &error) { std::string error_message{"Failed to create swapchain → "}; @@ -520,17 +520,17 @@ load_vk_swapchain(void *obj) } void -unload_vk_swapchain(void *obj) +unload_blucat_swapchain(void *obj) { delete cg_core.vk_swapchain; } void -load_vk_framebuffer(void *obj) +load_blucat_framebuffer(void *obj) { try { - cg_core.vk_framebuffer = new VK::Framebuffer(); + cg_core.vk_framebuffer = new BluCat::Framebuffer(); } catch(const CommandError &e) { @@ -539,17 +539,17 @@ load_vk_framebuffer(void *obj) } void -unload_vk_framebuffer(void *obj) +unload_blucat_framebuffer(void *obj) { delete cg_core.vk_framebuffer; } void -load_vk_render_pass(void *obj) +load_blucat_render_pass(void *obj) { try { - cg_core.vk_render_pass = new VK::RenderPass(); + cg_core.vk_render_pass = new BluCat::RenderPass(); } catch(const CommandError &e) { @@ -558,17 +558,17 @@ load_vk_render_pass(void *obj) } void -unload_vk_render_pass(void *obj) +unload_blucat_render_pass(void *obj) { delete cg_core.vk_render_pass; } void -load_vk_descriptor_set_layout(void *obj) +load_blucat_descriptor_set_layout(void *obj) { try { - cg_core.vk_descriptor_set_layout = new VK::DescriptorSetLayout(); + cg_core.vk_descriptor_set_layout = new BluCat::DescriptorSetLayout(); } catch(const CommandError &e) { @@ -577,18 +577,18 @@ load_vk_descriptor_set_layout(void *obj) } void -unload_vk_descriptor_set_layout(void *obj) +unload_blucat_descriptor_set_layout(void *obj) { delete cg_core.vk_descriptor_set_layout; } void -load_vk_graphics_pipeline_3d_layout(void *obj) +load_blucat_graphics_pipeline_3d_layout(void *obj) { try { cg_core.vk_graphics_pipeline_3d_layout = - new VK::GraphicsPipeline3DLayout(); + new BluCat::GraphicsPipeline3DLayout(); } catch(const CommandError &e) { @@ -597,18 +597,18 @@ load_vk_graphics_pipeline_3d_layout(void *obj) } void -unload_vk_graphics_pipeline_3d_layout(void *obj) +unload_blucat_graphics_pipeline_3d_layout(void *obj) { delete cg_core.vk_graphics_pipeline_3d_layout; } void -load_vk_graphics_pipeline_2d_solid_layout(void *obj) +load_blucat_graphics_pipeline_2d_solid_layout(void *obj) { try { cg_core.vk_graphics_pipeline_2d_solid_layout = - new VK::GraphicsPipeline2DSolidLayout(); + new BluCat::GraphicsPipeline2DSolidLayout(); } catch(const CommandError &e) { @@ -617,18 +617,18 @@ load_vk_graphics_pipeline_2d_solid_layout(void *obj) } void -unload_vk_graphics_pipeline_2d_solid_layout(void *obj) +unload_blucat_graphics_pipeline_2d_solid_layout(void *obj) { delete cg_core.vk_graphics_pipeline_2d_solid_layout; } void -load_vk_graphics_pipeline_2d_wired_layout(void *obj) +load_blucat_graphics_pipeline_2d_wired_layout(void *obj) { try { cg_core.vk_graphics_pipeline_2d_wired_layout = - new VK::GraphicsPipeline2DWiredLayout(); + new BluCat::GraphicsPipeline2DWiredLayout(); } catch(const CommandError &e) { @@ -637,17 +637,17 @@ load_vk_graphics_pipeline_2d_wired_layout(void *obj) } void -unload_vk_graphics_pipeline_2d_wired_layout(void *obj) +unload_blucat_graphics_pipeline_2d_wired_layout(void *obj) { delete cg_core.vk_graphics_pipeline_2d_wired_layout; } void -load_vk_light(void *obj) +load_blucat_light(void *obj) { try { - cg_core.vk_light = new VK::Light(); + cg_core.vk_light = new BluCat::Light(); } catch(const CommandError &e) { @@ -656,18 +656,18 @@ load_vk_light(void *obj) } void -unload_vk_light(void *obj) +unload_blucat_light(void *obj) { delete cg_core.vk_light; } void -load_vk_graphics_pipeline_3d(void *obj) +load_blucat_graphics_pipeline_3d(void *obj) { try { cg_core.vk_graphics_pipeline_3d = - std::make_unique<VK::GraphicsPipeline3D>(); + std::make_unique<BluCat::GraphicsPipeline3D>(); } catch(const CommandError &e) { @@ -676,18 +676,18 @@ load_vk_graphics_pipeline_3d(void *obj) } void -unload_vk_graphics_pipeline_3d(void *obj) +unload_blucat_graphics_pipeline_3d(void *obj) { cg_core.vk_graphics_pipeline_3d = nullptr; } void -load_vk_graphics_pipeline_3d_skeletal(void *obj) +load_blucat_graphics_pipeline_3d_skeletal(void *obj) { try { cg_core.vk_graphics_pipeline_3d_skeletal = - std::make_unique<VK::GraphicsPipeline3DSkeletal>(); + std::make_unique<BluCat::GraphicsPipeline3DSkeletal>(); } catch(const CommandError &e) { @@ -696,18 +696,18 @@ load_vk_graphics_pipeline_3d_skeletal(void *obj) } void -unload_vk_graphics_pipeline_3d_skeletal(void *obj) +unload_blucat_graphics_pipeline_3d_skeletal(void *obj) { cg_core.vk_graphics_pipeline_3d_skeletal = nullptr; } void -load_vk_graphics_pipeline_sprite_3d(void *obj) +load_blucat_graphics_pipeline_sprite_3d(void *obj) { try { cg_core.vk_graphics_pipeline_sprite_3d = - std::make_unique<VK::GraphicsPipelineSprite3D>(); + std::make_unique<BluCat::GraphicsPipelineSprite3D>(); } catch(const CommandError &e) { @@ -716,18 +716,18 @@ load_vk_graphics_pipeline_sprite_3d(void *obj) } void -unload_vk_graphics_pipeline_sprite_3d(void *obj) +unload_blucat_graphics_pipeline_sprite_3d(void *obj) { cg_core.vk_graphics_pipeline_sprite_3d = nullptr; } void -load_vk_graphics_pipeline_2d_solid(void *obj) +load_blucat_graphics_pipeline_2d_solid(void *obj) { try { cg_core.vk_graphics_pipeline_2d_solid = - std::make_unique<VK::GraphicsPipeline2DSolid>(); + std::make_unique<BluCat::GraphicsPipeline2DSolid>(); } catch(const CommandError &e) { @@ -736,18 +736,18 @@ load_vk_graphics_pipeline_2d_solid(void *obj) } void -unload_vk_graphics_pipeline_2d_solid(void *obj) +unload_blucat_graphics_pipeline_2d_solid(void *obj) { cg_core.vk_graphics_pipeline_2d_solid = nullptr; } void -load_vk_graphics_pipeline_2d_wired(void *obj) +load_blucat_graphics_pipeline_2d_wired(void *obj) { try { cg_core.vk_graphics_pipeline_2d_wired = - std::make_unique<VK::GraphicsPipeline2DWired>(); + std::make_unique<BluCat::GraphicsPipeline2DWired>(); } catch(const CommandError &e) { @@ -756,13 +756,13 @@ load_vk_graphics_pipeline_2d_wired(void *obj) } void -unload_vk_graphics_pipeline_2d_wired(void *obj) +unload_blucat_graphics_pipeline_2d_wired(void *obj) { cg_core.vk_graphics_pipeline_2d_wired = nullptr; } void -load_vk_renderer(void *obj) +load_blucat_renderer(void *obj) { try { @@ -770,9 +770,9 @@ load_vk_renderer(void *obj) 0.f, 0.f, static_cast<float>(cg_core.display_width), static_cast<float>(cg_core.display_height)); - cg_core.vk_renderer = new VK::Renderer( + cg_core.vk_renderer = new BluCat::Renderer( {}, - {std::make_shared<VK::View3D>(region, region.z, region.w)}); + {std::make_shared<BluCat::View3D>(region, region.z, region.w)}); } catch(const CommandError &e) { @@ -781,7 +781,7 @@ load_vk_renderer(void *obj) } void -unload_vk_renderer(void *obj) +unload_blucat_renderer(void *obj) { delete cg_core.vk_renderer; } @@ -818,33 +818,33 @@ const CommandChain cg_sCore::loader{ {&load_sdl_open_audio, &unload_sdl_open_audio}, {&load_window, &unload_window}, {&load_font_library, &unload_font_library}, - {&load_vk_instance, &unload_vk_instance}, + {&load_blucat_instance, &unload_blucat_instance}, {&load_window_surface, &unload_window_surface}, #ifdef DEBUG - {&load_vk_debug_callback, &unload_vk_debug_callback}, + {&load_blucat_debug_callback, &unload_blucat_debug_callback}, #endif - {&load_vk_devices, &unload_vk_devices}, - {&load_vk_swapchain, &unload_vk_swapchain}, - - {&load_vk_render_pass, &unload_vk_render_pass}, - {&load_vk_framebuffer, &unload_vk_framebuffer}, - {&load_vk_descriptor_set_layout, &unload_vk_descriptor_set_layout}, - {&load_vk_graphics_pipeline_3d_layout, - &unload_vk_graphics_pipeline_3d_layout}, - {&load_vk_graphics_pipeline_2d_solid_layout, - &unload_vk_graphics_pipeline_2d_solid_layout}, - {&load_vk_graphics_pipeline_2d_wired_layout, - &unload_vk_graphics_pipeline_2d_wired_layout}, - {&load_vk_light, &unload_vk_light}, + {&load_blucat_devices, &unload_blucat_devices}, + {&load_blucat_swapchain, &unload_blucat_swapchain}, + + {&load_blucat_render_pass, &unload_blucat_render_pass}, + {&load_blucat_framebuffer, &unload_blucat_framebuffer}, + {&load_blucat_descriptor_set_layout, &unload_blucat_descriptor_set_layout}, + {&load_blucat_graphics_pipeline_3d_layout, + &unload_blucat_graphics_pipeline_3d_layout}, + {&load_blucat_graphics_pipeline_2d_solid_layout, + &unload_blucat_graphics_pipeline_2d_solid_layout}, + {&load_blucat_graphics_pipeline_2d_wired_layout, + &unload_blucat_graphics_pipeline_2d_wired_layout}, + {&load_blucat_light, &unload_blucat_light}, // TODO: finish skeletal mesh animation - {&load_vk_graphics_pipeline_3d_skeletal, - &unload_vk_graphics_pipeline_3d_skeletal}, - {&load_vk_graphics_pipeline_3d, &unload_vk_graphics_pipeline_3d}, - {&load_vk_graphics_pipeline_sprite_3d, - &unload_vk_graphics_pipeline_sprite_3d}, - {&load_vk_graphics_pipeline_2d_solid, &unload_vk_graphics_pipeline_2d_solid}, - {&load_vk_graphics_pipeline_2d_wired, &unload_vk_graphics_pipeline_2d_wired}, - - {&load_vk_renderer, &unload_vk_renderer}, + {&load_blucat_graphics_pipeline_3d_skeletal, + &unload_blucat_graphics_pipeline_3d_skeletal}, + {&load_blucat_graphics_pipeline_3d, &unload_blucat_graphics_pipeline_3d}, + {&load_blucat_graphics_pipeline_sprite_3d, + &unload_blucat_graphics_pipeline_sprite_3d}, + {&load_blucat_graphics_pipeline_2d_solid, &unload_blucat_graphics_pipeline_2d_solid}, + {&load_blucat_graphics_pipeline_2d_wired, &unload_blucat_graphics_pipeline_2d_wired}, + + {&load_blucat_renderer, &unload_blucat_renderer}, {&load_mruby_interface, nullptr} }; diff --git a/src/core.hpp b/src/core.hpp index f9e1e80..c351917 100644 --- a/src/core.hpp +++ b/src/core.hpp @@ -49,21 +49,21 @@ #include "log.hpp" #include "worker.hpp" -#include "vk/device.hpp" -#include "vk/descriptor_set_layout.hpp" -#include "vk/render_pass.hpp" -#include "vk/framebuffer.hpp" -#include "vk/graphics_pipeline_2d_solid_layout.hpp" -#include "vk/graphics_pipeline_2d_wired_layout.hpp" -#include "vk/light.hpp" -#include "vk/graphics_pipeline_2d_solid.hpp" -#include "vk/graphics_pipeline_2d_wired.hpp" -#include "vk/graphics_pipeline_3d_layout.hpp" -#include "vk/graphics_pipeline_3d.hpp" -#include "vk/graphics_pipeline_3d_skeletal.hpp" -#include "vk/graphics_pipeline_sprite_3d.hpp" -#include "vk/renderer.hpp" -#include "vk/swapchain.hpp" +#include "blucat/device.hpp" +#include "blucat/descriptor_set_layout.hpp" +#include "blucat/render_pass.hpp" +#include "blucat/framebuffer.hpp" +#include "blucat/graphics_pipeline_2d_solid_layout.hpp" +#include "blucat/graphics_pipeline_2d_wired_layout.hpp" +#include "blucat/light.hpp" +#include "blucat/graphics_pipeline_2d_solid.hpp" +#include "blucat/graphics_pipeline_2d_wired.hpp" +#include "blucat/graphics_pipeline_3d_layout.hpp" +#include "blucat/graphics_pipeline_3d.hpp" +#include "blucat/graphics_pipeline_3d_skeletal.hpp" +#include "blucat/graphics_pipeline_sprite_3d.hpp" +#include "blucat/renderer.hpp" +#include "blucat/swapchain.hpp" extern std::random_device random_seed; extern std::mt19937 random_number_generator; @@ -120,25 +120,25 @@ struct cg_sCore #endif // Vulkan devices. - std::vector<VK::Device> vk_devices; - VK::Device *vk_device_with_swapchain; - VK::Swapchain *vk_swapchain; - - VK::Framebuffer *vk_framebuffer; - VK::RenderPass *vk_render_pass; - VK::DescriptorSetLayout *vk_descriptor_set_layout; - VK::GraphicsPipeline3DLayout *vk_graphics_pipeline_3d_layout; - VK::GraphicsPipeline2DSolidLayout *vk_graphics_pipeline_2d_solid_layout; - VK::GraphicsPipeline2DWiredLayout *vk_graphics_pipeline_2d_wired_layout; - VK::Light *vk_light; - std::unique_ptr<VK::GraphicsPipeline3D> vk_graphics_pipeline_3d; - std::unique_ptr<VK::GraphicsPipeline3DSkeletal> + std::vector<BluCat::Device> vk_devices; + BluCat::Device *vk_device_with_swapchain; + BluCat::Swapchain *vk_swapchain; + + BluCat::Framebuffer *vk_framebuffer; + BluCat::RenderPass *vk_render_pass; + BluCat::DescriptorSetLayout *vk_descriptor_set_layout; + BluCat::GraphicsPipeline3DLayout *vk_graphics_pipeline_3d_layout; + BluCat::GraphicsPipeline2DSolidLayout *vk_graphics_pipeline_2d_solid_layout; + BluCat::GraphicsPipeline2DWiredLayout *vk_graphics_pipeline_2d_wired_layout; + BluCat::Light *vk_light; + std::unique_ptr<BluCat::GraphicsPipeline3D> vk_graphics_pipeline_3d; + std::unique_ptr<BluCat::GraphicsPipeline3DSkeletal> vk_graphics_pipeline_3d_skeletal; - std::unique_ptr<VK::GraphicsPipelineSprite3D> vk_graphics_pipeline_sprite_3d; - std::unique_ptr<VK::GraphicsPipeline2DSolid> vk_graphics_pipeline_2d_solid; - std::unique_ptr<VK::GraphicsPipeline2DWired> vk_graphics_pipeline_2d_wired; + std::unique_ptr<BluCat::GraphicsPipelineSprite3D> vk_graphics_pipeline_sprite_3d; + std::unique_ptr<BluCat::GraphicsPipeline2DSolid> vk_graphics_pipeline_2d_solid; + std::unique_ptr<BluCat::GraphicsPipeline2DWired> vk_graphics_pipeline_2d_wired; - VK::Renderer *vk_renderer; + BluCat::Renderer *vk_renderer; bool quit_game; }; diff --git a/src/font.cpp b/src/font.cpp index 21559e1..919d271 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -16,12 +16,12 @@ #include "font.hpp" -#include "vk/font.hpp" +#include "blucat/font.hpp" void cg_free_font(mrb_state *mrb, void *obj) { - auto ptr = static_cast<VK::Font*>(obj); + auto ptr = static_cast<BluCat::Font*>(obj); ptr->~Font(); mrb_free(mrb, ptr); @@ -33,18 +33,18 @@ cg_font_type = {"CG_Font", cg_free_font}; static mrb_value cg_cFont_initialize(mrb_state *mrb, mrb_value self) { - VK::Font *ptr; + BluCat::Font *ptr; const char *font_path; mrb_int font_size; mrb_get_args(mrb, "zi", &font_path, &font_size); - ptr = (VK::Font*)DATA_PTR(self); + ptr = (BluCat::Font*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (VK::Font*)mrb_malloc(mrb, sizeof(VK::Font)); + ptr = (BluCat::Font*)mrb_malloc(mrb, sizeof(BluCat::Font)); try { - new(ptr)VK::Font(font_path, font_size); + new(ptr)BluCat::Font(font_path, font_size); } catch(const std::invalid_argument &e) { diff --git a/src/skeletal_mesh.cpp b/src/skeletal_mesh.cpp index b9d4b0e..90cbeee 100644 --- a/src/skeletal_mesh.cpp +++ b/src/skeletal_mesh.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -18,12 +18,12 @@ #include "orientation_3d.hpp" #include "vector_3d.hpp" -#include "vk/skeletal_mesh.hpp" +#include "blucat/skeletal_mesh.hpp" void cg_free_skeletal_mesh(mrb_state *mrb, void* obj) { - auto ptr = static_cast<std::shared_ptr<VK::SkeletalMesh>*>(obj); + auto ptr = static_cast<std::shared_ptr<BluCat::SkeletalMesh>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -37,16 +37,16 @@ cg_cSkeletalMesh_initialize(mrb_state *mrb, mrb_value self) { const char *file_path; - std::shared_ptr<VK::SkeletalMesh> *ptr; + std::shared_ptr<BluCat::SkeletalMesh> *ptr; mrb_get_args(mrb, "z", &file_path); - ptr = (std::shared_ptr<VK::SkeletalMesh>*)DATA_PTR(self); + ptr = (std::shared_ptr<BluCat::SkeletalMesh>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::SkeletalMesh>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::SkeletalMesh>)); + ptr = (std::shared_ptr<BluCat::SkeletalMesh>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::SkeletalMesh>)); - new(ptr)std::shared_ptr<VK::SkeletalMesh>( - std::make_shared<VK::SkeletalMesh>(file_path)); + new(ptr)std::shared_ptr<BluCat::SkeletalMesh>( + std::make_shared<BluCat::SkeletalMesh>(file_path)); mrb_data_init(self, ptr, &cg_skeletal_mesh_type); return self; diff --git a/src/skeletal_model.cpp b/src/skeletal_model.cpp index a8dc62a..3a3596e 100644 --- a/src/skeletal_model.cpp +++ b/src/skeletal_model.cpp @@ -20,12 +20,12 @@ #include "vector_3d.hpp" #include "skeletal_mesh.hpp" #include "texture.hpp" -#include "vk/skeletal_model.hpp" +#include "blucat/skeletal_model.hpp" void cg_free_skeletal_model(mrb_state *mrb, void *obj) { - auto ptr = static_cast<std::shared_ptr<VK::SkeletalModel>*>(obj); + auto ptr = static_cast<std::shared_ptr<BluCat::SkeletalModel>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -37,23 +37,23 @@ const struct mrb_data_type cg_skeletal_model_type = { static mrb_value cg_cSkeletalModel_initialize(mrb_state *mrb, mrb_value self) { - std::shared_ptr<VK::SkeletalMesh> *skeletal_mesh; - std::shared_ptr<VK::Texture> *texture; + std::shared_ptr<BluCat::SkeletalMesh> *skeletal_mesh; + std::shared_ptr<BluCat::Texture> *texture; std::shared_ptr<glm::vec3> *position; std::shared_ptr<glm::quat> *orientation; - std::shared_ptr<VK::SkeletalModel> *ptr; + std::shared_ptr<BluCat::SkeletalModel> *ptr; mrb_get_args( mrb, "dddd", &skeletal_mesh, &cg_skeletal_mesh_type, &texture, &cg_texture_type, &position, &cg_vector_3d_type, &orientation, &cg_orientation_3d_type); - ptr = (std::shared_ptr<VK::SkeletalModel>*)DATA_PTR(self); + ptr = (std::shared_ptr<BluCat::SkeletalModel>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::SkeletalModel>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::SkeletalModel>)); + ptr = (std::shared_ptr<BluCat::SkeletalModel>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::SkeletalModel>)); - new(ptr)std::shared_ptr<VK::SkeletalModel>( - std::make_shared<VK::SkeletalModel>( + new(ptr)std::shared_ptr<BluCat::SkeletalModel>( + std::make_shared<BluCat::SkeletalModel>( *skeletal_mesh, *texture, *position, *orientation)); mrb_data_init(self, ptr, &cg_skeletal_model_type); @@ -63,7 +63,7 @@ cg_cSkeletalModel_initialize(mrb_state *mrb, mrb_value self) static mrb_value cg_cSkeletalModel_set_orientation(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::SkeletalModel>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::SkeletalModel>*)DATA_PTR(self); std::shared_ptr<glm::quat> *orientation; mrb_get_args(mrb, "d", &orientation, &cg_orientation_3d_type); @@ -75,7 +75,7 @@ cg_cSkeletalModel_set_orientation(mrb_state *mrb, mrb_value self) static mrb_value cg_cSkeletalModel_set_position(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::SkeletalModel>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::SkeletalModel>*)DATA_PTR(self); std::shared_ptr<glm::vec3> *position; mrb_get_args(mrb, "d", &position, &cg_vector_3d_type); @@ -87,7 +87,7 @@ cg_cSkeletalModel_set_position(mrb_state *mrb, mrb_value self) static mrb_value cg_cSkeletalModel_set_animation(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::SkeletalModel>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::SkeletalModel>*)DATA_PTR(self); mrb_int animation_index; mrb_get_args(mrb, "i", &animation_index); @@ -99,7 +99,7 @@ cg_cSkeletalModel_set_animation(mrb_state *mrb, mrb_value self) static mrb_value cg_cSkeletalModel_draw(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::SkeletalModel>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::SkeletalModel>*)DATA_PTR(self); auto &instances = cg_core.vk_renderer->skeletal_models_to_draw[ cg_core.vk_swapchain->current_frame][(*ptr)->skeletal_mesh]; diff --git a/src/sprite.cpp b/src/sprite.cpp index dba9e22..65a49f7 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -19,12 +19,12 @@ #include "texture.hpp" #include "vector_4d.hpp" #include "view_2d.hpp" -#include "vk/sprite.hpp" +#include "blucat/sprite.hpp" void cg_free_sprite(mrb_state *mrb, void* obj) { - auto ptr = static_cast<std::shared_ptr<VK::Sprite>*>(obj); + auto ptr = static_cast<std::shared_ptr<BluCat::Sprite>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -37,22 +37,22 @@ cg_cSprite_initialize(mrb_state *mrb, mrb_value self) { mrb_float x, y, w, h; glm::vec4 vector_4d; - std::shared_ptr<VK::Texture> *texture; - std::shared_ptr<VK::Sprite> *ptr; + std::shared_ptr<BluCat::Texture> *texture; + std::shared_ptr<BluCat::Sprite> *ptr; mrb_get_args( mrb, "dffff", &texture, &cg_texture_type, &x, &y, &w, &h); - ptr = (std::shared_ptr<VK::Sprite>*)DATA_PTR(self); + ptr = (std::shared_ptr<BluCat::Sprite>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::Sprite>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::Sprite>)); + ptr = (std::shared_ptr<BluCat::Sprite>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::Sprite>)); vector_4d.x = x; vector_4d.y = y; vector_4d.z = w; vector_4d.w = h; - new(ptr)std::shared_ptr<VK::Sprite>( - std::make_shared<VK::Sprite>(*texture, vector_4d)); + new(ptr)std::shared_ptr<BluCat::Sprite>( + std::make_shared<BluCat::Sprite>(*texture, vector_4d)); mrb_data_init(self, ptr, &cg_sprite_type); return self; @@ -62,9 +62,9 @@ static mrb_value cg_cSprite_draw(mrb_state *mrb, mrb_value self) { mrb_value view_value; - VK::View2D *view_2d; + BluCat::View2D *view_2d; mrb_float x, y, w, h, z_index{0.0}; - auto ptr = (std::shared_ptr<VK::Sprite>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::Sprite>*)DATA_PTR(self); mrb_get_args(mrb, "offff|f", &view_value, &x, &y, &w, &h, &z_index); diff --git a/src/sprite_3d.cpp b/src/sprite_3d.cpp index 3e4e29d..d0e3319 100644 --- a/src/sprite_3d.cpp +++ b/src/sprite_3d.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -22,7 +22,7 @@ void cg_free_sprite_3d(mrb_state *mrb, void *obj) { - auto ptr = static_cast<std::shared_ptr<VK::Sprite3D>*>(obj); + auto ptr = static_cast<std::shared_ptr<BluCat::Sprite3D>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -34,21 +34,21 @@ const struct mrb_data_type cg_sprite_3d_type = { static mrb_value cg_cSprite3D_initialize(mrb_state *mrb, mrb_value self) { - std::shared_ptr<VK::Sprite> *sprite; + std::shared_ptr<BluCat::Sprite> *sprite; std::shared_ptr<glm::vec3> *position; mrb_float w, h; - std::shared_ptr<VK::Sprite3D> *ptr; + std::shared_ptr<BluCat::Sprite3D> *ptr; mrb_get_args(mrb, "ddff", &sprite, &cg_sprite_type, &position, &cg_vector_3d_type, &w, &h); - ptr = (std::shared_ptr<VK::Sprite3D>*)DATA_PTR(self); + ptr = (std::shared_ptr<BluCat::Sprite3D>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::Sprite3D>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::Sprite3D>)); + ptr = (std::shared_ptr<BluCat::Sprite3D>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::Sprite3D>)); glm::vec3 size{w, h, 0.0}; - new(ptr)std::shared_ptr<VK::Sprite3D>( - std::make_shared<VK::Sprite3D>(*sprite, *position, size)); + new(ptr)std::shared_ptr<BluCat::Sprite3D>( + std::make_shared<BluCat::Sprite3D>(*sprite, *position, size)); mrb_data_init(self, ptr, &cg_sprite_3d_type); return self; @@ -57,7 +57,7 @@ cg_cSprite3D_initialize(mrb_state *mrb, mrb_value self) static mrb_value cg_cSprite3D_draw(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::Sprite3D>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::Sprite3D>*)DATA_PTR(self); auto &sprites_3d_to_draw = cg_core.vk_renderer->sprites_3d_to_draw[ cg_core.vk_swapchain->current_frame]; diff --git a/src/static_mesh.cpp b/src/static_mesh.cpp index 17d7be3..3ae616e 100644 --- a/src/static_mesh.cpp +++ b/src/static_mesh.cpp @@ -18,12 +18,12 @@ #include "orientation_3d.hpp" #include "vector_3d.hpp" -#include "vk/static_mesh.hpp" +#include "blucat/static_mesh.hpp" void cg_free_static_mesh(mrb_state *mrb, void* obj) { - auto ptr = static_cast<std::shared_ptr<VK::StaticMesh>*>(obj); + auto ptr = static_cast<std::shared_ptr<BluCat::StaticMesh>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -37,16 +37,16 @@ cg_cStaticMesh_initialize(mrb_state *mrb, mrb_value self) { const char *file_path; - std::shared_ptr<VK::StaticMesh> *ptr; + std::shared_ptr<BluCat::StaticMesh> *ptr; mrb_get_args(mrb, "z", &file_path); - ptr = (std::shared_ptr<VK::StaticMesh>*)DATA_PTR(self); + ptr = (std::shared_ptr<BluCat::StaticMesh>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::StaticMesh>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::StaticMesh>)); + ptr = (std::shared_ptr<BluCat::StaticMesh>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::StaticMesh>)); - new(ptr)std::shared_ptr<VK::StaticMesh>( - std::make_shared<VK::StaticMesh>(file_path)); + new(ptr)std::shared_ptr<BluCat::StaticMesh>( + std::make_shared<BluCat::StaticMesh>(file_path)); mrb_data_init(self, ptr, &cg_static_mesh_type); return self; diff --git a/src/static_model.cpp b/src/static_model.cpp index eb9e4c9..3dd0c10 100644 --- a/src/static_model.cpp +++ b/src/static_model.cpp @@ -20,12 +20,12 @@ #include "static_mesh.hpp" #include "texture.hpp" #include "vector_3d.hpp" -#include "vk/static_model.hpp" +#include "blucat/static_model.hpp" void cg_free_static_model(mrb_state *mrb, void *obj) { - auto ptr = static_cast<std::shared_ptr<VK::StaticModel>*>(obj); + auto ptr = static_cast<std::shared_ptr<BluCat::StaticModel>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -37,23 +37,23 @@ const struct mrb_data_type cg_static_model_type = { static mrb_value cg_cStaticModel_initialize(mrb_state *mrb, mrb_value self) { - std::shared_ptr<VK::StaticMesh> *static_mesh; - std::shared_ptr<VK::Texture> *texture; + std::shared_ptr<BluCat::StaticMesh> *static_mesh; + std::shared_ptr<BluCat::Texture> *texture; std::shared_ptr<glm::vec3> *position; std::shared_ptr<glm::quat> *orientation; - std::shared_ptr<VK::StaticModel> *ptr; + std::shared_ptr<BluCat::StaticModel> *ptr; mrb_get_args( mrb, "dddd", &static_mesh, &cg_static_mesh_type, &texture, &cg_texture_type, &position, &cg_vector_3d_type, &orientation, &cg_orientation_3d_type); - ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); + ptr = (std::shared_ptr<BluCat::StaticModel>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::StaticModel>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::StaticModel>)); + ptr = (std::shared_ptr<BluCat::StaticModel>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::StaticModel>)); - new(ptr)std::shared_ptr<VK::StaticModel>( - std::make_shared<VK::StaticModel>( + new(ptr)std::shared_ptr<BluCat::StaticModel>( + std::make_shared<BluCat::StaticModel>( *static_mesh, *texture, *position, *orientation)); mrb_data_init(self, ptr, &cg_static_model_type); @@ -63,7 +63,7 @@ cg_cStaticModel_initialize(mrb_state *mrb, mrb_value self) static mrb_value cg_cStaticModel_set_orientation(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::StaticModel>*)DATA_PTR(self); std::shared_ptr<glm::quat> *orientation; mrb_get_args(mrb, "d", &orientation, &cg_orientation_3d_type); @@ -75,7 +75,7 @@ cg_cStaticModel_set_orientation(mrb_state *mrb, mrb_value self) static mrb_value cg_cStaticModel_set_position(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::StaticModel>*)DATA_PTR(self); std::shared_ptr<glm::vec3> *position; mrb_get_args(mrb, "d", &position, &cg_vector_3d_type); @@ -87,8 +87,8 @@ cg_cStaticModel_set_position(mrb_state *mrb, mrb_value self) static mrb_value cg_cStaticModel_set_texture(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); - std::shared_ptr<VK::Texture> *texture; + auto ptr = (std::shared_ptr<BluCat::StaticModel>*)DATA_PTR(self); + std::shared_ptr<BluCat::Texture> *texture; mrb_get_args(mrb, "d", &texture, &cg_texture_type); (*ptr)->texture = *texture; @@ -99,7 +99,7 @@ cg_cStaticModel_set_texture(mrb_state *mrb, mrb_value self) static mrb_value cg_cStaticModel_draw(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::StaticModel>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::StaticModel>*)DATA_PTR(self); auto &instances = cg_core.vk_renderer->static_models_to_draw[ cg_core.vk_swapchain->current_frame][(*ptr)->static_mesh]; diff --git a/src/texture.cpp b/src/texture.cpp index 24cdc95..0bfac25 100644 --- a/src/texture.cpp +++ b/src/texture.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -18,12 +18,12 @@ #include "core.hpp" #include "font.hpp" -#include "vk/texture.hpp" +#include "blucat/texture.hpp" void cg_free_texture(mrb_state *mrb, void* obj) { - auto *ptr = static_cast<std::shared_ptr<VK::Texture>*>(obj); + auto *ptr = static_cast<std::shared_ptr<BluCat::Texture>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -48,15 +48,15 @@ cg_cTexture_from_image(mrb_state *mrb, mrb_value self) { struct mrb_value texture = texture_alloc(mrb, self); const char *file_path; - std::shared_ptr<VK::Texture> *ptr; + std::shared_ptr<BluCat::Texture> *ptr; mrb_get_args(mrb, "z", &file_path); - ptr = (std::shared_ptr<VK::Texture>*)DATA_PTR(texture); + ptr = (std::shared_ptr<BluCat::Texture>*)DATA_PTR(texture); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::Texture>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::Texture>)); - new(ptr)std::shared_ptr<VK::Texture>( - std::make_shared<VK::Texture>(file_path)); + ptr = (std::shared_ptr<BluCat::Texture>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::Texture>)); + new(ptr)std::shared_ptr<BluCat::Texture>( + std::make_shared<BluCat::Texture>(file_path)); mrb_data_init(texture, ptr, &cg_texture_type); return texture; @@ -68,17 +68,17 @@ cg_cTexture_from_text(mrb_state *mrb, mrb_value self) const char *text; unsigned int width, height; struct mrb_value texture = texture_alloc(mrb, self); - VK::Font *font_ptr; - std::shared_ptr<VK::Texture> *ptr; + BluCat::Font *font_ptr; + std::shared_ptr<BluCat::Texture> *ptr; mrb_get_args(mrb, "dz", &font_ptr, &cg_font_type, &text); - ptr = (std::shared_ptr<VK::Texture>*)DATA_PTR(texture); + ptr = (std::shared_ptr<BluCat::Texture>*)DATA_PTR(texture); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::Texture>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::Texture>)); - new(ptr)std::shared_ptr<VK::Texture>( - std::make_shared<VK::Texture>(font_ptr, text)); + ptr = (std::shared_ptr<BluCat::Texture>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::Texture>)); + new(ptr)std::shared_ptr<BluCat::Texture>( + std::make_shared<BluCat::Texture>(font_ptr, text)); mrb_data_init(texture, ptr, &cg_texture_type); return texture; @@ -87,14 +87,14 @@ cg_cTexture_from_text(mrb_state *mrb, mrb_value self) static mrb_value cg_cTexture_width(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::Texture>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::Texture>*)DATA_PTR(self); return mrb_int_value(mrb, (*ptr)->width); } static mrb_value cg_cTexture_height(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::Texture>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::Texture>*)DATA_PTR(self); return mrb_int_value(mrb, (*ptr)->height); } diff --git a/src/vector_4d.cpp b/src/vector_4d.cpp index 7bdcbab..ba46bda 100644 --- a/src/vector_4d.cpp +++ b/src/vector_4d.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -348,7 +348,7 @@ static mrb_value cg_cVector4D_draw_rectangle(mrb_state *mrb, mrb_value self) { mrb_value view_value; - VK::View2D *view_2d; + BluCat::View2D *view_2d; std::shared_ptr<glm::vec3> *color; auto ptr = (std::shared_ptr<glm::vec4>*)DATA_PTR(self); @@ -358,7 +358,7 @@ cg_cVector4D_draw_rectangle(mrb_state *mrb, mrb_value self) glm::vec4 position( (*ptr)->x, (*ptr)->y, (*ptr)->x + (*ptr)->z, (*ptr)->y + (*ptr)->w); - VK::Rectangle rect{position, (**color)}; + BluCat::Rectangle rect{position, (**color)}; auto &rectangles = view_2d->rectangles_to_draw[ cg_core.vk_swapchain->current_frame]; rectangles.push_back(rect); diff --git a/src/view_2d.cpp b/src/view_2d.cpp index 4a973d6..09cbac1 100644 --- a/src/view_2d.cpp +++ b/src/view_2d.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2022 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -19,13 +19,13 @@ #include "sprite.hpp" #include "vector_4d.hpp" #include "view_3d.hpp" -#include "vk/sprite.hpp" -#include "vk/view_2d.hpp" +#include "blucat/sprite.hpp" +#include "blucat/view_2d.hpp" void cg_free_view_2d(mrb_state *mrb, void* obj) { - auto ptr = static_cast<std::shared_ptr<VK::View2D>*>(obj); + auto ptr = static_cast<std::shared_ptr<BluCat::View2D>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -38,35 +38,35 @@ cg_cView2D_initialize(mrb_state *mrb, mrb_value self) { std::shared_ptr<glm::vec4> *region; mrb_float projection_width, projection_height; - std::shared_ptr<VK::View2D> *ptr; + std::shared_ptr<BluCat::View2D> *ptr; mrb_get_args(mrb, "dff", ®ion, &cg_vector_4d_type, &projection_width, &projection_height); - ptr = (std::shared_ptr<VK::View2D>*)DATA_PTR(self); + ptr = (std::shared_ptr<BluCat::View2D>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::View2D>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::View2D>)); + ptr = (std::shared_ptr<BluCat::View2D>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::View2D>)); - new(ptr)std::shared_ptr<VK::View2D>( - std::make_shared<VK::View2D>( + new(ptr)std::shared_ptr<BluCat::View2D>( + std::make_shared<BluCat::View2D>( *region->get(), projection_width, projection_height)); mrb_data_init(self, ptr, &cg_view_2d_type); return self; } -VK::View2D* +BluCat::View2D* cg_cView_to_view_2d(mrb_state *mrb, mrb_value view_value) { - VK::View2D* view_2d; + BluCat::View2D* view_2d; const mrb_data_type *type = DATA_TYPE(view_value); if(type == &cg_view_2d_type) - view_2d = static_cast<std::shared_ptr<VK::View2D>*>( + view_2d = static_cast<std::shared_ptr<BluCat::View2D>*>( DATA_PTR(view_value))->get(); else if (type == &cg_view_3d_type) - view_2d = static_cast<VK::View2D*>( - static_cast<std::shared_ptr<VK::View3D>*>( + view_2d = static_cast<BluCat::View2D*>( + static_cast<std::shared_ptr<BluCat::View3D>*>( DATA_PTR(view_value))->get()); else mrb_raisef( diff --git a/src/view_2d.hpp b/src/view_2d.hpp index f2ff5b6..a18937e 100644 --- a/src/view_2d.hpp +++ b/src/view_2d.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Frederico de Oliveira Linhares + * Copyright 2022-2024 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. @@ -23,8 +23,8 @@ extern const struct mrb_data_type cg_view_2d_type; // Receives a mrb_value that points to a View2D or a View3D and returns a // pointer to View2D. If the mrb_value points to a View3D, the view will be -// cast to a VK::View2D. -VK::View2D* +// cast to a BluCat::View2D. +BluCat::View2D* cg_cView_to_view_2d(mrb_state *mrb, mrb_value view_value); void diff --git a/src/view_3d.cpp b/src/view_3d.cpp index 7db0015..ddaa3eb 100644 --- a/src/view_3d.cpp +++ b/src/view_3d.cpp @@ -20,13 +20,13 @@ #include "orientation_3d.hpp" #include "vector_3d.hpp" #include "vector_4d.hpp" -#include "vk/sprite.hpp" -#include "vk/view_3d.hpp" +#include "blucat/sprite.hpp" +#include "blucat/view_3d.hpp" void cg_free_view_3d(mrb_state *mrb, void* obj) { - auto ptr = static_cast<std::shared_ptr<VK::View3D>*>(obj); + auto ptr = static_cast<std::shared_ptr<BluCat::View3D>*>(obj); ptr->~shared_ptr(); mrb_free(mrb, ptr); @@ -39,17 +39,17 @@ cg_cView3D_initialize(mrb_state *mrb, mrb_value self) { std::shared_ptr<glm::vec4> *region; mrb_float projection_width, projection_height; - std::shared_ptr<VK::View3D> *ptr; + std::shared_ptr<BluCat::View3D> *ptr; mrb_get_args(mrb, "dff", ®ion, &cg_vector_4d_type, &projection_width, &projection_height); - ptr = (std::shared_ptr<VK::View3D>*)DATA_PTR(self); + ptr = (std::shared_ptr<BluCat::View3D>*)DATA_PTR(self); if(ptr) mrb_free(mrb, ptr); - ptr = (std::shared_ptr<VK::View3D>*)mrb_malloc( - mrb, sizeof(std::shared_ptr<VK::View3D>)); + ptr = (std::shared_ptr<BluCat::View3D>*)mrb_malloc( + mrb, sizeof(std::shared_ptr<BluCat::View3D>)); - new(ptr)std::shared_ptr<VK::View3D>( - std::make_shared<VK::View3D>( + new(ptr)std::shared_ptr<BluCat::View3D>( + std::make_shared<BluCat::View3D>( *region->get(), projection_width, projection_height)); mrb_data_init(self, ptr, &cg_view_3d_type); @@ -60,7 +60,7 @@ static mrb_value cg_cView3D_set_camera_position(mrb_state *mrb, mrb_value self) { std::shared_ptr<glm::vec3> *camera_position; - auto ptr = (std::shared_ptr<VK::View3D>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::View3D>*)DATA_PTR(self); mrb_get_args(mrb, "d", &camera_position, &cg_vector_3d_type); (*ptr)->camera_position = (*camera_position); @@ -72,7 +72,7 @@ static mrb_value cg_cView3D_set_camera_orientation(mrb_state *mrb, mrb_value self) { std::shared_ptr<glm::quat> *camera_orientation; - auto ptr = (std::shared_ptr<VK::View3D>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::View3D>*)DATA_PTR(self); mrb_get_args(mrb, "d", &camera_orientation, &cg_orientation_3d_type); (*ptr)->camera_orientation = (*camera_orientation); @@ -83,7 +83,7 @@ cg_cView3D_set_camera_orientation(mrb_state *mrb, mrb_value self) static mrb_value cg_cView3D_get_field_of_view(mrb_state *mrb, mrb_value self) { - auto ptr = (std::shared_ptr<VK::View3D>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::View3D>*)DATA_PTR(self); return mrb_float_value(mrb, (*ptr)->field_of_view); @@ -94,7 +94,7 @@ static mrb_value cg_cView3D_set_field_of_view(mrb_state *mrb, mrb_value self) { mrb_float fov; - auto ptr = (std::shared_ptr<VK::View3D>*)DATA_PTR(self); + auto ptr = (std::shared_ptr<BluCat::View3D>*)DATA_PTR(self); mrb_get_args(mrb, "f", &fov); (*ptr)->field_of_view = fov; |