<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { OrbitControls, Environment, vLightHelper } from '@tresjs/cientos'

const controlsState = reactive({
    minDistance: 5,
    maxDistance: 12,
    enablePan: false,
    // enableZoom: false,
    maxPolarAngle: (Math.PI / 2) - 0.2,
    // maxZoom: 2,
    // minZoom: 1,
})
const cameraStat = reactive({
    position: [-4, 2, 8],
    aspect: 1920 / 600,
    fov: 40,
})

onMounted(() => {
    cameraStat.aspect = window.innerWidth / 600
})
</script>
<template>
    <div class="container min-w-full relative">
        <ClientOnly fallback-tag="div" fallback="Загрузка 3D модели">
            <Loader />
            <TresCanvas shadows>
                <TresPerspectiveCamera v-bind="cameraStat" />
                <OrbitControls v-bind="controlsState" make-default />
                <Suspense v-if="false">
                    <Environment files='/hdrmaps/kloppenheim_06_4k.hdr' :background="true" />
                </Suspense>
                <Suspense>
                    <ModelParametric />
                </Suspense>
            </TresCanvas>
        </ClientOnly>
    </div>
</template>

<style scoped>
.container {
    height: 600px;
    display: block;
}
</style>