Files
shacraft-core/client/terrain-mesh-worker.js
Emil c7e86663d8
MVP checks / mvp (push) Canceled after 0s
Expand voxel gameplay, lighting, full-height streaming and world imports
Add shared Rust/WASM physics, worker meshing and diagnostics, 64-chunk full-height streaming, atlas texture support, and baseline world import. Document the current implementation and include the supplied in-game lobby screenshot.
2026-09-17 02:10:53 +03:00

14 lines
715 B
JavaScript

import { TerrainState } from './terrain-state.js';
import { loadLightProperties } from './light-properties.js';
// Geometry never queues behind a whole-view lighting build.
const state = loadLightProperties().then(properties => new TerrainState(properties));
self.onmessage = ({data}) => state.then(terrain => {
if (data.type === 'sync') {
if (terrain.sync(data)) self.postMessage({type:'synced',epoch:data.epoch,version:data.version});
} else if (data.type === 'mesh') {
const result = terrain.meshLocal(data);
self.postMessage(result, result.vertices ? [result.vertices.buffer,result.transparent.buffer] : []);
}
}).catch(error => self.postMessage({...data,type:'error',error:error.message}));