"use client"; import React, { useRef, useMemo, useState } from "react"; import { Canvas, useFrame } from "@react-three/fiber"; import * as THREE from "three"; // 1. Central Star (Helios / Core Sun) with radiant corona function CentralStar() { const sunRef = useRef(null!); const coronaRef = useRef(null!); const flareRef = useRef(null!); useFrame((state, delta) => { const t = state.clock.getElapsedTime(); if (sunRef.current) { sunRef.current.rotation.y += delta * 0.2; const pulse = 1 + Math.sin(t * 2.5) * 0.03; sunRef.current.scale.set(pulse, pulse, pulse); } if (coronaRef.current) { coronaRef.current.rotation.y -= delta * 0.15; coronaRef.current.rotation.z += delta * 0.08; const pulse2 = 1.2 + Math.cos(t * 1.8) * 0.05; coronaRef.current.scale.set(pulse2, pulse2, pulse2); } if (flareRef.current) { flareRef.current.rotation.z -= delta * 0.2; } }); return ( {/* Intense Core Sun */} {/* Atmospheric Corona Layer */} {/* Solar Flare Halo Disk */} {/* Radiant Solar Lights */} ); } // 2. Orbital Path Ring (crisp, faint geometric trajectory) function OrbitTrack({ radius, color = "#475569" }: { radius: number; color?: string }) { const lineGeometry = useMemo(() => { const points: THREE.Vector3[] = []; const segments = 120; for (let i = 0; i <= segments; i++) { const theta = (i / segments) * Math.PI * 2; points.push(new THREE.Vector3(Math.cos(theta) * radius, 0, Math.sin(theta) * radius)); } return new THREE.BufferGeometry().setFromPoints(points); }, [radius]); return ( ); } // 3. Orbiting Planet with optional Rings & Moons interface PlanetProps { name: string; radius: number; size: number; speed: number; color: string; emissive?: string; hasRings?: boolean; ringRadius?: [number, number]; ringColor?: string; hasMoon?: boolean; initialAngle?: number; onHover?: (name: string | null) => void; } function Planet({ name, radius, size, speed, color, emissive = "#000000", hasRings = false, ringRadius = [1.2, 1.8], ringColor = "#c084fc", hasMoon = false, initialAngle = 0, onHover, }: PlanetProps) { const planetGroupRef = useRef(null!); const planetMeshRef = useRef(null!); const moonGroupRef = useRef(null!); const angleRef = useRef(initialAngle); useFrame((_, delta) => { angleRef.current += delta * speed * 0.35; const x = Math.cos(angleRef.current) * radius; const z = Math.sin(angleRef.current) * radius; if (planetGroupRef.current) { planetGroupRef.current.position.set(x, 0, z); } if (planetMeshRef.current) { planetMeshRef.current.rotation.y += delta * 1.2; } if (moonGroupRef.current) { moonGroupRef.current.rotation.y += delta * 2.5; } }); return ( {/* The Planet Sphere */} { e.stopPropagation(); onHover?.(name); }} onPointerOut={() => onHover?.(null)} > {/* Planetary Rings */} {hasRings && ( )} {/* Orbiting Moon */} {hasMoon && ( )} ); } // 4. Asteroid Belt (subtle, clean, not overcrowded) function AsteroidBelt({ count = 180, innerR = 3.4, outerR = 4.2 }: { count?: number; innerR?: number; outerR?: number }) { const beltRef = useRef(null!); const [positions, colors] = useMemo(() => { const pos = new Float32Array(count * 3); const col = new Float32Array(count * 3); const colorA = new THREE.Color("#94a3b8"); const colorB = new THREE.Color("#38bdf8"); for (let i = 0; i < count; i++) { const r = innerR + Math.random() * (outerR - innerR); const theta = Math.random() * Math.PI * 2; const y = (Math.random() - 0.5) * 0.3; pos[i * 3] = Math.cos(theta) * r; pos[i * 3 + 1] = y; pos[i * 3 + 2] = Math.sin(theta) * r; const c = Math.random() > 0.4 ? colorA : colorB; col[i * 3] = c.r; col[i * 3 + 1] = c.g; col[i * 3 + 2] = c.b; } return [pos, col]; }, [count, innerR, outerR]); useFrame((_, delta) => { if (beltRef.current) { beltRef.current.rotation.y += delta * 0.06; } }); return ( ); } // 5. Composite Solar System Scene with smooth interactive tilt function SolarSystemScene({ onHoverPlanet }: { onHoverPlanet: (name: string | null) => void }) { const systemRef = useRef(null!); useFrame((state) => { if (!systemRef.current) return; // Subtle interactive tilt following pointer const targetRotX = 0.55 + (state.pointer.y * Math.PI) / 24; const targetRotY = -0.25 + (state.pointer.x * Math.PI) / 20; systemRef.current.rotation.x += (targetRotX - systemRef.current.rotation.x) * 0.04; systemRef.current.rotation.y += (targetRotY - systemRef.current.rotation.y) * 0.04; }); return ( {/* Central Star */} {/* Planetary Tracks — calibrated so outermost radius is 6.4 */} {/* Asteroid Belt between Orbit II and Orbit III */} {/* Planet 1: Chronos (Molten amber rocky core) */} {/* Planet 2: Aetheria (Teal Gem with Moon) */} {/* Planet 3: Nebula-IX (Ringed Gas Giant) */} {/* Planet 4: Void-Zero (Outer Starlight World) */} ); } export default function HeroSolarSystem() { const [hoveredPlanet, setHoveredPlanet] = useState(null); return (
{/* Background soft ambient radial lighting */}
{/* Camera position: [0, 11, 16] with fov: 42 At distance ~19.4, visible height is 15.6 units and width is >18 units. Outermost orbit radius is 6.4 (diameter 12.8). -> 100% Guaranteed ZERO CROPPING at all angles. */} {/* Interactive HUD Telemetry Card */}
AGHATIS ORBITAL
| {hoveredPlanet ? ( {hoveredPlanet} ) : ( "4 ACTIVE ORBITS • TILT TO EXPLORE" )}
{/* Orbit Speed & System Badge */}
SIMULATION: 1.0X
); }