Fix in shadow_cast_begin
@@ -123,10 +123,8 @@ impl DeferredPipeline
pub fn shadow_cast_begin(&self, light: &light::DirectionalLight) -> Result<(), Error>
{
- if light.shadow_render_target.is_none() {
- return Err(Error::ShadowRendertargetNotAvailable {message: format!("Trying to cast shadows with no shadow render target available")} )
- }
- let rendertarget = light.shadow_render_target.unwrap();
+ if let Some(ref rendertarget) = light.shadow_render_target
+ {
rendertarget.bind();
rendertarget.clear();
@@ -134,6 +132,10 @@ impl DeferredPipeline
state::depth_test(&self.gl, state::DepthTestType::LEQUAL);
state::cull(&self.gl,state::CullType::BACK);
state::blend(&self.gl, state::BlendType::NONE);
+ }
+ else {
+ return Err(Error::ShadowRendertargetNotAvailable {message: format!("Trying to cast shadows with no shadow render target available")} )
+ }
Ok(())
}
