summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorazagaya <azagaya.games@gmail.com>2019-08-08 10:24:44 -0300
committerazagaya <azagaya.games@gmail.com>2019-09-06 13:55:49 -0300
commitb8358680670efd75a1a91ea516d1316e2c3fad18 (patch)
tree2f2d84a64fb1633303e4aa14a06a168c5c1cd647 /servers
parent3a6102a6f716904bb158819146e3fed7590b8106 (diff)
Create shadow_vec for altering shadow computation
In 2.1 and 3.0, light_vec could be modified for altering shadow_computations. But it broke shadows when rotating light. shadow_vec would do the same, but without breaking shadows in rotated lights if not used. Add inverse light transformation to shadow vec, so it's not affected when rotating lights; Added usage define for shadow vec. For shadow vec working properly when rotating a light, it's needed to multiply it by light_matrix normalized. Added usage define in order to don't do that if shadow_vec not used.
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/shader_types.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index 75910ff1c0..019f477362 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -235,6 +235,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["TEXTURE_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_VEC"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW_VEC"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_HEIGHT"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_COLOR"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_UV"] = constt(ShaderLanguage::TYPE_VEC2);