From 089f70ccbacf1a68633ec09fd0399427dc2f5697 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 9 Jan 2023 20:03:16 +0100 Subject: [PATCH] Work on fixing compile. --- library/voxel_library_merger.cpp | 12 +++--------- library/voxel_library_merger.h | 2 +- library/voxel_library_merger_pcm.cpp | 12 +++--------- library/voxel_library_merger_pcm.h | 2 +- library/voxel_material_cache_pcm.cpp | 7 ++----- meshers/voxel_mesher.cpp | 2 +- world/default/voxel_chunk_default.cpp | 28 +++++++++++++-------------- 7 files changed, 25 insertions(+), 40 deletions(-) diff --git a/library/voxel_library_merger.cpp b/library/voxel_library_merger.cpp index 9b97981..fbd3d79 100644 --- a/library/voxel_library_merger.cpp +++ b/library/voxel_library_merger.cpp @@ -208,7 +208,7 @@ Rect2 VoxelLibraryMerger::get_prop_uv_rect(const Ref &texture) { } #if VERSION_MAJOR < 4 - Ref image = tex->get_data(); + Ref image = tex->get_image(); #else Ref image = tex->get_image(); #endif @@ -371,11 +371,8 @@ void VoxelLibraryMerger::_setup_material_albedo(const int material_index, const VoxelLibraryMerger::VoxelLibraryMerger() { _packer.INSTANCE(); -#if GODOT4 #warning implement -#else - _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif + //_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); @@ -383,11 +380,8 @@ VoxelLibraryMerger::VoxelLibraryMerger() { _prop_packer.INSTANCE(); -#if GODOT4 #warning implement -#else - _prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif + //_prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); _prop_packer->set_max_atlas_size(1024); _prop_packer->set_keep_original_atlases(false); diff --git a/library/voxel_library_merger.h b/library/voxel_library_merger.h index a75c77b..a62e58a 100644 --- a/library/voxel_library_merger.h +++ b/library/voxel_library_merger.h @@ -27,7 +27,7 @@ SOFTWARE. #if VERSION_MAJOR > 3 #include "core/io/resource.h" -#include "core/templates/map.h" +#include "core/templates/hash_map.h" #else #include "core/resource.h" #include "core/map.h" diff --git a/library/voxel_library_merger_pcm.cpp b/library/voxel_library_merger_pcm.cpp index aff7bff..39900b1 100644 --- a/library/voxel_library_merger_pcm.cpp +++ b/library/voxel_library_merger_pcm.cpp @@ -550,7 +550,7 @@ Rect2 VoxelLibraryMergerPCM::get_prop_uv_rect(const Ref &texture) { return Rect2(0, 0, 1, 1); } - Ref image = tex->get_data(); + Ref image = tex->get_image(); if (!image.is_valid()) { return Rect2(0, 0, 1, 1); @@ -710,11 +710,8 @@ void VoxelLibraryMergerPCM::_setup_material_albedo(const int material_index, con VoxelLibraryMergerPCM::VoxelLibraryMergerPCM() { _packer.instantiate(); -#if GODOT4 #warning implement -#else - _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif + //_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); @@ -722,11 +719,8 @@ VoxelLibraryMergerPCM::VoxelLibraryMergerPCM() { _prop_packer.instantiate(); -#if GODOT4 #warning implement -#else - _prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif + //_prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); _prop_packer->set_max_atlas_size(1024); _prop_packer->set_keep_original_atlases(false); diff --git a/library/voxel_library_merger_pcm.h b/library/voxel_library_merger_pcm.h index 818c87d..748a028 100644 --- a/library/voxel_library_merger_pcm.h +++ b/library/voxel_library_merger_pcm.h @@ -27,7 +27,7 @@ SOFTWARE. #if VERSION_MAJOR > 3 #include "core/io/resource.h" -#include "core/templates/map.h" +#include "core/templates/hash_map.h" #else #include "core/resource.h" #include "core/map.h" diff --git a/library/voxel_material_cache_pcm.cpp b/library/voxel_material_cache_pcm.cpp index 591ccb4..45ad7cb 100644 --- a/library/voxel_material_cache_pcm.cpp +++ b/library/voxel_material_cache_pcm.cpp @@ -88,7 +88,7 @@ Rect2 VoxelMaterialCachePCM::additional_texture_get_uv_rect(const Ref & return Rect2(0, 0, 1, 1); } - Ref image = tex->get_data(); + Ref image = tex->get_image(); if (!image.is_valid()) { return Rect2(0, 0, 1, 1); @@ -181,11 +181,8 @@ void VoxelMaterialCachePCM::_setup_material_albedo(Ref texture) { VoxelMaterialCachePCM::VoxelMaterialCachePCM() { _packer.instantiate(); -#if GODOT4 #warning implement -#else - _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif + //_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); diff --git a/meshers/voxel_mesher.cpp b/meshers/voxel_mesher.cpp index 38a0772..2ff3ded 100644 --- a/meshers/voxel_mesher.cpp +++ b/meshers/voxel_mesher.cpp @@ -460,7 +460,7 @@ void VoxelMesher::add_chunk(Ref chunk) { #ifdef MESH_DATA_RESOURCE_PRESENT void VoxelMesher::add_mesh_data_resource(Ref mesh, const Vector3 position, const Vector3 rotation, const Vector3 scale, const Rect2 uv_rect) { - Transform transform = Transform(Basis(rotation).scaled(scale), position); + Transform3D transform = Transform3D(Basis::from_euler(rotation).scaled(scale), position); add_mesh_data_resource_transform(mesh, transform, uv_rect); } diff --git a/world/default/voxel_chunk_default.cpp b/world/default/voxel_chunk_default.cpp index d5d8f8c..039933e 100644 --- a/world/default/voxel_chunk_default.cpp +++ b/world/default/voxel_chunk_default.cpp @@ -86,12 +86,12 @@ void VoxelChunkDefault::set_current_lod_level(const int value) { RID rid = mesh_rid_get_index(MESH_INDEX_TERRAIN, MESH_TYPE_INDEX_MESH_INSTANCE, i); if (rid != RID()) - VisualServer::get_singleton()->instance_set_visible(rid, vis); + RenderingServer::get_singleton()->instance_set_visible(rid, vis); rid = mesh_rid_get_index(MESH_INDEX_PROP, MESH_TYPE_INDEX_MESH_INSTANCE, i); if (rid != RID()) - VisualServer::get_singleton()->instance_set_visible(rid, vis); + RenderingServer::get_singleton()->instance_set_visible(rid, vis); } } @@ -538,11 +538,11 @@ int VoxelChunkDefault::get_light_count() const { void VoxelChunkDefault::debug_mesh_allocate() { if (_debug_mesh_rid == RID()) { - _debug_mesh_rid = VisualServer::get_singleton()->mesh_create(); + _debug_mesh_rid = RenderingServer::get_singleton()->mesh_create(); } if (_debug_mesh_instance == RID()) { - _debug_mesh_instance = VisualServer::get_singleton()->instance_create(); + _debug_mesh_instance = RenderingServer::get_singleton()->instance_create(); if (get_voxel_world()->GET_WORLD().is_valid()) VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->GET_WORLD()->get_scenario()); @@ -554,11 +554,11 @@ void VoxelChunkDefault::debug_mesh_allocate() { } void VoxelChunkDefault::debug_mesh_free() { if (_debug_mesh_instance != RID()) { - VisualServer::get_singleton()->free(_debug_mesh_instance); + RenderingServer::get_singleton()->free(_debug_mesh_instance); } if (_debug_mesh_rid != RID()) { - VisualServer::get_singleton()->free(_debug_mesh_rid); + RenderingServer::get_singleton()->free(_debug_mesh_rid); } } bool VoxelChunkDefault::debug_mesh_has() { @@ -566,7 +566,7 @@ bool VoxelChunkDefault::debug_mesh_has() { } void VoxelChunkDefault::debug_mesh_clear() { if (_debug_mesh_rid != RID()) { - VisualServer::get_singleton()->mesh_clear(_debug_mesh_rid); + RenderingServer::get_singleton()->mesh_clear(_debug_mesh_rid); } } void VoxelChunkDefault::debug_mesh_array_clear() { @@ -589,13 +589,13 @@ void VoxelChunkDefault::debug_mesh_send() { SceneTree *st = SceneTree::get_singleton(); Array arr; - arr.resize(VisualServer::ARRAY_MAX); - arr[VisualServer::ARRAY_VERTEX] = _debug_mesh_array; + arr.resize(RenderingServer::ARRAY_MAX); + arr[RenderingServer::ARRAY_VERTEX] = _debug_mesh_array; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(_debug_mesh_rid, VisualServer::PRIMITIVE_LINES, arr); + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(_debug_mesh_rid, RenderingServer::PRIMITIVE_LINES, arr); if (st) { - VisualServer::get_singleton()->mesh_surface_set_material(_debug_mesh_rid, 0, SceneTree::get_singleton()->get_debug_collision_material()->get_rid()); + RenderingServer::get_singleton()->mesh_surface_set_material(_debug_mesh_rid, 0, SceneTree::get_singleton()->get_debug_collision_material()->get_rid()); } debug_mesh_array_clear(); @@ -720,17 +720,17 @@ void VoxelChunkDefault::_visibility_changed(bool visible) { RID rid = mesh_rid_get_index(MESH_INDEX_TERRAIN, MESH_TYPE_INDEX_MESH_INSTANCE, i); if (rid != RID()) - VisualServer::get_singleton()->instance_set_visible(rid, false); + RenderingServer::get_singleton()->instance_set_visible(rid, false); rid = mesh_rid_get_index(MESH_INDEX_LIQUID, MESH_TYPE_INDEX_MESH_INSTANCE, i); if (rid != RID()) - VisualServer::get_singleton()->instance_set_visible(rid, false); + RenderingServer::get_singleton()->instance_set_visible(rid, false); rid = mesh_rid_get_index(MESH_INDEX_PROP, MESH_TYPE_INDEX_MESH_INSTANCE, i); if (rid != RID()) - VisualServer::get_singleton()->instance_set_visible(rid, false); + RenderingServer::get_singleton()->instance_set_visible(rid, false); } }