Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/boards processing #31

Merged
merged 9 commits into from
Jan 16, 2025
1 change: 1 addition & 0 deletions src/config/WorldEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class WorldEnv {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
dataEncoder: (blockType: BlockType, _blockMode?: BlockMode) =>
blockType || BlockType.NONE,
dataDecoder: (rawData: number) => rawData || BlockType.NONE,
}

schematics: {
Expand Down
8 changes: 8 additions & 0 deletions src/datacontainers/ChunkContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,22 @@ export class ChunkContainer {
axisOrder: ChunkAxisOrder
// local data encoder (defaulting to global)
dataEncoder: (blockType: BlockType, _blockMode?: BlockMode) => number
dataDecoder: (rawVal: number) => number

// global version
static get dataEncoder() {
return WorldEnv.current.chunks.dataEncoder
}

static get dataDecoder() {
return WorldEnv.current.chunks.dataDecoder
}

constructor(
boundsOrChunkKey: Box3 | ChunkKey = new Box3(),
margin = 0,
customDataEncoder = ChunkContainer.dataEncoder,
customDataDecoder = ChunkContainer.dataDecoder,
axisOrder = ChunkAxisOrder.ZXY,
) {
//, bitLength = BitLength.Uint16) {
Expand All @@ -76,6 +83,7 @@ export class ChunkContainer {
this.id = chunkId
}
this.dataEncoder = customDataEncoder
this.dataDecoder = customDataDecoder
this.adjustChunkBounds(bounds)
// this.rawData = getArrayConstructor(bitLength)
}
Expand Down
67 changes: 0 additions & 67 deletions src/datacontainers/ChunksIndexer.ts

This file was deleted.

Loading
Loading