aboutsummaryrefslogtreecommitdiff
path: root/src/client/shadows/dynamicshadowsrender.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/shadows/dynamicshadowsrender.h')
-rw-r--r--src/client/shadows/dynamicshadowsrender.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/client/shadows/dynamicshadowsrender.h b/src/client/shadows/dynamicshadowsrender.h
index e4b3c3e22..bd27f6f20 100644
--- a/src/client/shadows/dynamicshadowsrender.h
+++ b/src/client/shadows/dynamicshadowsrender.h
@@ -51,6 +51,8 @@ struct NodeToApply
class ShadowRenderer
{
public:
+ static const int TEXTURE_LAYER_SHADOW = 3;
+
ShadowRenderer(IrrlichtDevice *device, Client *client);
~ShadowRenderer();
@@ -74,6 +76,7 @@ public:
void removeNodeFromShadowList(scene::ISceneNode *node);
void update(video::ITexture *outputTarget = nullptr);
+ void setForceUpdateShadowMap() { m_force_update_shadow_map = true; }
void drawDebug();
video::ITexture *get_texture()
@@ -82,13 +85,17 @@ public:
}
- bool is_active() const { return m_shadows_enabled; }
+ bool is_active() const { return m_shadows_enabled && shadowMapTextureFinal != nullptr; }
void setTimeOfDay(float isDay) { m_time_day = isDay; };
+ void setShadowIntensity(float shadow_intensity);
s32 getShadowSamples() const { return m_shadow_samples; }
- float getShadowStrength() const { return m_shadow_strength; }
+ float getShadowStrength() const { return m_shadows_enabled ? m_shadow_strength : 0.0f; }
float getTimeOfDay() const { return m_time_day; }
+ f32 getPerspectiveBiasXY() { return m_perspective_bias_xy; }
+ f32 getPerspectiveBiasZ() { return m_perspective_bias_z; }
+
private:
video::ITexture *getSMTexture(const std::string &shadow_map_name,
video::ECOLOR_FORMAT texture_format,
@@ -101,8 +108,10 @@ private:
void mixShadowsQuad();
void updateSMTextures();
+ void disable();
+ void enable() { m_shadows_enabled = m_shadows_supported; }
+
// a bunch of variables
- IrrlichtDevice *m_device{nullptr};
scene::ISceneManager *m_smgr{nullptr};
video::IVideoDriver *m_driver{nullptr};
Client *m_client{nullptr};
@@ -116,15 +125,20 @@ private:
std::vector<NodeToApply> m_shadow_node_array;
float m_shadow_strength;
+ float m_shadow_strength_gamma;
float m_shadow_map_max_distance;
float m_shadow_map_texture_size;
float m_time_day{0.0f};
int m_shadow_samples;
bool m_shadow_map_texture_32bit;
bool m_shadows_enabled;
+ bool m_shadows_supported;
bool m_shadow_map_colored;
+ bool m_force_update_shadow_map;
u8 m_map_shadow_update_frames; /* Use this number of frames to update map shaodw */
u8 m_current_frame{0}; /* Current frame */
+ f32 m_perspective_bias_xy;
+ f32 m_perspective_bias_z;
video::ECOLOR_FORMAT m_texture_format{video::ECOLOR_FORMAT::ECF_R16F};
video::ECOLOR_FORMAT m_texture_format_color{video::ECOLOR_FORMAT::ECF_R16G16};
@@ -140,6 +154,7 @@ private:
s32 mixcsm_shader{-1};
ShadowDepthShaderCB *m_shadow_depth_cb{nullptr};
+ ShadowDepthShaderCB *m_shadow_depth_entity_cb{nullptr};
ShadowDepthShaderCB *m_shadow_depth_trans_cb{nullptr};
shadowScreenQuad *m_screen_quad{nullptr};