/* * Copyright (C) 2023 Christopher J. Howard * * This file is part of Antkeeper source code. * * Antkeeper source code is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Antkeeper source code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Antkeeper source code. If not, see . */ #ifndef ANTKEEPER_RENDER_SHADOW_MAP_PASS_HPP #define ANTKEEPER_RENDER_SHADOW_MAP_PASS_HPP #include #include #include #include #include #include class resource_manager; namespace render { /** * Renders shadow maps. */ class shadow_map_pass: public pass { public: /** * Constructs a shadow map pass. * * @param rasterizer Rasterizer. * @param framebuffer Shadow map framebuffer. * @param resource_manage Resource manager. */ shadow_map_pass(gl::rasterizer* rasterizer, resource_manager* resource_manager); /** * Renders shadow maps for a single camera. * * @param ctx Render context. * @param queue Render queue. */ void render(render::context& ctx) override; private: /** * Renders cascaded shadow maps for a single directional light. * * @param light Shadow-casting directional light. * @param ctx Render context. * @param queue Render queue. */ void render_csm(scene::directional_light& light, render::context& ctx); std::unique_ptr unskinned_shader_program; const gl::shader_variable* unskinned_model_view_projection_var; std::unique_ptr skinned_shader_program; const gl::shader_variable* skinned_model_view_projection_var; const gl::shader_variable* skinned_matrix_palette_var; }; } // namespace render #endif // ANTKEEPER_RENDER_SHADOW_MAP_PASS_HPP