r3f sheets are now re-usable

This commit is contained in:
Aria Minaei 2021-09-05 23:33:17 +02:00
parent 7af470a053
commit 5295f9ae91
5 changed files with 23 additions and 22 deletions

View file

@ -1,4 +1,4 @@
import {editable as e, Wrapper} from '@theatre/plugin-r3f'
import {editable as e, SheetProvider} from '@theatre/plugin-r3f'
import {getProject} from '@theatre/core'
import * as THREE from 'three'
import React, {useState, useEffect, useRef} from 'react'
@ -90,7 +90,7 @@ function App() {
// @ts-ignore
shadowMap
>
<Wrapper
<SheetProvider
getSheet={() => getProject('Playground - R3F').sheet('R3F-Canvas')}
>
{/* @ts-ignore */}
@ -140,7 +140,7 @@ function App() {
/>
</group>
<Button />
</Wrapper>
</SheetProvider>
</Canvas>
</div>
)

View file

@ -1,7 +1,7 @@
import {
editable as e,
RefreshSnapshot,
Wrapper,
SheetProvider,
extension,
} from '@theatre/plugin-r3f'
import {OrbitControls, Stars} from '@react-three/drei'
@ -61,7 +61,7 @@ function App() {
return (
<div onClick={() => setBgIndex((bgIndex) => (bgIndex + 1) % bgs.length)}>
<Canvas dpr={[1.5, 2]} linear shadows frameloop="demand">
<Wrapper getSheet={() => getProject('Space').sheet('Scene')}>
<SheetProvider getSheet={() => getProject('Space').sheet('Scene')}>
<fog attach="fog" args={[bg, 16, 30]} />
<color attach="background" args={[bg]} />
<ambientLight intensity={0.75} />
@ -99,7 +99,7 @@ function App() {
minPolarAngle={Math.PI / 2}
/>
<Stars radius={500} depth={50} count={1000} factor={10} />
</Wrapper>
</SheetProvider>
</Canvas>
</div>
)