From 6419a469bc13430d79db9aa7c2fd76ab4a45b141 Mon Sep 17 00:00:00 2001 From: Miles Ryan <75916236+Quicksticks-oss@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:16:36 -0400 Subject: [PATCH] Fixes white camera. (#552) --- app/pages/PageEnigma/Editor/scene.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/pages/PageEnigma/Editor/scene.ts b/app/pages/PageEnigma/Editor/scene.ts index 6fc5569b0a..17d410f3b5 100644 --- a/app/pages/PageEnigma/Editor/scene.ts +++ b/app/pages/PageEnigma/Editor/scene.ts @@ -254,11 +254,17 @@ class Scene { object.traverse((c: THREE.Object3D) => { if (c instanceof THREE.Mesh) { if (c.material.color !== undefined) { - if (c.userData["base"] == undefined) { + if (c.userData["base"] === undefined) { c.userData["base"] = c.material.color.getHex(); } - const tint = new THREE.Color(hex_color); - c.material.color.set(tint); + if (c.material.map === undefined || c.material.map === null) { + const currentColor = new THREE.Color(c.userData["base"]); + const tint = new THREE.Color(hex_color); + currentColor.multiply(tint); + c.material.color.set(new THREE.Color(currentColor)); + } else { + c.material.color.set(new THREE.Color(hex_color)); + } } } });