소스 검색

LightControl: setLight(Light) allows you to set null light

Wyatt Gillette 3 달 전
부모
커밋
2632bd9fcb
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      jme3-core/src/main/java/com/jme3/scene/control/LightControl.java

+ 8 - 0
jme3-core/src/main/java/com/jme3/scene/control/LightControl.java

@@ -158,6 +158,10 @@ public class LightControl extends AbstractControl {
     }
 
     private void validateSupportedLightType(Light light) {
+        if (light == null) {
+            return;
+        }
+
         switch (light.getType()) {
             case Point:
             case Directional:
@@ -172,6 +176,10 @@ public class LightControl extends AbstractControl {
 
     @Override
     protected void controlUpdate(float tpf) {
+        if (light == null) {
+            return;
+        }
+
         switch (controlDir) {
             case SpatialToLight:
                 spatialToLight(light);