mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 19:28:49 -04:00
Don't access the internals of the ChannelChunk.
This makes it easier to swap the implementation for future compression attempts.
This commit is contained in:
parent
d4f9270fa9
commit
69920c343d
@ -240,14 +240,13 @@ const PrimitiveMesh = struct {
|
|||||||
const x = (wx >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
|
const x = (wx >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
|
||||||
const y = (wy >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
|
const y = (wy >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
|
||||||
const z = (wz >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
|
const z = (wz >> mesh.chunk.voxelSizeShift) & chunk.chunkMask;
|
||||||
const index = chunk.getIndex(x, y, z);
|
|
||||||
return .{
|
return .{
|
||||||
mesh.lightingData[0].data[index].load(.Unordered),
|
mesh.lightingData[0].getValue(x, y, z),
|
||||||
mesh.lightingData[1].data[index].load(.Unordered),
|
mesh.lightingData[1].getValue(x, y, z),
|
||||||
mesh.lightingData[2].data[index].load(.Unordered),
|
mesh.lightingData[2].getValue(x, y, z),
|
||||||
mesh.lightingData[3].data[index].load(.Unordered),
|
mesh.lightingData[3].getValue(x, y, z),
|
||||||
mesh.lightingData[4].data[index].load(.Unordered),
|
mesh.lightingData[4].getValue(x, y, z),
|
||||||
mesh.lightingData[5].data[index].load(.Unordered),
|
mesh.lightingData[5].getValue(x, y, z),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +84,11 @@ pub const ChannelChunk = struct {
|
|||||||
entries: main.ListUnmanaged(PositionEntry),
|
entries: main.ListUnmanaged(PositionEntry),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub fn getValue(self: *const ChannelChunk, x: i32, y: i32, z: i32) u8 {
|
||||||
|
const index = chunk.getIndex(x, y, z);
|
||||||
|
return self.data[index].load(.Unordered);
|
||||||
|
}
|
||||||
|
|
||||||
fn propagateDirect(self: *ChannelChunk, lightQueue: *main.utils.CircularBufferQueue(Entry)) void {
|
fn propagateDirect(self: *ChannelChunk, lightQueue: *main.utils.CircularBufferQueue(Entry)) void {
|
||||||
var neighborLists: [6]main.ListUnmanaged(Entry) = .{.{}} ** 6;
|
var neighborLists: [6]main.ListUnmanaged(Entry) = .{.{}} ** 6;
|
||||||
defer {
|
defer {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user