<!--
  @component
  Renders a 2d pointcloud from a top-down perspective.
  The pointcloud exists on the xy axis, with the camera set at z=1.
  Has the ability to also render other environmental features,
  such as the pose of a base and / or a motion plan.

  ```svelte
  <SlamMap2d
    pointcloud={new Uint8Array()} // An arraybuffer representing a PCD file.
    basePose={{ x: number, y: number, z: number }} // An optional pose of a robot.
    destination={{ x: number, y: number }} // An optional user-specificed robot destination.
    helpers={true | false} // Whether or not scene helpers should be rendered. Default true.
    motionPath={new Float32Array(x1, y1, x2, y2, x3, y3])} // An optional motion path. Units are assumed to be in Meters. Must not contain NaN.
  />
  ```
-->
<script>import { Canvas } from "@threlte/core";
import Legend from "./legend.svelte";
import Scene from "./scene.svelte";
export let pointcloud = void 0;
export let basePose = void 0;
export let destination = void 0;
export let helpers = true;
export let motionPath = void 0;
</script>

<div class="relative h-full w-full">
  <Canvas useLegacyLights={false}>
    <Scene
      {helpers}
      {pointcloud}
      {basePose}
      {destination}
      {motionPath}
      on:click
    />
  </Canvas>

  {#if helpers}
    <p class="absolute left-3 top-3 bg-white text-xs">Grid set to 1 meter</p>
  {/if}

  <Legend />
</div>
