'use client'; import './page.css'; import { Environment, OrbitControls, useProgress } from "@react-three/drei"; import { Canvas } from '@react-three/fiber'; import { Bloom, BrightnessContrast, DepthOfField, EffectComposer, HueSaturation, Noise, SMAA, SSAO, Vignette } from '@react-three/postprocessing'; import { useLayoutEffect, useState } from "react"; import { folder, useControls, Leva } from 'leva'; import SealCube from './scene-components/sealcube'; import Terrain from './scene-components/terrain'; function Loader() { const { progress, active } = useProgress(); const [visible, setVisible] = useState(true); useLayoutEffect(() => { if (!active && progress === 100) { const timeout = setTimeout(() => setVisible(false), 500); return () => clearTimeout(timeout); } }, [progress, active]); return (
); } function Scene() { const { terrainDryColor, terrainLushColor, chunks, chunkSize, resolution, hillScale, hillHeight, detailScale, detailHeight, grassDryColor, grassLushColor, grassCount, grassSize, grassLOD, grassBlades, grassSegments, grassLODStart, grassLODExponent } = useControls('Environment', { Terrain: folder({ terrainDryColor: '#20270a', terrainLushColor: '#0f240f', chunks: { value: 16, min: 4, max: 24, step: 2 }, chunkSize: { value: 10.0, min: 5.0, max: 40.0, step: 1.0 }, resolution: { value: 8.0, min: 4.0, max: 30.0, step: 1.0 }, hillScale: { value: 0.1, min: 0.01, max: 0.5, step: 0.01 }, hillHeight: { value: 6.0, min: 0.0, max: 20.0, step: 0.5 }, detailScale: { value: 1.0, min: 0.1, max: 5.0, step: 0.1 }, detailHeight: { value: 0.2, min: 0.0, max: 2.0, step: 0.05 }, }), Grass: folder({ grassDryColor: '#495a17', grassLushColor: '#255825', grassCount: { value: 7000, min: 1000, max: 30000, step: 500 }, grassSize: { value: 0.6, min: 0.1, max: 2.0, step: 0.05 }, grassLOD: { value: 60, min: 10, max: 200, step: 5 }, grassBlades: { value: 3, min: 1, max: 4, step: 1 }, grassSegments: { value: 4, min: 1, max: 5, step: 1 }, grassLODStart: { value: 0.5, min: 0.0, max: 0.9, step: 0.05 }, grassLODExponent: { value: 1.0, min: 0.5, max: 3.0, step: 0.1 }, }) }); return (<> ) } function PostProcessing() { return ( ) } export default function Seal() { const isProduction = process.env.NODE_ENV === 'production'; return ( <>