1361 lines
45 KiB
HTML
1361 lines
45 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="description" content="Eaglercraft Shader Collection - Lightweight shaders for low-end WebGL devices">
|
||
<title>Eaglercraft Shader Collection</title>
|
||
<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=JetBrains+Mono:wght@400;500;700&family=Space+Grotesk:wght@400;500;700&display=swap" rel="stylesheet">
|
||
<style>
|
||
:root {
|
||
--bg: #050507;
|
||
--bg-deep: #030304;
|
||
--fg: #e0e0e8;
|
||
--fg-dim: #8a8a9a;
|
||
--muted: #5a5a6a;
|
||
--accent: #00cc99;
|
||
--accent-glow: #00cc9933;
|
||
--warm: #ff9f43;
|
||
--cool: #4da3ff;
|
||
--card: #0c0c11;
|
||
--card-hover: #13131a;
|
||
--border: #1f1f2b;
|
||
--border-bright: #2d2d3d;
|
||
--shadow: rgba(0,0,0,0.4);
|
||
}
|
||
|
||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
*, *::before, *::after {
|
||
animation-duration: 0.01ms !important;
|
||
animation-iteration-count: 1 !important;
|
||
transition-duration: 0.01ms !important;
|
||
}
|
||
}
|
||
|
||
html { scroll-behavior: smooth; }
|
||
|
||
body {
|
||
font-family: 'Space Grotesk', sans-serif;
|
||
background: var(--bg);
|
||
color: var(--fg);
|
||
min-height: 100vh;
|
||
overflow-x: hidden;
|
||
line-height: 1.65;
|
||
}
|
||
|
||
.mono { font-family: 'JetBrains Mono', monospace; }
|
||
|
||
#voxel-canvas {
|
||
position: fixed;
|
||
top: 0; left: 0;
|
||
width: 100%; height: 100%;
|
||
z-index: -1;
|
||
background: var(--bg);
|
||
}
|
||
|
||
.skip-link {
|
||
position: absolute;
|
||
top: -100%;
|
||
left: 1rem;
|
||
background: var(--accent);
|
||
color: var(--bg);
|
||
padding: 0.75rem 1.25rem;
|
||
border-radius: 6px;
|
||
font-weight: 700;
|
||
z-index: 1000;
|
||
text-decoration: none;
|
||
}
|
||
.skip-link:focus { top: 1rem; }
|
||
|
||
nav {
|
||
position: fixed;
|
||
top: 0; left: 0; right: 0;
|
||
z-index: 100;
|
||
padding: 1rem 2rem;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
background: linear-gradient(180deg, rgba(5,5,7,0.98) 0%, rgba(5,5,7,0) 100%);
|
||
border-bottom: 1px solid var(--border);
|
||
backdrop-filter: blur(12px);
|
||
}
|
||
|
||
.nav-brand {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 0.625rem;
|
||
font-weight: 700;
|
||
font-size: 1.125rem;
|
||
color: var(--fg);
|
||
text-decoration: none;
|
||
letter-spacing: -0.02em;
|
||
}
|
||
|
||
.nav-brand svg { width: 28px; height: 28px; }
|
||
|
||
.nav-links {
|
||
display: flex;
|
||
gap: 0.5rem;
|
||
list-style: none;
|
||
}
|
||
|
||
.nav-links a {
|
||
color: var(--fg-dim);
|
||
text-decoration: none;
|
||
font-size: 0.8125rem;
|
||
font-weight: 500;
|
||
padding: 0.5rem 0.875rem;
|
||
border-radius: 6px;
|
||
transition: all 0.15s;
|
||
}
|
||
|
||
.nav-links a:hover {
|
||
color: var(--fg);
|
||
background: var(--card-hover);
|
||
}
|
||
|
||
.nav-links a.active {
|
||
color: var(--accent);
|
||
background: var(--accent-glow);
|
||
}
|
||
|
||
.hero {
|
||
min-height: 100vh;
|
||
display: grid;
|
||
grid-template-rows: auto 1fr auto;
|
||
padding: 6rem 2rem 4rem;
|
||
max-width: 1200px;
|
||
margin: 0 auto;
|
||
position: relative;
|
||
}
|
||
|
||
.hero-badge {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 0.5rem;
|
||
background: var(--card);
|
||
border: 1px solid var(--border);
|
||
padding: 0.5rem 1rem;
|
||
border-radius: 100px;
|
||
font-size: 0.7rem;
|
||
font-weight: 600;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.1em;
|
||
color: var(--accent);
|
||
width: fit-content;
|
||
justify-self: start;
|
||
}
|
||
|
||
.hero-badge::before {
|
||
content: '';
|
||
width: 6px; height: 6px;
|
||
background: var(--accent);
|
||
border-radius: 50%;
|
||
animation: blink 1.5s infinite;
|
||
}
|
||
|
||
@keyframes blink {
|
||
0%, 100% { opacity: 1; }
|
||
50% { opacity: 0.3; }
|
||
}
|
||
|
||
.hero-content {
|
||
align-self: center;
|
||
max-width: 800px;
|
||
}
|
||
|
||
.hero h1 {
|
||
font-size: clamp(2.25rem, 5.5vw, 4.5rem);
|
||
font-weight: 700;
|
||
line-height: 1.05;
|
||
letter-spacing: -0.03em;
|
||
margin-bottom: 1.5rem;
|
||
}
|
||
|
||
.hero h1 .accent-word {
|
||
color: var(--accent);
|
||
position: relative;
|
||
}
|
||
|
||
.hero h1 .accent-word::after {
|
||
content: '';
|
||
position: absolute;
|
||
bottom: 0.1em; left: 0; right: 0;
|
||
height: 0.15em;
|
||
background: var(--accent-glow);
|
||
z-index: -1;
|
||
}
|
||
|
||
.hero p {
|
||
font-size: clamp(1rem, 1.8vw, 1.125rem);
|
||
color: var(--fg-dim);
|
||
max-width: 65ch;
|
||
margin-bottom: 2.5rem;
|
||
line-height: 1.7;
|
||
}
|
||
|
||
.hero-actions {
|
||
display: flex;
|
||
gap: 0.75rem;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
}
|
||
|
||
.btn {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 0.5rem;
|
||
padding: 0.8125rem 1.5rem;
|
||
border-radius: 8px;
|
||
font-weight: 600;
|
||
font-size: 0.8125rem;
|
||
text-decoration: none;
|
||
transition: all 0.15s;
|
||
border: 1px solid transparent;
|
||
cursor: pointer;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.btn-primary {
|
||
background: var(--accent);
|
||
color: var(--bg);
|
||
border-color: var(--accent);
|
||
}
|
||
|
||
.btn-primary:hover {
|
||
background: #00e6ac;
|
||
transform: translateY(-1px);
|
||
box-shadow: 0 8px 24px var(--accent-glow);
|
||
}
|
||
|
||
.btn-secondary {
|
||
background: transparent;
|
||
color: var(--fg);
|
||
border-color: var(--border-bright);
|
||
}
|
||
|
||
.btn-secondary:hover {
|
||
border-color: var(--accent);
|
||
color: var(--accent);
|
||
background: var(--accent-glow);
|
||
}
|
||
|
||
.btn-ghost {
|
||
background: transparent;
|
||
color: var(--fg-dim);
|
||
border-color: transparent;
|
||
padding: 0.5rem 0;
|
||
}
|
||
|
||
.btn-ghost:hover { color: var(--fg); }
|
||
|
||
.version-pill {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 0.375rem;
|
||
font-family: 'JetBrains Mono', monospace;
|
||
font-size: 0.7rem;
|
||
color: var(--muted);
|
||
padding: 0.25rem 0.625rem;
|
||
background: var(--card);
|
||
border: 1px solid var(--border);
|
||
border-radius: 4px;
|
||
}
|
||
|
||
.divider {
|
||
height: 1px;
|
||
background: linear-gradient(90deg, transparent, var(--border), transparent);
|
||
margin: 0 2rem;
|
||
}
|
||
|
||
section {
|
||
padding: 5rem 2rem;
|
||
max-width: 1200px;
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.section-header {
|
||
margin-bottom: 3.5rem;
|
||
}
|
||
|
||
.section-tag {
|
||
display: inline-block;
|
||
font-size: 0.65rem;
|
||
font-weight: 700;
|
||
color: var(--accent);
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.2em;
|
||
margin-bottom: 1rem;
|
||
}
|
||
|
||
.section-header h2 {
|
||
font-size: clamp(1.75rem, 3.5vw, 2.75rem);
|
||
font-weight: 700;
|
||
letter-spacing: -0.02em;
|
||
color: var(--fg);
|
||
}
|
||
|
||
.presets-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||
gap: 1.25rem;
|
||
}
|
||
|
||
.preset-card {
|
||
background: var(--card);
|
||
border: 1px solid var(--border);
|
||
border-radius: 12px;
|
||
padding: 1.75rem;
|
||
transition: all 0.2s;
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.preset-card::before {
|
||
content: '';
|
||
position: absolute;
|
||
top: 0; left: 0; right: 0;
|
||
height: 3px;
|
||
background: var(--preset-color);
|
||
transform: scaleX(0);
|
||
transform-origin: left;
|
||
transition: transform 0.25s;
|
||
}
|
||
|
||
.preset-card:hover::before { transform: scaleX(1); }
|
||
.preset-card:hover {
|
||
border-color: var(--preset-color);
|
||
background: var(--card-hover);
|
||
transform: translateY(-2px);
|
||
}
|
||
|
||
.preset-header {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
justify-content: space-between;
|
||
gap: 1rem;
|
||
margin-bottom: 1rem;
|
||
}
|
||
|
||
.preset-icon {
|
||
width: 40px; height: 40px;
|
||
border-radius: 8px;
|
||
background: var(--preset-color);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
opacity: 0.15;
|
||
}
|
||
|
||
.preset-meta {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-end;
|
||
gap: 0.375rem;
|
||
}
|
||
|
||
.preset-category {
|
||
font-size: 0.6rem;
|
||
font-weight: 700;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.1em;
|
||
color: var(--preset-color);
|
||
padding: 0.125rem 0.5rem;
|
||
background: var(--bg);
|
||
border: 1px solid var(--preset-color);
|
||
border-radius: 4px;
|
||
}
|
||
|
||
.preset-qualities {
|
||
display: flex;
|
||
gap: 0.375rem;
|
||
}
|
||
|
||
.quality-dot {
|
||
width: 8px; height: 8px;
|
||
border-radius: 50%;
|
||
border: 2px solid var(--border);
|
||
background: var(--bg);
|
||
transition: all 0.15s;
|
||
}
|
||
|
||
.quality-dot.low { border-color: #4ade80; background: #4ade80; box-shadow: 0 0 8px #4ade8060; }
|
||
.quality-dot.medium { border-color: #fbbf24; background: #fbbf24; box-shadow: 0 0 8px #fbbf2460; }
|
||
.quality-dot.high { border-color: #f87171; background: #f87171; box-shadow: 0 0 8px #f8717160; }
|
||
|
||
.preset-card h3 {
|
||
font-size: 1.125rem;
|
||
font-weight: 700;
|
||
margin-bottom: 0.5rem;
|
||
}
|
||
|
||
.preset-card p {
|
||
color: var(--fg-dim);
|
||
font-size: 0.875rem;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.code-block {
|
||
background: #08080a;
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
margin: 1.5rem 0;
|
||
position: relative;
|
||
}
|
||
|
||
.code-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 0.625rem 1rem;
|
||
background: #0c0c0f;
|
||
border-bottom: 1px solid var(--border);
|
||
font-size: 0.7rem;
|
||
}
|
||
|
||
.code-header .lang {
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.1em;
|
||
color: var(--muted);
|
||
}
|
||
|
||
.copy-btn {
|
||
background: transparent;
|
||
border: 1px solid var(--border);
|
||
color: var(--fg-dim);
|
||
cursor: pointer;
|
||
padding: 0.25rem 0.625rem;
|
||
border-radius: 4px;
|
||
font-size: 0.65rem;
|
||
font-weight: 500;
|
||
font-family: inherit;
|
||
transition: all 0.15s;
|
||
}
|
||
|
||
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
|
||
.copy-btn.copied { border-color: var(--accent); color: var(--accent); }
|
||
|
||
pre {
|
||
padding: 1.25rem 1.5rem;
|
||
overflow-x: auto;
|
||
font-size: 0.775rem;
|
||
line-height: 1.7;
|
||
tab-size: 2;
|
||
}
|
||
|
||
code { color: #c8c8d8; }
|
||
|
||
.token.comment { color: #5a5a6a; }
|
||
.token.keyword { color: #c792ea; }
|
||
.token.string { color: #ecc48d; }
|
||
.token.function { color: #82aaff; }
|
||
.token.number { color: #f78c6c; }
|
||
.token.operator { color: #89ddff; }
|
||
.token.punctuation { color: #89ddff; }
|
||
.token.class-name { color: #ffcb6b; }
|
||
.token.boolean { color: #f78c6c; }
|
||
.token.constant { color: #ffcb6b; }
|
||
|
||
.features-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
||
gap: 1rem;
|
||
}
|
||
|
||
.feature {
|
||
background: var(--card);
|
||
border: 1px solid var(--border);
|
||
border-radius: 10px;
|
||
padding: 1.5rem;
|
||
transition: all 0.2s;
|
||
}
|
||
|
||
.feature:hover { border-color: var(--border-bright); }
|
||
|
||
.feature-title {
|
||
font-size: 0.9375rem;
|
||
font-weight: 600;
|
||
margin-bottom: 0.5rem;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 0.5rem;
|
||
}
|
||
|
||
.feature-title::before {
|
||
content: '';
|
||
width: 8px; height: 8px;
|
||
background: var(--accent);
|
||
border-radius: 2px;
|
||
}
|
||
|
||
.feature p { color: var(--fg-dim); font-size: 0.8125rem; line-height: 1.6; }
|
||
|
||
.perf-table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
font-size: 0.8125rem;
|
||
}
|
||
|
||
.perf-table th,
|
||
.perf-table td {
|
||
padding: 0.875rem 1rem;
|
||
text-align: left;
|
||
border-bottom: 1px solid var(--border);
|
||
}
|
||
|
||
.perf-table th {
|
||
font-weight: 600;
|
||
color: var(--fg-dim);
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.05em;
|
||
font-size: 0.65rem;
|
||
background: var(--bg-deep);
|
||
}
|
||
|
||
.perf-table tr:hover td { background: var(--card-hover); }
|
||
|
||
.perf-table .preset-name { font-weight: 600; color: var(--fg); }
|
||
.perf-table .quality { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; }
|
||
.perf-table .overhead { color: var(--accent); font-family: 'JetBrains Mono', monospace; }
|
||
.perf-table .features { color: var(--fg-dim); font-size: 0.75rem; }
|
||
|
||
.perf-table .quality.low { color: #4ade80; }
|
||
.perf-table .quality.medium { color: #fbbf24; }
|
||
.perf-table .quality.high { color: #f87171; }
|
||
|
||
.install-steps {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||
gap: 1.5rem;
|
||
margin-bottom: 3rem;
|
||
}
|
||
|
||
.step {
|
||
background: var(--card);
|
||
border: 1px solid var(--border);
|
||
border-radius: 12px;
|
||
padding: 1.75rem;
|
||
position: relative;
|
||
}
|
||
|
||
.step::before {
|
||
content: attr(data-step);
|
||
position: absolute;
|
||
top: -12px; left: 1.5rem;
|
||
width: 24px; height: 24px;
|
||
background: var(--accent);
|
||
color: var(--bg);
|
||
border-radius: 50%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 0.7rem;
|
||
font-weight: 700;
|
||
font-family: 'JetBrains Mono', monospace;
|
||
}
|
||
|
||
.step h3 { font-size: 1rem; margin-bottom: 1rem; }
|
||
|
||
footer {
|
||
padding: 3rem 2rem;
|
||
text-align: center;
|
||
border-top: 1px solid var(--border);
|
||
background: var(--bg-deep);
|
||
}
|
||
|
||
.footer-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||
gap: 2rem;
|
||
max-width: 1000px;
|
||
margin: 0 auto 2rem;
|
||
text-align: left;
|
||
}
|
||
|
||
.footer-col h4 {
|
||
font-size: 0.7rem;
|
||
font-weight: 700;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.15em;
|
||
color: var(--muted);
|
||
margin-bottom: 1rem;
|
||
}
|
||
|
||
.footer-col a {
|
||
display: block;
|
||
color: var(--fg-dim);
|
||
text-decoration: none;
|
||
font-size: 0.875rem;
|
||
margin-bottom: 0.5rem;
|
||
transition: color 0.15s;
|
||
}
|
||
|
||
.footer-col a:hover { color: var(--accent); }
|
||
|
||
.footer-bottom {
|
||
padding-top: 2rem;
|
||
border-top: 1px solid var(--border);
|
||
color: var(--muted);
|
||
font-size: 0.75rem;
|
||
}
|
||
|
||
.footer-bottom a { color: var(--accent); text-decoration: none; }
|
||
.footer-bottom a:hover { text-decoration: underline; }
|
||
|
||
.reveal { opacity: 0; transform: translateY(20px); transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
|
||
.reveal.visible { opacity: 1; transform: translateY(0); }
|
||
|
||
@media (max-width: 768px) {
|
||
nav { padding: 0.875rem 1rem; }
|
||
.nav-links { display: none; }
|
||
.hero { padding: 5rem 1rem 3rem; }
|
||
section { padding: 3.5rem 1rem; }
|
||
.footer-grid { text-align: center; }
|
||
}
|
||
|
||
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<a href="#main" class="skip-link">Skip to main content</a>
|
||
<canvas id="voxel-canvas"></canvas>
|
||
|
||
<nav>
|
||
<a href="#" class="nav-brand">
|
||
<svg viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||
<rect x="2" y="2" width="24" height="24" rx="4" fill="currentColor" opacity="0.1"/>
|
||
<path d="M6 8h16M6 14h12M6 20h8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
||
</svg>
|
||
Eagler Shaders
|
||
</a>
|
||
<ul class="nav-links">
|
||
<li><a href="#presets">Presets</a></li>
|
||
<li><a href="#features">Features</a></li>
|
||
<li><a href="#performance">Performance</a></li>
|
||
<li><a href="#install">Install</a></li>
|
||
</ul>
|
||
<a href="https://github.com/NT9712/eagler-shaders" class="btn btn-ghost" target="_blank" rel="noopener">
|
||
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"/></svg>
|
||
GitHub
|
||
</a>
|
||
</nav>
|
||
|
||
<main id="main">
|
||
<section class="hero">
|
||
<div class="hero-badge">v1.0.0</div>
|
||
<div class="hero-content">
|
||
<h1>Shaders that <span class="accent-word">don't kill your FPS</span></h1>
|
||
<p>Six presets. Three quality tiers. One-line integration. Built for integrated GPUs, Chromebooks, and the laptop you've had since 2015.</p>
|
||
<div class="hero-actions">
|
||
<a href="#install" class="btn btn-primary">Get Started</a>
|
||
<a href="https://github.com/NT9712/eagler-shaders" class="btn btn-secondary" target="_blank" rel="noopener">View Source</a>
|
||
<span class="version-pill mono">Apache 2.0</span>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<div class="divider"></div>
|
||
|
||
<section id="presets">
|
||
<div class="section-header reveal">
|
||
<span class="section-tag">Presets</span>
|
||
<h2>Pick your vibe</h2>
|
||
</div>
|
||
|
||
<div class="presets-grid">
|
||
<article class="preset-card reveal" style="--preset-color: #5dab3d;">
|
||
<div class="preset-header">
|
||
<div class="preset-icon">
|
||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M12 3L4 9l8 6 8-6-8-6z"/><path d="M4 9v12l8 6 8-6V9"/></svg>
|
||
</div>
|
||
<div class="preset-meta">
|
||
<span class="preset-category">Light</span>
|
||
<div class="preset-qualities">
|
||
<span class="quality-dot low" title="LOW"></span>
|
||
<span class="quality-dot medium" title="MEDIUM"></span>
|
||
<span class="quality-dot high" title="HIGH"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<h3>Vanilla Enhanced</h3>
|
||
<p>The default. Better color balance, warmer sunlight, lightweight distance fog, improved sky. Barely any overhead.</p>
|
||
</article>
|
||
|
||
<article class="preset-card reveal" style="--preset-color: #ffb84d;">
|
||
<div class="preset-header">
|
||
<div class="preset-icon">
|
||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
|
||
</div>
|
||
<div class="preset-meta">
|
||
<span class="preset-category">Light</span>
|
||
<div class="preset-qualities">
|
||
<span class="quality-dot low" title="LOW"></span>
|
||
<span class="quality-dot medium" title="MEDIUM"></span>
|
||
<span class="quality-dot high" title="HIGH"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<h3>Bright</h3>
|
||
<p>Brighter lighting, clearer atmosphere, more vibrant colors. No bloom pipeline—just smart color grading and temperature shifts.</p>
|
||
</article>
|
||
|
||
<article class="preset-card reveal" style="--preset-color: #a78bfa;">
|
||
<div class="preset-header">
|
||
<div class="preset-icon">
|
||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M12 3a6 6 0 0 0-6 6v6a6 6 0 0 0 6 6h6a6 6 0 0 0 6-6V9a6 6 0 0 0-6-6z"/></svg>
|
||
</div>
|
||
<div class="preset-meta">
|
||
<span class="preset-category">Light</span>
|
||
<div class="preset-qualities">
|
||
<span class="quality-dot low" title="LOW"></span>
|
||
<span class="quality-dot medium" title="MEDIUM"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<h3>Soft</h3>
|
||
<p>Gentle transitions, reduced harsh lighting, lifted shadows, subtle atmosphere. Lower contrast, slight desaturation.</p>
|
||
</article>
|
||
|
||
<article class="preset-card reveal" style="--preset-color: #60a5fa;">
|
||
<div class="preset-header">
|
||
<div class="preset-icon">
|
||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
|
||
</div>
|
||
<div class="preset-meta">
|
||
<span class="preset-category">Dark</span>
|
||
<div class="preset-qualities">
|
||
<span class="quality-dot low" title="LOW"></span>
|
||
<span class="quality-dot medium" title="MEDIUM"></span>
|
||
<span class="quality-dot high" title="HIGH"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<h3>Nightfall</h3>
|
||
<p>Darker ambient, increased contrast, atmospheric fog, nighttime mood. Dynamic sky color—sunset actually looks like sunset.</p>
|
||
</article>
|
||
|
||
<article class="preset-card reveal" style="--preset-color: #f472b6;">
|
||
<div class="preset-header">
|
||
<div class="preset-icon">
|
||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="9" y1="9" x2="15" y2="15"/><line x1="15" y1="9" x2="9" y2="15"/></svg>
|
||
</div>
|
||
<div class="preset-meta">
|
||
<span class="preset-category">Dark</span>
|
||
<div class="preset-qualities">
|
||
<span class="quality-dot low" title="LOW"></span>
|
||
<span class="quality-dot medium" title="MEDIUM"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<h3>Noir</h3>
|
||
<p>High contrast, near-monochrome, crushed shadows. Strong visual identity through cheap color transforms—no expensive passes.</p>
|
||
</article>
|
||
|
||
<article class="preset-card reveal" style="--preset-color: #22d3ee;">
|
||
<div class="preset-header">
|
||
<div class="preset-icon">
|
||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M12 3a6 6 0 0 0 0 12 6 6 0 0 0 0-12z"/><path d="M12 3v18"/></svg>
|
||
</div>
|
||
<div class="preset-meta">
|
||
<span class="preset-category">Dark</span>
|
||
<div class="preset-qualities">
|
||
<span class="quality-dot low" title="LOW"></span>
|
||
<span class="quality-dot medium" title="MEDIUM"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<h3>Abyss</h3>
|
||
<p>Deep shadows, cool color grading, heavy exponential² distance fog. No volumetrics—just fog that actually works on Intel HD.</p>
|
||
</article>
|
||
</div>
|
||
</section>
|
||
|
||
<div class="divider"></div>
|
||
|
||
<section id="features">
|
||
<div class="section-header reveal">
|
||
<span class="section-tag">Features</span>
|
||
<h2>Built for the hardware you actually have</h2>
|
||
</div>
|
||
|
||
<div class="features-grid">
|
||
<article class="feature reveal">
|
||
<div class="feature-title">Aggressive LOW mode</div>
|
||
<p>Fast sRGB approximation (x*x / sqrt), no tonemapping, no vignette, no dithering, linear fog. Targets vanilla FPS on Intel UHD 620 / ancient Chromebooks.</p>
|
||
</article>
|
||
|
||
<article class="feature reveal">
|
||
<div class="feature-title">Capability detection</div>
|
||
<p>Auto-detects WebGL2, uniform limits, derivative support, draw buffers, frag depth. Gracefully degrades or disables features per-device.</p>
|
||
</article>
|
||
|
||
<article class="feature reveal">
|
||
<div class="feature-title">Safe fallbacks</div>
|
||
<p>Shader compilation failure? Missing uniform? Unsupported extension? Falls back to vanilla instantly—renderer never crashes.</p>
|
||
</article>
|
||
|
||
<article class="feature reveal">
|
||
<div class="feature-title">One-step integration</div>
|
||
<p><code class="mono">EaglercraftShaderIntegration.install(renderer)</code> — registers presets, compiles shaders, selects defaults, handles reloads, exposes clean API.</p>
|
||
</article>
|
||
|
||
<article class="feature reveal">
|
||
<div class="feature-title">Shared GLSL utilities</div>
|
||
<p>Color grading (lift/gamma/gain), fog (exp/exp²/linear), tonemapping (Reinhard/Filmic), vignette, blue-noise dithering, sky color—reused across all 15 programs.</p>
|
||
</article>
|
||
|
||
<article class="feature reveal">
|
||
<div class="feature-title">Time-aware</div>
|
||
<p>DayTime uniform drives dynamic sky colors, temperature shifts, fog density. Sunrise/sunset actually look different without a skybox.</p>
|
||
</article>
|
||
</div>
|
||
</section>
|
||
|
||
<div class="divider"></div>
|
||
|
||
<section id="performance">
|
||
<div class="section-header reveal">
|
||
<span class="section-tag">Performance</span>
|
||
<h2>Numbers that matter</h2>
|
||
</div>
|
||
|
||
<table class="perf-table reveal">
|
||
<thead>
|
||
<tr>
|
||
<th>Preset</th>
|
||
<th>Quality</th>
|
||
<th>Overhead (est.)</th>
|
||
<th>Enabled Features</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="preset-name">Vanilla Enhanced</td>
|
||
<td class="quality low">LOW</td>
|
||
<td class="overhead">~1–2%</td>
|
||
<td class="features">Fast sRGB, linear fog, no TM</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="preset-name">Vanilla Enhanced</td>
|
||
<td class="quality medium">MEDIUM</td>
|
||
<td class="overhead">~3–5%</td>
|
||
<td class="features">Filmic TM, vignette, dynamic sky, exp² fog</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="preset-name">Vanilla Enhanced</td>
|
||
<td class="quality high">HIGH</td>
|
||
<td class="overhead">~5–8%</td>
|
||
<td class="features">+Blue noise dithering, LGG color wheels</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="preset-name">Bright</td>
|
||
<td class="quality low">LOW</td>
|
||
<td class="overhead">~1–2%</td>
|
||
<td class="features">Saturation boost, warm temp, light fog</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="preset-name">Soft</td>
|
||
<td class="quality low">LOW</td>
|
||
<td class="overhead">~1–2%</td>
|
||
<td class="features">Reduced contrast, lifted shadows, gentle vignette</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="preset-name">Nightfall</td>
|
||
<td class="quality low">LOW</td>
|
||
<td class="overhead">~2–3%</td>
|
||
<td class="features">Heavy fog, strong vignette, cool temp</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="preset-name">Nightfall</td>
|
||
<td class="quality medium">MEDIUM</td>
|
||
<td class="overhead">~4–6%</td>
|
||
<td class="features">Dynamic sky bleed, moon glow (HIGH only)</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="preset-name">Noir</td>
|
||
<td class="quality low">LOW</td>
|
||
<td class="overhead">~1–2%</td>
|
||
<td class="features">Monochrome LUT, high contrast, crushed blacks</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="preset-name">Abyss</td>
|
||
<td class="quality low">LOW</td>
|
||
<td class="overhead">~2–4%</td>
|
||
<td class="features">Exp² fog, blue/green tint, deep shadow crush</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
<div class="reveal" style="margin-top: 2.5rem; padding: 1.5rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px;">
|
||
<h3 style="margin-bottom: 1rem; font-size: 0.9375rem;">What LOW mode disables</h3>
|
||
<ul style="columns: 2; list-style: none; color: var(--fg-dim); font-size: 0.8125rem; line-height: 2.2;">
|
||
<li>✗ Tonemapping (Reinhard only if forced)</li>
|
||
<li>✗ Vignette effect</li>
|
||
<li>✗ Blue noise dithering</li>
|
||
<li>✗ Dynamic sky color calculations</li>
|
||
<li>✗ Exponential² fog (uses linear)</li>
|
||
<li>✗ Time-based temperature shifts</li>
|
||
<li>✗ Full sRGB/linear conversion</li>
|
||
<li>✗ Lift/Gamma/Gain color wheels</li>
|
||
</ul>
|
||
</div>
|
||
</section>
|
||
|
||
<div class="divider"></div>
|
||
|
||
<section id="install">
|
||
<div class="section-header reveal">
|
||
<span class="section-tag">Installation</span>
|
||
<h2>Two steps. That's it.</h2>
|
||
</div>
|
||
|
||
<div class="install-steps">
|
||
<article class="step reveal" data-step="1">
|
||
<h3>Add the dependency</h3>
|
||
<div class="code-block">
|
||
<div class="code-header"><span class="lang">gradle.kts</span><button class="copy-btn" data-target="gradle">Copy</button></div>
|
||
<pre><code class="language-kotlin">repositories {
|
||
mavenCentral()
|
||
maven { url = uri("https://eaglercraft-teavm-fork.github.io/maven/") }
|
||
}
|
||
|
||
dependencies {
|
||
implementation("com.eaglercraft.shaders:eagler-shaders:1.0.0")
|
||
}</code></pre>
|
||
</div>
|
||
</article>
|
||
|
||
<article class="step reveal" data-step="2">
|
||
<h3>Initialize once</h3>
|
||
<div class="code-block">
|
||
<div class="code-header"><span class="lang">java</span><button class="copy-btn" data-target="java">Copy</button></div>
|
||
<pre><code class="language-java">import com.eaglercraft.shaders.EaglercraftShaderIntegration;
|
||
import net.minecraft.client.renderer.GameRenderer;
|
||
|
||
// Call once during client startup
|
||
EaglercraftShaderIntegration.install(gameRenderer);
|
||
|
||
// Later: switch presets, change quality, toggle
|
||
ShaderCollection.enable("nightfall");
|
||
ShaderCollection.setQuality(ShaderQuality.MEDIUM);
|
||
ShaderCollection.toggleShaders();</code></pre>
|
||
</div>
|
||
</article>
|
||
</div>
|
||
|
||
<div class="reveal">
|
||
<h3 style="margin-bottom: 1rem; font-size: 0.9375rem;">Hook into the render pipeline (optional)</h3>
|
||
<div class="code-block">
|
||
<div class="code-header"><span class="lang">java</span><button class="copy-btn" data-target="hook">Copy</button></div>
|
||
<pre><code class="language-java">// In GameRenderer.updateCameraAndRender, replace vanilla shader block:
|
||
if (GLX.usePostProcess) {
|
||
mc.worldRenderer.renderEntityOutlineFramebuffer();
|
||
// Replace vanilla shader rendering with:
|
||
EaglercraftShaderIntegration.renderShaders(partialTicks, this.useShader);
|
||
mc.getFramebuffer().bindFramebuffer(true);
|
||
}</code></pre>
|
||
</div>
|
||
</div>
|
||
|
||
<p class="reveal" style="margin-top: 2rem; color: var(--fg-dim); max-width: 700px;">
|
||
The mod also auto-initializes via <code class="mono">FMLClientSetupEvent</code> if you just drop the JAR in <code class="mono">mods/</code>. Requires Eaglercraft 26.2+ (1.16.5), Forge 36+, Java 11+.
|
||
</p>
|
||
</section>
|
||
</main>
|
||
|
||
<footer>
|
||
<div class="footer-grid">
|
||
<div class="footer-col">
|
||
<h4>Presets</h4>
|
||
<a href="#presets">Vanilla Enhanced</a>
|
||
<a href="#presets">Bright</a>
|
||
<a href="#presets">Soft</a>
|
||
<a href="#presets">Nightfall</a>
|
||
<a href="#presets">Noir</a>
|
||
<a href="#presets">Abyss</a>
|
||
</div>
|
||
<div class="footer-col">
|
||
<h4>Quality</h4>
|
||
<a href="#performance">LOW — Maximum FPS</a>
|
||
<a href="#performance">MEDIUM — Balanced</a>
|
||
<a href="#performance">HIGH — Best visuals</a>
|
||
</div>
|
||
<div class="footer-col">
|
||
<h4>Resources</h4>
|
||
<a href="https://github.com/NT9712/eagler-shaders" target="_blank" rel="noopener">GitHub Repository</a>
|
||
<a href="https://eaglercraft.com" target="_blank" rel="noopener">Eaglercraft Website</a>
|
||
<a href="https://github.com/lax1dude/eaglercraftx" target="_blank" rel="noopener">EaglercraftX Source</a>
|
||
</div>
|
||
<div class="footer-col">
|
||
<h4>Legal</h4>
|
||
<a href="LICENSE">Apache 2.0 License</a>
|
||
</div>
|
||
</div>
|
||
<div class="footer-bottom">
|
||
<p>Eaglercraft Shader Collection • Apache 2.0 • Built for <a href="https://eaglercraft.com" target="_blank" rel="noopener">Eaglercraft</a> • Not affiliated with Mojang or Microsoft</p>
|
||
</div>
|
||
</footer>
|
||
|
||
<script>
|
||
// ============================================
|
||
// INIT ALL FEATURES INDEPENDENTLY - NO DEPENDENCIES
|
||
// ============================================
|
||
|
||
// 1. COPY BUTTONS - runs immediately
|
||
(function() {
|
||
document.querySelectorAll('.copy-btn').forEach(btn => {
|
||
btn.addEventListener('click', function() {
|
||
const pre = this.closest('.code-block')?.querySelector('pre');
|
||
if (!pre) return;
|
||
const text = pre.innerText;
|
||
navigator.clipboard.writeText(text).then(() => {
|
||
const original = this.textContent;
|
||
this.textContent = 'Copied';
|
||
this.classList.add('copied');
|
||
setTimeout(() => { this.textContent = original; this.classList.remove('copied'); }, 1800);
|
||
}).catch(() => {});
|
||
});
|
||
});
|
||
})();
|
||
|
||
// 2. SCROLL REVEAL - runs independently
|
||
(function() {
|
||
const observer = new IntersectionObserver((entries) => {
|
||
entries.forEach(entry => {
|
||
if (entry.isIntersecting) {
|
||
entry.target.classList.add('visible');
|
||
}
|
||
});
|
||
}, { threshold: 0.08, rootMargin: '0px 0px -40px 0px' });
|
||
|
||
document.querySelectorAll('.reveal').forEach(el => observer.observe(el));
|
||
})();
|
||
|
||
// 3. NAV ACTIVE STATE - runs independently
|
||
(function() {
|
||
const sections = document.querySelectorAll('section[id]');
|
||
const navLinks = document.querySelectorAll('.nav-links a');
|
||
if (!sections.length || !navLinks.length) return;
|
||
|
||
window.addEventListener('scroll', () => {
|
||
let current = '';
|
||
sections.forEach(section => {
|
||
const top = section.offsetTop - 120;
|
||
if (scrollY >= top) current = section.getAttribute('id');
|
||
});
|
||
navLinks.forEach(link => {
|
||
link.classList.toggle('active', link.getAttribute('href') === '#' + current);
|
||
});
|
||
}, { passive: true });
|
||
})();
|
||
|
||
// 4. VOXEL BACKGROUND - robust Three.js loading
|
||
(function() {
|
||
const canvas = document.getElementById('voxel-canvas');
|
||
if (!canvas) return;
|
||
|
||
let threeLoaded = false;
|
||
|
||
function loadThree() {
|
||
return new Promise((resolve, reject) => {
|
||
if (window.THREE && window.OrbitControls) {
|
||
resolve({ THREE: window.THREE, OrbitControls: window.OrbitControls });
|
||
return;
|
||
}
|
||
|
||
// Method 1: Try importmap/ESM
|
||
const tryImport = () => {
|
||
import('https://esm.sh/three@0.165.0?pin=v120')
|
||
.then(THREE => {
|
||
window.THREE = THREE.default || THREE;
|
||
return import('https://esm.sh/three@0.165.0/addons/controls/OrbitControls.js?pin=v120');
|
||
})
|
||
.then(OrbitControls => {
|
||
window.OrbitControls = OrbitControls.default || OrbitControls;
|
||
resolve({ THREE: window.THREE, OrbitControls: window.OrbitControls });
|
||
})
|
||
.catch(reject);
|
||
};
|
||
|
||
// Method 2: Script tags as fallback
|
||
const tryScripts = () => {
|
||
return new Promise((resolve, reject) => {
|
||
const script1 = document.createElement('script');
|
||
script1.type = 'module';
|
||
script1.src = 'https://esm.sh/three@0.165.0?pin=v120';
|
||
const script2 = document.createElement('script');
|
||
script2.type = 'module';
|
||
script2.src = 'https://esm.sh/three@0.165.0/addons/controls/OrbitControls.js?pin=v120';
|
||
|
||
let loaded = 0;
|
||
const check = () => {
|
||
loaded++;
|
||
if (loaded === 2) {
|
||
setTimeout(() => {
|
||
if (window.THREE && window.OrbitControls) {
|
||
resolve({ THREE: window.THREE, OrbitControls: window.OrbitControls });
|
||
} else {
|
||
reject(new Error('Three.js not registered'));
|
||
}
|
||
}, 50);
|
||
}
|
||
};
|
||
script1.onload = check;
|
||
script2.onload = check;
|
||
script1.onerror = () => reject(new Error('Script load failed'));
|
||
script2.onerror = () => reject(new Error('Script load failed'));
|
||
document.head.appendChild(script1);
|
||
document.head.appendChild(script2);
|
||
});
|
||
};
|
||
|
||
// Try import first, fallback to scripts
|
||
tryImport().catch(() => tryScripts().catch(reject));
|
||
});
|
||
}
|
||
|
||
loadThree()
|
||
.then(({ THREE, OrbitControls }) => {
|
||
threeLoaded = true;
|
||
try { initVoxelBackground(THREE, OrbitControls); }
|
||
catch (e) { console.warn('Voxel init failed:', e); }
|
||
})
|
||
.catch(() => {
|
||
console.warn('Three.js unavailable, using fallback background');
|
||
});
|
||
|
||
function initVoxelBackground(THREE, OrbitControls) {
|
||
const renderer = new THREE.WebGLRenderer({
|
||
canvas,
|
||
alpha: true,
|
||
antialias: true,
|
||
powerPreference: 'high-performance',
|
||
precision: 'highp'
|
||
});
|
||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
|
||
renderer.outputEncoding = THREE.sRGBEncoding;
|
||
|
||
const scene = new THREE.Scene();
|
||
scene.fog = new THREE.FogExp2(0x050507, 0.015);
|
||
|
||
const camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.1, 150);
|
||
camera.position.set(16, 12, 16);
|
||
camera.lookAt(0, 1, 0);
|
||
|
||
const controls = new OrbitControls(camera, canvas);
|
||
controls.enableDamping = true;
|
||
controls.enablePan = false;
|
||
controls.enableZoom = false;
|
||
controls.autoRotate = true;
|
||
controls.autoRotateSpeed = 0.08;
|
||
controls.dampingFactor = 0.05;
|
||
controls.minPolarAngle = 0.45;
|
||
controls.maxPolarAngle = 1.25;
|
||
controls.minDistance = 14;
|
||
controls.maxDistance = 30;
|
||
|
||
// Block palette with proper Minecraft colors
|
||
const BLOCK_COLORS = {
|
||
grass_top: 0x5dab3d,
|
||
grass_side: 0x4a8f2f,
|
||
dirt: 0x8b6b42,
|
||
stone: 0x6d6d6d,
|
||
sand: 0xe8d8a8,
|
||
water: 0x3d8fd8,
|
||
leaves: 0x3a7d2e,
|
||
log: 0x5d4028,
|
||
bedrock: 0x141414,
|
||
};
|
||
|
||
const boxGeo = new THREE.BoxGeometry(1, 1, 1);
|
||
const meshes = [];
|
||
|
||
function createMesh(color, count) {
|
||
const mat = new THREE.MeshLambertMaterial({ color, depthWrite: true });
|
||
const mesh = new THREE.InstancedMesh(boxGeo, mat, count);
|
||
mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
|
||
mesh.frustumCulled = true;
|
||
scene.add(mesh);
|
||
meshes.push(mesh);
|
||
return mesh;
|
||
}
|
||
|
||
// Fast deterministic hash
|
||
const SEED = 0x9e3779b9;
|
||
function hash(x, z) {
|
||
let h = (x * 374761393) ^ (z * 668265263) ^ SEED;
|
||
h = (h ^ (h >>> 13)) * 0x5bd1e995;
|
||
h = (h ^ (h >>> 15)) * 0x5bd1e995;
|
||
h = h ^ (h >>> 16);
|
||
return (h >>> 0) / 4294967296;
|
||
}
|
||
|
||
function noise(x, z, freq) {
|
||
const xi = Math.floor(x * freq);
|
||
const zi = Math.floor(z * freq);
|
||
const xf = x * freq - xi;
|
||
const zf = z * freq - zi;
|
||
const v00 = hash(xi, zi);
|
||
const v10 = hash(xi + 1, zi);
|
||
const v01 = hash(xi, zi + 1);
|
||
const v11 = hash(xi + 1, zi + 1);
|
||
const u = xf * xf * (3 - 2 * xf);
|
||
const v = zf * zf * (3 - 2 * zf);
|
||
return v00 * (1 - u) * (1 - v) + v10 * u * (1 - v) + v01 * (1 - u) * v + v11 * u * v;
|
||
}
|
||
|
||
function fbm(x, z) {
|
||
return noise(x, z, 0.01) * 0.5 +
|
||
noise(x, z, 0.02) * 0.25 +
|
||
noise(x, z, 0.04) * 0.125 +
|
||
noise(x, z, 0.08) * 0.0625;
|
||
}
|
||
|
||
// Generate terrain
|
||
const CHUNK = 40;
|
||
const HALF = CHUNK >> 1;
|
||
const WATER_LEVEL = 8;
|
||
const positionsByColor = {};
|
||
|
||
for (let x = -HALF; x < HALF; x++) {
|
||
for (let z = -HALF; z < HALF; z++) {
|
||
const h = fbm(x, z);
|
||
const biome = noise(x * 0.3, z * 0.3, 0.02);
|
||
const height = Math.max(2, Math.min(26, Math.floor(h * 16) + 10));
|
||
|
||
for (let y = 0; y <= height; y++) {
|
||
const depth = height - y;
|
||
let color;
|
||
if (y === 0) color = BLOCK_COLORS.bedrock;
|
||
else if (depth === 0) color = biome > 0.4 ? BLOCK_COLORS.sand : BLOCK_COLORS.grass_top;
|
||
else if (depth < 3) color = BLOCK_COLORS.dirt;
|
||
else color = BLOCK_COLORS.stone;
|
||
|
||
if (!positionsByColor[color]) positionsByColor[color] = [];
|
||
positionsByColor[color].push(x + 0.5, y + 0.5, z + 0.5);
|
||
}
|
||
|
||
if (height < WATER_LEVEL) {
|
||
if (!positionsByColor[BLOCK_COLORS.water]) positionsByColor[BLOCK_COLORS.water] = [];
|
||
for (let y = height + 1; y <= WATER_LEVEL; y++) {
|
||
positionsByColor[BLOCK_COLORS.water].push(x + 0.5, y + 0.5, z + 0.5);
|
||
}
|
||
}
|
||
|
||
// Trees
|
||
if (height > 8 && biome < 0.25 && Math.random() < 0.006) {
|
||
const treeH = 4 + (hash(x + 100, z + 100) * 3) | 0;
|
||
if (!positionsByColor[BLOCK_COLORS.log]) positionsByColor[BLOCK_COLORS.log] = [];
|
||
for (let ty = 1; ty <= treeH; ty++) {
|
||
positionsByColor[BLOCK_COLORS.log].push(x + 0.5, height + ty + 0.5, z + 0.5);
|
||
}
|
||
if (!positionsByColor[BLOCK_COLORS.leaves]) positionsByColor[BLOCK_COLORS.leaves] = [];
|
||
for (let lx = -2; lx <= 2; lx++) {
|
||
for (let lz = -2; lz <= 2; lz++) {
|
||
if (Math.abs(lx) + Math.abs(lz) <= 2) {
|
||
for (let ly = treeH - 1; ly <= treeH + 1; ly++) {
|
||
positionsByColor[BLOCK_COLORS.leaves].push(x + lx + 0.5, height + ly + 0.5, z + lz + 0.5);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// Create instanced meshes
|
||
const dummy = new THREE.Object3D();
|
||
Object.entries(positionsByColor).forEach(([colorStr, positions]) => {
|
||
const count = positions.length / 3;
|
||
const mesh = createMesh(parseInt(colorStr), count);
|
||
for (let i = 0; i < count; i++) {
|
||
dummy.position.set(positions[i * 3], positions[i * 3 + 1], positions[i * 3 + 2]);
|
||
dummy.updateMatrix();
|
||
mesh.setMatrixAt(i, dummy.matrix);
|
||
}
|
||
mesh.instanceMatrix.needsUpdate = true;
|
||
});
|
||
|
||
function createMesh(color, count) {
|
||
const mat = new THREE.MeshLambertMaterial({ color, depthWrite: true });
|
||
const mesh = new THREE.InstancedMesh(boxGeo, mat, count);
|
||
mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
|
||
mesh.frustumCulled = true;
|
||
scene.add(mesh);
|
||
meshes.push(mesh);
|
||
return mesh;
|
||
}
|
||
|
||
// Lighting
|
||
const sun = new THREE.DirectionalLight(0xffffee, 1.1);
|
||
sun.position.set(40, 60, 25);
|
||
scene.add(sun);
|
||
|
||
const fill = new THREE.DirectionalLight(0x4da3ff, 0.35);
|
||
fill.position.set(-25, 15, -25);
|
||
scene.add(fill);
|
||
|
||
const ambient = new THREE.AmbientLight(0x333344, 0.7);
|
||
scene.add(ambient);
|
||
|
||
// Stars
|
||
const starGeo = new THREE.BufferGeometry();
|
||
const STAR_COUNT = 300;
|
||
const starPos = new Float32Array(STAR_COUNT * 3);
|
||
for (let i = 0; i < STAR_COUNT; i++) {
|
||
const r = 70 + Math.random() * 30;
|
||
const theta = Math.random() * Math.PI * 2;
|
||
const phi = Math.acos(2 * Math.random() - 1);
|
||
starPos[i * 3] = r * Math.sin(phi) * Math.cos(theta);
|
||
starPos[i * 3 + 1] = r * Math.sin(phi) * Math.sin(theta) + 35;
|
||
starPos[i * 3 + 2] = r * Math.cos(phi);
|
||
}
|
||
starGeo.setAttribute('position', new THREE.BufferAttribute(starPos, 3));
|
||
const starMat = new THREE.PointsMaterial({ color: 0xffffff, size: 0.6, transparent: true, opacity: 0.35, sizeAttenuation: true });
|
||
const stars = new THREE.Points(starGeo, starMat);
|
||
scene.add(stars);
|
||
|
||
// Animation
|
||
let time = 0;
|
||
function animate() {
|
||
requestAnimationFrame(animate);
|
||
time += 0.0005;
|
||
|
||
const day = Math.sin(time * 0.2);
|
||
const t = (day + 1) * 0.5;
|
||
|
||
sun.intensity = THREE.MathUtils.lerp(0.15, 1.2, t);
|
||
sun.position.y = THREE.MathUtils.lerp(-15, 70, t);
|
||
sun.color.setHSL(0.1, 0.25, THREE.MathUtils.lerp(0.35, 0.95, t));
|
||
|
||
fill.intensity = THREE.MathUtils.lerp(0.1, 0.4, t);
|
||
ambient.intensity = THREE.MathUtils.lerp(0.25, 0.7, t);
|
||
|
||
const fogC = new THREE.Color();
|
||
fogC.setHSL(0.58, 0.12, THREE.MathUtils.lerp(0.03, 0.15, t));
|
||
scene.fog.color = fogC;
|
||
|
||
stars.rotation.y += 0.000015;
|
||
|
||
controls.update();
|
||
renderer.render(scene, camera);
|
||
}
|
||
animate();
|
||
|
||
window.addEventListener('resize', () => {
|
||
camera.aspect = window.innerWidth / window.innerHeight;
|
||
camera.updateProjectionMatrix();
|
||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||
});
|
||
}
|
||
})();
|
||
</script>
|
||
</body>
|
||
</html> |