61 lines
1.8 KiB
C++
Executable file
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:
|
|
explicit 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, Matrix4x4 light_matrix, Matrix4x4 model, prism::float3 light_position, Light::Type type, const CameraFrustum& frustum, int base_instance);
|
|
|
|
void render_sun(GFXCommandBuffer* command_buffer, Scene& scene, prism::Object light_object, Light& light);
|
|
void render_spot(GFXCommandBuffer* command_buffer, Scene& scene, prism::Object light_object, Light& light);
|
|
void render_point(GFXCommandBuffer* command_buffer, Scene& scene, prism::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::float4* 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;
|
|
};
|