From 8dc0fee9259a84a9353eb8612ee255d4e3efdf85 Mon Sep 17 00:00:00 2001 From: jk20012001 Date: Fri, 22 Oct 2021 18:37:43 +0800 Subject: [PATCH] Fix normalizeHDRColor with vec4 (#9528) --- cocos/core/scene-graph/scene-globals.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cocos/core/scene-graph/scene-globals.ts b/cocos/core/scene-graph/scene-globals.ts index 717b72f95a..2f834252d8 100644 --- a/cocos/core/scene-graph/scene-globals.ts +++ b/cocos/core/scene-graph/scene-globals.ts @@ -43,11 +43,11 @@ const _qt = new Quat(); // Normalize HDR color const normalizeHDRColor = (color : Vec4) => { - const intensity = 1.0 / Math.max(Math.max(color[0], color[1]), color[2]); + const intensity = 1.0 / Math.max(Math.max(Math.max(color.x, color.y), color.z), 0.0001); if (intensity < 1.0) { - for (let i = 0; i < 3; ++i) { - color[i] *= intensity; - } + color.x *= intensity; + color.y *= intensity; + color.z *= intensity; } }; /**