From 484c50c921727ee19499d507269f667be26e6767 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Thu, 12 Aug 2021 06:15:23 +1000 Subject: [PATCH] Adjust scene lighting, attach light to camera for consistent lighting --- .../src/components/IdeViewer/IdeViewer.tsx | 21 ++++++++++++++----- app/web/src/helpers/hooks/useEdegeSplit.ts | 12 +++++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/app/web/src/components/IdeViewer/IdeViewer.tsx b/app/web/src/components/IdeViewer/IdeViewer.tsx index 38faa9a..b17f1f0 100644 --- a/app/web/src/components/IdeViewer/IdeViewer.tsx +++ b/app/web/src/components/IdeViewer/IdeViewer.tsx @@ -25,7 +25,9 @@ function Asset({ geometry: incomingGeo }) { const mesh = useEdgeSplit((thresholdAngle * Math.PI) / 180, true, incomingGeo) const edges = React.useMemo( () => - incomingGeo.length ? null : new THREE.EdgesGeometry(incomingGeo, thresholdAngle), + incomingGeo.length + ? null + : new THREE.EdgesGeometry(incomingGeo, thresholdAngle), [incomingGeo] ) if (!incomingGeo) return null @@ -211,11 +213,20 @@ const IdeViewer = ({ Loading }) => { }) }} /> - + + + - - - + + () const original = React.useRef() const modifier = React.useRef() @@ -19,7 +23,11 @@ export function useEdgeSplit(cutOffAngle: number, tryKeepNormals: boolean = true React.useEffect(() => { if (original.current && ref.current && modifier.current) { - const modifiedGeometry = modifier.current.modify(original.current, cutOffAngle, tryKeepNormals) + const modifiedGeometry = modifier.current.modify( + original.current, + cutOffAngle, + tryKeepNormals + ) modifiedGeometry.computeVertexNormals() ref.current.geometry = modifiedGeometry