<!--
Auto-generated by: https://github.com/threlte/threlte/tree/main/packages/gltf
Command: npx @threlte/gltf@1.0.0-next.13 ./static/models/terraform-flat.glb --transform
-->

<script lang="ts">
	import { Group } from 'three';
	import { T, forwardEventHandlers } from '@threlte/core';
	import { useGltf } from '@threlte/extras';

	export const ref = new Group();
	const initialScale = 30;
	const offsetOrigin: [number, number, number] = [-0.1, 0, -0.034];
	const multipliedOffset: [number, number, number] = [
		offsetOrigin[0] * initialScale,
		offsetOrigin[1] * initialScale,
		offsetOrigin[2] * initialScale
	];

	const gltf = useGltf('/models/terraform-flat-transformed.glb', { useDraco: true });

	const component = forwardEventHandlers();
</script>

<T is={ref} dispose={false} {...$$restProps} bind:this={$component}>
	{#await gltf}
		<slot name="fallback" />
	{:then gltf}
		<T.Group rotation={[Math.PI / 2, 0, 5]}>
			<T.Mesh
				geometry={gltf.nodes.Curve_1.geometry}
				material={gltf.materials.SVGMat}
				position={multipliedOffset}
				scale={initialScale}
			/>
			<T.Mesh
				geometry={gltf.nodes.Curve_2.geometry}
				material={gltf.materials['SVGMat.001']}
				position={multipliedOffset}
				scale={initialScale}
			/>
		</T.Group>
	{:catch error}
		<slot name="error" {error} />
	{/await}

	<slot {ref} />
</T>
