aboutsummaryrefslogtreecommitdiff
path: root/src/client/shadows/dynamicshadowsrender.h
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-03-26 16:58:26 +0100
committerGitHub <noreply@github.com>2022-03-26 16:58:26 +0100
commit0f25fa7af655b98fa401176a523f269c843d1943 (patch)
tree1fa8762f53941d6c1250c0c3a7dc6b8557995a40 /src/client/shadows/dynamicshadowsrender.h
parent8d55702d139db739f8bf43eaa600f41446b29a16 (diff)
downloadhax-minetest-server-0f25fa7af655b98fa401176a523f269c843d1943.tar.gz
hax-minetest-server-0f25fa7af655b98fa401176a523f269c843d1943.zip
Add API to control shadow intensity from the game/mod (#11944)
* Also Disable shadows when sun/moon is hidden. Fixes #11972.
Diffstat (limited to 'src/client/shadows/dynamicshadowsrender.h')
-rw-r--r--src/client/shadows/dynamicshadowsrender.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/shadows/dynamicshadowsrender.h b/src/client/shadows/dynamicshadowsrender.h
index e4b3c3e22..dc8f79c56 100644
--- a/src/client/shadows/dynamicshadowsrender.h
+++ b/src/client/shadows/dynamicshadowsrender.h
@@ -82,11 +82,12 @@ 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; }
private:
@@ -101,6 +102,9 @@ 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};
@@ -116,12 +120,14 @@ 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;
u8 m_map_shadow_update_frames; /* Use this number of frames to update map shaodw */
u8 m_current_frame{0}; /* Current frame */