diff --git a/components/HeightMapImage.tsx b/components/HeightMapImage.tsx
new file mode 100644
index 0000000..5c9937e
--- /dev/null
+++ b/components/HeightMapImage.tsx
@@ -0,0 +1,52 @@
+import { DoubleSide, RepeatWrapping, sRGBEncoding } from "three";
+import {
+ useTexture,
+} from "@react-three/drei";
+
+import { vertexShader, fragmentShader } from "../shaders";
+
+interface HeightMapImageProps {
+ url: string;
+ position: [number, number, number];
+ rotation: [number, number, number];
+ scale: [number, number, number];
+ }
+
+export default function HeightMapImage(props: HeightMapImageProps) {
+ const url = props.url;
+
+ // Load the heightmap image
+ const heightMap = useTexture(url);
+ heightMap.wrapS = RepeatWrapping;
+ heightMap.wrapT = RepeatWrapping;
+
+ // Load the texture map
+ const textureMap = useTexture(url);
+ textureMap.wrapS = RepeatWrapping;
+ textureMap.wrapT = RepeatWrapping;
+
+ return (
+
+ {/* TODO hayk reduce */}
+
+
+
+ );
+}
diff --git a/components/SpectrogramViewer.tsx b/components/SpectrogramViewer.tsx
index 2275cee..c8cb83d 100644
--- a/components/SpectrogramViewer.tsx
+++ b/components/SpectrogramViewer.tsx
@@ -1,23 +1,25 @@
-import ImagePlane from "./ImagePlane";
-
import { useRef } from "react";
import { useFrame, useThree } from "@react-three/fiber";
+import { QuadraticBezierLine } from "@react-three/drei";
import { InferenceResult } from "../types";
-import { QuadraticBezierLine } from "@react-three/drei";
+import HeightMapImage from "./HeightMapImage";
+import ImagePlane from "./ImagePlane";
interface SpectrogramViewerProps {
paused: boolean;
inferenceResults: InferenceResult[];
+ use_height_map?: boolean;
}
/**
* Spectrogram drawing code.
*/
-export default function SpectrogramViewer(props: SpectrogramViewerProps) {
- const paused = props.paused;
- const inferenceResults = props.inferenceResults;
-
+export default function SpectrogramViewer({
+ paused,
+ inferenceResults,
+ use_height_map = true,
+}: SpectrogramViewerProps) {
const camera = useThree((state) => state.camera);
const playheadRef = useRef(null);
@@ -37,7 +39,20 @@ export default function SpectrogramViewer(props: SpectrogramViewerProps) {
{inferenceResults.map((value: InferenceResult, index: number) => {
const height = 5 * (-1 - value.counter) - 2;
- return ;
+
+ if (use_height_map) {
+ return (
+
+ );
+ } else {
+ return ;
+ }
})}
{/* TODO make into playhead component */}
diff --git a/components/ThreeCanvas.tsx b/components/ThreeCanvas.tsx
index 48d7bbd..ccc88a2 100644
--- a/components/ThreeCanvas.tsx
+++ b/components/ThreeCanvas.tsx
@@ -13,7 +13,7 @@ interface CanvasProps {
*/
export default function ThreeCanvas(props: CanvasProps) {
return (
-