From e153c4cbbb691999900b335921475fa71cf89b14 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Sat, 5 Aug 2023 09:30:16 +0200 Subject: [PATCH] WIP: Upgrade to THREE.r155: Remove the legacy/physical lighting distinction --- packages/r3f/src/extension/components/ProxyManager.tsx | 3 ++- .../r3f/src/extension/components/SnapshotEditor.tsx | 10 ---------- packages/r3f/src/extension/editorStuff.ts | 8 -------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/r3f/src/extension/components/ProxyManager.tsx b/packages/r3f/src/extension/components/ProxyManager.tsx index 863624a..66f3ee4 100644 --- a/packages/r3f/src/extension/components/ProxyManager.tsx +++ b/packages/r3f/src/extension/components/ProxyManager.tsx @@ -1,7 +1,7 @@ import type {FC} from 'react' import React, {useLayoutEffect, useMemo, useRef, useState} from 'react' import type {Editable} from '../../main/store' -import {createPortal} from '@react-three/fiber' +import {createPortal, invalidate} from '@react-three/fiber' import EditableProxy from './EditableProxy' import type {OrbitControls} from 'three-stdlib' import TransformControls from './TransformControls' @@ -186,6 +186,7 @@ const ProxyManager: FC = ({orbitControlsRef}) => { mesh.material = renderMaterials[mesh.id] } } + invalidate() }) }, [viewportShading, renderMaterials, sceneProxy]) diff --git a/packages/r3f/src/extension/components/SnapshotEditor.tsx b/packages/r3f/src/extension/components/SnapshotEditor.tsx index 0b0fb19..22efca3 100644 --- a/packages/r3f/src/extension/components/SnapshotEditor.tsx +++ b/packages/r3f/src/extension/components/SnapshotEditor.tsx @@ -54,16 +54,6 @@ const EditorScene: React.FC<{snapshotEditorSheet: ISheet; paneId: string}> = ({ const editorObject = getEditorSheetObject() - const viewportLighting = - useVal(editorObject?.props.viewport.lighting) ?? 'physical' - - useEffect(() => { - if (gl && scene && camera) { - gl.physicallyCorrectLights = viewportLighting === 'physical' - gl.compile(scene, camera) - } - }, [gl, viewportLighting, scene, camera]) - const helpersRoot = useExtensionStore((state) => state.helpersRoot, shallow) const showGrid = useVal(editorObject?.props.viewport.showGrid) ?? true diff --git a/packages/r3f/src/extension/editorStuff.ts b/packages/r3f/src/extension/editorStuff.ts index 6a76902..9cf8764 100644 --- a/packages/r3f/src/extension/editorStuff.ts +++ b/packages/r3f/src/extension/editorStuff.ts @@ -31,14 +31,6 @@ const editorSheetObjectConfig = { }, {as: 'menu', label: 'Reference Window'}, ), - lighting: types.stringLiteral( - 'physical', - { - physical: 'Physical', - legacy: 'Legacy', - }, - {as: 'menu', label: 'Lighting'}, - ), }, {label: 'Viewport Config'}, ),