diff --git a/library/voxelman_library.cpp b/library/voxelman_library.cpp index 45f21c9..2dda85c 100644 --- a/library/voxelman_library.cpp +++ b/library/voxelman_library.cpp @@ -60,11 +60,11 @@ void VoxelmanLibrary::clear_materials() { Vector VoxelmanLibrary::get_materials() { Vector r; for (int i = 0; i < _materials.size(); i++) { - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 r.push_back(_materials[i].get_ref_ptr()); - #else +#else r.push_back(_materials[i]); - #endif +#endif } return r; } @@ -113,11 +113,11 @@ void VoxelmanLibrary::clear_liquid_materials() { Vector VoxelmanLibrary::get_liquid_materials() { Vector r; for (int i = 0; i < _liquid_materials.size(); i++) { - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 r.push_back(_liquid_materials[i].get_ref_ptr()); - #else +#else r.push_back(_liquid_materials[i]); - #endif +#endif } return r; } diff --git a/library/voxelman_library_merger.cpp b/library/voxelman_library_merger.cpp index 2f4ccf5..9cd3c7d 100644 --- a/library/voxelman_library_merger.cpp +++ b/library/voxelman_library_merger.cpp @@ -135,11 +135,11 @@ void VoxelmanLibraryMerger::clear_surfaces() { Vector VoxelmanLibraryMerger::get_voxel_surfaces() { Vector r; for (int i = 0; i < _voxel_surfaces.size(); i++) { - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 r.push_back(_voxel_surfaces[i].get_ref_ptr()); - #else +#else r.push_back(_voxel_surfaces[i]); - #endif +#endif } return r; } @@ -217,11 +217,11 @@ void VoxelmanLibraryMerger::clear_liquid_surfaces() { Vector VoxelmanLibraryMerger::get_liquid_voxel_surfaces() { Vector r; for (int i = 0; i < _liquid_surfaces.size(); i++) { - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 r.push_back(_liquid_surfaces[i].get_ref_ptr()); - #else +#else r.push_back(_liquid_surfaces[i]); - #endif +#endif } return r; } @@ -387,11 +387,11 @@ void VoxelmanLibraryMerger::_setup_material_albedo(int material_index, Refset_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); - #else - //nyi - #endif +#else +//nyi +#endif _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); diff --git a/library/voxelman_library_simple.cpp b/library/voxelman_library_simple.cpp index ad89829..2c9d2c4 100644 --- a/library/voxelman_library_simple.cpp +++ b/library/voxelman_library_simple.cpp @@ -91,11 +91,11 @@ void VoxelmanLibrarySimple::clear_surfaces() { Vector VoxelmanLibrarySimple::get_voxel_surfaces() { Vector r; for (int i = 0; i < _voxel_surfaces.size(); i++) { - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 r.push_back(_voxel_surfaces[i].get_ref_ptr()); - #else +#else r.push_back(_voxel_surfaces[i]); - #endif +#endif } return r; } @@ -164,11 +164,11 @@ void VoxelmanLibrarySimple::clear_liquid_surfaces() { Vector VoxelmanLibrarySimple::get_liquid_voxel_surfaces() { Vector r; for (int i = 0; i < _liquid_surfaces.size(); i++) { - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 r.push_back(_liquid_surfaces[i].get_ref_ptr()); - #else +#else r.push_back(_liquid_surfaces[i]); - #endif +#endif } return r; } diff --git a/meshers/cubic_mesher/voxel_mesher_cubic.cpp b/meshers/cubic_mesher/voxel_mesher_cubic.cpp index 9782ae5..3b2b0db 100644 --- a/meshers/cubic_mesher/voxel_mesher_cubic.cpp +++ b/meshers/cubic_mesher/voxel_mesher_cubic.cpp @@ -33,7 +33,6 @@ typedef class RenderingServer VisualServer; typedef class RenderingServer VS; #endif - void VoxelMesherCubic::_add_chunk(Ref p_chunk) { Ref chunk = p_chunk; diff --git a/meshers/voxel_mesher.cpp b/meshers/voxel_mesher.cpp index 5f52418..ec44a61 100644 --- a/meshers/voxel_mesher.cpp +++ b/meshers/voxel_mesher.cpp @@ -167,17 +167,17 @@ Array VoxelMesher::build_mesh() { { PoolVector array; array.resize(_vertices.size()); - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 PoolVector::Write w = array.write(); - #endif +#endif for (int i = 0; i < _vertices.size(); ++i) { array.set(i, _vertices[i].vertex); } - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 w.release(); - #endif +#endif a[VisualServer::ARRAY_VERTEX] = array; } @@ -189,51 +189,51 @@ Array VoxelMesher::build_mesh() { { PoolVector array; array.resize(_vertices.size()); - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 PoolVector::Write w = array.write(); - #endif +#endif for (int i = 0; i < _vertices.size(); ++i) { array.set(i, _vertices[i].normal); } - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 w.release(); - #endif +#endif a[VisualServer::ARRAY_NORMAL] = array; } if ((_format & VisualServer::ARRAY_FORMAT_COLOR) != 0) { PoolVector array; array.resize(_vertices.size()); - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 PoolVector::Write w = array.write(); - #endif +#endif for (int i = 0; i < _vertices.size(); ++i) { array.set(i, _vertices[i].color); } - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 w.release(); - #endif +#endif a[VisualServer::ARRAY_COLOR] = array; } if ((_format & VisualServer::ARRAY_FORMAT_TEX_UV) != 0) { PoolVector array; array.resize(_vertices.size()); - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 PoolVector::Write w = array.write(); - #endif +#endif for (int i = 0; i < _vertices.size(); ++i) { array.set(i, _vertices[i].uv); } - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 w.release(); - #endif +#endif a[VisualServer::ARRAY_TEX_UV] = array; } @@ -241,34 +241,34 @@ Array VoxelMesher::build_mesh() { if ((_format & VisualServer::ARRAY_FORMAT_TEX_UV2) != 0) { PoolVector array; array.resize(_vertices.size()); - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 PoolVector::Write w = array.write(); - #endif +#endif for (int i = 0; i < _vertices.size(); ++i) { array.set(i, _vertices[i].uv2); } - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 w.release(); - #endif +#endif a[VisualServer::ARRAY_TEX_UV2] = array; } if (_indices.size() > 0) { PoolVector array; array.resize(_indices.size()); - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 PoolVector::Write w = array.write(); - #endif +#endif for (int i = 0; i < _indices.size(); ++i) { array.set(i, _indices[i]); } - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 w.release(); - #endif +#endif a[VisualServer::ARRAY_INDEX] = array; } diff --git a/world/default/voxel_chunk_default.h b/world/default/voxel_chunk_default.h index 10913c0..685bfce 100644 --- a/world/default/voxel_chunk_default.h +++ b/world/default/voxel_chunk_default.h @@ -35,7 +35,6 @@ SOFTWARE. typedef class ImmediateGeometry3D ImmediateGeometry; #endif - #include "core/engine.h" #include "core/os/mutex.h" #include "core/os/thread.h" diff --git a/world/voxel_chunk.cpp b/world/voxel_chunk.cpp index cb3a068..3937667 100644 --- a/world/voxel_chunk.cpp +++ b/world/voxel_chunk.cpp @@ -445,15 +445,15 @@ PoolByteArray VoxelChunk::get_channel_compressed(int channel_index) const { int bound = LZ4_compressBound(size); arr.resize(bound); - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 PoolByteArray::Write w = arr.write(); int ns = LZ4_compress_default(reinterpret_cast(ch), reinterpret_cast(w.ptr()), size, bound); - + w.release(); - #else +#else int ns = LZ4_compress_default(reinterpret_cast(ch), reinterpret_cast(arr.ptrw()), size, bound); - #endif +#endif arr.resize(ns); return arr; @@ -479,19 +479,19 @@ void VoxelChunk::set_channel_compressed(int channel_index, const PoolByteArray & int ds = data.size(); - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 PoolByteArray::Read r = data.read(); //We are not going to write to it uint8_t *data_arr = const_cast(r.ptr()); LZ4_decompress_safe(reinterpret_cast(data_arr), reinterpret_cast(ch), ds, size); - #else +#else //We are not going to write to it uint8_t *data_arr = const_cast(data.ptr()); LZ4_decompress_safe(reinterpret_cast(data_arr), reinterpret_cast(ch), ds, size); - #endif +#endif } _FORCE_INLINE_ int VoxelChunk::get_index(const int x, const int y, const int z) const { @@ -588,9 +588,9 @@ Array VoxelChunk::bake_mesh_array_uv(Array arr, Ref tex, float mul_colo PoolVector2Array uvs = arr[VisualServer::ARRAY_TEX_UV]; PoolColorArray colors = arr[VisualServer::ARRAY_COLOR]; - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 img->lock(); - #endif +#endif for (int i = 0; i < uvs.size(); ++i) { Vector2 uv = uvs[i]; @@ -601,9 +601,9 @@ Array VoxelChunk::bake_mesh_array_uv(Array arr, Ref tex, float mul_colo colors.set(i, colors[i] * c * mul_color); } - #if VERSION_MAJOR < 4 +#if VERSION_MAJOR < 4 img->unlock(); - #endif +#endif arr[VisualServer::ARRAY_COLOR] = colors; diff --git a/world/voxel_chunk.h b/world/voxel_chunk.h index 5e9c07e..684ee6b 100644 --- a/world/voxel_chunk.h +++ b/world/voxel_chunk.h @@ -63,7 +63,6 @@ SOFTWARE. class VoxelWorld; - class VoxelChunk : public Resource { GDCLASS(VoxelChunk, Resource);