File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
jme3-core/src/main/java/com/jme3/shadow Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -569,8 +569,10 @@ public static void updateShadowCamera(ViewPort viewPort,
569569 float scaleX , scaleY , scaleZ ;
570570 float offsetX , offsetY , offsetZ ;
571571
572- scaleX = (2.0f ) / (cropMax .x - cropMin .x );
573- scaleY = (2.0f ) / (cropMax .y - cropMin .y );
572+ float deltaCropX = cropMax .x - cropMin .x ;
573+ float deltaCropY = cropMax .y - cropMin .y ;
574+ scaleX = deltaCropX == 0 ? 0 : 2.0f / deltaCropX ;
575+ scaleY = deltaCropY == 0 ? 0 : 2.0f / deltaCropY ;
574576
575577 //Shadow map stabilization approximation from shaderX 7
576578 //from Practical Cascaded Shadow maps adapted to PSSM
@@ -595,7 +597,8 @@ public static void updateShadowCamera(ViewPort viewPort,
595597 offsetY = FastMath .ceil (offsetY * halfTextureSize ) / halfTextureSize ;
596598 }
597599
598- scaleZ = 1.0f / (cropMax .z - cropMin .z );
600+ float deltaCropZ = cropMax .z - cropMin .z ;
601+ scaleZ = deltaCropZ == 0 ? 0 : 1.0f / deltaCropZ ;
599602 offsetZ = -cropMin .z * scaleZ ;
600603
601604
You can’t perform that action at this time.
0 commit comments