/* eslint-disable */ import * as THREE from "three"; import { useLayoutEffect, useRef, useState } from "react"; import { Canvas, applyProps, useFrame } from "@react-three/fiber"; import { PerformanceMonitor, AccumulativeShadows, RandomizedLight, Environment, Lightformer, Float, useGLTF, } from "@react-three/drei"; import { LayerMaterial, Color, Depth } from "lamina"; import { useTheme } from "next-themes"; export function MiniModel() { const [degraded, degrade] = useState(false); const { theme } = useTheme(); return ( degrade(true)} /> ); } function Mini(props: any) { const { scene, nodes, materials } = useGLTF("/mini.glb") as any; useLayoutEffect(() => { Object.values(nodes).forEach((node) => { if (node instanceof THREE.Mesh) { node.receiveShadow = true; node.castShadow = true; } }); if (materials["CAR_BODY_PAINT"]) { applyProps(materials["CAR_BODY_PAINT"], { color: "black", roughness: 0.45, metalness: 0.8, envMapIntensity: 2, }); } if (materials["MATT"]) { applyProps(materials["MATT"], { color: "black", roughness: 0.45, metalness: 0.8, envMapIntensity: 2, }); } if (materials["WINDOW_GLASS"]) { applyProps(materials["WINDOW_GLASS"], { color: "black", roughness: 0, clearcoat: 0.1, }); } if (materials["LIGHT_GLASS"]) { applyProps(materials["LIGHT_GLASS"], { color: "black", roughness: 0, clearcoat: 0.1, }); } if (materials["LIGHTS_POD"]) { applyProps(materials["LIGHTS_POD"], { roughness: 0, clearcoat: 0.1, }); } if (materials["SHINY_METAL"]) { applyProps(materials["SHINY_METAL"], { color: "black", envMapIntensity: 4, roughness: 0.5, metalness: 1, }); } if (materials["CALIPER"]) { applyProps(materials["CALIPER"], { color: "red", envMapIntensity: 4, roughness: 0.5, metalness: 1, }); } }, [nodes, materials]); return ; } function CameraRig({ v = new THREE.Vector3() }) { return useFrame((state) => { const t = state.clock.elapsedTime; state.camera.position.lerp( v.set(Math.sin(t / 2) * 1.2, 0, 12 + Math.cos(t / 5) / 2), 0.05 ); state.camera.lookAt(0, 0, 0); }); } function Lightformers({ positions = [2, 0, 2, 0, 2, 0, 2, 0] }) { const group = useRef(null); useFrame( (state, delta) => (group.current!.position.z += delta * 10) > 20 && (group.current!.position.z = -60) ); return ( <> {/* Ceiling */} {positions.map((x, i) => ( ))} {/* Sides */} {/* Accent (red) */} {/* Background */} ); }