aboutsummaryrefslogtreecommitdiff
path: root/src/client/shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/shader.cpp')
-rw-r--r--src/client/shader.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client/shader.cpp b/src/client/shader.cpp
index d9c1952c4..1be9ef128 100644
--- a/src/client/shader.cpp
+++ b/src/client/shader.cpp
@@ -220,6 +220,7 @@ class MainShaderConstantSetter : public IShaderConstantSetter
CachedPixelShaderSetting<f32> m_shadow_strength;
CachedPixelShaderSetting<f32> m_time_of_day;
CachedPixelShaderSetting<f32> m_shadowfar;
+ CachedPixelShaderSetting<f32, 4> m_camera_pos;
CachedPixelShaderSetting<s32> m_shadow_texture;
CachedVertexShaderSetting<f32> m_perspective_bias0_vertex;
CachedPixelShaderSetting<f32> m_perspective_bias0_pixel;
@@ -252,6 +253,7 @@ public:
, m_shadow_strength("f_shadow_strength")
, m_time_of_day("f_timeofday")
, m_shadowfar("f_shadowfar")
+ , m_camera_pos("CameraPos")
, m_shadow_texture("ShadowMapSampler")
, m_perspective_bias0_vertex("xyPerspectiveBias0")
, m_perspective_bias0_pixel("xyPerspectiveBias0")
@@ -321,6 +323,10 @@ public:
f32 shadowFar = shadow->getMaxShadowFar();
m_shadowfar.set(&shadowFar, services);
+ f32 cam_pos[4];
+ shadowViewProj.transformVect(cam_pos, light.getPlayerPos());
+ m_camera_pos.set(cam_pos, services);
+
// I dont like using this hardcoded value. maybe something like
// MAX_TEXTURE - 1 or somthing like that??
s32 TextureLayerID = 3;