2022-11-20 12:56:36 -07:00
|
|
|
import { Canvas } from "@react-three/fiber";
|
|
|
|
|
2022-11-24 01:00:06 -07:00
|
|
|
import { InferenceResult } from "../types";
|
|
|
|
import SpectrogramViewer from "./SpectrogramViewer";
|
2022-11-26 12:26:19 -07:00
|
|
|
import { PerspectiveCamera } from "@react-three/drei";
|
2022-11-20 12:56:36 -07:00
|
|
|
|
2022-11-23 22:46:32 -07:00
|
|
|
interface CanvasProps {
|
|
|
|
paused: boolean;
|
2022-11-24 01:00:06 -07:00
|
|
|
inferenceResults: InferenceResult[];
|
2022-11-24 15:54:25 -07:00
|
|
|
getTime: () => number;
|
2022-11-23 22:46:32 -07:00
|
|
|
}
|
|
|
|
|
2022-11-20 14:39:15 -07:00
|
|
|
/**
|
|
|
|
* React three fiber canvas with spectrogram drawing.
|
|
|
|
*/
|
2022-11-24 15:54:25 -07:00
|
|
|
export default function ThreeCanvas({
|
|
|
|
paused,
|
|
|
|
inferenceResults,
|
|
|
|
getTime,
|
|
|
|
}: CanvasProps) {
|
2022-11-20 12:56:36 -07:00
|
|
|
return (
|
2022-11-26 12:26:19 -07:00
|
|
|
<Canvas>
|
2022-11-20 14:39:15 -07:00
|
|
|
<ambientLight intensity={2} />
|
|
|
|
<pointLight position={[40, 40, 40]} />
|
2022-11-26 12:26:19 -07:00
|
|
|
<PerspectiveCamera
|
|
|
|
makeDefault
|
|
|
|
position={[0, 0, 8]}
|
|
|
|
rotation={[0.4, 0, 0]}
|
|
|
|
fov={70}
|
|
|
|
/>
|
|
|
|
|
2022-11-24 01:00:06 -07:00
|
|
|
<SpectrogramViewer
|
2022-11-24 15:54:25 -07:00
|
|
|
paused={paused}
|
|
|
|
inferenceResults={inferenceResults}
|
|
|
|
getTime={getTime}
|
2022-11-23 22:46:32 -07:00
|
|
|
/>
|
2022-11-20 14:39:15 -07:00
|
|
|
</Canvas>
|
2022-11-20 12:56:36 -07:00
|
|
|
);
|
|
|
|
}
|