From 74677c89a2963ffd9e2ab0bd91e57b3bab99be4a Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Thu, 12 Aug 2021 06:49:30 +1000 Subject: [PATCH] Add more scene tweaks --- .../src/components/IdeViewer/IdeViewer.tsx | 36 ++++++++++++++----- app/yarn.lock | 12 +++---- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/web/src/components/IdeViewer/IdeViewer.tsx b/app/web/src/components/IdeViewer/IdeViewer.tsx index b17f1f0..2d3d4eb 100644 --- a/app/web/src/components/IdeViewer/IdeViewer.tsx +++ b/app/web/src/components/IdeViewer/IdeViewer.tsx @@ -7,18 +7,16 @@ import { GizmoHelper, GizmoViewport, OrbitControls, + Environment, + useTexture, } from '@react-three/drei' import { useEdgeSplit } from 'src/helpers/hooks/useEdegeSplit' import { Vector3 } from 'three' import { requestRender } from 'src/helpers/hooks/useIdeState' import texture from './dullFrontLitMetal.png' -import { TextureLoader } from 'three/src/loaders/TextureLoader' import Customizer from 'src/components/Customizer/Customizer' import DelayedPingAnimation from 'src/components/DelayedPingAnimation/DelayedPingAnimation' -const loader = new TextureLoader() -const colorMap = loader.load(texture) - const thresholdAngle = 12 function Asset({ geometry: incomingGeo }) { @@ -30,6 +28,7 @@ function Asset({ geometry: incomingGeo }) { : new THREE.EdgesGeometry(incomingGeo, thresholdAngle), [incomingGeo] ) + const colorMap = useTexture(texture) if (!incomingGeo) return null if (incomingGeo.length) @@ -40,10 +39,19 @@ function Asset({ geometry: incomingGeo }) { return ( - + - - + + ) @@ -163,6 +171,12 @@ const IdeViewer = ({ Loading }) => { const pink400 = '#F472B6' const indigo300 = '#A5B4FC' const indigo900 = '#312E81' + const jscadLightIntensity = + state.objectData?.type === 'geometry' && + state.objectData?.data && + state.objectData?.data.length + ? 0.5 + : 1.2 return (
{state.isLoading && Loading} @@ -188,7 +202,7 @@ const IdeViewer = ({ Loading }) => { }`} onMouseDown={() => setIsDragging(true)} > - + setIsDragging(true)} onInit={onInit} @@ -214,9 +228,13 @@ const IdeViewer = ({ Loading }) => { }} /> - + +