From 633090f967c54cbc4162ada9ddd17f7fa9255863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 25 Aug 2024 19:23:13 -0500 Subject: [PATCH] fix: auto clear --- .../tools/tankopedia/[id]/components/Model/AutoClear.tsx | 9 +++++++++ .../tankopedia/[id]/components/Model/TankSandbox.tsx | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 src/app/tools/tankopedia/[id]/components/Model/AutoClear.tsx diff --git a/src/app/tools/tankopedia/[id]/components/Model/AutoClear.tsx b/src/app/tools/tankopedia/[id]/components/Model/AutoClear.tsx new file mode 100644 index 000000000..7c095b7cd --- /dev/null +++ b/src/app/tools/tankopedia/[id]/components/Model/AutoClear.tsx @@ -0,0 +1,9 @@ +import { useFrame } from '@react-three/fiber'; + +export function AutoClear() { + useFrame(({ gl }) => { + gl.clear(); + }, 0); + + return null; +} diff --git a/src/app/tools/tankopedia/[id]/components/Model/TankSandbox.tsx b/src/app/tools/tankopedia/[id]/components/Model/TankSandbox.tsx index 773d18806..0760202a2 100644 --- a/src/app/tools/tankopedia/[id]/components/Model/TankSandbox.tsx +++ b/src/app/tools/tankopedia/[id]/components/Model/TankSandbox.tsx @@ -25,6 +25,7 @@ import { TankopediaDisplay } from '../../../../../../stores/tankopediaPersistent import { Controls } from '../Control'; import { Lighting } from '../Lighting'; import { SceneProps } from '../SceneProps'; +import { AutoClear } from './AutoClear'; import { ModelLoader } from './components/ModelLoader'; import { TankModel } from './components/TankModel'; @@ -178,6 +179,7 @@ export const TankSandbox = forwardRef( + {/* idk why the shot display doesn't work without suspense here lol */} }>