<!--
Auto-generated by: https://github.com/threlte/threlte/tree/main/packages/gltf
Command: npx @threlte/gltf@2.0.1 static/planet.gltf -t -T
-->
<script lang="ts">
	import * as THREE from 'three';
	import { Group } from 'three';
	import { T, type Props, type Events, type Slots, forwardEventHandlers } from '@threlte/core';
	import { useGltf } from '@threlte/extras';

	import FakeGlowMaterial from './FakeGlowMaterial/FakeGlowMaterial.svelte';

	type $$Props = Props<THREE.Group>;
	type $$Events = Events<THREE.Group>;
	type $$Slots = Slots<THREE.Group> & { fallback: {}; error: { error: any } };

	export const ref = new Group();

	type GLTFResult = {
		nodes: {
			mesh_0: THREE.Mesh;
			mesh_1: THREE.Mesh;
		};
		materials: {};
	};

	const gltf = useGltf<GLTFResult>('/planet-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.Mesh
			geometry={gltf.nodes.mesh_0.geometry}
			material={gltf.nodes.mesh_0.material}
			material.opacity={1.0}
			material.transparent={false}
			material.flatShading={true}
		>
			<T.Mesh
				geometry={gltf.nodes.mesh_1.geometry}
				material={gltf.nodes.mesh_1.material}
				material.transparent={true}
				material.flatShading={true}
			/>
		</T.Mesh>
	{:catch error}
		<slot name="error" {error} />
	{/await}

	<slot {ref} />
</T>
