improves 3d model

This commit is contained in:
Christian Beutel
2024-02-22 17:43:04 +01:00
parent e41649e395
commit b2482233ac
7 changed files with 38 additions and 1018 deletions

View File

@@ -1,22 +1,25 @@
<script lang="ts">
import { theme } from "$lib/stores/theme_store";
import { T, useTask } from "@threlte/core";
import { tweened } from "svelte/motion";
import Earth from "./earth.svelte";
import { T, useTask, useThrelte } from "@threlte/core";
import { onMount } from "svelte";
import { tweened } from "svelte/motion";
import * as THREE from "three";
import Earth from "./earth.svelte";
let rotation = 0;
useTask((delta) => {
rotation += delta / 4;
});
const ambientIntensitiy = tweened($theme == "light" ? 1.2 : 0, {
const { toneMapping } = useThrelte();
toneMapping.set(THREE.NoToneMapping);
const ambientIntensitiy = tweened($theme == "light" ? 3 : 0, {
duration: 500,
});
$: ambientColor = $theme == "light" ? "#ffffff" : "#4c7fe6";
$: ambientIntensitiy.set($theme == "light" ? 1.2 : 0);
$: ambientIntensitiy.set($theme == "light" ? 3 : 0.1);
let starsGeometry!: THREE.BufferGeometry;
let starsMaterial!: THREE.PointsMaterial;
@@ -49,6 +52,10 @@
<T.Points geometry={starsGeometry} material={starsMaterial}></T.Points>
{/if}
<T.AmbientLight color={ambientColor} intensity={$ambientIntensitiy} />
<Earth {rotation}></Earth>
<T.HemisphereLight
skyColor={ambientColor}
groundColor="#242734"
intensity={$ambientIntensitiy}
/>