File tree Expand file tree Collapse file tree
jme3-core/src/main/java/com/jme3/light Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,11 +165,13 @@ public final void setRadius(float radius) {
165165 if (radius < 0 ) {
166166 throw new IllegalArgumentException ("Light radius cannot be negative" );
167167 }
168-
169- // Fix #2566 - Prevent shader overflow with infinite or invalid radius
170- if (radius == Float .POSITIVE_INFINITY || radius < 0f || Float .isNaN (radius )) {
171- radius = Float .MAX_VALUE / 4f ; // Safe large value, avoids overflow in shaders
168+ if (Float .isNaN (radius )){
169+ throw new IllegalArgumentException ("Light radius cannot be a NaN (Not a Number) value" );
172170 }
171+ // Prevent shader overflow with infinite or invalid radius
172+ if (radius == Float .POSITIVE_INFINITY || radius > Float .MAX_VALUE / 4.0f ) {
173+ radius = Float .MAX_VALUE / 4.0f ; // Safe large value, avoids overflow in shaders
174+ }
173175 this .radius = radius ;
174176 if (radius != 0f ) {
175177 this .invRadius = 1f / radius ;
@@ -259,3 +261,4 @@ public String toString() {
259261 + "]" ;
260262 }
261263}
264+
You can’t perform that action at this time.
0 commit comments