From 40962e1eb5c7c4d5ae72f212ba351448b016f2a1 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 29 Jun 2020 12:17:36 +0200 Subject: [PATCH] gsg: Don't error for sampler/light type mismatch for non-casting lights Closes #942 --- panda/src/display/graphicsStateGuardian.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index a7f2c41685..43074a2234 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -1872,7 +1872,14 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler, Light *light_obj = light.node()->as_light(); nassertr(light_obj != nullptr, nullptr); - PT(Texture) tex = get_shadow_map(light); + PT(Texture) tex; + LightLensNode *lln = DCAST(LightLensNode, light.node()); + if (lln != nullptr && lln->_shadow_caster) { + tex = get_shadow_map(light); + } else { + tex = get_dummy_shadow_map((Texture::TextureType)spec._desired_type); + } + if (tex != nullptr) { sampler = tex->get_default_sampler(); }