MVP checks / mvp (push) Canceled after 0s
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.
14 lines
715 B
JavaScript
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}));
|