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.
prism/engine/renderer/include/shadowpass.hpp
2021-05-12 09:56:44 -04:00

61 lines
1.8 KiB
C++
Executable file

#pragma once
#include "math.hpp"
#include "object.hpp"
#include "components.hpp"
class GFX;
class GFXCommandBuffer;
class GFXFramebuffer;
class GFXPipeline;
class GFXRenderPass;
class GFXTexture;
class GFXSampler;
class GFXBuffer;
class Scene;
struct CameraFrustum;
class ShadowPass {
public:
ShadowPass(GFX* gfx);
void create_scene_resources(Scene& scene);
void render(GFXCommandBuffer* command_buffer, Scene& scene);
private:
void render_meshes(GFXCommandBuffer* command_buffer, Scene& scene, const Matrix4x4 light_matrix, const Matrix4x4 model, const prism::float3 light_position, const Light::Type type, const CameraFrustum& frustum, const int base_instance);
void render_sun(GFXCommandBuffer* command_buffer, Scene& scene, Object light_object, Light& light);
void render_spot(GFXCommandBuffer* command_buffer, Scene& scene, Object light_object, Light& light);
void render_point(GFXCommandBuffer* command_buffer, Scene& scene, Object light_object, Light& light);
int last_point_light = 0;
int last_spot_light = 0;
void create_render_passes();
void create_pipelines();
void create_offscreen_resources();
GFXRenderPass* render_pass = nullptr;
GFXRenderPass* cube_render_pass = nullptr;
GFXTexture* offscreen_color_texture = nullptr;
GFXTexture* offscreen_depth = nullptr;
GFXFramebuffer* offscreen_framebuffer = nullptr;
GFXBuffer* point_location_buffer = nullptr;
prism::float3* point_location_map = nullptr;
// sun
GFXPipeline* static_sun_pipeline = nullptr;
GFXPipeline* skinned_sun_pipeline = nullptr;
// spot
GFXPipeline* static_spot_pipeline = nullptr;
GFXPipeline* skinned_spot_pipeline = nullptr;
// point
GFXPipeline* static_point_pipeline = nullptr;
GFXPipeline* skinned_point_pipeline = nullptr;
};