Repository navigation
Expand file tree
/
Copy pathVulkanApplication.h
More file actions
112 lines (81 loc) · 3.4 KB
/
Copy pathVulkanApplication.h
File metadata and controls
112 lines (81 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* @file VulkanApplication.h
* @brief This file contains VulkanApplication class declaration.
* @author Mustafa Yemural (myemural)
* @date 16.09.2026
*
* Copyright (c) 2025 Mustafa Yemural - www.mustafayemural.com
* Released under the MIT License
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <memory>
#include "ApplicationColorProcessingToneMapping.h"
#include "ApplicationData.h"
#include "AssetManager.h"
#include "PerspectiveCamera.h"
#include "Scene.h"
#include "VulkanCommandBuffer.h"
#include "VulkanFramebuffer.h"
#include "VulkanPipeline.h"
#include "VulkanPipelineLayout.h"
#include "Window.h"
namespace examples::post_processing_effects::color_processing_tone_mapping::hdr_tone_mapping
{
class VulkanApplication final : public base::ApplicationColorProcessingToneMapping
{
public:
explicit VulkanApplication(common::utility::ParameterServer&& params);
~VulkanApplication() override = default;
protected:
bool Init() override;
void DrawFrame() override;
void PreUpdate() override;
private:
void InitAssetManager();
void CreateInitialResources() const;
void BuildScene();
void CreateAndUpdateDescriptorSets() const;
void InitInputSystem();
void CreateRenderPass();
void CreatePipelines();
void CreateFramebuffers();
void CreateCommandBuffers();
void RecordPresentCommandBuffers(std::uint32_t currentImageIndex);
void UpdateSceneTransforms() const;
void ProcessInput();
// Render Passes
std::shared_ptr<common::vulkan_wrapper::VulkanRenderPass> geometryRenderPass_;
std::shared_ptr<common::vulkan_wrapper::VulkanRenderPass> lightingRenderPass_;
std::shared_ptr<common::vulkan_wrapper::VulkanRenderPass> postProcessingRenderPass_;
// Pipelines
std::shared_ptr<common::vulkan_wrapper::VulkanPipelineLayout> geometryPipelineLayout_;
std::shared_ptr<common::vulkan_wrapper::VulkanPipelineLayout> lightPipelineLayout_;
std::shared_ptr<common::vulkan_wrapper::VulkanPipelineLayout> postProcessingPipelineLayout_;
std::shared_ptr<common::vulkan_wrapper::VulkanPipeline> geometryPassPipeline_;
std::shared_ptr<common::vulkan_wrapper::VulkanPipeline> lightPassPipeline_;
std::shared_ptr<common::vulkan_wrapper::VulkanPipeline> postProcessingPassPipeline_;
// Framebuffers
std::shared_ptr<common::vulkan_wrapper::VulkanFramebuffer> geometryFramebuffer_;
std::shared_ptr<common::vulkan_wrapper::VulkanFramebuffer> lightingFramebuffer_;
std::vector<std::shared_ptr<common::vulkan_wrapper::VulkanFramebuffer>> presentFramebuffers_;
// Command buffers
std::vector<std::shared_ptr<common::vulkan_wrapper::VulkanCommandBuffer>> cmdBuffersPresent_;
// Mouse related values
bool firstMouseTriggered_ = true;
float lastX_ = 0.0f;
float lastY_ = 0.0f;
// Camera
std::shared_ptr<common::camera::PerspectiveCamera> camera_ = nullptr;
// Scene manager
std::unique_ptr<common::scene::Scene> scene_;
// Asset manager
std::unique_ptr<common::asset_manager::AssetManager> assetManager_;
// Material registry
std::unordered_map<std::string, common::scene::Material> materialRegistry_;
// Current tone mapping operation value
ToneMappingMode toneMappingMode_ = ToneMappingMode::OFF;
// Current exposure value
float exposure_ = 1.0f;
};
} // namespace examples::post_processing_effects::color_processing_tone_mapping::hdr_tone_mapping