-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b63270
commit 6d8599a
Showing
29 changed files
with
644 additions
and
706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,62 @@ | ||
// /* | ||
// This file is part of Vulkan-Engine, a simple to use Vulkan based 3D library | ||
|
||
// MIT License | ||
|
||
// Copyright (c) 2023 Antonio Espinosa Garcia | ||
|
||
// */ | ||
// #ifndef COMPOSITION_PASS_H | ||
// #define COMPOSITION_PASS_H | ||
// #include <engine/graphics/renderpass.h> | ||
|
||
// VULKAN_ENGINE_NAMESPACE_BEGIN | ||
|
||
// class CompositionPass : public RenderPass | ||
// { | ||
|
||
// ColorFormatType m_colorFormat; | ||
|
||
// Mesh *m_vignette; | ||
|
||
// bool m_fxaa; | ||
|
||
// DescriptorSet m_GBufferDescriptor{}; | ||
|
||
// std::vector<Image> m_Gbuffer; | ||
// Buffer m_uniformBuffer; | ||
|
||
// unsigned int m_outputType{0}; | ||
|
||
// public: | ||
// CompositionPass(Context* ctx,VkExtent2D extent, | ||
// uint32_t framebufferCount, | ||
// ColorFormatType colorFormat, Mesh *vignette, bool fxaa) : RenderPass(ctx, extent, framebufferCount, 1, fxaa ? false : true), | ||
// m_colorFormat(colorFormat), m_vignette(vignette), m_fxaa(fxaa) {} | ||
|
||
// void init(); | ||
|
||
// void create_pipelines( DescriptorManager &descriptorManager); | ||
|
||
// void init_resources(); | ||
|
||
// void render(uint32_t frameIndex, Scene *const scene, uint32_t presentImageIndex = 0); | ||
|
||
// inline void set_output_type(int op) { m_outputType = op; } | ||
// inline int get_output_type() const { return m_outputType; } | ||
|
||
// void set_g_buffer(Image position, Image normals, Image albedo, Image material, DescriptorManager &descriptorManager); | ||
|
||
// void update_uniforms(); | ||
|
||
// void cleanup(); | ||
|
||
// void update(); | ||
// }; | ||
// VULKAN_ENGINE_NAMESPACE_END | ||
|
||
// #endif | ||
/* | ||
This file is part of Vulkan-Engine, a simple to use Vulkan based 3D library | ||
MIT License | ||
Copyright (c) 2023 Antonio Espinosa Garcia | ||
*/ | ||
#ifndef COMPOSITION_PASS_H | ||
#define COMPOSITION_PASS_H | ||
#include <engine/core/renderpasses/renderpass.h> | ||
#include <engine/core/resource_manager.h> | ||
|
||
VULKAN_ENGINE_NAMESPACE_BEGIN | ||
namespace Core { | ||
|
||
/* | ||
DEFERRED RENDERING LIGHTING PASS | ||
*/ | ||
class CompositionPass : public RenderPass | ||
{ | ||
/*Setup*/ | ||
ColorFormatType m_colorFormat; | ||
Mesh* m_vignette; | ||
|
||
/*Descriptors*/ | ||
struct FrameDescriptors { | ||
Graphics::DescriptorSet globalDescritor; | ||
Graphics::DescriptorSet gBufferDescritor; | ||
}; | ||
std::vector<FrameDescriptors> m_descriptors; | ||
|
||
public: | ||
CompositionPass(Graphics::Device* ctx, | ||
VkExtent2D extent, | ||
uint32_t framebufferCount, | ||
ColorFormatType colorFormat, | ||
Mesh* vignette, | ||
bool isDefault = true) | ||
: RenderPass(ctx, extent, framebufferCount, 1, isDefault) | ||
, m_colorFormat(colorFormat) | ||
, m_vignette(vignette) { | ||
} | ||
|
||
void setup_attachments(std::vector<Graphics::Attachment>& attachments, | ||
std::vector<Graphics::SubPassDependency>& dependencies); | ||
|
||
void setup_uniforms(std::vector<Graphics::Frame>& frames); | ||
|
||
void setup_shader_passes(); | ||
|
||
void render(Graphics::Frame& currentFrame, Scene* const scene, uint32_t presentImageIndex = 0); | ||
|
||
void connect_to_previous_images(std::vector<Graphics::Image> images); | ||
|
||
void update_uniforms(uint32_t frameIndex, Scene* const scene); | ||
|
||
}; | ||
} // namespace Core | ||
VULKAN_ENGINE_NAMESPACE_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#ifndef DEFERRED_H | ||
#define DEFERRED_H | ||
|
||
#include <engine/core/renderpasses/composition_pass.h> | ||
#include <engine/core/renderpasses/fxaa_pass.h> | ||
#include <engine/core/renderpasses/geometry_pass.h> | ||
#include <engine/core/renderpasses/variance_shadow_pass.h> | ||
#include <engine/systems/renderers/renderer.h> | ||
|
||
VULKAN_ENGINE_NAMESPACE_BEGIN | ||
|
||
namespace Systems { | ||
|
||
/* | ||
Renders a given scene data to a given window using forward rendering. Fully parametrizable. | ||
*/ | ||
class DeferredRenderer : public BaseRenderer | ||
{ | ||
enum RenderPasses | ||
{ | ||
SHADOW_PASS = 0, | ||
GEOMETRY_PASS = 1, | ||
COMPOSITION_PASS = 2, | ||
FXAA_PASS = 3 | ||
}; | ||
|
||
bool m_softwareAA = true; //FXAA for now | ||
ShadowResolution m_shadowQuality = ShadowResolution::MEDIUM; | ||
|
||
//Query | ||
bool m_updateShadows = false; | ||
|
||
public: | ||
DeferredRenderer(Core::IWindow* window) | ||
: BaseRenderer(window) { | ||
} | ||
DeferredRenderer(Core::IWindow* window, | ||
bool softwareAA = true, | ||
ShadowResolution shadowQuality = ShadowResolution::MEDIUM, | ||
RendererSettings settings = {}) | ||
: BaseRenderer(window, settings) | ||
, m_softwareAA(softwareAA) | ||
, m_shadowQuality(shadowQuality) { | ||
} | ||
|
||
inline void set_shadow_quality(ShadowResolution quality) { | ||
m_shadowQuality = quality; | ||
if (m_initialized) | ||
m_updateShadows = true; | ||
} | ||
|
||
protected: | ||
virtual void on_before_render(Core::Scene* const scene); | ||
|
||
virtual void on_after_render(RenderResult& renderResult, Core::Scene* const scene); | ||
|
||
virtual void create_renderpasses(); | ||
}; | ||
} // namespace Systems | ||
VULKAN_ENGINE_NAMESPACE_END | ||
|
||
#endif |
Oops, something went wrong.