diff --git a/public/img/niko.jpg b/public/img/niko.jpg new file mode 100644 index 0000000..cdc42e4 Binary files /dev/null and b/public/img/niko.jpg differ diff --git a/src/app/page.tsx b/src/app/page.tsx index fdd0ba4..bdb9a59 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,6 +1,83 @@ +'use client'; + +import { Canvas, useFrame } from "@react-three/fiber"; +import { useEffect, useRef, useState } from "react"; + +import { OrbitControls } from '@react-three/drei'; + +import * as THREE from 'three'; + + +function Cube() { + const meshRef = useRef(null); + const [texture, setTexture] = useState(null); + + useFrame((state, delta) => { + if (meshRef.current) { + meshRef.current.rotation.x += delta * 0.5; + meshRef.current.rotation.y += delta * 0.5; + } + }); + + useEffect(() => { + const loader = new THREE.TextureLoader(); + loader.load( + '/img/niko.jpg', + (loadedTex) => { + loadedTex.wrapS = THREE.RepeatWrapping; + loadedTex.wrapT = THREE.RepeatWrapping; + loadedTex.repeat.set(1, 1); + setTexture(loadedTex); + }, + undefined, // onProgress callback (optional) + (error) => { + console.error('Error loading texture:', error); + } + ); + + // Cleanup texture on unmount + return () => { + if (texture) { + texture.dispose(); + } + }; + }, []); + + return ( + + + + + ) +} + export default function Home() { return ( <> + + + + {/* + */} + + + + + + ); }