Initial commit: WMOC 3D maritime documentation experience with Three.js, R3F, and GSAP

This commit is contained in:
2026-10-14 00:18:32 +08:00
commit c33cce9e6d
30 changed files with 6087 additions and 0 deletions

26
.gitignore vendored Normal file
View File

@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
# IDE & Agent customizations
.agents
.agents/

8
.oxlintrc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "oxc"],
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}

16
README.md Normal file
View File

@@ -0,0 +1,16 @@
# React + Vite
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the Oxlint configuration
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and Oxlint's TypeScript related rules in your project.

18
index.html Normal file
View File

@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en" class="dark scroll-smooth">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⚓</text></svg>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="M/Y AURELIA — An 88-meter bespoke hybrid luxury superyacht engineered for transoceanic voyages with zero-emission silent cruising." />
<title>WMOC — Global Maritime Documentation Partner</title>
<!-- Editorial & Modern Sans Typography -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@1,400;1,600;1,700;1,800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
</head>
<body class="bg-[#030a16] text-slate-100 antialiased selection:bg-[#2dd4bf] selection:text-slate-950 overflow-x-hidden">
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

3169
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

34
package.json Normal file
View File

@@ -0,0 +1,34 @@
{
"name": "temp-vite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "oxlint",
"preview": "vite preview"
},
"dependencies": {
"@gsap/react": "^2.1.2",
"@react-three/drei": "^10.7.9",
"@react-three/fiber": "^9.8.1",
"@react-three/postprocessing": "^3.2.0",
"gsap": "^3.15.0",
"lucide-react": "^1.56.0",
"postprocessing": "^6.39.5",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"three": "^0.186.1"
},
"devDependencies": {
"@tailwindcss/vite": "^4.3.3",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.7",
"@vitejs/plugin-react": "^6.1.1",
"oxlint": "^1.81.0",
"react-grab": "^0.2.0",
"tailwindcss": "^4.3.3",
"vite": "^8.3.0"
}
}

BIN
public/cruise_ship.glb Normal file

Binary file not shown.

1
public/favicon.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.3 KiB

24
public/icons.svg Normal file
View File

@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="bluesky-icon" viewBox="0 0 16 17">
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
</symbol>
<symbol id="discord-icon" viewBox="0 0 20 19">
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
</symbol>
<symbol id="documentation-icon" viewBox="0 0 21 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
</symbol>
<symbol id="github-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
</symbol>
<symbol id="social-icon" viewBox="0 0 20 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
</symbol>
<symbol id="x-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

1
public/ship.glb Symbolic link
View File

@@ -0,0 +1 @@
cruise_ship.glb

184
src/App.css Normal file
View File

@@ -0,0 +1,184 @@
.counter {
font-size: 16px;
padding: 5px 10px;
border-radius: 5px;
color: var(--accent);
background: var(--accent-bg);
border: 2px solid transparent;
transition: border-color 0.3s;
margin-bottom: 24px;
&:hover {
border-color: var(--accent-border);
}
&:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
}
.hero {
position: relative;
.base,
.framework,
.vite {
inset-inline: 0;
margin: 0 auto;
}
.base {
width: 170px;
position: relative;
z-index: 0;
}
.framework,
.vite {
position: absolute;
}
.framework {
z-index: 1;
top: 34px;
height: 28px;
transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
scale(1.4);
}
.vite {
z-index: 0;
top: 107px;
height: 26px;
width: auto;
transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
scale(0.8);
}
}
#center {
display: flex;
flex-direction: column;
gap: 25px;
place-content: center;
place-items: center;
flex-grow: 1;
@media (max-width: 1024px) {
padding: 32px 20px 24px;
gap: 18px;
}
}
#next-steps {
display: flex;
border-top: 1px solid var(--border);
text-align: left;
& > div {
flex: 1 1 0;
padding: 32px;
@media (max-width: 1024px) {
padding: 24px 20px;
}
}
.icon {
margin-bottom: 16px;
width: 22px;
height: 22px;
}
@media (max-width: 1024px) {
flex-direction: column;
text-align: center;
}
}
#docs {
border-right: 1px solid var(--border);
@media (max-width: 1024px) {
border-right: none;
border-bottom: 1px solid var(--border);
}
}
#next-steps ul {
list-style: none;
padding: 0;
display: flex;
gap: 8px;
margin: 32px 0 0;
.logo {
height: 18px;
}
a {
color: var(--text-h);
font-size: 16px;
border-radius: 6px;
background: var(--social-bg);
display: flex;
padding: 6px 12px;
align-items: center;
gap: 8px;
text-decoration: none;
transition: box-shadow 0.3s;
&:hover {
box-shadow: var(--shadow);
}
.button-icon {
height: 18px;
width: 18px;
}
}
@media (max-width: 1024px) {
margin-top: 20px;
flex-wrap: wrap;
justify-content: center;
li {
flex: 1 1 calc(50% - 8px);
}
a {
width: 100%;
justify-content: center;
box-sizing: border-box;
}
}
}
#spacer {
height: 88px;
border-top: 1px solid var(--border);
@media (max-width: 1024px) {
height: 48px;
}
}
.ticks {
position: relative;
width: 100%;
&::before,
&::after {
content: '';
position: absolute;
top: -4.5px;
border: 5px solid transparent;
}
&::before {
left: 0;
border-left-color: var(--border);
}
&::after {
right: 0;
border-right-color: var(--border);
}
}

113
src/App.jsx Normal file
View File

@@ -0,0 +1,113 @@
import React, { useRef, useState, useEffect } from "react";
import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import Scene from "./components/Scene";
import Overlay from "./components/Overlay";
gsap.registerPlugin(ScrollTrigger);
export default function App() {
const containerRef = useRef(null);
// Shared ref for 60fps/120fps animation loop without React state overhead
const scrollProgress = useRef(0);
const [hudProgress, setHudProgress] = useState(0);
const [dragToRotate, setDragToRotate] = useState(false);
const toggleDragToRotate = () => {
setDragToRotate((prev) => !prev);
};
useEffect(() => {
const ctx = gsap.context(() => {
// Create master ScrollTrigger spanning the 400vh container
ScrollTrigger.create({
trigger: containerRef.current,
start: "top top",
end: "bottom bottom",
scrub: 1.0, // Smooth inertia scrub
onUpdate: (self) => {
scrollProgress.current = self.progress;
// Only trigger React state update when active section (0, 1, 2, 3) actually changes
// Eliminates 60+ re-renders per second that cause WebGL canvas flickering
const nextSection = Math.min(3, Math.floor(self.progress * 3.99));
setHudProgress((prev) => (prev !== nextSection ? nextSection : prev));
},
});
// Hero section: visible on load, smoothly fades out as user scrolls down
gsap.to("#section-0 .hero-content", {
opacity: 0,
y: -60,
ease: "power1.out",
scrollTrigger: {
trigger: "#section-0",
start: "15% top",
end: "85% top",
scrub: true,
},
});
// Sections 1, 2, 3 fade in on scroll smoothly with scrub: true (never flickering toggleActions)
const scrollSections = [1, 2, 3];
scrollSections.forEach((idx) => {
const el = document.getElementById(`section-${idx}`);
if (el) {
const panel = el.querySelector(".glass-panel");
if (panel) {
gsap.fromTo(
panel,
{
opacity: 0,
y: 40,
},
{
opacity: 1,
y: 0,
ease: "power2.out",
scrollTrigger: {
trigger: el,
start: "top 80%",
end: "top 30%",
scrub: true,
},
}
);
}
}
});
}, containerRef);
// Refresh ScrollTrigger when layout is fully settled
ScrollTrigger.refresh();
return () => {
ctx.revert();
};
}, []);
// Smooth programmatic scroll to a specific section
const handleScrollToSection = (sectionIndex) => {
const targetElement = document.getElementById(`section-${sectionIndex}`);
if (targetElement) {
targetElement.scrollIntoView({ behavior: "smooth" });
}
};
return (
<div ref={containerRef} className="relative w-full bg-[#030813] text-slate-100 min-h-[400vh]">
{/* Fixed Full-screen 3D Scene Background */}
<Scene
scrollProgress={scrollProgress}
dragToRotate={dragToRotate}
/>
{/* 4 Overlapping HTML Overlay Sections with Tailwind */}
<Overlay
currentProgress={hudProgress}
onScrollToSection={handleScrollToSection}
dragToRotate={dragToRotate}
onToggleDragToRotate={toggleDragToRotate}
/>
</div>
);
}

BIN
src/assets/hero.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

1
src/assets/react.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

1
src/assets/vite.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -0,0 +1,300 @@
import React, { useRef, useMemo } from "react";
import { useFrame } from "@react-three/fiber";
import * as THREE from "three";
/**
* High-Quality Soft Atomized Sea-Foam Particle Texture
* Radial Gaussian with internal micro-bubble dispersion
*/
function createFoamParticleTexture() {
const canvas = document.createElement("canvas");
canvas.width = 128;
canvas.height = 128;
const ctx = canvas.getContext("2d");
const grad = ctx.createRadialGradient(64, 64, 0, 64, 64, 60);
grad.addColorStop(0, "rgba(255, 255, 255, 0.95)");
grad.addColorStop(0.3, "rgba(240, 250, 255, 0.65)");
grad.addColorStop(0.65, "rgba(215, 240, 255, 0.22)");
grad.addColorStop(1.0, "rgba(255, 255, 255, 0)");
ctx.fillStyle = grad;
ctx.fillRect(0, 0, 128, 128);
ctx.fillStyle = "rgba(255, 255, 255, 0.35)";
for (let i = 0; i < 40; i++) {
const ang = Math.random() * Math.PI * 2;
const rad = Math.pow(Math.random(), 0.7) * 44;
const bx = 64 + Math.cos(ang) * rad;
const by = 64 + Math.sin(ang) * rad;
const br = 1.0 + Math.random() * 1.8;
ctx.beginPath();
ctx.arc(bx, by, br, 0, Math.PI * 2);
ctx.fill();
}
const texture = new THREE.CanvasTexture(canvas);
texture.needsUpdate = true;
return texture;
}
/**
* Perpetual Volumetric Bow Wave & Cutwater Foam
* - Continuous steady-state lifecycle: runs indefinitely without fading or disappearing
* - 3D volumetric dispersion: natural, irregular foam cluster (never a thin wire or string of beads)
* - Zero gap: mathematically anchored to the true prow stem cutwater (X = 0.05, Z = 11.5, Y = -0.42)
* - Calm, stately cruising speed
*/
export default function BowSplash({ bowZ = 11.5 }) {
const coreRef = useRef();
const mistRef = useRef();
const shoulderRef = useRef();
const particleTexture = useMemo(() => createFoamParticleTexture(), []);
const prowX = 0.05;
const waterlineY = -0.42;
// 1. Volumetric Cutwater Froth Core (The churning white water where the stem slices the sea)
const coreCount = 500;
const [corePositions, coreStatic] = useMemo(() => {
const pos = new Float32Array(coreCount * 3);
// Static traits: [life (0..1), side, randScatterX, speedFactor, randScatterY]
const data = new Float32Array(coreCount * 5);
for (let i = 0; i < coreCount; i++) {
const side = (i % 2 === 0) ? 1 : -1;
const life = Math.random(); // Uniform random initial phase
const randScatterX = Math.random(); // Volumetric width fill
const speedFactor = 0.85 + Math.random() * 0.35;
const randScatterY = (Math.random() - 0.5) * 0.025;
data[i * 5] = life;
data[i * 5 + 1] = side;
data[i * 5 + 2] = randScatterX;
data[i * 5 + 3] = speedFactor;
data[i * 5 + 4] = randScatterY;
const distAft = life * 2.2;
const halfBeam = 1.56 * Math.sqrt(Math.min(1.0, Math.max(0.0, distAft / 2.0)));
const lateralSpread = (0.015 + randScatterX * 0.18) * Math.pow(life, 0.6);
pos[i * 3] = prowX + side * (halfBeam + lateralSpread);
pos[i * 3 + 1] = waterlineY + Math.sin(life * Math.PI) * 0.045 + randScatterY;
pos[i * 3 + 2] = bowZ - distAft;
}
return [pos, data];
}, [bowZ]);
// 2. Delicate Bow Mist & Atomized Spray
const mistCount = 350;
const [mistPositions, mistStatic] = useMemo(() => {
const pos = new Float32Array(mistCount * 3);
const data = new Float32Array(mistCount * 5);
for (let i = 0; i < mistCount; i++) {
const side = (i % 2 === 0) ? 1 : -1;
const life = Math.random();
const randScatterX = Math.random();
const speedFactor = 0.75 + Math.random() * 0.45;
const randScatterY = Math.random() * 0.04;
data[i * 5] = life;
data[i * 5 + 1] = side;
data[i * 5 + 2] = randScatterX;
data[i * 5 + 3] = speedFactor;
data[i * 5 + 4] = randScatterY;
const distAft = life * 2.8;
const halfBeam = 1.56 * Math.sqrt(Math.min(1.0, Math.max(0.0, distAft / 2.0)));
const lateralSpread = (0.03 + randScatterX * 0.24) * Math.pow(life, 0.7);
pos[i * 3] = prowX + side * (halfBeam + lateralSpread);
pos[i * 3 + 1] = waterlineY + Math.sin(life * Math.PI) * 0.075 + randScatterY;
pos[i * 3 + 2] = bowZ - distAft;
}
return [pos, data];
}, [bowZ]);
// 3. Waterline Shoulder Streamers (Flowing along the forward hull curves)
const shoulderCount = 450;
const [shoulderPositions, shoulderStatic] = useMemo(() => {
const pos = new Float32Array(shoulderCount * 3);
const data = new Float32Array(shoulderCount * 5);
for (let i = 0; i < shoulderCount; i++) {
const side = (i % 2 === 0) ? 1 : -1;
const life = Math.random();
const randScatterX = Math.random();
const speedFactor = 0.8 + Math.random() * 0.35;
const randScatterY = (Math.random() - 0.5) * 0.015;
data[i * 5] = life;
data[i * 5 + 1] = side;
data[i * 5 + 2] = randScatterX;
data[i * 5 + 3] = speedFactor;
data[i * 5 + 4] = randScatterY;
const distAft = life * 5.5;
const halfBeam = distAft < 2.0
? 1.56 * Math.sqrt(Math.max(0.0, distAft / 2.0))
: 1.58;
const lateralSpread = (0.01 + randScatterX * 0.16) * Math.pow(life, 0.5);
pos[i * 3] = prowX + side * (halfBeam + lateralSpread);
pos[i * 3 + 1] = waterlineY + 0.005 + randScatterY;
pos[i * 3 + 2] = bowZ - distAft;
}
return [pos, data];
}, [bowZ]);
useFrame((state, delta) => {
const safeDelta = Math.min(delta, 0.05);
// 1. Perpetually animate cutwater froth core
if (coreRef.current) {
const pos = coreRef.current.geometry.attributes.position.array;
for (let i = 0; i < coreCount; i++) {
let life = coreStatic[i * 5];
const side = coreStatic[i * 5 + 1];
const randScatterX = coreStatic[i * 5 + 2];
const speed = coreStatic[i * 5 + 3];
const randScatterY = coreStatic[i * 5 + 4];
life += safeDelta * 0.42 * speed;
if (life >= 1.0) life -= 1.0;
coreStatic[i * 5] = life;
const distAft = life * 2.2;
const halfBeam = 1.56 * Math.sqrt(Math.min(1.0, Math.max(0.0, distAft / 2.0)));
const lateralSpread = (0.015 + randScatterX * 0.18) * Math.pow(life, 0.6);
pos[i * 3] = prowX + side * (halfBeam + lateralSpread);
pos[i * 3 + 1] = waterlineY + Math.sin(life * Math.PI) * 0.045 + randScatterY;
pos[i * 3 + 2] = bowZ - distAft;
}
coreRef.current.geometry.attributes.position.needsUpdate = true;
}
// 2. Perpetually animate delicate mist
if (mistRef.current) {
const pos = mistRef.current.geometry.attributes.position.array;
for (let i = 0; i < mistCount; i++) {
let life = mistStatic[i * 5];
const side = mistStatic[i * 5 + 1];
const randScatterX = mistStatic[i * 5 + 2];
const speed = mistStatic[i * 5 + 3];
const randScatterY = mistStatic[i * 5 + 4];
life += safeDelta * 0.36 * speed;
if (life >= 1.0) life -= 1.0;
mistStatic[i * 5] = life;
const distAft = life * 2.8;
const halfBeam = 1.56 * Math.sqrt(Math.min(1.0, Math.max(0.0, distAft / 2.0)));
const lateralSpread = (0.03 + randScatterX * 0.24) * Math.pow(life, 0.7);
pos[i * 3] = prowX + side * (halfBeam + lateralSpread);
pos[i * 3 + 1] = waterlineY + Math.sin(life * Math.PI) * 0.075 + randScatterY;
pos[i * 3 + 2] = bowZ - distAft;
}
mistRef.current.geometry.attributes.position.needsUpdate = true;
}
// 3. Perpetually animate shoulder streamers
if (shoulderRef.current) {
const pos = shoulderRef.current.geometry.attributes.position.array;
for (let i = 0; i < shoulderCount; i++) {
let life = shoulderStatic[i * 5];
const side = shoulderStatic[i * 5 + 1];
const randScatterX = shoulderStatic[i * 5 + 2];
const speed = shoulderStatic[i * 5 + 3];
const randScatterY = shoulderStatic[i * 5 + 4];
life += safeDelta * 0.30 * speed;
if (life >= 1.0) life -= 1.0;
shoulderStatic[i * 5] = life;
const distAft = life * 5.5;
const halfBeam = distAft < 2.0
? 1.56 * Math.sqrt(Math.max(0.0, distAft / 2.0))
: 1.58;
const lateralSpread = (0.01 + randScatterX * 0.16) * Math.pow(life, 0.5);
pos[i * 3] = prowX + side * (halfBeam + lateralSpread);
pos[i * 3 + 1] = waterlineY + 0.005 + randScatterY;
pos[i * 3 + 2] = bowZ - distAft;
}
shoulderRef.current.geometry.attributes.position.needsUpdate = true;
}
});
return (
<group name="steady-state-volumetric-bow-splash">
{/* 1. Volumetric Whitewater Froth Core */}
<points ref={coreRef} key={`core-${coreCount}`}>
<bufferGeometry>
<bufferAttribute
attach="attributes-position"
count={coreCount}
array={corePositions}
itemSize={3}
/>
</bufferGeometry>
<pointsMaterial
size={0.22}
map={particleTexture}
transparent
opacity={0.62}
blending={THREE.AdditiveBlending}
depthWrite={false}
color="#ffffff"
/>
</points>
{/* 2. Delicate Mist Peeling Off Crest */}
<points ref={mistRef} key={`mist-${mistCount}`}>
<bufferGeometry>
<bufferAttribute
attach="attributes-position"
count={mistCount}
array={mistPositions}
itemSize={3}
/>
</bufferGeometry>
<pointsMaterial
size={0.18}
map={particleTexture}
transparent
opacity={0.38}
blending={THREE.AdditiveBlending}
depthWrite={false}
color="#f0f9ff"
/>
</points>
{/* 3. Waterline Shoulder Streamers */}
<points ref={shoulderRef} key={`shoulder-${shoulderCount}`}>
<bufferGeometry>
<bufferAttribute
attach="attributes-position"
count={shoulderCount}
array={shoulderPositions}
itemSize={3}
/>
</bufferGeometry>
<pointsMaterial
size={0.20}
map={particleTexture}
transparent
opacity={0.42}
blending={THREE.AdditiveBlending}
depthWrite={false}
color="#e0f2fe"
/>
</points>
</group>
);
}

View File

@@ -0,0 +1,94 @@
import React, { useRef, useMemo } from "react";
import { useFrame, useThree } from "@react-three/fiber";
import * as THREE from "three";
/**
* Camera Waypoints representing 4 key stages of the luxury voyage:
* 0.0: Bow View — Majestic flared bow cutting through the sea
* 0.33: Profile — Wide exterior broadside architectural silhouette
* 0.66: Sun Deck — Close intimate inspection of teak lounges and infinity plunge pool
* 1.0: Zenith Aerial — High panoramic bird's-eye view sailing toward the horizon
*/
const WAYPOINTS = [
{
progress: 0.0,
pos: new THREE.Vector3(-8.0, 4.4, 21),
target: new THREE.Vector3(2.5, 2.2, 0.5),
fov: 40,
},
{
progress: 0.33,
pos: new THREE.Vector3(-20, 6.5, 0.0),
target: new THREE.Vector3(7.0, 2.6, -2.5),
fov: 39,
},
{
progress: 0.66,
pos: new THREE.Vector3(15.0, 9.5, -6.5),
target: new THREE.Vector3(7.0, 3.6, -3.5),
fov: 38,
},
{
progress: 1.0,
pos: new THREE.Vector3(-8, 26, -20),
target: new THREE.Vector3(7.0, 0.5, 1.5),
fov: 44,
},
];
export default function CameraRig({ scrollProgress }) {
const { camera } = useThree();
const currentTarget = useRef(new THREE.Vector3(0, 2, 6));
// Temporary vectors to avoid garbage collection allocation in useFrame
const tempPos = useMemo(() => new THREE.Vector3(), []);
const tempTarget = useMemo(() => new THREE.Vector3(), []);
useFrame((state, delta) => {
// Current normalized scroll progress clamped [0, 1]
const p = Math.max(0, Math.min(1, scrollProgress.current));
// Find the current waypoint segment
let segIdx = 0;
for (let i = 0; i < WAYPOINTS.length - 1; i++) {
if (p >= WAYPOINTS[i].progress && p <= WAYPOINTS[i + 1].progress) {
segIdx = i;
break;
}
}
const w0 = WAYPOINTS[segIdx];
const w1 = WAYPOINTS[segIdx + 1];
// Local segment progress [0, 1]
const segRange = w1.progress - w0.progress;
const localP = segRange > 0 ? (p - w0.progress) / segRange : 0;
// Smoothstep interpolation for seamless easing between shots
const smoothT = localP * localP * (3 - 2 * localP);
tempPos.lerpVectors(w0.pos, w1.pos, smoothT);
tempTarget.lerpVectors(w0.target, w1.target, smoothT);
// Subtle natural cinematic camera breathing/drift
const time = state.clock.getElapsedTime();
const driftX = Math.sin(time * 0.4) * 0.25;
const driftY = Math.cos(time * 0.5) * 0.15;
tempPos.x += driftX;
tempPos.y += driftY;
// Smooth dampening towards target values (prevents jerkiness on mousewheel clicks)
const dampSpeed = 1 - Math.exp(-delta * 3.5);
camera.position.lerp(tempPos, dampSpeed);
currentTarget.current.lerp(tempTarget, dampSpeed);
// Lerp FOV smoothly if needed
const targetFov = THREE.MathUtils.lerp(w0.fov, w1.fov, smoothT);
camera.fov = THREE.MathUtils.lerp(camera.fov, targetFov, dampSpeed);
camera.updateProjectionMatrix();
camera.lookAt(currentTarget.current);
});
return null;
}

View File

@@ -0,0 +1,484 @@
import React, { useRef, useMemo } from "react";
import { useFrame } from "@react-three/fiber";
import * as THREE from "three";
/**
* Procedural Seamless High-Frequency Ocean Normal Map
* 100% Offline, Zero Network Calls
*/
/**
* Procedural Seamless Multi-Frequency Ocean Normal Map
* 100% Organic, Zero Checkerboard or Tile Artifacts, Toroidally Seamless
*/
function createOceanNormalMap(size = 512) {
const canvas = document.createElement("canvas");
canvas.width = size;
canvas.height = size;
const ctx = canvas.getContext("2d");
const imgData = ctx.createImageData(size, size);
const data = imgData.data;
// 4D Toroidal embedding guarantees 100% seamless periodic wrapping with ZERO grid seams
const wave = (x, y) => {
const s = (x / size) * Math.PI * 2;
const t = (y / size) * Math.PI * 2;
const cosS = Math.cos(s);
const sinS = Math.sin(s);
const cosT = Math.cos(t);
const sinT = Math.sin(t);
let h = 0;
// Layered irrational wave components
h += Math.sin(cosS * 2.4 + sinT * 3.7 + 0.5) * 0.40;
h += Math.cos(sinS * 4.2 - cosT * 2.8 + 1.4) * 0.30;
h += Math.sin(cosS * 7.1 + cosT * 6.3 + 2.1) * 0.20;
h += Math.cos(sinS * 11.5 + sinT * 9.8 + 0.9) * 0.12;
h += Math.sin(cosS * 16.3 - sinT * 15.1 + 3.4) * 0.07;
h += Math.cos(sinS * 23.0 + cosT * 21.0 + 1.8) * 0.04;
return h;
};
const strength = 1.4;
for (let y = 0; y < size; y++) {
for (let x = 0; x < size; x++) {
const left = wave((x - 1 + size) % size, y);
const right = wave((x + 1) % size, y);
const up = wave(x, (y - 1 + size) % size);
const down = wave(x, (y + 1) % size);
const dx = (right - left) * strength;
const dy = (down - up) * strength;
const dz = 1.0;
const len = Math.sqrt(dx * dx + dy * dy + dz * dz);
const nx = dx / len;
const ny = dy / len;
const nz = dz / len;
const idx = (y * size + x) * 4;
data[idx] = Math.floor((nx * 0.5 + 0.5) * 255);
data[idx + 1] = Math.floor((ny * 0.5 + 0.5) * 255);
data[idx + 2] = Math.floor((nz * 0.5 + 0.5) * 255);
data[idx + 3] = 255;
}
}
ctx.putImageData(imgData, 0, 0);
const texture = new THREE.CanvasTexture(canvas);
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.needsUpdate = true;
return texture;
}
/**
* Custom 60fps Ocean Shader
* - Deep sapphire navy watercolor
* - Waves flow AGAINST the ship (towards -Z at slow, majestic cruise speed)
* - Tri-rotated domain warping completely eliminates tiling patterns
* - Subtle golden sunset highway without flat beige wash
*/
const OceanShader = {
vertexShader: `
uniform float uTime;
varying vec3 vWorldPos;
varying vec3 vNormal;
varying vec2 vUv;
varying float vWaveElevation;
// Gerstner Wave: computes 3D displacement rolling AGAINST the ship (towards -Z) at majestic slow speed
vec3 gerstnerWave(vec4 wave, vec3 p, inout vec3 tangent, inout vec3 binormal) {
float a = wave.z;
float wavelength = wave.w;
float k = 2.0 * 3.14159265 / wavelength;
float c = sqrt(9.8 / k);
vec2 d = normalize(wave.xy);
// Slow, hypnotic ocean wave propagation
float f = k * (dot(d, p.xz) - c * uTime * 0.14);
float steepness = clamp(a * k * 0.85, 0.0, 0.40);
tangent += vec3(
-d.x * d.x * (steepness * sin(f)),
d.x * (steepness * cos(f)),
-d.x * d.y * (steepness * sin(f))
);
binormal += vec3(
-d.x * d.y * (steepness * sin(f)),
d.y * (steepness * cos(f)),
-d.y * d.y * (steepness * sin(f))
);
return vec3(
d.x * (a * cos(f)),
a * sin(f),
d.y * (a * cos(f))
);
}
void main() {
vUv = uv;
vec3 p = position; // Already in XZ horizontal plane (y=0)
vec3 tangent = vec3(1.0, 0.0, 0.0);
vec3 binormal = vec3(0.0, 0.0, 1.0);
// 4 Deep Non-Harmonic Gerstner Swells rolling into the bow (+Z) towards the stern (-Z)
vec4 w1 = vec4(0.06, -0.99, 0.260, 54.0); // Primary oncoming oceanic swell
vec4 w2 = vec4(-0.28, -0.96, 0.150, 32.0); // Crossing maritime swell
vec4 w3 = vec4(0.42, -0.90, 0.080, 18.0); // Rolling surface heave
vec4 w4 = vec4(-0.55, -0.83, 0.040, 9.0); // Fine wind ripples
p += gerstnerWave(w1, position, tangent, binormal);
p += gerstnerWave(w2, position, tangent, binormal);
p += gerstnerWave(w3, position, tangent, binormal);
p += gerstnerWave(w4, position, tangent, binormal);
vec3 normal = normalize(cross(binormal, tangent));
vNormal = normalMatrix * normal;
vWaveElevation = p.y;
vec4 worldPosition = modelMatrix * vec4(p, 1.0);
vWorldPos = worldPosition.xyz;
gl_Position = projectionMatrix * viewMatrix * worldPosition;
}
`,
fragmentShader: `
uniform float uTime;
uniform sampler2D uNormalMap;
uniform vec3 uSunPosition;
uniform vec3 uSunColor;
uniform vec3 uDeepWaterColor;
uniform vec3 uMidWaterColor;
uniform vec3 uCrestWaterColor;
uniform vec3 uFoamColor;
uniform vec3 uSkyColor;
uniform float uFogNear;
uniform float uFogFar;
varying vec3 vWorldPos;
varying vec3 vNormal;
varying vec2 vUv;
varying float vWaveElevation;
void main() {
vec3 viewDir = normalize(cameraPosition - vWorldPos);
vec3 sunDir = normalize(uSunPosition - vWorldPos);
// 1. Continuous Low-Frequency Domain Warp
// Smoothly bends coordinate space so rectilinear tile repetition is physically destroyed
vec2 domainWarp = vec2(
sin(vWorldPos.z * 0.022 + uTime * 0.04) * 2.2,
cos(vWorldPos.x * 0.022 + uTime * 0.04) * 2.2
);
vec2 pos = vWorldPos.xz + domainWarp;
// 2. Tri-Rotated Non-Harmonic UV Layers (Slow, majestic, hypnotic ocean flow)
mat2 rot1 = mat2(0.948, 0.317, -0.317, 0.948);
vec2 uv1 = rot1 * pos * 0.014 + vec2(uTime * 0.006, uTime * 0.10);
mat2 rot2 = mat2(0.752, -0.659, 0.659, 0.752);
vec2 uv2 = rot2 * pos * 0.031 + vec2(-uTime * 0.009, uTime * 0.13);
mat2 rot3 = mat2(0.378, 0.926, -0.926, 0.378);
vec2 uv3 = rot3 * pos * 0.068 + vec2(uTime * 0.011, uTime * 0.16);
vec3 n1 = texture2D(uNormalMap, uv1).rgb * 2.0 - 1.0;
vec3 n2 = texture2D(uNormalMap, uv2).rgb * 2.0 - 1.0;
vec3 n3 = texture2D(uNormalMap, uv3).rgb * 2.0 - 1.0;
// Re-orient normal vectors according to each layer's rotation matrix
vec2 nRot1 = rot1 * n1.xy;
vec2 nRot2 = rot2 * n2.xy;
vec2 nRot3 = rot3 * n3.xy;
vec3 detailNormal = normalize(vec3(nRot1 * 0.48 + nRot2 * 0.34 + nRot3 * 0.18, 1.0));
// Enhanced wave normal strength for rich specular facets & 3D liquid tactile depth
vec3 N = normalize(vNormal + vec3(detailNormal.x, 0.0, detailNormal.y) * 0.42);
// 3. Deep Ocean Watercolor Gradient
float heightT = clamp((vWaveElevation + 0.18) / 0.36, 0.0, 1.0);
vec3 waterColor = mix(uDeepWaterColor, uMidWaterColor, smoothstep(0.0, 0.50, heightT));
waterColor = mix(waterColor, uCrestWaterColor, smoothstep(0.45, 0.95, heightT));
// 4. Optical Fresnel Reflection (Schlick approximation)
float cosTheta = max(0.0, dot(viewDir, N));
float fresnel = 0.02 + 0.98 * pow(1.0 - cosTheta, 5.0);
vec3 skyReflect = mix(uSkyColor, vec3(0.08, 0.22, 0.38), 0.5);
vec3 color = mix(waterColor, skyReflect, fresnel * 0.52);
// 5. Glistening Golden Sun Highway (Confined strictly along sunset path)
vec3 halfVec = normalize(sunDir + viewDir);
float NdotH = max(0.0, dot(N, halfVec));
vec2 dirToSun = normalize(uSunPosition.xz - vWorldPos.xz);
vec2 dirToCam = normalize(cameraPosition.xz - vWorldPos.xz);
float sunPathGate = max(0.0, dot(-dirToSun, dirToCam));
float sunGlint = pow(NdotH, 120.0) * pow(sunPathGate, 8.0) * 3.6;
float sunSheen = pow(NdotH, 32.0) * pow(sunPathGate, 4.0) * 0.55;
vec3 sunSpecular = (sunGlint + sunSheen) * uSunColor;
color += sunSpecular;
// 6. Dynamic White Sea Crest Foam on Peaks (Delicate filigree whitecaps only on highest crests)
float peakHeight = smoothstep(0.20, 0.35, vWaveElevation);
float crestNoise = smoothstep(0.46, 0.78, n3.r * 0.55 + n2.g * 0.45);
float foamAmount = peakHeight * crestNoise * 0.70;
color = mix(color, uFoamColor, foamAmount);
// 7. Atmospheric Horizon Fog & Sunset Haze Blending
vec2 dirToHoriz = normalize(vWorldPos.xz - cameraPosition.xz);
float sunAlignment = max(0.0, dot(dirToHoriz, normalize(uSunPosition.xz)));
vec3 horizonHaze = mix(vec3(0.06, 0.15, 0.26), vec3(0.68, 0.35, 0.16), pow(sunAlignment, 2.5));
float dist = length(cameraPosition - vWorldPos);
float fogFactor = smoothstep(uFogNear, uFogFar, dist);
color = mix(color, horizonHaze, fogFactor * 0.94);
gl_FragColor = vec4(color, 1.0);
}
`,
};
/**
* 3D Ocean Water Component
*/
function OceanWater({
sunPosition = [2, 16, -75],
}) {
const meshRef = useRef();
const materialRef = useRef();
const normalMap = useMemo(() => createOceanNormalMap(512), []);
const uniforms = useMemo(
() => ({
uTime: { value: 0 },
uNormalMap: { value: normalMap },
uSunPosition: { value: new THREE.Vector3(...sunPosition) },
uSunColor: { value: new THREE.Color("#ffb86c") },
uDeepWaterColor: { value: new THREE.Color("#020e1e") }, // Deep oceanic abyss navy
uMidWaterColor: { value: new THREE.Color("#05223e") }, // Rich maritime navy blue
uCrestWaterColor: { value: new THREE.Color("#0a4565") }, // Translucent emerald/teal wave scattering
uFoamColor: { value: new THREE.Color("#f0f9ff") }, // Crisp white sea spray
uSkyColor: { value: new THREE.Color("#102844") }, // Cool twilight sky reflection
uFogNear: { value: 70 },
uFogFar: { value: 450 },
}),
[normalMap, sunPosition]
);
const oceanGeom = useMemo(() => {
const geom = new THREE.PlaneGeometry(3500, 3500, 256, 256);
geom.rotateX(-Math.PI / 2);
return geom;
}, []);
useFrame((state, delta) => {
if (materialRef.current) {
materialRef.current.uniforms.uTime.value += delta;
}
});
return (
<mesh
ref={meshRef}
geometry={oceanGeom}
position={[0, -0.42, 0]}
>
<shaderMaterial
ref={materialRef}
vertexShader={OceanShader.vertexShader}
fragmentShader={OceanShader.fragmentShader}
uniforms={uniforms}
transparent={false}
depthWrite={true}
/>
</mesh>
);
}
/**
* Sky Dome with Atmospheric Sunset Haze, Golden Corona & Volumetric Procedural Clouds
*/
function SkyWithClouds({ sunPosition = [2, 16, -75] }) {
const materialRef = useRef();
const shaderMaterial = useMemo(() => {
return new THREE.ShaderMaterial({
uniforms: {
uTime: { value: 0 },
topColor: { value: new THREE.Color("#020813") }, // Deep night sky zenith
midColor: { value: new THREE.Color("#0b223d") }, // Atmospheric maritime twilight blue
sunColor: { value: new THREE.Color("#ffe0b2") }, // Radiant setting sun
sunPosition: { value: new THREE.Vector3(...sunPosition).normalize() },
},
vertexShader: `
varying vec3 vWorldPosition;
void main() {
vec4 worldPosition = modelMatrix * vec4(position, 1.0);
vWorldPosition = worldPosition.xyz;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,
fragmentShader: `
uniform float uTime;
uniform vec3 topColor;
uniform vec3 midColor;
uniform vec3 sunColor;
uniform vec3 sunPosition;
varying vec3 vWorldPosition;
float hash(vec2 p) {
p = fract(p * vec2(123.34, 456.21));
p += dot(p, p + 45.32);
return fract(p.x * p.y);
}
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(mix(hash(i + vec2(0.0, 0.0)), hash(i + vec2(1.0, 0.0)), u.x),
mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y);
}
float fbm(vec2 p) {
float v = 0.0;
float a = 0.5;
mat2 rot = mat2(cos(0.5), sin(0.5), -sin(0.5), cos(0.5));
for (int i = 0; i < 4; ++i) {
v += a * noise(p);
p = rot * p * 2.05 + vec2(10.0);
a *= 0.5;
}
return v;
}
void main() {
vec3 dir = normalize(vWorldPosition);
float y = dir.y;
// Horizon haze matches ocean in every direction
float sunAlignment = max(0.0, dot(normalize(dir.xz), normalize(sunPosition.xz)));
vec3 horizonHaze = mix(vec3(0.06, 0.15, 0.26), vec3(0.68, 0.35, 0.16), pow(sunAlignment, 2.5));
// 1. Sky gradient
float t = clamp(pow(max(0.0, y), 0.42), 0.0, 1.0);
vec3 sky = mix(horizonHaze, mix(midColor, topColor, t), t);
if (y < 0.0) {
sky = mix(horizonHaze, vec3(0.02, 0.06, 0.12), clamp(-y * 12.0, 0.0, 1.0));
}
// 2. Horizon Haze Band
float horizonMist = exp(-abs(y) * 28.0);
sky = mix(sky, horizonHaze * 1.15, horizonMist * 0.78);
// 3. Radiant Sun Disk, Golden Corona & Horizon Bleed
float sunDot = max(dot(dir, sunPosition), 0.0);
float sunCore = pow(sunDot, 1500.0);
float sunGlow = pow(sunDot, 42.0) * 0.85;
float sunFlare = pow(sunDot, 14.0) * 0.30;
float sunHorizonBleed = pow(sunAlignment, 4.0) * exp(-abs(y) * 16.0) * 0.45;
vec3 sunLight = sunColor * (sunCore * 2.4 + sunGlow * 1.2 + sunFlare * 0.6 + sunHorizonBleed);
// 4. Distant Horizon Cloud Bank Silhouettes
if (y > 0.002 && y < 0.16) {
vec2 lowCoord = vec2(dir.x / (y + 0.12) * 3.5 + uTime * 0.004, y * 35.0);
float lowCloud = fbm(lowCoord);
float lowDensity = smoothstep(0.44, 0.68, lowCloud);
vec3 lowCloudColor = mix(horizonHaze * 0.65, vec3(0.85, 0.48, 0.22), sunAlignment * 0.85);
float lowFade = smoothstep(0.002, 0.02, y) * smoothstep(0.16, 0.06, y);
sky = mix(sky, lowCloudColor, lowDensity * lowFade * 0.75);
}
// 5. Upper Volumetric Sunset Clouds drifting with wind
if (y > 0.04) {
vec2 cloudCoord = (dir.xz / (y + 0.18)) * 1.8;
cloudCoord += vec2(uTime * 0.008, uTime * 0.004);
float cloudNoise = fbm(cloudCoord);
float cloudDensity = smoothstep(0.42, 0.72, cloudNoise);
if (cloudDensity > 0.01) {
float sunCloudLight = pow(sunDot, 2.5);
vec3 cloudSunLit = mix(vec3(0.95, 0.62, 0.32), vec3(1.0, 0.90, 0.72), sunCloudLight);
vec3 cloudShadow = mix(vec3(0.07, 0.13, 0.22), vec3(0.16, 0.24, 0.36), y);
vec3 cloudColor = mix(cloudShadow, cloudSunLit, clamp(sunCloudLight * 0.85 + (cloudNoise - 0.45) * 1.2, 0.0, 1.0));
float horizonFade = smoothstep(0.04, 0.22, y);
float cloudAlpha = cloudDensity * horizonFade * 0.82;
sky = mix(sky, cloudColor, cloudAlpha);
}
}
vec3 finalColor = sky + sunLight;
gl_FragColor = vec4(finalColor, 1.0);
}
`,
side: THREE.BackSide,
depthWrite: false,
});
}, [sunPosition]);
useFrame((state, delta) => {
if (materialRef.current) {
materialRef.current.uniforms.uTime.value += delta;
}
});
return (
<mesh position={[0, 0, 0]}>
<sphereGeometry args={[900, 32, 32]} />
<primitive ref={materialRef} object={shaderMaterial} attach="material" />
</mesh>
);
}
/**
* High-Fidelity 3D Environment Component
* Zero-Suspension, 100% Offline, Instant-Load, 60 FPS
*/
export default function Environment({
children,
sunPosition = [2, 16, -75],
}) {
return (
<group name="high-fidelity-environment">
{/* 1. Atmospheric Sky with Clouds & Horizon Bleed */}
<SkyWithClouds sunPosition={sunPosition} />
{/* 2. Golden Sunset Directional Light */}
<directionalLight
position={sunPosition}
intensity={2.4}
color="#ffae52"
castShadow
shadow-bias={-0.00012}
shadow-mapSize={[2048, 2048]}
/>
{/* Soft Front-Quarter Maritime Ambient & Hemisphere Fill */}
<ambientLight intensity={0.35} color="#94b8e0" />
<hemisphereLight
args={["#ffe4c4", "#031428", 0.50]}
position={[0, 50, 0]}
/>
<directionalLight
position={[-22, 12, 30]}
intensity={0.75}
color="#c8e1ff"
/>
{/* 3. Infinite 10,000-Unit Ocean Surface (Flows against ship) */}
<OceanWater sunPosition={sunPosition} />
{/* 4. Drop-in Children Slot (e.g. <CruiseShip />) */}
{children}
</group>
);
}

View File

@@ -0,0 +1,145 @@
import React, { useRef, useMemo } from "react";
import { useFrame } from "@react-three/fiber";
import * as THREE from "three";
/**
* Procedural Soft Atomized Spray Texture for Waterline Foam
*/
function createFlankFoamTexture() {
const canvas = document.createElement("canvas");
canvas.width = 128;
canvas.height = 128;
const ctx = canvas.getContext("2d");
const baseGrad = ctx.createRadialGradient(64, 64, 0, 64, 64, 62);
baseGrad.addColorStop(0, "rgba(255, 255, 255, 1.0)");
gradStop(baseGrad);
ctx.fillStyle = baseGrad;
ctx.fillRect(0, 0, 128, 128);
ctx.fillStyle = "rgba(255, 255, 255, 0.35)";
for (let i = 0; i < 40; i++) {
const ang = Math.random() * Math.PI * 2;
const rad = Math.pow(Math.random(), 0.7) * 44;
const bx = 64 + Math.cos(ang) * rad;
const by = 64 + Math.sin(ang) * rad;
const br = 1.0 + Math.random() * 1.6;
ctx.beginPath();
ctx.arc(bx, by, br, 0, Math.PI * 2);
ctx.fill();
}
const tex = new THREE.CanvasTexture(canvas);
tex.needsUpdate = true;
return tex;
}
function gradStop(grad) {
grad.addColorStop(0.30, "rgba(240, 250, 255, 0.65)");
grad.addColorStop(0.65, "rgba(215, 240, 255, 0.22)");
grad.addColorStop(1.0, "rgba(255, 255, 255, 0)");
}
/**
* Continuous Steady-State Hull Flank Foam Waves
* - Permanently streams along both port and starboard waterlines
* - Constant density with zero decay or timers
*/
export default function HullFlankWaves() {
const foamParticlesRef = useRef();
const particleTexture = useMemo(() => createFlankFoamTexture(), []);
const prowX = 0.05;
const waterlineY = -0.42;
const particleCount = 650;
const [particlePositions, particleParams] = useMemo(() => {
const pos = new Float32Array(particleCount * 3);
const params = new Float32Array(particleCount * 4); // [progress (0..1), side, spread, speed]
for (let i = 0; i < particleCount; i++) {
const side = (i % 2 === 0) ? 1 : -1;
const progress = i / particleCount; // Uniform distribution for steady state
const spread = (Math.random() - 0.5) * 0.06;
const speed = 0.85 + Math.random() * 0.3;
params[i * 4] = progress;
params[i * 4 + 1] = side;
params[i * 4 + 2] = spread;
params[i * 4 + 3] = speed;
const z = 11.2 - progress * 24.2; // Spans 11.2 to -13.0
let halfBeam = 1.58;
if (z > 9.5) {
halfBeam = 1.56 * Math.sqrt(Math.max(0.0, (11.5 - z) / 2.0));
} else if (z < -11.5) {
halfBeam = Math.max(0.40, 1.58 - (-11.5 - z) * 0.55);
}
pos[i * 3] = prowX + side * (halfBeam + 0.015 + spread);
pos[i * 3 + 1] = waterlineY + (Math.random() - 0.2) * 0.02;
pos[i * 3 + 2] = z;
}
return [pos, params];
}, []);
useFrame((state, delta) => {
const safeDelta = Math.min(delta, 0.05);
if (foamParticlesRef.current) {
const pos = foamParticlesRef.current.geometry.attributes.position.array;
for (let i = 0; i < particleCount; i++) {
let p = particleParams[i * 4];
const side = particleParams[i * 4 + 1];
const spread = particleParams[i * 4 + 2];
const speed = particleParams[i * 4 + 3];
p += safeDelta * 0.04 * speed; // Calm stately motion along the 24m hull
if (p >= 1.0) p -= 1.0;
particleParams[i * 4] = p;
const z = 11.2 - p * 24.2;
let halfBeam = 1.58;
if (z > 9.5) {
halfBeam = 1.56 * Math.sqrt(Math.max(0.0, (11.5 - z) / 2.0));
} else if (z < -11.5) {
halfBeam = Math.max(0.40, 1.58 - (-11.5 - z) * 0.55);
}
pos[i * 3] = prowX + side * (halfBeam + 0.015 + spread);
pos[i * 3 + 1] = waterlineY + 0.005;
pos[i * 3 + 2] = z;
}
foamParticlesRef.current.geometry.attributes.position.needsUpdate = true;
}
});
return (
<group name="steady-state-hull-flank-waves">
<points ref={foamParticlesRef} key={`flank-foam-${particleCount}`}>
<bufferGeometry>
<bufferAttribute
attach="attributes-position"
count={particleCount}
array={particlePositions}
itemSize={3}
/>
</bufferGeometry>
<pointsMaterial
size={0.26}
map={particleTexture}
transparent
opacity={0.48}
blending={THREE.AdditiveBlending}
depthWrite={false}
color="#e0f2fe"
/>
</points>
</group>
);
}

409
src/components/Overlay.jsx Normal file
View File

@@ -0,0 +1,409 @@
import React, { useState } from "react";
import {
ArrowUpRight,
Volume2,
VolumeX,
Check,
ShieldCheck,
FileCheck,
Globe2,
Compass
} from "lucide-react";
import { oceanAudio } from "../utils/audio";
export default function Overlay({
currentProgress,
onScrollToSection,
dragToRotate,
onToggleDragToRotate,
modelMode,
onToggleModelMode
}) {
const [soundActive, setSoundActive] = useState(false);
const [contactModal, setContactModal] = useState(false);
const [submitted, setSubmitted] = useState(false);
const toggleSound = () => {
const active = oceanAudio.toggle();
setSoundActive(active);
};
const handleContactSubmit = (e) => {
e.preventDefault();
setSubmitted(true);
setTimeout(() => {
setContactModal(false);
setSubmitted(false);
}, 2400);
};
const activeSection = Number.isInteger(currentProgress)
? currentProgress
: Math.min(3, Math.floor((currentProgress || 0) * 3.99));
return (
<>
{/* 1. Global Navigation Header */}
<header className="fixed top-0 left-0 right-0 z-40 px-6 sm:px-10 lg:px-16 py-6 flex items-center justify-between pointer-events-auto bg-gradient-to-b from-[#020a16]/85 via-[#020a16]/45 to-transparent backdrop-blur-[3px]">
{/* Logo: Stylized Ocean Wave + Brand */}
<div className="flex items-center gap-3 cursor-pointer" onClick={() => onScrollToSection(0)}>
{/* Wave Ridges Icon in Light Blue */}
<svg className="w-8 h-8 text-[#38bdf8]" viewBox="0 0 40 40" fill="none">
<path
d="M4 26C8 18 12 18 16 26C20 14 24 14 28 26C31 20 34 20 36 26"
stroke="#38bdf8"
strokeWidth="2.8"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M10 29C13 23 16 23 19 29C22 19 25 19 28 29"
stroke="#7dd3fc"
strokeWidth="2.2"
strokeLinecap="round"
opacity="0.85"
/>
</svg>
<div>
<div className="flex items-baseline gap-0.5">
<span className="font-extrabold text-2xl tracking-tight text-white">
WMOC
</span>
<span className="text-[#38bdf8] font-black text-2xl">.</span>
</div>
<span className="text-[8px] sm:text-[9px] tracking-[0.28em] text-slate-200 font-semibold block uppercase font-sans-clean -mt-0.5">
DOCUMENTATION SERVICES
</span>
</div>
</div>
{/* Center Navigation Links */}
<nav className="hidden lg:flex items-center gap-8 text-xs font-medium font-sans-clean tracking-wide text-white">
<button
onClick={() => onScrollToSection(0)}
className={`transition-colors hover:text-[#38bdf8] ${activeSection === 0 ? "text-[#38bdf8] font-bold" : ""}`}
>
Home
</button>
<button
onClick={() => onScrollToSection(1)}
className={`transition-colors hover:text-[#38bdf8] ${activeSection === 1 ? "text-[#38bdf8] font-bold" : ""}`}
>
Our Journey
</button>
<button
onClick={() => onScrollToSection(2)}
className={`transition-colors hover:text-[#38bdf8] ${activeSection === 2 ? "text-[#38bdf8] font-bold" : ""}`}
>
Services
</button>
<button
onClick={() => onScrollToSection(2)}
className="transition-colors hover:text-[#38bdf8]"
>
Flag States
</button>
<button
onClick={() => onScrollToSection(1)}
className="transition-colors hover:text-[#38bdf8]"
>
Process
</button>
<button
onClick={() => onScrollToSection(3)}
className={`transition-colors hover:text-[#38bdf8] ${activeSection === 3 ? "text-[#38bdf8] font-bold" : ""}`}
>
Contact
</button>
</nav>
{/* Right CTA Button & Sound Toggle */}
<div className="flex items-center gap-3">
<button
onClick={toggleSound}
className={`p-2.5 rounded-lg border transition-all flex items-center gap-1.5 text-xs ${
soundActive
? "bg-[#38bdf8]/15 border-[#38bdf8] text-[#38bdf8]"
: "bg-slate-900/60 border-white/15 text-slate-300 hover:text-white hover:border-sky-300"
}`}
title="Toggle maritime ocean spray soundscape"
>
{soundActive ? <Volume2 className="w-4 h-4 animate-pulse" /> : <VolumeX className="w-4 h-4" />}
</button>
<button
onClick={() => setContactModal(true)}
className="px-6 py-2.5 rounded-md bg-[#38bdf8] hover:bg-[#0ea5e9] text-slate-950 font-bold text-xs tracking-wider uppercase transition-all shadow-[0_2px_15px_rgba(56,189,248,0.35)] hover:shadow-[0_4px_25px_rgba(56,189,248,0.55)] flex items-center gap-1.5"
>
<span>TALK TO WMOC</span>
<ArrowUpRight className="w-4 h-4 stroke-[2.5]" />
</button>
</div>
</header>
{/* 2. Main Overlapping HTML Content Sections */}
<main className="relative z-10 w-full">
{/* SECTION 1: HERO */}
<section
id="section-0"
className="min-h-screen w-full flex flex-col justify-center px-6 sm:px-12 lg:px-20 pt-28 pb-20 pointer-events-none relative"
>
<div className="max-w-3xl pointer-events-auto hero-content">
{/* Light Blue Dot + Over-title */}
<div className="flex items-center gap-2 mb-6">
<span className="w-2.5 h-2.5 rounded-full bg-[#38bdf8] shadow-[0_0_10px_#38bdf8]" />
<span className="text-[11px] sm:text-xs tracking-[0.22em] text-white font-bold uppercase font-sans-clean">
GLOBAL MARITIME DOCUMENTATION PARTNER
</span>
</div>
{/* Giant Signature Headline */}
<h1 className="text-6xl sm:text-7xl md:text-8xl lg:text-[7.2rem] font-black tracking-tight leading-[0.9] text-white">
<span className="block font-black tracking-tight hero-letter-shadow">Navigate</span>
<span className="block font-black tracking-tight hero-letter-shadow text-white">
beyond
</span>
<span className="block font-script-italic text-[#38bdf8] font-normal my-1 -ml-1 text-7xl sm:text-8xl md:text-9xl lg:text-[7.8rem] hero-script-shadow">
Boundaries
</span>
</h1>
{/* Subtitle paragraph in clean white with protective soft shadow */}
<p className="mt-8 max-w-xl text-sm sm:text-base text-slate-100/90 leading-relaxed font-sans-clean font-normal drop-shadow-[0_2px_8px_rgba(2,6,23,0.45)]">
From seafarer endorsements to vessel compliance — guiding maritime professionals through complex documentation with clarity, precision, and confidence.
</p>
{/* Action Buttons: Light Blue & White */}
<div className="mt-9 flex flex-wrap items-center gap-4">
<button
onClick={() => onScrollToSection(1)}
className="px-7 py-3.5 rounded-md bg-[#38bdf8] hover:bg-[#0ea5e9] text-slate-950 font-bold text-xs tracking-wider uppercase transition-all flex items-center gap-2 shadow-[0_4px_20px_rgba(56,189,248,0.4)]"
>
<span>EXPERIENCE THE JOURNEY</span>
<ArrowUpRight className="w-4 h-4 stroke-[2.5]" />
</button>
<button
onClick={() => onScrollToSection(2)}
className="px-7 py-3.5 rounded-md bg-white/10 hover:bg-white/20 border border-white/30 hover:border-sky-300 text-white font-semibold text-xs tracking-wider uppercase transition-all backdrop-blur-md flex items-center gap-2 shadow-lg"
>
<span>EXPLORE SERVICES</span>
<ArrowUpRight className="w-4 h-4 stroke-[2]" />
</button>
</div>
</div>
</section>
{/* SECTION 2: OUR JOURNEY & MARITIME FLEET */}
<section
id="section-1"
className="min-h-screen w-full flex items-center px-6 sm:px-12 lg:px-20 py-24 pointer-events-none relative"
>
<div className="max-w-2xl pointer-events-auto glass-panel p-8 sm:p-12 rounded-2xl border border-sky-300/25 shadow-2xl">
<div className="text-[11px] tracking-[0.25em] text-[#38bdf8] uppercase font-sans-clean font-bold mb-3 flex items-center gap-2">
<Compass className="w-4 h-4 text-[#38bdf8]" />
Our Global Maritime Journey
</div>
<h2 className="text-4xl sm:text-5xl font-black text-white mb-6 leading-tight tracking-tight">
Flawless Compliance on Every Ocean
</h2>
<p className="text-slate-200 text-sm sm:text-base leading-relaxed font-sans-clean mb-8">
Navigating international maritime regulations demands rigorous expertise. We manage end-to-end flag state applications, STCW crew endorsements, safety management audits, and ISM/ISPS verification across over 35 global maritime registries.
</p>
<div className="grid grid-cols-2 gap-4 border-t border-white/10 pt-6">
<div className="p-4 rounded-xl bg-sky-950/40 border border-sky-400/20">
<span className="text-2xl sm:text-3xl font-black text-[#38bdf8] block">35+</span>
<span className="text-xs text-slate-300 font-medium">Flag State Administrations</span>
</div>
<div className="p-4 rounded-xl bg-sky-950/40 border border-sky-400/20">
<span className="text-2xl sm:text-3xl font-black text-white block">99.8%</span>
<span className="text-xs text-slate-300 font-medium">Endorsement Approval Rate</span>
</div>
</div>
<div className="mt-8 flex items-center gap-4">
<button
onClick={() => onScrollToSection(2)}
className="inline-flex items-center gap-2 text-xs font-bold tracking-wider uppercase text-[#38bdf8] hover:text-[#7dd3fc] transition-colors"
>
Inspect Flag State Services <ArrowUpRight className="w-4 h-4" />
</button>
</div>
</div>
</section>
{/* SECTION 3: FLAG STATES & ENDORSEMENTS */}
<section
id="section-2"
className="min-h-screen w-full flex items-center justify-end px-6 sm:px-12 lg:px-20 py-24 pointer-events-none relative"
>
<div className="max-w-2xl pointer-events-auto glass-panel p-8 sm:p-12 rounded-2xl border border-sky-300/25 shadow-2xl text-left">
<div className="text-[11px] tracking-[0.25em] text-[#38bdf8] uppercase font-sans-clean font-bold mb-3 flex items-center gap-2">
<Globe2 className="w-4 h-4 text-[#38bdf8]" />
Accredited Maritime Services
</div>
<h2 className="text-4xl sm:text-5xl font-black text-white mb-6 leading-tight tracking-tight">
Rapid Flag State Endorsements
</h2>
<p className="text-slate-200 text-sm sm:text-base leading-relaxed font-sans-clean mb-8">
Expedited processing for Panama, Liberia, Marshall Islands, Bahamas, Malta, Cyprus, and Singapore registries with direct governmental liaisons.
</p>
<div className="space-y-4 border-t border-white/10 pt-6">
<div className="flex items-start gap-4">
<div className="p-2.5 rounded-lg bg-[#38bdf8]/15 text-[#38bdf8] shrink-0">
<FileCheck className="w-5 h-5" />
</div>
<div>
<h3 className="text-white text-sm font-bold tracking-wide">Seafarer Certification (CoC / CoE)</h3>
<p className="text-slate-300 text-xs mt-0.5 leading-relaxed">
Complete verification and issuance of Certificate of Competency endorsements for Masters, Chief Engineers, and specialized ratings.
</p>
</div>
</div>
<div className="flex items-start gap-4">
<div className="p-2.5 rounded-lg bg-[#38bdf8]/15 text-[#38bdf8] shrink-0">
<ShieldCheck className="w-5 h-5" />
</div>
<div>
<h3 className="text-white text-sm font-bold tracking-wide">Vessel Registration & Continuous Synopsis</h3>
<p className="text-slate-300 text-xs mt-0.5 leading-relaxed">
Provisional and permanent registration, CSR record maintenance, radio station licenses, and minimum safe manning certificates.
</p>
</div>
</div>
</div>
<div className="mt-8">
<button
onClick={() => onScrollToSection(3)}
className="inline-flex items-center gap-2 text-xs font-bold tracking-wider uppercase text-[#38bdf8] hover:text-[#7dd3fc] transition-colors"
>
Initiate Documentation Dossier <ArrowUpRight className="w-4 h-4" />
</button>
</div>
</div>
</section>
{/* SECTION 4: CONTACT & TALK TO WMOC */}
<section
id="section-3"
className="min-h-screen w-full flex flex-col justify-center items-center px-6 sm:px-12 lg:px-20 py-28 pointer-events-none relative text-center"
>
<div className="max-w-3xl pointer-events-auto glass-panel p-8 sm:p-14 rounded-2xl border border-sky-300/25 shadow-2xl backdrop-blur-xl">
<span className="text-[11px] tracking-[0.25em] text-[#38bdf8] uppercase font-sans-clean font-bold mb-3 block">
24/7 Global Maritime Support
</span>
<h2 className="text-4xl sm:text-6xl font-black text-white mb-6 leading-tight tracking-tight">
Ready to Navigate Beyond?
</h2>
<p className="text-slate-200 text-sm sm:text-base leading-relaxed font-sans-clean max-w-xl mx-auto mb-8">
Connect with our maritime legal advisors and documentation officers for priority vessel clearance and officer endorsements.
</p>
<div className="flex flex-col sm:flex-row items-center justify-center gap-4">
<button
onClick={() => setContactModal(true)}
className="w-full sm:w-auto px-8 py-4 rounded-md bg-[#38bdf8] hover:bg-[#0ea5e9] text-slate-950 font-bold text-xs tracking-wider uppercase transition-all shadow-[0_4px_25px_rgba(56,189,248,0.45)] flex items-center justify-center gap-2"
>
<span>TALK TO WMOC ADVISOR</span>
<ArrowUpRight className="w-4 h-4 stroke-[2.5]" />
</button>
<button
onClick={() => onScrollToSection(0)}
className="w-full sm:w-auto px-8 py-4 rounded-md bg-white/10 hover:bg-white/20 text-white font-medium text-xs tracking-wider uppercase border border-white/25 hover:border-sky-300 transition-all shadow-md"
>
Back to Top ↑
</button>
</div>
</div>
</section>
</main>
{/* Contact Modal */}
{contactModal && (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-md pointer-events-auto">
<div className="glass-panel w-full max-w-lg p-8 rounded-2xl border border-sky-400/40 relative shadow-2xl">
<button
onClick={() => setContactModal(false)}
className="absolute top-6 right-6 text-slate-300 hover:text-white text-lg font-bold"
>
✕
</button>
{submitted ? (
<div className="py-12 text-center">
<div className="w-16 h-16 rounded-full bg-[#38bdf8]/20 border border-[#38bdf8] text-[#38bdf8] flex items-center justify-center mx-auto mb-4">
<Check className="w-8 h-8" />
</div>
<h3 className="text-2xl font-black text-white mb-2">Inquiry Dispatched</h3>
<p className="text-slate-200 text-xs">
A WMOC Documentation Specialist will connect with your fleet coordinator immediately.
</p>
</div>
) : (
<>
<div className="mb-6">
<span className="text-[10px] tracking-[0.25em] text-[#38bdf8] uppercase block font-bold">
Talk to WMOC
</span>
<h3 className="text-2xl sm:text-3xl font-black text-white mt-1">
Maritime Documentation Inquiry
</h3>
<p className="text-slate-300 text-xs mt-1">
Receive guidance on vessel compliance, seafarer endorsements, or registry transfers.
</p>
</div>
<form onSubmit={handleContactSubmit} className="space-y-4 text-left">
<div>
<label className="text-[11px] text-white tracking-wider uppercase block mb-1 font-semibold">
Full Name
</label>
<input
required
type="text"
placeholder="Captain Johnathan Vance"
className="w-full px-4 py-2.5 rounded-lg bg-white/5 border border-sky-300/30 text-white text-xs focus:outline-none focus:border-[#38bdf8] focus:ring-1 focus:ring-[#38bdf8]"
/>
</div>
<div>
<label className="text-[11px] text-white tracking-wider uppercase block mb-1 font-semibold">
Business Email / Fleet Domain
</label>
<input
required
type="email"
placeholder="jvance@maritime-fleet.com"
className="w-full px-4 py-2.5 rounded-lg bg-white/5 border border-sky-300/30 text-white text-xs focus:outline-none focus:border-[#38bdf8] focus:ring-1 focus:ring-[#38bdf8]"
/>
</div>
<div>
<label className="text-[11px] text-white tracking-wider uppercase block mb-1 font-semibold">
Service Category
</label>
<select className="w-full px-4 py-2.5 rounded-lg bg-[#061426] border border-sky-300/30 text-white text-xs focus:outline-none focus:border-[#38bdf8] focus:ring-1 focus:ring-[#38bdf8]">
<option>Flag State Endorsement (STCW)</option>
<option>Vessel Permanent Registration</option>
<option>Continuous Synopsis Record (CSR)</option>
<option>Radio & Safety Equipment Licensing</option>
</select>
</div>
<button
type="submit"
className="w-full py-3.5 rounded-lg bg-[#38bdf8] text-slate-950 font-bold text-xs tracking-wider uppercase mt-2 shadow-lg hover:bg-[#0ea5e9] transition-all"
>
Submit Documentation Request ↗
</button>
</form>
</>
)}
</div>
</div>
)}
</>
);
}

108
src/components/Scene.jsx Normal file
View File

@@ -0,0 +1,108 @@
import React, { Suspense } from "react";
import { Canvas } from "@react-three/fiber";
import { OrbitControls } from "@react-three/drei";
import { EffectComposer, Bloom, Vignette } from "@react-three/postprocessing";
import * as THREE from "three";
import Environment from "./Environment";
import ShipModel from "./ShipModel";
import CameraRig from "./CameraRig";
import ShipWake from "./ShipWake";
class CanvasErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
static getDerivedStateFromError() {
return { hasError: true };
}
componentDidCatch(error) {
console.warn("Notice: 3D Canvas error caught:", error?.message || error);
}
render() {
if (this.state.hasError) {
return (
<div className="fixed inset-0 flex items-center justify-center bg-[#020b18] text-slate-400 text-xs">
<button
onClick={() => this.setState({ hasError: false })}
className="px-4 py-2 rounded-full border border-teal-500/40 bg-teal-900/20 text-teal-200 hover:bg-teal-900/40 transition-colors"
>
Click to Restore 3D View
</button>
</div>
);
}
return this.props.children;
}
}
function Scene({ scrollProgress, dragToRotate, onModelLoaded }) {
return (
<CanvasErrorBoundary>
<div className={`fixed inset-0 w-full h-full z-0 overflow-hidden ${dragToRotate ? "pointer-events-auto cursor-grab active:cursor-grabbing" : "pointer-events-none"}`}>
<Canvas
shadows={{ type: THREE.PCFShadowMap }}
dpr={[1, Math.min(window.devicePixelRatio || 1, 2)]}
camera={{ position: [-8.0, 4.4, 21], fov: 40, near: 0.5, far: 1800 }}
gl={{
antialias: true,
alpha: false,
powerPreference: "high-performance",
toneMapping: THREE.ACESFilmicToneMapping,
toneMappingExposure: 1.05,
failIfMajorPerformanceCaveat: false,
}}
onCreated={({ gl }) => {
gl.domElement.addEventListener("webglcontextlost", (event) => {
event.preventDefault();
console.warn("Notice: WebGL context lost. Attempting auto-restore...");
});
}}
>
{/* Camera Control: Waypoint timeline or free 3D Orbit */}
{!dragToRotate ? (
<CameraRig scrollProgress={scrollProgress} />
) : (
<OrbitControls
target={[7.5, 2.0, -2.5]}
enableZoom={false}
maxPolarAngle={Math.PI / 2 - 0.05}
minPolarAngle={0.25}
dampingFactor={0.05}
/>
)}
{/* High-Fidelity 3D Environment (Atmospheric Sunset Sky, Drifting Clouds & Gerstner Ocean) */}
<Environment sunPosition={[2, 16, -75]}>
{/* Cruise Ship Group: Positioned on the RIGHT side (+X = 7.5) to highlight the vessel and balance with text */}
<group position={[7.5, 0, -2.5]}>
{/* 3D Cruise Ship Model */}
<ShipModel onModelLoaded={onModelLoaded} />
{/* Soft Foam Propeller Wash trailing the ship */}
<ShipWake />
</group>
</Environment>
{/* Post-Processing: multisampling={0} prevents MSAA buffer swap flicker on retina screens */}
<Suspense fallback={null}>
<EffectComposer multisampling={0} disableNormalPass>
<Bloom
luminanceThreshold={0.88}
luminanceSmoothing={0.7}
intensity={0.25}
mipmapBlur
/>
<Vignette eskil={false} offset={0.15} darkness={0.45} />
</EffectComposer>
</Suspense>
</Canvas>
</div>
</CanvasErrorBoundary>
);
}
// React.memo prevents Scene and 3D Canvas from re-rendering when scrollProgress changes
export default React.memo(Scene, (prev, next) => {
return prev.dragToRotate === next.dragToRotate;
});

View File

@@ -0,0 +1,147 @@
import React, { useRef, useState, useEffect } from "react";
import { useFrame } from "@react-three/fiber";
import { useGLTF } from "@react-three/drei";
import * as THREE from "three";
import BowSplash from "./BowSplash";
import HullFlankWaves from "./HullFlankWaves";
// Preload 3D Cruise Ship so browser caches immediately
useGLTF.preload("/cruise_ship.glb");
/**
* GLTF Model Loader for cruise_ship.glb
* - Exact centering based on visible meshes only
* - Rotated so bow faces forward (+Z) where water splashes
* - Wireframe CAD edge lines hidden for smooth, solid surface
* - Calibrated low-key materials with deep navy hull contrast & sunset rim reflections
* - Smooth entrance fade-in animation to eliminate jarring pop-in on reload
*/
function GLTFModel({ url = "/cruise_ship.glb", onLoaded }) {
const gltf = useGLTF(url);
const groupRef = useRef();
const [modelTransform, setModelTransform] = useState({ scale: 1, offset: [0, 0, 0] });
useEffect(() => {
if (gltf?.scene) {
gltf.scene.updateMatrixWorld(true);
// Compute bounding box ONLY from actual 3D meshes (ignoring rogue CAD lines)
const meshBox = new THREE.Box3();
gltf.scene.traverse((child) => {
if (child.isMesh) {
meshBox.expandByObject(child);
}
});
const size = new THREE.Vector3();
meshBox.getSize(size);
const center = new THREE.Vector3();
meshBox.getCenter(center);
// Target ship length to 26 units in the scene
const maxDim = Math.max(size.x, size.y, size.z);
const targetScale = maxDim > 0 ? 26 / maxDim : 1;
// Exact centered offset
const offsetX = -center.x * targetScale;
const offsetY = -meshBox.min.y * targetScale - 0.55;
const offsetZ = -center.z * targetScale;
setModelTransform({
scale: targetScale,
offset: [offsetX, offsetY, offsetZ],
});
// Traverse all meshes & materials
gltf.scene.traverse((child) => {
// HIDE ALL CAD EDGE LINES & OUTLINE MESHES (including SketchUp edge_color materials)
const isCadEdge =
child.isLine ||
child.type === "LineSegments" ||
(child.name && /edge|wire|line/i.test(child.name)) ||
(child.material && child.material.name && /edge|wire/i.test(child.material.name));
if (isCadEdge) {
child.visible = false;
return;
}
if (child.isMesh) {
child.castShadow = true;
child.receiveShadow = true;
if (child.material) {
// Luxury yacht finish: rich specular, sleek reflections, solid depth
if (child.material.name && /glass_red|red/i.test(child.material.name)) {
child.material.color.set("#152538");
}
child.material.envMapIntensity = 0.85;
child.material.roughness = 0.26;
child.material.metalness = 0.12;
child.material.transparent = false;
child.material.opacity = 1.0;
child.material.depthWrite = true;
child.material.needsUpdate = true;
}
}
});
if (onLoaded) onLoaded(true);
}
}, [gltf, onLoaded]);
// Majestic ocean swell physics on deep transoceanic waters
useFrame((state, delta) => {
const t = state.clock.getElapsedTime();
if (groupRef.current) {
groupRef.current.position.y = Math.sin(t * 0.32) * 0.032;
groupRef.current.rotation.z = Math.sin(t * 0.24) * 0.005; // Gentle roll
groupRef.current.rotation.x = Math.cos(t * 0.18) * 0.004; // Stately pitch
}
});
return (
<group ref={groupRef}>
{/* Ship faces forward (+Z towards camera) angled slightly (-0.16 rad) to show the majestic starboard profile */}
<group rotation={[0, -0.16, 0]}>
<group position={modelTransform.offset} scale={modelTransform.scale}>
<primitive object={gltf.scene} />
</group>
{/* Dynamic Bow Splash & Foam Spray locked directly to the forward stem at waterline Z = 11.5 */}
<BowSplash bowZ={11.5} />
{/* <HullFlankWaves /> */}
</group>
</group>
);
}
class ModelErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
static getDerivedStateFromError() {
return { hasError: true };
}
componentDidCatch(error) {
console.warn("Notice: Error loading custom model:", error?.message || error);
}
render() {
if (this.state.hasError) {
return null;
}
return this.props.children;
}
}
export default function ShipModel({ onModelLoaded }) {
return (
<ModelErrorBoundary fallback={null}>
<React.Suspense fallback={null}>
<GLTFModel url="/cruise_ship.glb" onLoaded={onModelLoaded} />
</React.Suspense>
</ModelErrorBoundary>
);
}

View File

@@ -0,0 +1,89 @@
import React, { useRef, useMemo } from "react";
import { useFrame } from "@react-three/fiber";
import * as THREE from "three";
/**
* Soft Stern Wash & Wake Particles
* Completely eliminates any flat rectangular planes.
*/
export default function ShipWake() {
const pointsRef = useRef();
const particleTexture = useMemo(() => {
const canvas = document.createElement("canvas");
canvas.width = 64;
canvas.height = 64;
const ctx = canvas.getContext("2d");
const grad = ctx.createRadialGradient(32, 32, 0, 32, 32, 32);
grad.addColorStop(0, "rgba(255, 255, 255, 0.7)");
grad.addColorStop(0.35, "rgba(224, 242, 254, 0.4)");
grad.addColorStop(1, "rgba(255, 255, 255, 0)");
ctx.fillStyle = grad;
ctx.fillRect(0, 0, 64, 64);
const tex = new THREE.CanvasTexture(canvas);
tex.needsUpdate = true;
return tex;
}, []);
const count = 400;
const [positions, velocities] = useMemo(() => {
const pos = new Float32Array(count * 3);
const vel = new Float32Array(count * 3);
for (let i = 0; i < count; i++) {
// Trailing behind the stern from Z = -8 to -35
pos[i * 3] = (Math.random() - 0.5) * (3.0 + Math.random() * 5.0); // X spreads
pos[i * 3 + 1] = -0.25; // Y right on water
pos[i * 3 + 2] = -8 - Math.random() * 28; // Z aft
vel[i * 3] = (Math.random() - 0.5) * 0.2;
vel[i * 3 + 2] = -(0.9 + Math.random() * 1.4); // Rushes aft at stately cruising speed
}
return [pos, vel];
}, []);
useFrame((state, delta) => {
if (!pointsRef.current) return;
const posAttr = pointsRef.current.geometry.attributes.position;
const pos = posAttr.array;
for (let i = 0; i < count; i++) {
const idx = i * 3;
pos[idx + 2] += velocities[idx + 2] * delta;
// Wrap around when trailing too far
if (pos[idx + 2] < -42) {
pos[idx] = (Math.random() - 0.5) * 3.5;
pos[idx + 2] = -8 - Math.random() * 4;
}
}
posAttr.needsUpdate = true;
});
return (
<points ref={pointsRef}>
<bufferGeometry>
<bufferAttribute
attach="attributes-position"
count={count}
array={positions}
itemSize={3}
/>
</bufferGeometry>
<pointsMaterial
size={1.4}
map={particleTexture}
transparent
opacity={0.42}
blending={THREE.AdditiveBlending}
depthWrite={false}
color="#e0f2fe"
/>
</points>
);
}

155
src/components/SkyDome.jsx Normal file
View File

@@ -0,0 +1,155 @@
import React, { useMemo, useRef } from "react";
import { useFrame } from "@react-three/fiber";
import * as THREE from "three";
/**
* Photorealistic 3D Sky Dome
* - Atmospheric Sunset Horizon Haze & Golden Corona
* - Distant maritime horizon stratus silhouettes (eliminates harsh bland dividing line)
* - Volumetric sunset clouds drifting with the wind
* - Seamless optical blending with ocean surface
*/
export default function SkyDome() {
const materialRef = useRef();
const shaderMaterial = useMemo(() => {
return new THREE.ShaderMaterial({
uniforms: {
uTime: { value: 0 },
topColor: { value: new THREE.Color("#020813") }, // Deep night sky zenith
midColor: { value: new THREE.Color("#0b223d") }, // Atmospheric maritime twilight blue
sunColor: { value: new THREE.Color("#ffe0b2") }, // Radiant setting sun
sunPosition: { value: new THREE.Vector3(2, 16, -75).normalize() },
},
vertexShader: `
varying vec3 vWorldPosition;
void main() {
vec4 worldPosition = modelMatrix * vec4(position, 1.0);
vWorldPosition = worldPosition.xyz;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,
fragmentShader: `
uniform float uTime;
uniform vec3 topColor;
uniform vec3 midColor;
uniform vec3 sunColor;
uniform vec3 sunPosition;
varying vec3 vWorldPosition;
// Smooth procedural noise hash
float hash(vec2 p) {
p = fract(p * vec2(123.34, 456.21));
p += dot(p, p + 45.32);
return fract(p.x * p.y);
}
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(mix(hash(i + vec2(0.0, 0.0)), hash(i + vec2(1.0, 0.0)), u.x),
mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y);
}
// 4-octave Fractional Brownian Motion for clouds
float fbm(vec2 p) {
float v = 0.0;
float a = 0.5;
mat2 rot = mat2(cos(0.5), sin(0.5), -sin(0.5), cos(0.5));
for (int i = 0; i < 4; ++i) {
v += a * noise(p);
p = rot * p * 2.05 + vec2(10.0);
a *= 0.5;
}
return v;
}
void main() {
vec3 dir = normalize(vWorldPosition);
float y = dir.y;
// Direction-dependent horizon haze color:
// Warm glowing amber towards the sun; deep twilight navy away from the sun
float sunAlignment = max(0.0, dot(normalize(dir.xz), normalize(sunPosition.xz)));
vec3 horizonHaze = mix(vec3(0.06, 0.15, 0.26), vec3(0.68, 0.35, 0.16), pow(sunAlignment, 2.5));
// 1. Smooth vertical sky gradient
float t = clamp(pow(max(0.0, y), 0.42), 0.0, 1.0);
vec3 sky = mix(horizonHaze, mix(midColor, topColor, t), t);
// Below horizon: fade into oceanic depth
if (y < 0.0) {
sky = mix(horizonHaze, vec3(0.02, 0.06, 0.12), clamp(-y * 12.0, 0.0, 1.0));
}
// 2. Atmospheric Horizon Haze Band (Softens the boundary where water and sky meet)
float horizonMist = exp(-abs(y) * 28.0);
sky = mix(sky, horizonHaze * 1.15, horizonMist * 0.78);
// 3. Radiant Sun Disk, Golden Corona & Horizon Bleed
float sunDot = max(dot(dir, sunPosition), 0.0);
float sunCore = pow(sunDot, 1500.0); // Sharp sun disk
float sunGlow = pow(sunDot, 42.0) * 0.85; // Warm golden corona
float sunFlare = pow(sunDot, 14.0) * 0.30; // Wide sunset wash
// Sun flare bleeds softly over the horizon
float sunHorizonBleed = pow(sunAlignment, 4.0) * exp(-abs(y) * 16.0) * 0.45;
vec3 sunLight = sunColor * (sunCore * 2.4 + sunGlow * 1.2 + sunFlare * 0.6 + sunHorizonBleed);
// 4. Distant Horizon Cloud Bank Silhouettes (Breaks up the flat straight line!)
if (y > 0.002 && y < 0.16) {
vec2 lowCoord = vec2(dir.x / (y + 0.12) * 3.5 + uTime * 0.004, y * 35.0);
float lowCloud = fbm(lowCoord);
float lowDensity = smoothstep(0.44, 0.68, lowCloud);
// Distant stratus clouds catch the golden sunset glow on their tops
vec3 lowCloudColor = mix(horizonHaze * 0.65, vec3(0.85, 0.48, 0.22), sunAlignment * 0.85);
float lowFade = smoothstep(0.002, 0.02, y) * smoothstep(0.16, 0.06, y);
sky = mix(sky, lowCloudColor, lowDensity * lowFade * 0.75);
}
// 5. Upper Volumetric Sunset Clouds
if (y > 0.04) {
vec2 cloudCoord = (dir.xz / (y + 0.18)) * 1.8;
cloudCoord += vec2(uTime * 0.008, uTime * 0.004);
float cloudNoise = fbm(cloudCoord);
float cloudDensity = smoothstep(0.42, 0.72, cloudNoise);
if (cloudDensity > 0.01) {
float sunCloudLight = pow(sunDot, 2.5);
vec3 cloudSunLit = mix(vec3(0.95, 0.62, 0.32), vec3(1.0, 0.90, 0.72), sunCloudLight);
vec3 cloudShadow = mix(vec3(0.07, 0.13, 0.22), vec3(0.16, 0.24, 0.36), y);
vec3 cloudColor = mix(cloudShadow, cloudSunLit, clamp(sunCloudLight * 0.85 + (cloudNoise - 0.45) * 1.2, 0.0, 1.0));
float horizonFade = smoothstep(0.04, 0.22, y);
float cloudAlpha = cloudDensity * horizonFade * 0.82;
sky = mix(sky, cloudColor, cloudAlpha);
}
}
vec3 finalColor = sky + sunLight;
gl_FragColor = vec4(finalColor, 1.0);
}
`,
side: THREE.BackSide,
depthWrite: false,
});
}, []);
useFrame((state, delta) => {
if (materialRef.current) {
materialRef.current.uniforms.uTime.value += delta;
}
});
return (
<mesh position={[0, 0, 0]}>
<sphereGeometry args={[900, 32, 32]} />
<primitive ref={materialRef} object={shaderMaterial} attach="material" />
</mesh>
);
}

View File

@@ -0,0 +1,84 @@
import React, { useMemo } from "react";
import * as THREE from "three";
/**
* Creates soft radial glow texture for the setting sun
*/
function createSunCoronaTexture() {
const canvas = document.createElement("canvas");
canvas.width = 256;
canvas.height = 256;
const ctx = canvas.getContext("2d");
const gradient = ctx.createRadialGradient(128, 128, 0, 128, 128, 128);
gradient.addColorStop(0, "rgba(255, 255, 255, 1.0)");
gradient.addColorStop(0.2, "rgba(255, 235, 180, 0.95)");
gradient.addColorStop(0.45, "rgba(255, 170, 70, 0.65)");
gradient.addColorStop(0.75, "rgba(240, 110, 40, 0.2)");
gradient.addColorStop(1, "rgba(200, 70, 20, 0)");
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, 256, 256);
const texture = new THREE.CanvasTexture(canvas);
texture.needsUpdate = true;
return texture;
}
/**
* Golden Hour Sunset Sky & Sun Disc
* Creates the cinematic golden sun flare positioned directly behind the cruise ship
*/
export default function SunsetSky() {
const sunTexture = useMemo(() => createSunCoronaTexture(), []);
return (
<group position={[-10, 14, -85]}>
{/* 1. Radiant Sun Core */}
<mesh>
<planeGeometry args={[26, 26]} />
<meshBasicMaterial
map={sunTexture}
transparent
blending={THREE.AdditiveBlending}
depthWrite={false}
/>
</mesh>
{/* 2. Outer Volumetric Atmosphere Glow */}
<mesh position={[0, 0, -2]}>
<planeGeometry args={[65, 45]} />
<meshBasicMaterial
map={sunTexture}
color="#ffaa44"
transparent
opacity={0.5}
blending={THREE.AdditiveBlending}
depthWrite={false}
/>
</mesh>
{/* 3. Golden Cloud Layer Strips */}
<mesh position={[4, 2, -1]}>
<planeGeometry args={[90, 12]} />
<meshBasicMaterial
color="#ff9944"
transparent
opacity={0.25}
blending={THREE.AdditiveBlending}
depthWrite={false}
/>
</mesh>
<mesh position={[-6, 6, -1.5]}>
<planeGeometry args={[110, 16]} />
<meshBasicMaterial
color="#ff7733"
transparent
opacity={0.18}
blending={THREE.AdditiveBlending}
depthWrite={false}
/>
</mesh>
</group>
);
}

265
src/components/Water.jsx Normal file
View File

@@ -0,0 +1,265 @@
import React, { useMemo, useRef } from "react";
import { useFrame } from "@react-three/fiber";
import * as THREE from "three";
/**
* Creates high-detail procedural ocean ripple normal map
*/
function createOceanNormalMap(size = 512) {
const canvas = document.createElement("canvas");
canvas.width = size;
canvas.height = size;
const ctx = canvas.getContext("2d");
const imgData = ctx.createImageData(size, size);
const data = imgData.data;
const wave = (x, y) => {
const nx = (x / size) * Math.PI * 14;
const ny = (y / size) * Math.PI * 14;
const s1 = Math.sin(nx * 0.8 + ny * 1.3);
const s2 = Math.cos(nx * 1.5 - ny * 1.0) * 0.55;
const c1 = Math.sin(nx * 3.4 + ny * 4.0) * 0.28;
const c2 = Math.cos(nx * 6.0 - ny * 4.5) * 0.15;
const rip = (Math.sin(nx * 14.0) * Math.cos(ny * 14.0)) * 0.08;
return s1 + s2 + c1 + c2 + rip;
};
const strength = 1.6;
for (let y = 0; y < size; y++) {
for (let x = 0; x < size; x++) {
const left = wave((x - 1 + size) % size, y);
const right = wave((x + 1) % size, y);
const up = wave(x, (y - 1 + size) % size);
const down = wave(x, (y + 1) % size);
const dx = (right - left) * strength;
const dy = (down - up) * strength;
const dz = 1.0;
const len = Math.sqrt(dx * dx + dy * dy + dz * dz);
const nx = dx / len;
const ny = dy / len;
const nz = dz / len;
const idx = (y * size + x) * 4;
data[idx] = Math.floor((nx * 0.5 + 0.5) * 255);
data[idx + 1] = Math.floor((ny * 0.5 + 0.5) * 255);
data[idx + 2] = Math.floor((nz * 0.5 + 0.5) * 255);
data[idx + 3] = 255;
}
}
ctx.putImageData(imgData, 0, 0);
const texture = new THREE.CanvasTexture(canvas);
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.needsUpdate = true;
return texture;
}
/**
* Authentic Photorealistic Ocean Shader
* - Deep oceanic sapphire navy watercolor (NEVER beige/tan/brown)
* - True optical Fresnel: glancing angles reflect cool sky, steep angles reveal deep clear water
* - Focused golden sunset specular trail strictly pointing towards the setting sun
* - Smooth Gerstner 3D wave swells without grid artifacts
* - Crisp sea-spray foam on wave crests
*/
const OceanShader = {
vertexShader: `
uniform float uTime;
varying vec3 vWorldPos;
varying vec3 vNormal;
varying vec2 vUv;
varying float vWaveElevation;
// Gerstner Wave: computes 3D trochoidal displacement and analytic surface vectors
vec3 gerstnerWave(vec4 wave, vec3 p, inout vec3 tangent, inout vec3 binormal) {
float a = wave.z; // Amplitude
float wavelength = wave.w; // Wavelength
float k = 2.0 * 3.14159265 / wavelength;
float c = sqrt(9.8 / k);
vec2 d = normalize(wave.xy);
float f = k * (dot(d, p.xz) - c * uTime * 0.38);
float steepness = clamp(a * k * 1.2, 0.0, 0.55);
tangent += vec3(
-d.x * d.x * (steepness * sin(f)),
d.x * (steepness * cos(f)),
-d.x * d.y * (steepness * sin(f))
);
binormal += vec3(
-d.x * d.y * (steepness * sin(f)),
d.y * (steepness * cos(f)),
-d.y * d.y * (steepness * sin(f))
);
return vec3(
d.x * (a * cos(f)),
a * sin(f),
d.y * (a * cos(f))
);
}
void main() {
vUv = uv;
vec3 gridPoint = position;
vec3 tangent = vec3(1.0, 0.0, 0.0);
vec3 binormal = vec3(0.0, 0.0, 1.0);
vec3 p = gridPoint;
// 4 Harmonious Gerstner Waves flowing DIRECTLY AGAINST THE SHIP (towards -Z)
// The ship points into +Z, so waves crash into the bow (+Z) and roll past the hull to -Z
vec4 w1 = vec4(0.08, -0.99, 0.090, 32.0); // Primary oncoming swell slamming into bow
vec4 w2 = vec4(-0.32, -0.95, 0.058, 20.0); // Crossing roll rushing aft
vec4 w3 = vec4(0.55, -0.83, 0.032, 10.0); // Oncoming maritime chop
vec4 w4 = vec4(-0.65, -0.76, 0.016, 5.0); // High speed surface ripples
p += gerstnerWave(w1, gridPoint, tangent, binormal);
p += gerstnerWave(w2, gridPoint, tangent, binormal);
p += gerstnerWave(w3, gridPoint, tangent, binormal);
p += gerstnerWave(w4, gridPoint, tangent, binormal);
vec3 normal = normalize(cross(binormal, tangent));
vNormal = normalMatrix * normal;
vWaveElevation = p.y - gridPoint.y;
vec4 worldPosition = modelMatrix * vec4(p, 1.0);
vWorldPos = worldPosition.xyz;
gl_Position = projectionMatrix * viewMatrix * worldPosition;
}
`,
fragmentShader: `
uniform float uTime;
uniform sampler2D uNormalMap;
uniform vec3 uSunPosition;
uniform vec3 uSunColor;
uniform vec3 uDeepWaterColor;
uniform vec3 uMidWaterColor;
uniform vec3 uCrestWaterColor;
uniform vec3 uFoamColor;
uniform vec3 uSkyColor;
uniform vec3 uFogColor;
uniform float uFogNear;
uniform float uFogFar;
varying vec3 vWorldPos;
varying vec3 vNormal;
varying vec2 vUv;
varying float vWaveElevation;
void main() {
vec3 viewDir = normalize(cameraPosition - vWorldPos);
vec3 sunDir = normalize(uSunPosition - vWorldPos);
// Micro-texture ripples streaming backwards past the ship (towards -Z at 22-knot cruise speed)
vec2 uv1 = vWorldPos.xz * 0.055 + vec2(uTime * 0.03, uTime * 0.45);
vec2 uv2 = vWorldPos.xz * 0.13 + vec2(-uTime * 0.04, uTime * 0.72);
vec3 nMap1 = texture2D(uNormalMap, uv1).rgb * 2.0 - 1.0;
vec3 nMap2 = texture2D(uNormalMap, uv2).rgb * 2.0 - 1.0;
vec3 detailNormal = normalize(vec3(nMap1.xy + nMap2.xy * 0.5, 1.0));
// Combine geometric wave normal with liquid micro-texture
vec3 N = normalize(vNormal + vec3(detailNormal.x, 0.0, detailNormal.y) * 0.28);
// 1. Deep Ocean Watercolor Gradient
// Troughs are deep midnight navy; crests scatter sunlight into translucent marine teal
float heightT = clamp((vWaveElevation + 0.10) / 0.22, 0.0, 1.0);
vec3 waterColor = mix(uDeepWaterColor, uMidWaterColor, smoothstep(0.0, 0.55, heightT));
waterColor = mix(waterColor, uCrestWaterColor, smoothstep(0.50, 0.95, heightT));
// 2. Optical Fresnel Reflection (Schlick approximation)
// Steep angles (looking down): reveals deep navy water
// Glancing angles (horizon): reflects cool twilight sky
float cosTheta = max(0.0, dot(viewDir, N));
float fresnel = 0.02 + 0.98 * pow(1.0 - cosTheta, 5.0);
vec3 skyReflect = mix(uSkyColor, vec3(0.08, 0.22, 0.38), 0.5);
vec3 color = mix(waterColor, skyReflect, fresnel * 0.55);
// 3. Realistic Golden Sun Specular Trail
// Crucial: The sun reflection is a longitudinal highway ONLY pointing toward the sun, NOT a flat wash!
vec3 halfVec = normalize(sunDir + viewDir);
float NdotH = max(0.0, dot(N, halfVec));
// Sun alignment: gates specular so it only appears in the direction of the sun
vec2 dirToSun = normalize(uSunPosition.xz - vWorldPos.xz);
vec2 dirToCam = normalize(cameraPosition.xz - vWorldPos.xz);
float sunPathGate = max(0.0, dot(-dirToSun, dirToCam));
float sunGlint = pow(NdotH, 120.0) * pow(sunPathGate, 8.0) * 3.5;
float sunSheen = pow(NdotH, 32.0) * pow(sunPathGate, 4.0) * 0.6;
vec3 sunSpecular = (sunGlint + sunSheen) * uSunColor;
color += sunSpecular;
// 4. White Sea Spray Foam on Wave Peaks
float foamThreshold = smoothstep(0.08, 0.16, vWaveElevation + nMap1.r * 0.04);
color = mix(color, uFoamColor, foamThreshold * 0.65);
// 5. Atmospheric Horizon Fog & Sunset Haze Blending
// Perfectly matches SkyDome's direction-dependent horizon atmosphere
vec2 dirToHoriz = normalize(vWorldPos.xz - cameraPosition.xz);
float sunAlignment = max(0.0, dot(dirToHoriz, normalize(uSunPosition.xz)));
vec3 horizonHaze = mix(vec3(0.06, 0.15, 0.26), vec3(0.68, 0.35, 0.16), pow(sunAlignment, 2.5));
float dist = length(cameraPosition - vWorldPos);
float fogFactor = smoothstep(uFogNear, uFogFar, dist);
color = mix(color, horizonHaze, fogFactor * 0.94);
gl_FragColor = vec4(color, 1.0);
}
`,
};
export default function Water() {
const meshRef = useRef();
const materialRef = useRef();
const normalMap = useMemo(() => createOceanNormalMap(512), []);
const uniforms = useMemo(
() => ({
uTime: { value: 0 },
uNormalMap: { value: normalMap },
uSunPosition: { value: new THREE.Vector3(2, 16, -75) },
uSunColor: { value: new THREE.Color("#ffb86c") }, // Golden sunset sunbeam
uDeepWaterColor: { value: new THREE.Color("#020e1e") }, // Deep oceanic abyss sapphire navy
uMidWaterColor: { value: new THREE.Color("#05223e") }, // Rich maritime navy blue
uCrestWaterColor: { value: new THREE.Color("#0a4565") }, // Translucent emerald/teal wave scattering
uFoamColor: { value: new THREE.Color("#f0f9ff") }, // Crisp white sea spray
uSkyColor: { value: new THREE.Color("#102844") }, // Cool twilight sky reflection
uFogColor: { value: new THREE.Color("#08182b") }, // Deep oceanic horizon fog
uFogNear: { value: 60 },
uFogFar: { value: 450 },
}),
[normalMap]
);
useFrame((state, delta) => {
if (materialRef.current) {
materialRef.current.uniforms.uTime.value += delta;
}
});
return (
<mesh
ref={meshRef}
rotation={[-Math.PI / 2, 0, 0]}
position={[0, -0.45, 0]}
>
<planeGeometry args={[1400, 1400, 128, 128]} />
<shaderMaterial
ref={materialRef}
vertexShader={OceanShader.vertexShader}
fragmentShader={OceanShader.fragmentShader}
uniforms={uniforms}
transparent={false}
depthWrite={true}
/>
</mesh>
);
}

90
src/index.css Normal file
View File

@@ -0,0 +1,90 @@
@import "tailwindcss";
@layer base {
:root {
--font-serif: 'Playfair Display', Georgia, serif;
--font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
}
html, body {
margin: 0;
padding: 0;
width: 100%;
min-height: 100%;
background-color: #020713;
color: #f8fafc;
font-family: var(--font-sans);
overflow-x: hidden;
}
#root {
width: 100%;
min-height: 100vh;
position: relative;
}
}
.font-serif-luxury {
font-family: var(--font-serif);
}
.font-script-italic {
font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
font-style: italic;
font-weight: 500;
}
.font-sans-clean {
font-family: var(--font-sans);
}
/* Glassmorphism Luxury Panel with Light-Blue & White Theme */
.glass-panel {
background: rgba(5, 18, 38, 0.78);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border: 1px solid rgba(125, 211, 252, 0.24);
box-shadow: 0 8px 32px rgba(2, 10, 24, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.18);
transform: translateZ(0);
-webkit-transform: translateZ(0);
will-change: transform, opacity;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
}
.glass-pill {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border: 1px solid rgba(255, 255, 255, 0.12);
transform: translateZ(0);
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
background: #030712;
}
::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
background: #334155;
}
/* Hero letter shadow: Very faint, delicate whisper shadow */
.hero-letter-shadow {
text-shadow:
0 2px 8px rgba(2, 6, 23, 0.20),
0 4px 18px rgba(2, 6, 23, 0.12);
}
.hero-script-shadow {
text-shadow:
0 2px 8px rgba(2, 6, 23, 0.20),
0 4px 18px rgba(2, 6, 23, 0.12),
0 0 20px rgba(56, 189, 248, 0.15);
}

14
src/main.jsx Normal file
View File

@@ -0,0 +1,14 @@
if (import.meta.env.DEV) {
import("react-grab");
}
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)

99
src/utils/audio.js Normal file
View File

@@ -0,0 +1,99 @@
/**
* Web Audio API procedural ocean surf & breeze sound generator.
* Zero external audio files required. Runs purely in-browser.
*/
class OceanSoundscape {
constructor() {
this.ctx = null;
this.isPlaying = false;
this.gainNode = null;
this.filterNode = null;
this.lfo = null;
}
init() {
if (!this.ctx) {
const AudioCtx = window.AudioContext || window.webkitAudioContext;
this.ctx = new AudioCtx();
}
}
start() {
this.init();
if (this.ctx.state === "suspended") {
this.ctx.resume();
}
if (this.isPlaying) return;
// Create pink/brown noise buffer for ocean surf
const bufferSize = this.ctx.sampleRate * 4;
const noiseBuffer = this.ctx.createBuffer(1, bufferSize, this.ctx.sampleRate);
const output = noiseBuffer.getChannelData(0);
let lastOut = 0.0;
for (let i = 0; i < bufferSize; i++) {
const white = Math.random() * 2 - 1;
// Low-pass filter for ocean rumble
output[i] = (lastOut + 0.02 * white) / 1.02;
lastOut = output[i];
output[i] *= 3.5;
}
const whiteNoise = this.ctx.createBufferSource();
whiteNoise.buffer = noiseBuffer;
whiteNoise.loop = true;
// Filter simulating wave movement
this.filterNode = this.ctx.createBiquadFilter();
this.filterNode.type = "lowpass";
this.filterNode.frequency.setValueAtTime(320, this.ctx.currentTime);
// LFO for wave modulation rhythm
this.lfo = this.ctx.createOscillator();
this.lfo.frequency.setValueAtTime(0.12, this.ctx.currentTime); // ~8 sec wave cycle
const lfoGain = this.ctx.createGain();
lfoGain.gain.setValueAtTime(220, this.ctx.currentTime);
this.lfo.connect(this.filterNode.frequency);
// Master volume gain
this.gainNode = this.ctx.createGain();
this.gainNode.gain.setValueAtTime(0.001, this.ctx.currentTime);
this.gainNode.gain.exponentialRampToValueAtTime(0.18, this.ctx.currentTime + 2);
whiteNoise.connect(this.filterNode);
this.filterNode.connect(this.gainNode);
this.gainNode.connect(this.ctx.destination);
whiteNoise.start();
this.lfo.start();
this.noiseSource = whiteNoise;
this.isPlaying = true;
}
stop() {
if (!this.isPlaying || !this.gainNode) return;
this.gainNode.gain.exponentialRampToValueAtTime(0.0001, this.ctx.currentTime + 1.2);
setTimeout(() => {
try {
if (this.noiseSource) this.noiseSource.stop();
if (this.lfo) this.lfo.stop();
} catch (e) {
// ignore
}
this.isPlaying = false;
}, 1200);
}
toggle() {
if (this.isPlaying) {
this.stop();
return false;
} else {
this.start();
return true;
}
}
}
export const oceanAudio = new OceanSoundscape();

8
vite.config.js Normal file
View File

@@ -0,0 +1,8 @@
import tailwindcss from '@tailwindcss/vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
// https://vite.dev/config/
export default defineConfig({
plugins: [tailwindcss(), react()],
})