From 458b0e75e0f5d4b1d5eaf91cd8a41db698de7e1a Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Wed, 1 Mar 2017 17:32:15 -0500 Subject: [PATCH] Prevent raytracing render engine option from crashing the 3D viewer Fix for lp bug #1667722 using a change made by Mario Luzeiro. Fixes lp:1667722 https://bugs.launchpad.net/kicad/+bug/1667722 --- .../3d_render_raytracing/c3d_render_raytracing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp index ef1024f42f..c56ca28586 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp @@ -1861,8 +1861,8 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor, // Improvement: this is not taking in account the lightcolor if( nr_lights_that_can_cast_shadows > 0 ) { - aHitInfo.m_ShadowFactor = shadow_att_factor_sum / - (float)(nr_lights_that_can_cast_shadows * 1.0f); + aHitInfo.m_ShadowFactor = glm::max( shadow_att_factor_sum / + (float)(nr_lights_that_can_cast_shadows * 1.0f), 0.0f ); } else {