From 5e066fa7cd1480c93e9990faf108751f1e434ab0 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Mon, 6 Jan 2020 00:46:58 +0000 Subject: [PATCH] Fix compilation --- meshers/blocky/voxel_mesher_blocky.cpp | 6 +++--- streams/voxel_block_serializer.cpp | 2 +- voxel_buffer.cpp | 2 +- voxel_buffer.h | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/meshers/blocky/voxel_mesher_blocky.cpp b/meshers/blocky/voxel_mesher_blocky.cpp index f2b1e4c7..08664a94 100644 --- a/meshers/blocky/voxel_mesher_blocky.cpp +++ b/meshers/blocky/voxel_mesher_blocky.cpp @@ -106,9 +106,9 @@ void VoxelMesherBlocky::build(VoxelMesher::Output &output, const VoxelMesher::In // That means we can use raw pointers to voxel data inside instead of using the higher-level getters, // and then save a lot of time. - ERR_FAIL_COND(buffer.get_channel_depth(channel) != VoxelBuffer::DEPTH_8_BIT); - ERR_FAIL_COND(buffer.get_channel_compression(channel) != VoxelBuffer::COMPRESSION_NONE); - const uint8_t *type_buffer = buffer.get_channel_raw(channel); + ERR_FAIL_COND(voxels.get_channel_depth(channel) != VoxelBuffer::DEPTH_8_BIT); + ERR_FAIL_COND(voxels.get_channel_compression(channel) != VoxelBuffer::COMPRESSION_NONE); + const uint8_t *type_buffer = voxels.get_channel_raw(channel); /* _ // | \ // /\ \\ diff --git a/streams/voxel_block_serializer.cpp b/streams/voxel_block_serializer.cpp index 2fee42a6..140a58a1 100644 --- a/streams/voxel_block_serializer.cpp +++ b/streams/voxel_block_serializer.cpp @@ -64,7 +64,7 @@ const std::vector &VoxelBlockSerializer::serialize(VoxelBuffer &voxel_b int v = voxel_buffer.get_voxel(Vector3i(), channel_index); f->store_8((uint8_t)v); // TODO Support for larger depths - if (VoxelBuffer::get_depth_bit_count(voxel_buffer.get_channel_depth(channel_index) > 8)) { + if (VoxelBuffer::get_depth_bit_count(voxel_buffer.get_channel_depth(channel_index)) > 8) { ERR_PRINT("Uniform compression serialization doesn't support more than 8 bit depth"); } } break; diff --git a/voxel_buffer.cpp b/voxel_buffer.cpp index 733d9ff3..47705693 100644 --- a/voxel_buffer.cpp +++ b/voxel_buffer.cpp @@ -785,7 +785,7 @@ VoxelBuffer::Depth VoxelBuffer::get_channel_depth(unsigned int channel_index) co return _channels[channel_index].depth; } -uint32_t VoxelBuffer::get_depth_bit_count(Depth d) const { +uint32_t VoxelBuffer::get_depth_bit_count(Depth d) { return ::get_depth_bit_count(d); } diff --git a/voxel_buffer.h b/voxel_buffer.h index f4b8b8e0..a0477693 100644 --- a/voxel_buffer.h +++ b/voxel_buffer.h @@ -106,6 +106,7 @@ public: return _size.x * _size.y * _size.z; } + // TODO Return an ArraySlice uint8_t *get_channel_raw(unsigned int channel_index, uint32_t *out_size_in_bytes = nullptr) const; void downscale_to(VoxelBuffer &dst, Vector3i src_min, Vector3i src_max, Vector3i dst_min) const; @@ -115,7 +116,7 @@ public: void set_channel_depth(unsigned int channel_index, Depth new_depth); Depth get_channel_depth(unsigned int channel_index) const; - static uint32_t get_depth_bit_count(Depth d) const; + static uint32_t get_depth_bit_count(Depth d); // TODO Make this work, would be awesome for perf //