From b8358680670efd75a1a91ea516d1316e2c3fad18 Mon Sep 17 00:00:00 2001 From: azagaya Date: Thu, 8 Aug 2019 10:24:44 -0300 Subject: 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. --- servers/visual/shader_types.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'servers') 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); -- cgit v1.2.3