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-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-23 22:46:32 -07:00
|
|
|
}
|
|
|
|
|
2022-11-20 14:39:15 -07:00
|
|
|
/**
|
|
|
|
* React three fiber canvas with spectrogram drawing.
|
|
|
|
*/
|
2022-11-23 22:46:32 -07:00
|
|
|
export default function ThreeCanvas(props: CanvasProps) {
|
2022-11-20 12:56:36 -07:00
|
|
|
return (
|
2022-11-24 01:00:06 -07:00
|
|
|
<Canvas camera={{ position: [0, 0, 7], rotation: [0.2, 0, 0] }}>
|
2022-11-20 14:39:15 -07:00
|
|
|
<ambientLight intensity={2} />
|
|
|
|
<pointLight position={[40, 40, 40]} />
|
2022-11-24 01:00:06 -07:00
|
|
|
<SpectrogramViewer
|
2022-11-23 22:46:32 -07:00
|
|
|
paused={props.paused}
|
2022-11-24 01:00:06 -07:00
|
|
|
inferenceResults={props.inferenceResults}
|
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
|
|
|
);
|
|
|
|
}
|