diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/include/Model.h b/include/Model.h index 8d6b798..9f1be76 100644 --- a/include/Model.h +++ b/include/Model.h @@ -4,7 +4,6 @@ namespace fpr { - //Helper struct to pass on primitive data to construct meshes and buffers. struct ModelPrimitives { std::vector vertices; diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/include/Model.h b/include/Model.h index 8d6b798..9f1be76 100644 --- a/include/Model.h +++ b/include/Model.h @@ -4,7 +4,6 @@ namespace fpr { - //Helper struct to pass on primitive data to construct meshes and buffers. struct ModelPrimitives { std::vector vertices; diff --git a/include/ShaderObjects.h b/include/ShaderObjects.h index 8f2e9ec..ece9c17 100644 --- a/include/ShaderObjects.h +++ b/include/ShaderObjects.h @@ -1,13 +1,13 @@ #pragma once #include -#define FPR_MAX_LIGHTS 8192 +#define FPR_MAX_LIGHTS 4098 #define FPR_MAX_LIGHTS_PER_TILE 1024 namespace fpr { static constexpr unsigned int MAX_LIGHTS = FPR_MAX_LIGHTS; struct ViewportConstants { - alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.05f }; + alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.01f }; alignas(8) glm::ivec2 viewport_size = {}; alignas(8) glm::ivec2 tile_size; alignas(4) unsigned int horizontal_tile_count; diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/include/Model.h b/include/Model.h index 8d6b798..9f1be76 100644 --- a/include/Model.h +++ b/include/Model.h @@ -4,7 +4,6 @@ namespace fpr { - //Helper struct to pass on primitive data to construct meshes and buffers. struct ModelPrimitives { std::vector vertices; diff --git a/include/ShaderObjects.h b/include/ShaderObjects.h index 8f2e9ec..ece9c17 100644 --- a/include/ShaderObjects.h +++ b/include/ShaderObjects.h @@ -1,13 +1,13 @@ #pragma once #include -#define FPR_MAX_LIGHTS 8192 +#define FPR_MAX_LIGHTS 4098 #define FPR_MAX_LIGHTS_PER_TILE 1024 namespace fpr { static constexpr unsigned int MAX_LIGHTS = FPR_MAX_LIGHTS; struct ViewportConstants { - alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.05f }; + alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.01f }; alignas(8) glm::ivec2 viewport_size = {}; alignas(8) glm::ivec2 tile_size; alignas(4) unsigned int horizontal_tile_count; diff --git a/include/SwapChain.h b/include/SwapChain.h index 0fe5dfe..2041fa8 100644 --- a/include/SwapChain.h +++ b/include/SwapChain.h @@ -31,14 +31,13 @@ std::vector m_image_ready_semaphores; std::vector m_render_done_semaphores; std::vector m_compute_semaphores; + vk::UniqueFence m_draw_fence; + std::vector m_earlyz_semaphores; + uint32_t MAX_IMAGES_IN_FLIGHT = 2; // Want at least double buffering if possible. + uint32_t m_current_frame = 0; + vk::Extent2D m_extent; - vk::UniqueFence m_draw_fence; - std::vector m_earlyz_semaphores; - uint32_t MAX_IMAGES_IN_FLIGHT = 2; //Want at least double buffering if possible. - uint32_t m_current_frame = 0; - vk::Extent2D m_extent; - - bool is_recreation = false; //Resizing requires swapchain recreation. Most of the time, not needed + bool is_recreation = false; // Resizing requires swapchain recreation. Most of the time, not needed std::vector m_depth_framebuffers; std::vector m_depth_command_buffers; diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/include/Model.h b/include/Model.h index 8d6b798..9f1be76 100644 --- a/include/Model.h +++ b/include/Model.h @@ -4,7 +4,6 @@ namespace fpr { - //Helper struct to pass on primitive data to construct meshes and buffers. struct ModelPrimitives { std::vector vertices; diff --git a/include/ShaderObjects.h b/include/ShaderObjects.h index 8f2e9ec..ece9c17 100644 --- a/include/ShaderObjects.h +++ b/include/ShaderObjects.h @@ -1,13 +1,13 @@ #pragma once #include -#define FPR_MAX_LIGHTS 8192 +#define FPR_MAX_LIGHTS 4098 #define FPR_MAX_LIGHTS_PER_TILE 1024 namespace fpr { static constexpr unsigned int MAX_LIGHTS = FPR_MAX_LIGHTS; struct ViewportConstants { - alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.05f }; + alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.01f }; alignas(8) glm::ivec2 viewport_size = {}; alignas(8) glm::ivec2 tile_size; alignas(4) unsigned int horizontal_tile_count; diff --git a/include/SwapChain.h b/include/SwapChain.h index 0fe5dfe..2041fa8 100644 --- a/include/SwapChain.h +++ b/include/SwapChain.h @@ -31,14 +31,13 @@ std::vector m_image_ready_semaphores; std::vector m_render_done_semaphores; std::vector m_compute_semaphores; + vk::UniqueFence m_draw_fence; + std::vector m_earlyz_semaphores; + uint32_t MAX_IMAGES_IN_FLIGHT = 2; // Want at least double buffering if possible. + uint32_t m_current_frame = 0; + vk::Extent2D m_extent; - vk::UniqueFence m_draw_fence; - std::vector m_earlyz_semaphores; - uint32_t MAX_IMAGES_IN_FLIGHT = 2; //Want at least double buffering if possible. - uint32_t m_current_frame = 0; - vk::Extent2D m_extent; - - bool is_recreation = false; //Resizing requires swapchain recreation. Most of the time, not needed + bool is_recreation = false; // Resizing requires swapchain recreation. Most of the time, not needed std::vector m_depth_framebuffers; std::vector m_depth_command_buffers; diff --git a/include/stdafx.h b/include/stdafx.h index 82cae5c..c5d0b2a 100644 --- a/include/stdafx.h +++ b/include/stdafx.h @@ -28,4 +28,5 @@ #include #include #include -#include "ShaderObjects.h" \ No newline at end of file +#include "ShaderObjects.h" +#include \ No newline at end of file diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/include/Model.h b/include/Model.h index 8d6b798..9f1be76 100644 --- a/include/Model.h +++ b/include/Model.h @@ -4,7 +4,6 @@ namespace fpr { - //Helper struct to pass on primitive data to construct meshes and buffers. struct ModelPrimitives { std::vector vertices; diff --git a/include/ShaderObjects.h b/include/ShaderObjects.h index 8f2e9ec..ece9c17 100644 --- a/include/ShaderObjects.h +++ b/include/ShaderObjects.h @@ -1,13 +1,13 @@ #pragma once #include -#define FPR_MAX_LIGHTS 8192 +#define FPR_MAX_LIGHTS 4098 #define FPR_MAX_LIGHTS_PER_TILE 1024 namespace fpr { static constexpr unsigned int MAX_LIGHTS = FPR_MAX_LIGHTS; struct ViewportConstants { - alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.05f }; + alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.01f }; alignas(8) glm::ivec2 viewport_size = {}; alignas(8) glm::ivec2 tile_size; alignas(4) unsigned int horizontal_tile_count; diff --git a/include/SwapChain.h b/include/SwapChain.h index 0fe5dfe..2041fa8 100644 --- a/include/SwapChain.h +++ b/include/SwapChain.h @@ -31,14 +31,13 @@ std::vector m_image_ready_semaphores; std::vector m_render_done_semaphores; std::vector m_compute_semaphores; + vk::UniqueFence m_draw_fence; + std::vector m_earlyz_semaphores; + uint32_t MAX_IMAGES_IN_FLIGHT = 2; // Want at least double buffering if possible. + uint32_t m_current_frame = 0; + vk::Extent2D m_extent; - vk::UniqueFence m_draw_fence; - std::vector m_earlyz_semaphores; - uint32_t MAX_IMAGES_IN_FLIGHT = 2; //Want at least double buffering if possible. - uint32_t m_current_frame = 0; - vk::Extent2D m_extent; - - bool is_recreation = false; //Resizing requires swapchain recreation. Most of the time, not needed + bool is_recreation = false; // Resizing requires swapchain recreation. Most of the time, not needed std::vector m_depth_framebuffers; std::vector m_depth_command_buffers; diff --git a/include/stdafx.h b/include/stdafx.h index 82cae5c..c5d0b2a 100644 --- a/include/stdafx.h +++ b/include/stdafx.h @@ -28,4 +28,5 @@ #include #include #include -#include "ShaderObjects.h" \ No newline at end of file +#include "ShaderObjects.h" +#include \ No newline at end of file diff --git a/shaders/FragmentShader.frag b/shaders/FragmentShader.frag index a19337d..533ca9e 100644 --- a/shaders/FragmentShader.frag +++ b/shaders/FragmentShader.frag @@ -1,6 +1,6 @@ #version 450 -const int light_count = 8192; +const int light_count = 4098; struct PointLight { vec3 color; diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/include/Model.h b/include/Model.h index 8d6b798..9f1be76 100644 --- a/include/Model.h +++ b/include/Model.h @@ -4,7 +4,6 @@ namespace fpr { - //Helper struct to pass on primitive data to construct meshes and buffers. struct ModelPrimitives { std::vector vertices; diff --git a/include/ShaderObjects.h b/include/ShaderObjects.h index 8f2e9ec..ece9c17 100644 --- a/include/ShaderObjects.h +++ b/include/ShaderObjects.h @@ -1,13 +1,13 @@ #pragma once #include -#define FPR_MAX_LIGHTS 8192 +#define FPR_MAX_LIGHTS 4098 #define FPR_MAX_LIGHTS_PER_TILE 1024 namespace fpr { static constexpr unsigned int MAX_LIGHTS = FPR_MAX_LIGHTS; struct ViewportConstants { - alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.05f }; + alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.01f }; alignas(8) glm::ivec2 viewport_size = {}; alignas(8) glm::ivec2 tile_size; alignas(4) unsigned int horizontal_tile_count; diff --git a/include/SwapChain.h b/include/SwapChain.h index 0fe5dfe..2041fa8 100644 --- a/include/SwapChain.h +++ b/include/SwapChain.h @@ -31,14 +31,13 @@ std::vector m_image_ready_semaphores; std::vector m_render_done_semaphores; std::vector m_compute_semaphores; + vk::UniqueFence m_draw_fence; + std::vector m_earlyz_semaphores; + uint32_t MAX_IMAGES_IN_FLIGHT = 2; // Want at least double buffering if possible. + uint32_t m_current_frame = 0; + vk::Extent2D m_extent; - vk::UniqueFence m_draw_fence; - std::vector m_earlyz_semaphores; - uint32_t MAX_IMAGES_IN_FLIGHT = 2; //Want at least double buffering if possible. - uint32_t m_current_frame = 0; - vk::Extent2D m_extent; - - bool is_recreation = false; //Resizing requires swapchain recreation. Most of the time, not needed + bool is_recreation = false; // Resizing requires swapchain recreation. Most of the time, not needed std::vector m_depth_framebuffers; std::vector m_depth_command_buffers; diff --git a/include/stdafx.h b/include/stdafx.h index 82cae5c..c5d0b2a 100644 --- a/include/stdafx.h +++ b/include/stdafx.h @@ -28,4 +28,5 @@ #include #include #include -#include "ShaderObjects.h" \ No newline at end of file +#include "ShaderObjects.h" +#include \ No newline at end of file diff --git a/shaders/FragmentShader.frag b/shaders/FragmentShader.frag index a19337d..533ca9e 100644 --- a/shaders/FragmentShader.frag +++ b/shaders/FragmentShader.frag @@ -1,6 +1,6 @@ #version 450 -const int light_count = 8192; +const int light_count = 4098; struct PointLight { vec3 color; diff --git a/shaders/LightComputeShader.comp b/shaders/LightComputeShader.comp index 1059685..f32e4d3 100644 --- a/shaders/LightComputeShader.comp +++ b/shaders/LightComputeShader.comp @@ -1,7 +1,7 @@ #version 450 //CONSTANTS -const int MAX_LIGHTS = 8192; +const int MAX_LIGHTS = 4098; #define MAX_LIGHTS_IN_TILE 1024 const vec2 ndc_begin = vec2(-1.0, -1.0); diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/include/Model.h b/include/Model.h index 8d6b798..9f1be76 100644 --- a/include/Model.h +++ b/include/Model.h @@ -4,7 +4,6 @@ namespace fpr { - //Helper struct to pass on primitive data to construct meshes and buffers. struct ModelPrimitives { std::vector vertices; diff --git a/include/ShaderObjects.h b/include/ShaderObjects.h index 8f2e9ec..ece9c17 100644 --- a/include/ShaderObjects.h +++ b/include/ShaderObjects.h @@ -1,13 +1,13 @@ #pragma once #include -#define FPR_MAX_LIGHTS 8192 +#define FPR_MAX_LIGHTS 4098 #define FPR_MAX_LIGHTS_PER_TILE 1024 namespace fpr { static constexpr unsigned int MAX_LIGHTS = FPR_MAX_LIGHTS; struct ViewportConstants { - alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.05f }; + alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.01f }; alignas(8) glm::ivec2 viewport_size = {}; alignas(8) glm::ivec2 tile_size; alignas(4) unsigned int horizontal_tile_count; diff --git a/include/SwapChain.h b/include/SwapChain.h index 0fe5dfe..2041fa8 100644 --- a/include/SwapChain.h +++ b/include/SwapChain.h @@ -31,14 +31,13 @@ std::vector m_image_ready_semaphores; std::vector m_render_done_semaphores; std::vector m_compute_semaphores; + vk::UniqueFence m_draw_fence; + std::vector m_earlyz_semaphores; + uint32_t MAX_IMAGES_IN_FLIGHT = 2; // Want at least double buffering if possible. + uint32_t m_current_frame = 0; + vk::Extent2D m_extent; - vk::UniqueFence m_draw_fence; - std::vector m_earlyz_semaphores; - uint32_t MAX_IMAGES_IN_FLIGHT = 2; //Want at least double buffering if possible. - uint32_t m_current_frame = 0; - vk::Extent2D m_extent; - - bool is_recreation = false; //Resizing requires swapchain recreation. Most of the time, not needed + bool is_recreation = false; // Resizing requires swapchain recreation. Most of the time, not needed std::vector m_depth_framebuffers; std::vector m_depth_command_buffers; diff --git a/include/stdafx.h b/include/stdafx.h index 82cae5c..c5d0b2a 100644 --- a/include/stdafx.h +++ b/include/stdafx.h @@ -28,4 +28,5 @@ #include #include #include -#include "ShaderObjects.h" \ No newline at end of file +#include "ShaderObjects.h" +#include \ No newline at end of file diff --git a/shaders/FragmentShader.frag b/shaders/FragmentShader.frag index a19337d..533ca9e 100644 --- a/shaders/FragmentShader.frag +++ b/shaders/FragmentShader.frag @@ -1,6 +1,6 @@ #version 450 -const int light_count = 8192; +const int light_count = 4098; struct PointLight { vec3 color; diff --git a/shaders/LightComputeShader.comp b/shaders/LightComputeShader.comp index 1059685..f32e4d3 100644 --- a/shaders/LightComputeShader.comp +++ b/shaders/LightComputeShader.comp @@ -1,7 +1,7 @@ #version 450 //CONSTANTS -const int MAX_LIGHTS = 8192; +const int MAX_LIGHTS = 4098; #define MAX_LIGHTS_IN_TILE 1024 const vec2 ndc_begin = vec2(-1.0, -1.0); diff --git a/src/Camera.cpp b/src/Camera.cpp index ff0a160..4733cff 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -46,7 +46,7 @@ void Camera::RotateX(float value) { value *= m_rotation_speed; - glm::quat new_rotation; + glm::quat new_rotation{}; new_rotation.x = sin(value / 2.0f); new_rotation.y = 0.0f; new_rotation.z = 0.0f; @@ -57,7 +57,7 @@ void Camera::RotateY(float value) { value *= m_rotation_speed; - glm::quat new_rotation; + glm::quat new_rotation{}; new_rotation.x = 0; new_rotation.y = sin(value / 2.0f); new_rotation.z = 0; @@ -68,7 +68,7 @@ void Camera::RotateZ(float value) { value *= m_rotation_speed; - glm::quat new_rotation; + glm::quat new_rotation{}; new_rotation.x = 0.0f; new_rotation.y = 0.0f; new_rotation.z = sin(value / 2.0f); diff --git a/.gitignore b/.gitignore index e587228..e6ce446 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ # JetBrains Rider .idea/ *.sln.iml +/DoxyGen diff --git a/CAMERA.ipch b/CAMERA.ipch new file mode 100644 index 0000000..af7c66d --- /dev/null +++ b/CAMERA.ipch Binary files differ diff --git a/Camera.ixx b/Camera.ixx new file mode 100644 index 0000000..9c5dde2 --- /dev/null +++ b/Camera.ixx @@ -0,0 +1,46 @@ +module; +#include + +export module Camera; +namespace fpr +{ +export class Camera +{ + glm::vec3 m_position; + glm::quat m_rotation; + glm::mat4 m_view_matrix; + glm::mat4 m_projection_matrix; + float m_FOV; + float m_near; + float m_far; + float m_movement_speed = 300.0f; + float m_rotation_speed = 2.0f; +public: + Camera( + glm::vec3 position = { 0.0f, 0, 0.0f }, + glm::quat rotation = { 1.0f, 0.0f, 0.0f, 0.0f }, + float FOV = 60.0f, + float near = 1.0f, + float far = 10000); + + void Update(); + + void SetPosition(glm::vec3 new_pos); + void SetRotation(float amount, glm::vec3 axis_rot); + + void MoveX(float value); + void MoveY(float value); + void MoveZ(float value); + + void RotateX(float value); + void RotateY(float value); + void RotateZ(float value); + + [[nodiscard]] const glm::mat4 GetViewMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; + [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; +}; +} // namespace fpr + + + diff --git a/Forward Plus Renderer.vcxproj b/Forward Plus Renderer.vcxproj index 2eae8d7..a3055e6 100644 --- a/Forward Plus Renderer.vcxproj +++ b/Forward Plus Renderer.vcxproj @@ -49,6 +49,8 @@ v143 Unicode false + true + true StaticLibrary @@ -84,6 +86,10 @@ true Build + true + true + false + clang-analyzer- cppcoreguidelines- performance- true @@ -158,8 +164,8 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - $(ProjectDir)include;C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)external - true + $(ProjectDir)include;C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)external + false TurnOffAllWarnings true Cdecl @@ -184,6 +190,9 @@ cmd /c $(ProjectDir)shaders\comile_shaders.bat + + $(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + @@ -194,7 +203,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 - C:\VulkanSDK\1.2.189.2\Include;$(ProjectDir)\external;$(ProjectDir)\include + C:\VulkanSDK\1.3.204.1\Include;$(ProjectDir)\external;$(ProjectDir)\include true TurnOffAllWarnings true @@ -223,7 +232,7 @@ assimp-vc142-mt.lib;glfw3.lib;glfw3_mt.lib;vulkan-1.lib;%(AdditionalDependencies) - $(ProjectDir)lib/Release;C:\VulkanSDK\1.2.189.2\Lib;%(AdditionalLibraryDirectories) + $(ProjectDir)lib/Release;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) diff --git a/include/Buffer/Buffer.h b/include/Buffer/Buffer.h index 8bff9cb..1d45d61 100644 --- a/include/Buffer/Buffer.h +++ b/include/Buffer/Buffer.h @@ -13,10 +13,12 @@ vk::BufferUsageFlags m_usage; vk::MemoryPropertyFlags m_memory_flags; void* mapped_data = nullptr; + public: + Buffer(Buffer& other) = delete; Buffer() = default; Buffer(vk::DeviceSize buffer_size, vk::BufferUsageFlags usage_flags, vk::MemoryPropertyFlags mem_flags); - ~Buffer(); + virtual ~Buffer(); vk::DeviceSize GetSize(); vk::Buffer& GetBuffer(); diff --git a/include/Buffer/DepthBuffer.h b/include/Buffer/DepthBuffer.h index 28a4919..478a012 100644 --- a/include/Buffer/DepthBuffer.h +++ b/include/Buffer/DepthBuffer.h @@ -1,5 +1,5 @@ -#include #pragma once +#include #include "Buffer/Buffer.h" #include "Texture.h" namespace fpr @@ -9,6 +9,7 @@ class DepthBuffer { + vk::UniqueImage m_depth_image; vk::UniqueDeviceMemory m_depth_buffer_memory; vk::UniqueImageView m_depth_image_view; @@ -39,8 +40,6 @@ static constexpr std::array DEPTH_BUFFER_IMAGE_FORMATS = { vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint, - - }; DepthBuffer(const DepthBuffer& other) = delete; diff --git a/include/Camera.h b/include/Camera.h index 664387b..f66b8be 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,8 +1,5 @@ #pragma once #include - -#include "Buffer/Buffer.h" -#include namespace fpr { class Camera @@ -41,4 +38,4 @@ [[nodiscard]] const glm::mat4 GetProjectionMatrix() const FPR_NOEXCEPT; [[nodiscard]] const glm::vec3 GetPosition() const FPR_NOEXCEPT; }; -} // namespace fpr \ No newline at end of file +} // namespace fpr diff --git a/include/Model.h b/include/Model.h index 8d6b798..9f1be76 100644 --- a/include/Model.h +++ b/include/Model.h @@ -4,7 +4,6 @@ namespace fpr { - //Helper struct to pass on primitive data to construct meshes and buffers. struct ModelPrimitives { std::vector vertices; diff --git a/include/ShaderObjects.h b/include/ShaderObjects.h index 8f2e9ec..ece9c17 100644 --- a/include/ShaderObjects.h +++ b/include/ShaderObjects.h @@ -1,13 +1,13 @@ #pragma once #include -#define FPR_MAX_LIGHTS 8192 +#define FPR_MAX_LIGHTS 4098 #define FPR_MAX_LIGHTS_PER_TILE 1024 namespace fpr { static constexpr unsigned int MAX_LIGHTS = FPR_MAX_LIGHTS; struct ViewportConstants { - alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.05f }; + alignas(16) glm::vec4 ambient_light = { 1.0, 0.8, 0.3, 0.01f }; alignas(8) glm::ivec2 viewport_size = {}; alignas(8) glm::ivec2 tile_size; alignas(4) unsigned int horizontal_tile_count; diff --git a/include/SwapChain.h b/include/SwapChain.h index 0fe5dfe..2041fa8 100644 --- a/include/SwapChain.h +++ b/include/SwapChain.h @@ -31,14 +31,13 @@ std::vector m_image_ready_semaphores; std::vector m_render_done_semaphores; std::vector m_compute_semaphores; + vk::UniqueFence m_draw_fence; + std::vector m_earlyz_semaphores; + uint32_t MAX_IMAGES_IN_FLIGHT = 2; // Want at least double buffering if possible. + uint32_t m_current_frame = 0; + vk::Extent2D m_extent; - vk::UniqueFence m_draw_fence; - std::vector m_earlyz_semaphores; - uint32_t MAX_IMAGES_IN_FLIGHT = 2; //Want at least double buffering if possible. - uint32_t m_current_frame = 0; - vk::Extent2D m_extent; - - bool is_recreation = false; //Resizing requires swapchain recreation. Most of the time, not needed + bool is_recreation = false; // Resizing requires swapchain recreation. Most of the time, not needed std::vector m_depth_framebuffers; std::vector m_depth_command_buffers; diff --git a/include/stdafx.h b/include/stdafx.h index 82cae5c..c5d0b2a 100644 --- a/include/stdafx.h +++ b/include/stdafx.h @@ -28,4 +28,5 @@ #include #include #include -#include "ShaderObjects.h" \ No newline at end of file +#include "ShaderObjects.h" +#include \ No newline at end of file diff --git a/shaders/FragmentShader.frag b/shaders/FragmentShader.frag index a19337d..533ca9e 100644 --- a/shaders/FragmentShader.frag +++ b/shaders/FragmentShader.frag @@ -1,6 +1,6 @@ #version 450 -const int light_count = 8192; +const int light_count = 4098; struct PointLight { vec3 color; diff --git a/shaders/LightComputeShader.comp b/shaders/LightComputeShader.comp index 1059685..f32e4d3 100644 --- a/shaders/LightComputeShader.comp +++ b/shaders/LightComputeShader.comp @@ -1,7 +1,7 @@ #version 450 //CONSTANTS -const int MAX_LIGHTS = 8192; +const int MAX_LIGHTS = 4098; #define MAX_LIGHTS_IN_TILE 1024 const vec2 ndc_begin = vec2(-1.0, -1.0); diff --git a/src/Camera.cpp b/src/Camera.cpp index ff0a160..4733cff 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -46,7 +46,7 @@ void Camera::RotateX(float value) { value *= m_rotation_speed; - glm::quat new_rotation; + glm::quat new_rotation{}; new_rotation.x = sin(value / 2.0f); new_rotation.y = 0.0f; new_rotation.z = 0.0f; @@ -57,7 +57,7 @@ void Camera::RotateY(float value) { value *= m_rotation_speed; - glm::quat new_rotation; + glm::quat new_rotation{}; new_rotation.x = 0; new_rotation.y = sin(value / 2.0f); new_rotation.z = 0; @@ -68,7 +68,7 @@ void Camera::RotateZ(float value) { value *= m_rotation_speed; - glm::quat new_rotation; + glm::quat new_rotation{}; new_rotation.x = 0.0f; new_rotation.y = 0.0f; new_rotation.z = sin(value / 2.0f); diff --git a/src/Device.cpp b/src/Device.cpp index 7c5d28a..ccaa58b 100644 --- a/src/Device.cpp +++ b/src/Device.cpp @@ -194,8 +194,8 @@ for(auto& device : devices) { - if(device.getProperties().deviceType != vk::PhysicalDeviceType::eDiscreteGpu) - continue; + //if(device.getProperties().deviceType != vk::PhysicalDeviceType::eDiscreteGpu) + // continue; if(IsDeviceSuitable(device, surface)) { m_physical_device = device; @@ -203,6 +203,8 @@ } } - // assert(m_physical_device != nullptr); + std::cout << "No valid device found. Exiting.\n"; + exit(EXIT_FAILURE); + } } // namespace fpr \ No newline at end of file