import { Canvas, useFrame, useThree } from '@react-three/fiber'; import { KeyboardControls, Stats } from '@react-three/drei'; import { useRef } from 'react'; function RenderInfoUpdater({ domRef }: { domRef: React.RefObject }) { const { gl } = useThree(); useFrame(() => { if (!domRef.current) return; const { calls, triangles } = gl.info.render; const shaders = gl.info.programs?.length ?? 0; const { geometries, textures } = gl.info.memory; domRef.current.textContent = `draw: ${calls} | tri: ${triangles} | shaders: ${shaders} | geometries: ${geometries} | textures: ${textures}`; }); return null; } import { observer } from 'mobx-react-lite'; import { state } from '../state'; import { GameView } from './GameView'; import { SceneEditorView } from './SceneEditorView'; const IconStop = () => ; const IconPause = () => ; const IconPlay = () => ; export const ThreeView = observer(function () { const isGame = state.isGamePlaying; const infoRef = useRef(null); return (
state.worldEditor.resetSelectedObject()} > {isGame ? : }
{ state.game ? <> { state.game!.isPaused ? : } : }
) });