From 192399057eb79782121dc84520f40f99b1fabf8b Mon Sep 17 00:00:00 2001 From: jerrywwl Date: Thu, 18 Jul 2019 13:10:18 +0800 Subject: [PATCH] fix null value read when model without bounding box --- cocos/pipeline/culling.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cocos/pipeline/culling.ts b/cocos/pipeline/culling.ts index e8f1ad5bd5..94b30c1be9 100644 --- a/cocos/pipeline/culling.ts +++ b/cocos/pipeline/culling.ts @@ -19,11 +19,12 @@ export function cullDirectionalLight (light: DirectionalLight, model: Model) { } export function cullSphereLight (light: SphereLight, model: Model) { - return cullLight(light, model) || !intersect.aabb_aabb(model.worldBounds, light.aabb); + return cullLight(light, model) || (model.worldBounds && !intersect.aabb_aabb(model.worldBounds, light.aabb)); } export function cullSpotLight (light: SpotLight, model: Model) { - return cullLight(light, model) || !intersect.aabb_aabb(model.worldBounds, light.aabb) || !intersect.aabb_frustum(model.worldBounds, light.frustum); + return cullLight(light, model) || (model.worldBounds && + (!intersect.aabb_aabb(model.worldBounds, light.aabb) || !intersect.aabb_frustum(model.worldBounds, light.frustum))); } export const cullSceneWithDirectionalLight = (() => {