Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
graphite/engine/renderer/include/shadowpass.hpp
2024-01-03 16:05:02 -05:00

68 lines
No EOL
1.2 KiB
C++

#pragma once
#include <map>
#include <glm/glm.hpp>
#include <vk.hpp>
#include <component.hpp>
#include "renderer.hpp"
struct ShadowData
{
VkImage image;
VkDeviceMemory memory;
VkImageView view;
VkSampler sampler;
VkFramebuffer framebuffer;
};
class ShadowPass
{
public:
void Initialize(Renderer* inRenderer, vk::Device device);
void Cleanup(vk::Device device);
void Record(vk::Device device);
bool IsLightPrepared(Light* light);
ShadowData GetLightShadow(Light* light);
void PrepareLight(Light* light, vk::Device device);
bool HasRecorded()
{
return has_recorded;
}
VkCommandBuffer commandBuffer;
VkSemaphore semaphore;
private:
bool has_recorded = false;
VkRenderPass renderPass;
VkPipelineLayout pipelineLayout;
VkPipeline pipeline;
VkShaderModule vertexShaderModule;
VkShaderModule fragmentShaderModule;
VkDescriptorSetLayout descriptorSetLayout;
VkDescriptorSet descriptorSet;
VkDescriptorPool descriptorPool;
struct UniformObjectData
{
glm::mat4 model, view, proj;
};
VkBuffer uniformObjectBuffer;
VkDeviceMemory uniformObjectBufferMemory;
std::map<Light*, ShadowData> lights;
Renderer* renderer;
};