Claude Opus 5.5max
index.html
<!doctype html>
<html lang="ja">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>土谷大地</title>
<style>
:root { color-scheme: dark; }
html, body { height: 100%; margin: 0; background: #0d0f12; color: #cfc8b8; font: 13px/1.6 "Noto Serif CJK JP", "Hiragino Mincho ProN", serif; }
body { display: flex; flex-direction: column; }
#stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 18px 18px 6px; }
#stage.zoom { display: block; padding: 0; cursor: zoom-out; }
canvas { max-width: 100%; max-height: 100%; cursor: zoom-in; box-shadow: 0 10px 50px #000a; background: #15181d; }
#stage.zoom canvas { max-width: none; max-height: none; cursor: zoom-out; box-shadow: none; }
footer { display: flex; gap: 14px; align-items: center; justify-content: center; padding: 6px 16px 12px; letter-spacing: .08em; }
#status { opacity: .7; min-width: 16em; }
button { font: inherit; color: inherit; background: none; border: 1px solid #cfc8b855; border-radius: 3px; padding: 2px 12px; cursor: pointer; letter-spacing: .1em; }
button:hover { background: #cfc8b81a; }
button:disabled { opacity: .35; cursor: default; }
</style>
<div id="stage"><canvas id="c"></canvas></div>
<footer><span>土谷大地 — 夜明けの棚田</span><span id="status">準備中…</span><button id="save" disabled>PNG で保存</button></footer>
<script src="daichi.js"></script>
<script>
// index.html?scale=0.5&ss=2&seed=1012 — scale: 描く大きさ(1 で 3840×2400)、ss: 画素あたりの標本数の平方根
(async () => {
const q = new URLSearchParams(location.search);
const scale = +(q.get('scale') || 1), ss = +(q.get('ss') || 2), opt = q.get('seed') ? { seed: +q.get('seed') } : {};
const core = daichiCore(opt), { W, H } = core.setup(scale, ss);
const cv = document.getElementById('c'), ctx = cv.getContext('2d'), status = document.getElementById('status');
const stage = document.getElementById('stage');
cv.width = W; cv.height = H;
cv.onclick = (e) => {
const fx = e.offsetX / cv.clientWidth, fy = e.offsetY / cv.clientHeight;
stage.classList.toggle('zoom');
if (stage.classList.contains('zoom')) { stage.scrollLeft = fx * W - stage.clientWidth / 2; stage.scrollTop = fy * H - stage.clientHeight / 2; }
};
const tick = () => new Promise((r) => requestAnimationFrame(() => setTimeout(r, 0)));
const hdr = new Float32Array(W * H * 3), depth = new Float32Array(W * H), mat = new Uint8Array(W * H);
const img = ctx.createImageData(W, H), rgba = img.data;
const t0 = performance.now();
status.textContent = '朝日の影を計算中…';
await tick();
const shadow = core.buildShadow();
// 地形:列の束をワーカーへ配り、戻った順に下絵として見せる
const CH = 4, chunks = [];
for (let x = 0; x < W; x += CH) chunks.push(x);
// 粗い間隔から埋まるように並べ替える
const nb = Math.ceil(Math.log2(chunks.length));
const order = chunks.map((x, i) => { let r = 0; for (let b = 0; b < nb; b++) r |= ((i >> b) & 1) << (nb - 1 - b); return [r, x]; }).sort((a, b) => a[0] - b[0]).map((v) => v[1]);
let done = 0;
const place = (m) => {
const nc = m.to - m.from;
for (let y = 0; y < H; y++) {
hdr.set(m.rgb.subarray(y * nc * 3, (y + 1) * nc * 3), (y * W + m.from) * 3);
depth.set(m.depth.subarray(y * nc, (y + 1) * nc), y * W + m.from);
mat.set(m.mat.subarray(y * nc, (y + 1) * nc), y * W + m.from);
}
core.develop(hdr, W, H, rgba, m.from, m.to);
ctx.putImageData(img, 0, 0, m.from, 0, nc, H);
done += nc;
status.textContent = '土の谷と大地を描いています… ' + Math.round(done / W * 100) + '%';
};
const src = `'use strict';\nconst daichiCore = ${daichiCore.toString()};\n(${daichiWorkerMain.toString()})(daichiCore, self);`;
const url = URL.createObjectURL(new Blob([src], { type: 'text/javascript' }));
const n = Math.max(1, Math.min(16, (navigator.hardwareConcurrency || 4) - 1));
await new Promise((resolve) => {
let next = 0, alive = n;
const give = (w) => {
if (next >= order.length) { w.terminate(); if (--alive === 0) resolve(); return; }
const from = order[next++];
w.postMessage({ type: 'cols', from, to: Math.min(W, from + CH) });
};
for (let i = 0; i < n; i++) {
const w = new Worker(url);
w.onmessage = (e) => { if (e.data.type === 'done') place(e.data); give(w); };
w.postMessage({ type: 'init', opt, scale, ss, shadow });
}
});
status.textContent = '草木と鳥、桜の枝を描いています…';
await tick();
core.paintDetails(hdr, depth, mat);
core.develop(hdr, W, H, rgba);
ctx.putImageData(img, 0, 0);
status.textContent = '光をにじませて現像しています…';
await tick();
core.develop(core.bloom(hdr, W, H), W, H, rgba);
core.paintTitle(rgba);
ctx.putImageData(img, 0, 0);
status.textContent = W + '×' + H + '・' + ((performance.now() - t0) / 1000).toFixed(1) + ' 秒';
document.title = '土谷大地';
const save = document.getElementById('save');
save.disabled = false;
save.onclick = () => cv.toBlob((b) => { const a = document.createElement('a'); a.href = URL.createObjectURL(b); a.download = '土谷大地.png'; a.click(); });
window.__done = true;
})();
</script>
</html>