Class: ChunkSharedPool
Methods
ensureChunk
▸ ensureChunk(chunk): boolean
Puts a chunk's voxels and lights on the shared buffer, so a worker reads them where they are instead of being sent a copy. True when the chunk's arrays are views of the pool afterwards.
A chunk that already holds a slot is checked, not trusted: the server
sending it again (Chunk.setData) swaps in plain arrays, and its slot
then holds what it had before. Answering "already shared" for that chunk
left every dispatch after it copying the whole column on the main
thread (nine columns a mesh job) for the rest of the session, with
nothing to say so. Its new data is moved into the slot it has.
Parameters
| Name | Type |
|---|---|
chunk | RawChunk |
Returns
boolean
getInstance
▸ getInstance(): ChunkSharedPool
Returns
getStats
▸ getStats(): ChunkSharedPoolStats
Returns
hasSlot
▸ hasSlot(key): boolean
Parameters
| Name | Type |
|---|---|
key | string |
Returns
boolean
isSharedArrayBufferAvailable
▸ isSharedArrayBufferAvailable(): boolean
Returns
boolean
releaseChunk
▸ releaseChunk(key): void
Parameters
| Name | Type |
|---|---|
key | string |
Returns
void
resetForTests
▸ resetForTests(): void
Returns
void