mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 14:01:49 +00:00
refactor: move shadows-related code to separate module
This commit is contained in:
parent
70c5c67bd1
commit
8290c147c5
9 changed files with 317 additions and 243 deletions
46
src/graphics/core/Shadows.hpp
Normal file
46
src/graphics/core/Shadows.hpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
#include "typedefs.hpp"
|
||||
#include "window/Camera.hpp"
|
||||
|
||||
class Shader;
|
||||
class Level;
|
||||
class Assets;
|
||||
struct Weather;
|
||||
class DrawContext;
|
||||
struct EngineSettings;
|
||||
class ShadowMap;
|
||||
|
||||
class Shadows {
|
||||
public:
|
||||
Shadows(const Level& level);
|
||||
~Shadows();
|
||||
|
||||
void setup(Shader& shader, const Weather& weather);
|
||||
void setQuality(int quality);
|
||||
void refresh(
|
||||
const Camera& camera,
|
||||
const DrawContext& pctx,
|
||||
std::function<void(Camera&)> renderShadowPass
|
||||
);
|
||||
private:
|
||||
const Level& level;
|
||||
bool shadows = false;
|
||||
Camera shadowCamera;
|
||||
Camera wideShadowCamera;
|
||||
std::unique_ptr<ShadowMap> shadowMap;
|
||||
std::unique_ptr<ShadowMap> wideShadowMap;
|
||||
int quality = 0;
|
||||
|
||||
void generateShadowsMap(
|
||||
const Camera& camera,
|
||||
const DrawContext& pctx,
|
||||
ShadowMap& shadowMap,
|
||||
Camera& shadowCamera,
|
||||
float scale,
|
||||
std::function<void(Camera&)> renderShadowPass
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue