From 3039645b4ac10532671859c6eae18e08426f54c7 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 18 Mar 2022 02:41:08 +0100 Subject: [PATCH] Cleaned up Terraman's version checks. --- modules/terraman/areas/terrain_world_area.h | 13 -- modules/terraman/data/terrain_light.h | 17 +- modules/terraman/defines.h | 134 --------------- .../level_generator/terrain_level_generator.h | 9 -- .../terrain_level_generator_flat.h | 3 - modules/terraman/library/terrain_library.cpp | 153 ------------------ modules/terraman/library/terrain_library.h | 52 ------ .../library/terrain_library_merger.cpp | 8 - .../terraman/library/terrain_library_merger.h | 16 +- .../library/terrain_library_merger_pcm.cpp | 8 - .../library/terrain_library_merger_pcm.h | 22 +-- .../terraman/library/terrain_library_simple.h | 11 +- .../library/terrain_material_cache.cpp | 8 - .../terraman/library/terrain_material_cache.h | 15 -- .../library/terrain_material_cache_pcm.cpp | 4 - .../library/terrain_material_cache_pcm.h | 11 -- modules/terraman/library/terrain_surface.h | 20 +-- .../library/terrain_surface_merger.cpp | 6 - .../terraman/library/terrain_surface_merger.h | 9 -- .../terraman/library/terrain_surface_simple.h | 3 - .../meshers/blocky/terrain_mesher_blocky.h | 11 +- .../meshers/default/terrain_mesher_default.h | 9 -- modules/terraman/meshers/terrain_mesher.cpp | 59 +------ modules/terraman/meshers/terrain_mesher.h | 26 +-- modules/terraman/nodes/terrain_light_node.h | 11 -- modules/terraman/register_types.h | 3 - .../terraman/world/block_terrain_structure.h | 11 -- .../world/blocky/terrain_chunk_blocky.h | 3 - .../world/blocky/terrain_world_blocky.h | 3 - .../world/default/terrain_chunk_default.cpp | 9 -- .../world/default/terrain_chunk_default.h | 26 +-- .../world/default/terrain_world_default.h | 3 - modules/terraman/world/jobs/terrain_job.cpp | 7 - modules/terraman/world/jobs/terrain_job.h | 15 -- .../terraman/world/jobs/terrain_light_job.cpp | 2 +- .../terraman/world/jobs/terrain_light_job.h | 3 - .../world/jobs/terrain_mesher_job_step.h | 44 ++--- .../terraman/world/jobs/terrain_prop_job.cpp | 10 +- .../terraman/world/jobs/terrain_prop_job.h | 3 - .../world/jobs/terrain_terrain_job.cpp | 8 - .../terraman/world/jobs/terrain_terrain_job.h | 9 +- modules/terraman/world/terrain_chunk.cpp | 11 -- modules/terraman/world/terrain_chunk.h | 20 +-- .../world/terrain_environment_data.cpp | 4 - .../terraman/world/terrain_environment_data.h | 14 -- modules/terraman/world/terrain_structure.cpp | 4 - modules/terraman/world/terrain_structure.h | 18 +-- modules/terraman/world/terrain_world.cpp | 30 ---- modules/terraman/world/terrain_world.h | 24 --- .../terraman/world/terrain_world_editor.cpp | 47 +----- modules/terraman/world/terrain_world_editor.h | 16 -- 51 files changed, 53 insertions(+), 932 deletions(-) diff --git a/modules/terraman/areas/terrain_world_area.h b/modules/terraman/areas/terrain_world_area.h index 58f9c2286..3ad04464d 100644 --- a/modules/terraman/areas/terrain_world_area.h +++ b/modules/terraman/areas/terrain_world_area.h @@ -22,21 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/ref_counted.h" -#ifndef Reference -#define Reference RefCounted -#endif -#include "core/string/ustring.h" -#else #include "core/reference.h" #include "core/ustring.h" -#endif #include "core/math/aabb.h" diff --git a/modules/terraman/data/terrain_light.h b/modules/terraman/data/terrain_light.h index 54b2c5d5b..5876b4efc 100644 --- a/modules/terraman/data/terrain_light.h +++ b/modules/terraman/data/terrain_light.h @@ -22,24 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/ref_counted.h" -#ifndef Reference -#define Reference RefCounted -#endif -#include "core/templates/vector.h" -#include "core/math/color.h" -#else +#include "core/color.h" #include "core/reference.h" #include "core/vector.h" -#include "core/color.h" -#endif - class TerrainLight : public Reference { GDCLASS(TerrainLight, Reference); diff --git a/modules/terraman/defines.h b/modules/terraman/defines.h index fdb66b3c9..293a0d978 100644 --- a/modules/terraman/defines.h +++ b/modules/terraman/defines.h @@ -2,32 +2,6 @@ #ifndef TERRAIN_DEFINES_H #define TERRAIN_DEFINES_H -#include "core/version.h" - -#if VERSION_MAJOR >= 4 -#define GODOT4 true -#endif - -//includes -#if GODOT4 -#define core_input_h "core/input/input_event.h" -#define spatial_editor_plugin_h "editor/plugins/node_3d_editor_plugin.h" -#define camera_h "scene/3d/camera_3d.h" -#define spatial_h "scene/3d/node_3d.h" -#define navigation_h "scene/3d/node_3d.h" -#define Navigation3D Node3D -#define light_h "scene/3d/light_3d.h" -#define visual_server_h "servers/rendering_server.h" -#define mesh_instance_h "scene/3d/mesh_instance_3d.h" -#define pool_vector_h "core/templates/vector.h" -#define physics_server_h "servers/physics_server_3d.h" -#define immediate_geometry_h "scene/3d/immediate_geometry_3d.h" -#define include_pool_vector \ - template \ - class Vector; \ - template \ - using PoolVector = Vector; -#else #define core_input_h "core/os/input.h" #define spatial_editor_plugin_h "editor/plugins/spatial_editor_plugin.h" #define camera_h "scene/3d/camera.h" @@ -40,57 +14,6 @@ #define physics_server_h "servers/physics_server.h" #define immediate_geometry_h "scene/3d/immediate_geometry.h" #define include_pool_vector -#endif - -//Type Defines -#if GODOT4 -#define PhysicsDirectSpaceState PhysicsDirectSpaceState3D -#define SpatialEditor Node3DEditor -#define SpatialEditorPlugin Node3DEditorPlugin -#define SpatialEditorViewport Node3DEditorViewport -#define PoolStringArray PackedStringArray -#define REAL FLOAT -#define POOL_STRING_ARRAY PACKED_STRING_ARRAY -#define POOL_BYTE_ARRAY PACKED_BYTE_ARRAY -#define Spatial Node3D -#define SpatialMaterial StandardMaterial3D -#define PoolVector3Array PackedVector3Array -#define PoolVector2Array PackedVector2Array -#define PoolColorArray PackedColorArray -#define PoolIntArray PackedInt64Array -#define PoolRealArray PackedFloat32Array -#define PoolByteArray PackedByteArray -#define MeshInstance MeshInstance3D -#define Camera Camera3D -#define ToolButton Button -#define Shape Shape3D -#define Reference RefCounted - -typedef class World3D World; - -#define DirectionalLight DirectionalLight3D - -typedef class ImmediateGeometry3D ImmediateGeometry; -typedef class Navigation3D Navigation; -typedef class PhysicsServer3D PhysicsServer; -typedef class RenderingServer VisualServer; -typedef class RenderingServer VS; -//typedef class StandardMaterial3D SpatialMaterial; - -//toodo figure out a way to have this -//#define Variant::CallError Callable::CallError -#endif - -#if GODOT4 - -#define VARIANT_ARRAY_GET(arr) \ - Vector r; \ - for (int i = 0; i < arr.size(); i++) { \ - r.push_back(arr[i]); \ - } \ - return r; - -#else #define VARIANT_ARRAY_GET(arr) \ Vector r; \ @@ -99,8 +22,6 @@ typedef class RenderingServer VS; } \ return r; -#endif - #define VARIANT_ARRAY_SET(arr, arr_into, type) \ arr_into.clear(); \ for (int i = 0; i < arr.size(); i++) { \ @@ -108,59 +29,6 @@ typedef class RenderingServer VS; arr_into.push_back(e); \ } -#if GODOT4 -//TODO do this properly -#define INSTANCE_VALIDATE(var) var -#define CONNECT(sig, obj, target_method_class, method) connect(sig, callable_mp(obj, &target_method_class::method)) -#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, callable_mp(obj, &target_method_class::method)) -#define GET_WORLD get_world_3d -#define INSTANCE instantiate -#define VREMOVE remove_at - -#define CALL(func, ...) \ - _gdvirtual_##func##_call(__VA_ARGS__) - -#define RETURN_CALL(ret_type, func) \ - ret_type _return_call_ret_var; \ - _gdvirtual_##func##_call(_return_call_ret_var); \ - return _return_call_ret_var; - -#define RETURN_CALLP(ret_type, func, ...) \ - ret_type _return_call_ret_var; \ - _gdvirtual_##func##_call(__VA_ARGS__, _return_call_ret_var); \ - return _return_call_ret_var; - -#define GET_CALL(ret_type, ret_var, func) \ - _gdvirtual_##func##_call(ret_var); - -#define GET_CALLP(ret_type, ret_var, func, ...) \ - _gdvirtual_##func##_call(__VA_ARGS__, ret_var); - -#define RETURN_CALLD(ret_type, def_val, func) \ - ret_type _return_call_ret_var = def_val; \ - if (_gdvirtual_##func##_call(_return_call_ret_var)) { \ - return _return_call_ret_var; \ - } \ - return def_val; - -#define RETURN_CALLPD(ret_type, def_val, func, ...) \ - ret_type _return_call_ret_var = def_val; \ - if (_gdvirtual_##func##_call(__VA_ARGS__, _return_call_ret_var)) { \ - return _return_call_ret_var; \ - } \ - return def_val; - -#define GET_CALLD(ret_type, def_val, ret_var, func) \ - if (!_gdvirtual_##func##_call(ret_var)) { \ - ret_var = def_val; \ - } - -#define GET_CALLPD(ret_type, def_val, ret_var, func, ...) \ - if (!_gdvirtual_##func##_call(__VA_ARGS__, ret_var)) { \ - ret_var = def_val; \ - } - -#else #define INSTANCE_VALIDATE(var) ObjectDB::instance_validate(var) #define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method) #define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method) @@ -196,5 +64,3 @@ typedef class RenderingServer VS; return call(#func, ##__VA_ARGS__); #endif - -#endif diff --git a/modules/terraman/level_generator/terrain_level_generator.h b/modules/terraman/level_generator/terrain_level_generator.h index 5f8bcdb31..ac3a60e86 100644 --- a/modules/terraman/level_generator/terrain_level_generator.h +++ b/modules/terraman/level_generator/terrain_level_generator.h @@ -22,16 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#else #include "core/resource.h" -#endif class TerrainChunk; diff --git a/modules/terraman/level_generator/terrain_level_generator_flat.h b/modules/terraman/level_generator/terrain_level_generator_flat.h index 64eaf621c..2192e90dc 100644 --- a/modules/terraman/level_generator/terrain_level_generator_flat.h +++ b/modules/terraman/level_generator/terrain_level_generator_flat.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_level_generator.h" class TerrainChunk; diff --git a/modules/terraman/library/terrain_library.cpp b/modules/terraman/library/terrain_library.cpp index 0bef9f28b..b92de1fa0 100644 --- a/modules/terraman/library/terrain_library.cpp +++ b/modules/terraman/library/terrain_library.cpp @@ -32,119 +32,6 @@ SOFTWARE. #include "scene/resources/packed_scene.h" -#include "../defines.h" - -#if VERSION_MAJOR > 3 - -#define TMCGDVIRTUAL1(m_class, m_name, m_type1) \ - bool m_class::_gdvirtual_##m_name##_call(m_type1 arg1) { \ - ScriptInstance *script_instance = ((Object *)(this))->get_script_instance(); \ - if (script_instance) { \ - Callable::CallError ce; \ - Variant vargs[1] = { Variant(arg1) }; \ - const Variant *vargptrs[1] = { &vargs[0] }; \ - \ - script_instance->call(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs, 1, ce); \ - if (ce.error == Callable::CallError::CALL_OK) { \ - return true; \ - } \ - } \ - if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) { \ - _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr; \ - _gdvirtual_##m_name##_initialized = true; \ - } \ - if (_gdvirtual_##m_name) { \ - PtrToArg::EncodeT argval1 = arg1; \ - const GDNativeTypePtr argptrs[1] = { &argval1 }; \ - \ - _gdvirtual_##m_name(_get_extension_instance(), (const GDNativeTypePtr *)argptrs, nullptr); \ - \ - return true; \ - } \ - \ - return false; \ - } \ - bool m_class::_gdvirtual_##m_name##_overridden() const { \ - ScriptInstance *script_instance = ((Object *)(this))->get_script_instance(); \ - if (script_instance) { \ - return script_instance->has_method(_gdvirtual_##m_name##_sn); \ - } \ - if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) { \ - _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr; \ - _gdvirtual_##m_name##_initialized = true; \ - } \ - if (_gdvirtual_##m_name) { \ - return true; \ - } \ - return false; \ - } \ - \ - MethodInfo m_class::_gdvirtual_##m_name##_get_method_info() { \ - MethodInfo method_info; \ - method_info.name = #m_name; \ - method_info.flags = METHOD_FLAG_VIRTUAL; \ - method_info.arguments.push_back(GetTypeInfo::get_class_info()); \ - \ - return method_info; \ - } - -#define TMCGDVIRTUAL1R(m_class, m_ret, m_name, m_type1) \ - bool m_class::_gdvirtual_##m_name##_call(m_type1 arg1, m_ret &r_ret) { \ - ScriptInstance *script_instance = ((Object *)(this))->get_script_instance(); \ - if (script_instance) { \ - Callable::CallError ce; \ - Variant vargs[1] = { Variant(arg1) }; \ - const Variant *vargptrs[1] = { &vargs[0] }; \ - \ - Variant ret = script_instance->call(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs, 1, ce); \ - if (ce.error == Callable::CallError::CALL_OK) { \ - r_ret = VariantCaster::cast(ret); \ - return true; \ - } \ - } \ - if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) { \ - _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr; \ - _gdvirtual_##m_name##_initialized = true; \ - } \ - if (_gdvirtual_##m_name) { \ - PtrToArg::EncodeT argval1 = arg1; \ - const GDNativeTypePtr argptrs[1] = { &argval1 }; \ - \ - PtrToArg::EncodeT ret; \ - _gdvirtual_##m_name(_get_extension_instance(), (const GDNativeTypePtr *)argptrs, &ret); \ - r_ret = (m_ret)ret; \ - return true; \ - } \ - \ - return false; \ - } \ - bool m_class::_gdvirtual_##m_name##_overridden() const { \ - ScriptInstance *script_instance = ((Object *)(this))->get_script_instance(); \ - if (script_instance) { \ - return script_instance->has_method(_gdvirtual_##m_name##_sn); \ - } \ - if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) { \ - _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr; \ - _gdvirtual_##m_name##_initialized = true; \ - } \ - if (_gdvirtual_##m_name) { \ - return true; \ - } \ - return false; \ - } \ - \ - MethodInfo m_class::_gdvirtual_##m_name##_get_method_info() { \ - MethodInfo method_info; \ - method_info.name = #m_name; \ - method_info.flags = METHOD_FLAG_VIRTUAL; \ - method_info.return_val = GetTypeInfo::get_class_info(); \ - method_info.arguments.push_back(GetTypeInfo::get_class_info()); \ - \ - return method_info; \ - } - -#endif - bool TerrainLibrary::get_initialized() const { return _initialized; } @@ -469,49 +356,21 @@ TerrainLibrary::~TerrainLibrary() { _prop_materials.clear(); } -#if VERSION_MAJOR >= 4 -TMCGDVIRTUAL1(TerrainLibrary, _material_cache_get_key, Ref); -TMCGDVIRTUAL1R(TerrainLibrary, Ref, _material_cache_get, int); -TMCGDVIRTUAL1(TerrainLibrary, _material_cache_unref, int); - -TMCGDVIRTUAL1(TerrainLibrary, _liquid_material_cache_get_key, Ref); -TMCGDVIRTUAL1R(TerrainLibrary, Ref, _liquid_material_cache_get, int); -TMCGDVIRTUAL1(TerrainLibrary, _liquid_material_cache_unref, int); - -TMCGDVIRTUAL1(TerrainLibrary, _prop_material_cache_get_key, Ref); -TMCGDVIRTUAL1R(TerrainLibrary, Ref, _prop_material_cache_get, int); -TMCGDVIRTUAL1(TerrainLibrary, _prop_material_cache_unref, int); -#endif - void TerrainLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("get_initialized"), &TerrainLibrary::get_initialized); ClassDB::bind_method(D_METHOD("set_initialized", "value"), &TerrainLibrary::set_initialized); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "initialized", PROPERTY_HINT_NONE, "", 0), "set_initialized", "get_initialized"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "ret"), "_supports_caching")); -#else - GDVIRTUAL_BIND(_supports_caching); -#endif ClassDB::bind_method(D_METHOD("_supports_caching"), &TerrainLibrary::_supports_caching); ClassDB::bind_method(D_METHOD("supports_caching"), &TerrainLibrary::supports_caching); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_setup_material_albedo", PropertyInfo(Variant::INT, "material_index"), PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"))); -#else - GDVIRTUAL_BIND(_setup_material_albedo, "material_index", "texture"); -#endif -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "TerrainMaterialCache"), "_material_cache_get", PropertyInfo(Variant::INT, "key"))); BIND_VMETHOD(MethodInfo("_material_cache_unref", PropertyInfo(Variant::INT, "key"))); -#else - GDVIRTUAL_BIND(_material_cache_get_key, "chunk", "texture"); - GDVIRTUAL_BIND(_material_cache_get, "key"); - GDVIRTUAL_BIND(_material_cache_unref, "key"); -#endif ClassDB::bind_method(D_METHOD("material_get", "index"), &TerrainLibrary::material_get); ClassDB::bind_method(D_METHOD("material_lod_get", "index"), &TerrainLibrary::material_lod_get); @@ -533,15 +392,9 @@ void TerrainLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_set"), &TerrainLibrary::materials_set); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_liquid_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "TerrainMaterialCache"), "_liquid_material_cache_get", PropertyInfo(Variant::INT, "key"))); BIND_VMETHOD(MethodInfo("_liquid_material_cache_unref", PropertyInfo(Variant::INT, "key"))); -#else - GDVIRTUAL_BIND(_liquid_material_cache_get_key, "chunk", "texture"); - GDVIRTUAL_BIND(_liquid_material_cache_get, "key"); - GDVIRTUAL_BIND(_liquid_material_cache_unref, "key"); -#endif ClassDB::bind_method(D_METHOD("liquid_material_get", "index"), &TerrainLibrary::liquid_material_get); ClassDB::bind_method(D_METHOD("liquid_material_lod_get", "index"), &TerrainLibrary::liquid_material_lod_get); @@ -563,15 +416,9 @@ void TerrainLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("liquid_materials_set"), &TerrainLibrary::liquid_materials_set); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "liquid_materials_set", "liquid_materials_get"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_prop_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "TerrainMaterialCache"), "_prop_material_cache_get", PropertyInfo(Variant::INT, "key"))); BIND_VMETHOD(MethodInfo("_prop_material_cache_unref", PropertyInfo(Variant::INT, "key"))); -#else - GDVIRTUAL_BIND(_prop_material_cache_get_key, "chunk", "texture"); - GDVIRTUAL_BIND(_prop_material_cache_get, "key"); - GDVIRTUAL_BIND(_prop_material_cache_unref, "key"); -#endif ClassDB::bind_method(D_METHOD("prop_material_get", "index"), &TerrainLibrary::prop_material_get); ClassDB::bind_method(D_METHOD("prop_material_lod_get", "index"), &TerrainLibrary::prop_material_lod_get); diff --git a/modules/terraman/library/terrain_library.h b/modules/terraman/library/terrain_library.h index 9faeb6338..84fe499cd 100644 --- a/modules/terraman/library/terrain_library.h +++ b/modules/terraman/library/terrain_library.h @@ -22,35 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" - -// These are needed here to use incomplete classes as vmethod arguments (godot4) - -#define TMHGDVIRTUAL1(m_name, m_type1) \ - StringName _gdvirtual_##m_name##_sn = #m_name; \ - mutable bool _gdvirtual_##m_name##_initialized = false; \ - mutable GDNativeExtensionClassCallVirtual _gdvirtual_##m_name = nullptr; \ - bool _gdvirtual_##m_name##_call(m_type1 arg1); \ - bool _gdvirtual_##m_name##_overridden() const; \ - static MethodInfo _gdvirtual_##m_name##_get_method_info(); - -#define TMHGDVIRTUAL1R(m_ret, m_name, m_type1) \ - StringName _gdvirtual_##m_name##_sn = #m_name; \ - mutable bool _gdvirtual_##m_name##_initialized = false; \ - mutable GDNativeExtensionClassCallVirtual _gdvirtual_##m_name = nullptr; \ - bool _gdvirtual_##m_name##_call(m_type1 arg1, m_ret &r_ret); \ - bool _gdvirtual_##m_name##_overridden() const; \ - static MethodInfo _gdvirtual_##m_name##_get_method_info(); - -#else #include "core/resource.h" -#endif #include "core/math/rect2.h" #include "scene/resources/material.h" @@ -58,12 +30,6 @@ SOFTWARE. #include "../data/terrain_light.h" #include "terrain_surface.h" -#include "../defines.h" - -#if GODOT4 -#define Texture Texture2D -#endif - class TerrainMaterialCache; class TerrainSurface; class TerrainMesher; @@ -177,24 +143,6 @@ public: void setup_material_albedo(int material_index, Ref texture); -#if VERSION_MAJOR >= 4 - GDVIRTUAL0R(bool, _supports_caching); - - GDVIRTUAL2(_setup_material_albedo, int, Ref); - - TMHGDVIRTUAL1(_material_cache_get_key, Ref); - TMHGDVIRTUAL1R(Ref, _material_cache_get, int); - TMHGDVIRTUAL1(_material_cache_unref, int); - - TMHGDVIRTUAL1(_liquid_material_cache_get_key, Ref); - TMHGDVIRTUAL1R(Ref, _liquid_material_cache_get, int); - TMHGDVIRTUAL1(_liquid_material_cache_unref, int); - - TMHGDVIRTUAL1(_prop_material_cache_get_key, Ref); - TMHGDVIRTUAL1R(Ref, _prop_material_cache_get, int); - TMHGDVIRTUAL1(_prop_material_cache_unref, int); -#endif - TerrainLibrary(); ~TerrainLibrary(); diff --git a/modules/terraman/library/terrain_library_merger.cpp b/modules/terraman/library/terrain_library_merger.cpp index 906295946..ce5d8958d 100644 --- a/modules/terraman/library/terrain_library_merger.cpp +++ b/modules/terraman/library/terrain_library_merger.cpp @@ -367,11 +367,7 @@ void TerrainLibraryMerger::_setup_material_albedo(const int material_index, cons TerrainLibraryMerger::TerrainLibraryMerger() { _packer.instance(); -#if GODOT4 -#warning implement -#else _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); @@ -379,11 +375,7 @@ TerrainLibraryMerger::TerrainLibraryMerger() { _prop_packer.instance(); -#if GODOT4 -#warning implement -#else _prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _prop_packer->set_max_atlas_size(1024); _prop_packer->set_keep_original_atlases(false); diff --git a/modules/terraman/library/terrain_library_merger.h b/modules/terraman/library/terrain_library_merger.h index 2b08e71fb..4a4138cfa 100644 --- a/modules/terraman/library/terrain_library_merger.h +++ b/modules/terraman/library/terrain_library_merger.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/templates/map.h" -#else -#include "core/resource.h" #include "core/map.h" -#endif +#include "core/resource.h" #include "terrain_library.h" @@ -106,9 +96,9 @@ protected: static void _bind_methods(); - Vector > _terra_surfaces; + Vector> _terra_surfaces; #ifdef PROPS_PRESENT - Vector > _props; + Vector> _props; #endif Ref _packer; diff --git a/modules/terraman/library/terrain_library_merger_pcm.cpp b/modules/terraman/library/terrain_library_merger_pcm.cpp index e7b5734ba..79c544e30 100644 --- a/modules/terraman/library/terrain_library_merger_pcm.cpp +++ b/modules/terraman/library/terrain_library_merger_pcm.cpp @@ -905,11 +905,7 @@ void TerrainLibraryMergerPCM::_setup_material_albedo(const int material_index, c TerrainLibraryMergerPCM::TerrainLibraryMergerPCM() { _packer.instance(); -#if GODOT4 -#warning implement -#else _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); @@ -917,11 +913,7 @@ TerrainLibraryMergerPCM::TerrainLibraryMergerPCM() { _prop_packer.instance(); -#if GODOT4 -#warning implement -#else _prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _prop_packer->set_max_atlas_size(1024); _prop_packer->set_keep_original_atlases(false); diff --git a/modules/terraman/library/terrain_library_merger_pcm.h b/modules/terraman/library/terrain_library_merger_pcm.h index 2aba8a21d..9d09a50d2 100644 --- a/modules/terraman/library/terrain_library_merger_pcm.h +++ b/modules/terraman/library/terrain_library_merger_pcm.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/templates/map.h" -#else -#include "core/resource.h" #include "core/map.h" -#endif +#include "core/resource.h" #include "terrain_library.h" @@ -125,13 +115,13 @@ protected: static void _bind_methods(); - Map > _material_cache; - Map > _liquid_material_cache; - Map > _prop_material_cache; + Map> _material_cache; + Map> _liquid_material_cache; + Map> _prop_material_cache; - Vector > _terra_surfaces; + Vector> _terra_surfaces; #ifdef PROPS_PRESENT - Vector > _props; + Vector> _props; #endif //todo remove these diff --git a/modules/terraman/library/terrain_library_simple.h b/modules/terraman/library/terrain_library_simple.h index 49b36babe..3726e1294 100644 --- a/modules/terraman/library/terrain_library_simple.h +++ b/modules/terraman/library/terrain_library_simple.h @@ -22,16 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#else #include "core/resource.h" -#endif #include "terrain_library.h" @@ -72,7 +63,7 @@ protected: static void _bind_methods(); private: - Vector > _terra_surfaces; + Vector> _terra_surfaces; //atlas int _atlas_columns; diff --git a/modules/terraman/library/terrain_material_cache.cpp b/modules/terraman/library/terrain_material_cache.cpp index eeb5763cf..06c2835d7 100644 --- a/modules/terraman/library/terrain_material_cache.cpp +++ b/modules/terraman/library/terrain_material_cache.cpp @@ -256,13 +256,9 @@ void TerrainMaterialCache::refresh_rects() { } void TerrainMaterialCache::setup_material_albedo(Ref texture) { -#if VERSION_MAJOR < 4 if (has_method("_setup_material_albedo")) { call("_setup_material_albedo", texture); } -#else - GDVIRTUAL_CALL(_setup_material_albedo, texture); -#endif } TerrainMaterialCache::TerrainMaterialCache() { @@ -286,11 +282,7 @@ void TerrainMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("inc_ref_count"), &TerrainMaterialCache::inc_ref_count); ClassDB::bind_method(D_METHOD("dec_ref_count"), &TerrainMaterialCache::dec_ref_count); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_setup_material_albedo", PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"))); -#else - GDVIRTUAL_BIND(_setup_material_albedo, "texture"); -#endif ClassDB::bind_method(D_METHOD("material_get", "index"), &TerrainMaterialCache::material_get); ClassDB::bind_method(D_METHOD("material_lod_get", "index"), &TerrainMaterialCache::material_lod_get); diff --git a/modules/terraman/library/terrain_material_cache.h b/modules/terraman/library/terrain_material_cache.h index 1fb707dc8..facb05a8b 100644 --- a/modules/terraman/library/terrain_material_cache.h +++ b/modules/terraman/library/terrain_material_cache.h @@ -22,20 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/math/color.h" -#include "core/templates/vector.h" -#else #include "core/color.h" #include "core/resource.h" #include "core/vector.h" -#endif #include "core/math/rect2.h" #include "scene/resources/material.h" @@ -96,10 +85,6 @@ public: void setup_material_albedo(Ref texture); -#if VERSION_MAJOR >= 4 - GDVIRTUAL1(_setup_material_albedo, Ref); -#endif - TerrainMaterialCache(); ~TerrainMaterialCache(); diff --git a/modules/terraman/library/terrain_material_cache_pcm.cpp b/modules/terraman/library/terrain_material_cache_pcm.cpp index 320f57835..a84024f4c 100644 --- a/modules/terraman/library/terrain_material_cache_pcm.cpp +++ b/modules/terraman/library/terrain_material_cache_pcm.cpp @@ -181,11 +181,7 @@ void TerrainMaterialCachePCM::_setup_material_albedo(Ref texture) { TerrainMaterialCachePCM::TerrainMaterialCachePCM() { _packer.instance(); -#if GODOT4 -#warning implement -#else _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); diff --git a/modules/terraman/library/terrain_material_cache_pcm.h b/modules/terraman/library/terrain_material_cache_pcm.h index 989d55e84..cc70041b1 100644 --- a/modules/terraman/library/terrain_material_cache_pcm.h +++ b/modules/terraman/library/terrain_material_cache_pcm.h @@ -22,22 +22,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_material_cache.h" -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/math/color.h" -#include "core/templates/vector.h" -#else #include "core/color.h" #include "core/resource.h" #include "core/vector.h" -#endif #include "core/math/rect2.h" #include "scene/resources/material.h" diff --git a/modules/terraman/library/terrain_surface.h b/modules/terraman/library/terrain_surface.h index 0e8a29295..61efe4e27 100644 --- a/modules/terraman/library/terrain_surface.h +++ b/modules/terraman/library/terrain_surface.h @@ -22,21 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/templates/vector.h" -#include "core/math/color.h" -#else +#include "core/color.h" #include "core/resource.h" #include "core/vector.h" -#include "core/color.h" -#endif #include "core/math/rect2.h" #include "scene/resources/material.h" @@ -57,9 +45,9 @@ public: I_____I/ - I y - I I - O----- x I B + I y + I I + O----- x I B / I F I / / z+ I ---I/ */ diff --git a/modules/terraman/library/terrain_surface_merger.cpp b/modules/terraman/library/terrain_surface_merger.cpp index c56fc5fbd..f0834e03f 100644 --- a/modules/terraman/library/terrain_surface_merger.cpp +++ b/modules/terraman/library/terrain_surface_merger.cpp @@ -24,12 +24,6 @@ SOFTWARE. #include "terrain_library_merger.h" -#include "../defines.h" - -#if GODOT4 -#define Texture Texture2D -#endif - Ref TerrainSurfaceMerger::get_region(const TerrainSurfaceSides side) { return _regions[side]; } diff --git a/modules/terraman/library/terrain_surface_merger.h b/modules/terraman/library/terrain_surface_merger.h index d879af1ec..ae027dae5 100644 --- a/modules/terraman/library/terrain_surface_merger.h +++ b/modules/terraman/library/terrain_surface_merger.h @@ -22,21 +22,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_surface.h" #include "scene/resources/texture.h" #include "../../texture_packer/texture_packer.h" -#include "../defines.h" - -#if GODOT4 -#define Texture Texture2D -#endif - class TerrainSurfaceMerger : public TerrainSurface { GDCLASS(TerrainSurfaceMerger, TerrainSurface) diff --git a/modules/terraman/library/terrain_surface_simple.h b/modules/terraman/library/terrain_surface_simple.h index 01d7be82a..e27c67ce4 100644 --- a/modules/terraman/library/terrain_surface_simple.h +++ b/modules/terraman/library/terrain_surface_simple.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_surface.h" class TerrainSurfaceSimple : public TerrainSurface { diff --git a/modules/terraman/meshers/blocky/terrain_mesher_blocky.h b/modules/terraman/meshers/blocky/terrain_mesher_blocky.h index 1ffce2076..afd045e72 100644 --- a/modules/terraman/meshers/blocky/terrain_mesher_blocky.h +++ b/modules/terraman/meshers/blocky/terrain_mesher_blocky.h @@ -22,22 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/math/color.h" -#else #include "core/color.h" -#endif #include "core/math/vector2.h" #include "core/math/vector3.h" -#include "../default/terrain_mesher_default.h" #include "../../world/default/terrain_chunk_default.h" +#include "../default/terrain_mesher_default.h" class TerrainMesherBlocky : public TerrainMesherDefault { GDCLASS(TerrainMesherBlocky, TerrainMesherDefault); diff --git a/modules/terraman/meshers/default/terrain_mesher_default.h b/modules/terraman/meshers/default/terrain_mesher_default.h index d4827b9e7..4781ee763 100644 --- a/modules/terraman/meshers/default/terrain_mesher_default.h +++ b/modules/terraman/meshers/default/terrain_mesher_default.h @@ -22,16 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/math/color.h" -#else #include "core/color.h" -#endif #include "core/math/vector2.h" #include "core/math/vector3.h" diff --git a/modules/terraman/meshers/terrain_mesher.cpp b/modules/terraman/meshers/terrain_mesher.cpp index 85b70ad0a..3cd3353a6 100644 --- a/modules/terraman/meshers/terrain_mesher.cpp +++ b/modules/terraman/meshers/terrain_mesher.cpp @@ -180,21 +180,13 @@ Array TerrainMesher::build_mesh() { { PoolVector array; array.resize(_vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _vertices.size(); ++i) { -#if !GODOT4 w[i] = _vertices[i].vertex; -#else - array.set(i, _vertices[i].vertex); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_VERTEX] = array; } @@ -206,63 +198,39 @@ Array TerrainMesher::build_mesh() { { PoolVector array; array.resize(_vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _vertices.size(); ++i) { -#if !GODOT4 w[i] = _vertices[i].normal; -#else - array.set(i, _vertices[i].normal); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_NORMAL] = array; } if ((_format & VisualServer::ARRAY_FORMAT_COLOR) != 0) { PoolVector array; array.resize(_vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _vertices.size(); ++i) { -#if !GODOT4 w[i] = _vertices[i].color; -#else - array.set(i, _vertices[i].color); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_COLOR] = array; } if ((_format & VisualServer::ARRAY_FORMAT_TEX_UV) != 0) { PoolVector array; array.resize(_vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _vertices.size(); ++i) { -#if !GODOT4 w[i] = _vertices[i].uv; -#else - array.set(i, _vertices[i].uv); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_TEX_UV] = array; } @@ -270,42 +238,27 @@ Array TerrainMesher::build_mesh() { if ((_format & VisualServer::ARRAY_FORMAT_TEX_UV2) != 0) { PoolVector array; array.resize(_vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _vertices.size(); ++i) { -#if !GODOT4 w[i] = _vertices[i].uv2; -#else - array.set(i, _vertices[i].uv2); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_TEX_UV2] = array; } if (_indices.size() > 0) { PoolVector array; array.resize(_indices.size()); -#if !GODOT4 + PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _indices.size(); ++i) { -#if !GODOT4 w[i] = _indices[i]; -#else - array.set(i, _indices[i]); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_INDEX] = array; } @@ -965,15 +918,9 @@ TerrainMesher::~TerrainMesher() { } void TerrainMesher::_bind_methods() { -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_add_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo("_bake_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo("_bake_liquid_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); -#else - GDVIRTUAL_BIND(_add_chunk, "chunk"); - GDVIRTUAL_BIND(_bake_colors, "chunk"); - GDVIRTUAL_BIND(_bake_liquid_colors, "chunk"); -#endif ClassDB::bind_method(D_METHOD("get_channel_index_type"), &TerrainMesher::get_channel_index_type); ClassDB::bind_method(D_METHOD("set_channel_index_type", "value"), &TerrainMesher::set_channel_index_type); @@ -1035,11 +982,7 @@ void TerrainMesher::_bind_methods() { ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform_colored", "mesh", "transform", "colors", "uv_rect"), &TerrainMesher::add_mesh_data_resource_transform_colored, DEFVAL(Rect2(0, 0, 1, 1))); #endif -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_add_mesher", PropertyInfo(Variant::OBJECT, "mesher", PROPERTY_HINT_RESOURCE_TYPE, "TerrainMesher"))); -#else - GDVIRTUAL_BIND(_add_mesher, "mesher"); -#endif ClassDB::bind_method(D_METHOD("add_mesher", "mesher"), &TerrainMesher::add_mesher); ClassDB::bind_method(D_METHOD("_add_mesher", "mesher"), &TerrainMesher::_add_mesher); diff --git a/modules/terraman/meshers/terrain_mesher.h b/modules/terraman/meshers/terrain_mesher.h index 388fe5cd3..7ff755516 100644 --- a/modules/terraman/meshers/terrain_mesher.h +++ b/modules/terraman/meshers/terrain_mesher.h @@ -22,28 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/ref_counted.h" -#ifndef Reference -#define Reference RefCounted -#endif -#include "core/templates/vector.h" -#include "core/math/color.h" -#else +#include "core/color.h" #include "core/reference.h" #include "core/vector.h" -#include "core/color.h" -#endif #include "../defines.h" #include pool_vector_h -include_pool_vector #include mesh_instance_h @@ -60,7 +45,7 @@ include_pool_vector #include "../library/terrain_library.h" - class TerrainLibrary; +class TerrainLibrary; class TerrainChunk; class TerrainMesher : public Reference { @@ -199,13 +184,6 @@ public: void remove_index(const int idx); void add_indices(const int index); -#if VERSION_MAJOR >= 4 - GDVIRTUAL1(_add_chunk, Ref); - GDVIRTUAL1(_bake_colors, Ref); - GDVIRTUAL1(_bake_liquid_colors, Ref); - GDVIRTUAL1(_add_mesher, Ref); -#endif - TerrainMesher(const Ref &library); TerrainMesher(); ~TerrainMesher(); diff --git a/modules/terraman/nodes/terrain_light_node.h b/modules/terraman/nodes/terrain_light_node.h index bf963dde9..fb265764a 100644 --- a/modules/terraman/nodes/terrain_light_node.h +++ b/modules/terraman/nodes/terrain_light_node.h @@ -22,18 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR < 4 #include "scene/3d/spatial.h" -#else -#include "scene/3d/node_3d.h" - -#define Spatial Node3D -#endif #include "core/math/vector3.h" diff --git a/modules/terraman/register_types.h b/modules/terraman/register_types.h index 98e954240..a9551a3c3 100644 --- a/modules/terraman/register_types.h +++ b/modules/terraman/register_types.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - void register_terraman_types(); void unregister_terraman_types(); diff --git a/modules/terraman/world/block_terrain_structure.h b/modules/terraman/world/block_terrain_structure.h index e73be2aa0..48f706dc5 100644 --- a/modules/terraman/world/block_terrain_structure.h +++ b/modules/terraman/world/block_terrain_structure.h @@ -22,26 +22,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/templates/vector.h" -#else #include "core/vector.h" -#endif #include "terrain_structure.h" #include "../defines.h" #include pool_vector_h -include_pool_vector #include "terrain_chunk.h" - ; class BlockTerrainStructure : public TerrainStructure { GDCLASS(BlockTerrainStructure, TerrainStructure); diff --git a/modules/terraman/world/blocky/terrain_chunk_blocky.h b/modules/terraman/world/blocky/terrain_chunk_blocky.h index 0d133d7b3..84b7a2d48 100644 --- a/modules/terraman/world/blocky/terrain_chunk_blocky.h +++ b/modules/terraman/world/blocky/terrain_chunk_blocky.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "../default/terrain_chunk_default.h" class TerrainChunkBlocky : public TerrainChunkDefault { diff --git a/modules/terraman/world/blocky/terrain_world_blocky.h b/modules/terraman/world/blocky/terrain_world_blocky.h index 3c6d1e09c..96405df6c 100644 --- a/modules/terraman/world/blocky/terrain_world_blocky.h +++ b/modules/terraman/world/blocky/terrain_world_blocky.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "../default/terrain_world_default.h" class TerrainWorldBlocky : public TerrainWorldDefault { diff --git a/modules/terraman/world/default/terrain_chunk_default.cpp b/modules/terraman/world/default/terrain_chunk_default.cpp index 913f540d5..c04750058 100644 --- a/modules/terraman/world/default/terrain_chunk_default.cpp +++ b/modules/terraman/world/default/terrain_chunk_default.cpp @@ -125,13 +125,8 @@ RID TerrainChunkDefault::mesh_rid_get(const int mesh_index, const int mesh_type_ Variant v = m[mesh_type_index]; -#if VERSION_MAJOR > 3 - if (v.get_type() != Variant::RID) - return RID(); -#else if (v.get_type() != Variant::_RID) return RID(); -#endif return v; } @@ -149,11 +144,7 @@ void TerrainChunkDefault::mesh_rid_set(const int mesh_index, const int mesh_type Variant v = m[mesh_type_index]; -#if VERSION_MAJOR > 3 - ERR_FAIL_COND(v.get_type() != Variant::RID); -#else ERR_FAIL_COND(v.get_type() != Variant::_RID); -#endif m[mesh_type_index] = value; _rids[mesh_index] = m; diff --git a/modules/terraman/world/default/terrain_chunk_default.h b/modules/terraman/world/default/terrain_chunk_default.h index b6d3ce564..aaf4dbc4e 100644 --- a/modules/terraman/world/default/terrain_chunk_default.h +++ b/modules/terraman/world/default/terrain_chunk_default.h @@ -22,21 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/string/ustring.h" -#include "core/config/engine.h" -#include "core/variant/array.h" -#else -#include "core/ustring.h" -#include "core/engine.h" #include "core/array.h" -#endif - +#include "core/engine.h" +#include "core/ustring.h" #include "../terrain_chunk.h" @@ -46,12 +34,12 @@ SOFTWARE. #include "core/os/thread.h" #include "core/os/thread_safe.h" -#include "scene/resources/packed_scene.h" -#include "../terrain_world.h" #include "../../data/terrain_light.h" -#include "../../meshers/terrain_mesher.h" -#include "../../library/terrain_surface.h" #include "../../library/terrain_library.h" +#include "../../library/terrain_surface.h" +#include "../../meshers/terrain_mesher.h" +#include "../terrain_world.h" +#include "scene/resources/packed_scene.h" class TerrainWorld; class TerrainJob; @@ -224,7 +212,7 @@ protected: RID _debug_mesh_instance; PoolVector3Array _debug_mesh_array; - Vector > _lights; + Vector> _lights; }; VARIANT_ENUM_CAST(TerrainChunkDefault::DefaultChannels); diff --git a/modules/terraman/world/default/terrain_world_default.h b/modules/terraman/world/default/terrain_world_default.h index 2421efd12..76e4fc0e0 100644 --- a/modules/terraman/world/default/terrain_world_default.h +++ b/modules/terraman/world/default/terrain_world_default.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "../terrain_world.h" class TerrainWorldDefault : public TerrainWorld { diff --git a/modules/terraman/world/jobs/terrain_job.cpp b/modules/terraman/world/jobs/terrain_job.cpp index 601305d06..15faf861f 100644 --- a/modules/terraman/world/jobs/terrain_job.cpp +++ b/modules/terraman/world/jobs/terrain_job.cpp @@ -72,7 +72,6 @@ void TerrainJob::_reset() { } void TerrainJob::_execute() { - ActiveBuildPhaseType origpt = _build_phase_type; while (!get_cancelled() && _in_tree && !_build_done && origpt == _build_phase_type && !should_return()) { @@ -162,7 +161,6 @@ void TerrainJob::generate_random_ao(int seed, int octaves, int period, float per for (int x = -margin_start; x < size_x + margin_end; ++x) { for (int z = -margin_start; z < size_z + margin_end; ++z) { - float val = noise->get_noise_3d(x + (position_x * size_x), 0, z + (position_z * size_z)); val *= scale_factor; @@ -258,9 +256,7 @@ Array TerrainJob::bake_mesh_array_uv(Array arr, Ref tex, const float mu if (colors.size() < uvs.size()) colors.resize(uvs.size()); -#if !GODOT4 img->lock(); -#endif for (int i = 0; i < uvs.size(); ++i) { Vector2 uv = uvs[i]; @@ -274,9 +270,7 @@ Array TerrainJob::bake_mesh_array_uv(Array arr, Ref tex, const float mu colors.set(i, colors[i] * c * mul_color); } -#if !GODOT4 img->unlock(); -#endif arr[VisualServer::ARRAY_COLOR] = colors; @@ -284,7 +278,6 @@ Array TerrainJob::bake_mesh_array_uv(Array arr, Ref tex, const float mu } void TerrainJob::chunk_exit_tree() { - _in_tree = false; if (get_complete()) { diff --git a/modules/terraman/world/jobs/terrain_job.h b/modules/terraman/world/jobs/terrain_job.h index 0cec7c755..441071173 100644 --- a/modules/terraman/world/jobs/terrain_job.h +++ b/modules/terraman/world/jobs/terrain_job.h @@ -22,31 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "scene/resources/texture.h" #if THREAD_POOL_PRESENT #include "../../../thread_pool/thread_pool_job.h" #else - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/reference.h" -#else #include "core/reference.h" #endif -#endif - #include "../../defines.h" -#if GODOT4 -#define Texture Texture2D -#endif - class TerrainChunk; #if THREAD_POOL_PRESENT diff --git a/modules/terraman/world/jobs/terrain_light_job.cpp b/modules/terraman/world/jobs/terrain_light_job.cpp index 8f4468df3..8f356adfe 100644 --- a/modules/terraman/world/jobs/terrain_light_job.cpp +++ b/modules/terraman/world/jobs/terrain_light_job.cpp @@ -24,8 +24,8 @@ SOFTWARE. #include "../../defines.h" -#include "../../library/terrain_surface.h" #include "../../library/terrain_library.h" +#include "../../library/terrain_surface.h" #include "../../meshers/terrain_mesher.h" #include "../default/terrain_chunk_default.h" diff --git a/modules/terraman/world/jobs/terrain_light_job.h b/modules/terraman/world/jobs/terrain_light_job.h index 7ff2654cf..aba6e77f5 100644 --- a/modules/terraman/world/jobs/terrain_light_job.h +++ b/modules/terraman/world/jobs/terrain_light_job.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_job.h" class TerrainMesher; diff --git a/modules/terraman/world/jobs/terrain_mesher_job_step.h b/modules/terraman/world/jobs/terrain_mesher_job_step.h index 05ee84e26..0f59bff1d 100644 --- a/modules/terraman/world/jobs/terrain_mesher_job_step.h +++ b/modules/terraman/world/jobs/terrain_mesher_job_step.h @@ -22,19 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/ref_counted.h" -#ifndef Reference -#define Reference RefCounted -#endif -#else #include "core/reference.h" -#endif #ifdef MESH_UTILS_PRESENT #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" @@ -66,19 +54,19 @@ public: int get_lod_index() const; void set_lod_index(const int value); - #ifdef MESH_UTILS_PRESENT - Ref get_fqms(); - void set_fqms(const Ref &val); +#ifdef MESH_UTILS_PRESENT + Ref get_fqms(); + void set_fqms(const Ref &val); - float get_simplification_step_ratio() const; - void set_simplification_step_ratio(const float value); + float get_simplification_step_ratio() const; + void set_simplification_step_ratio(const float value); - int get_simplification_steps() const; - void set_simplification_steps(const int value); + int get_simplification_steps() const; + void set_simplification_steps(const int value); - float get_simplification_agressiveness() const; - void set_simplification_agressiveness(const float value); - #endif + float get_simplification_agressiveness() const; + void set_simplification_agressiveness(const float value); +#endif TerrainMesherJobStep(); ~TerrainMesherJobStep(); @@ -89,12 +77,12 @@ protected: TerrainMesherJobStepType _job_type; int _lod_index; - #ifdef MESH_UTILS_PRESENT - Ref _fqms; - float _simplification_step_ratio; - int _simplification_steps; - float _simplification_agressiveness; - #endif +#ifdef MESH_UTILS_PRESENT + Ref _fqms; + float _simplification_step_ratio; + int _simplification_steps; + float _simplification_agressiveness; +#endif }; VARIANT_ENUM_CAST(TerrainMesherJobStep::TerrainMesherJobStepType); diff --git a/modules/terraman/world/jobs/terrain_prop_job.cpp b/modules/terraman/world/jobs/terrain_prop_job.cpp index 2351a8ab6..20cebf83e 100644 --- a/modules/terraman/world/jobs/terrain_prop_job.cpp +++ b/modules/terraman/world/jobs/terrain_prop_job.cpp @@ -24,15 +24,15 @@ SOFTWARE. #include "../../defines.h" +#include "../../library/terrain_library.h" #include "../../library/terrain_material_cache.h" #include "../../library/terrain_surface.h" -#include "../../library/terrain_library.h" #include "../../meshers/default/terrain_mesher_default.h" #include "../../meshers/terrain_mesher.h" #include "../default/terrain_chunk_default.h" -#include "servers/physics_server.h" #include "scene/resources/world.h" +#include "servers/physics_server.h" #ifdef MESH_DATA_RESOURCE_PRESENT #include "../../../mesh_data_resource/mesh_data_resource.h" @@ -302,7 +302,7 @@ void TerrainPropJob::phase_setup() { #if MESH_DATA_RESOURCE_PRESENT for (int i = 0; i < _chunk->mesh_data_resource_get_count(); ++i) { - Ref tex = _chunk->mesh_data_resource_get_texture(i); + Ref tex = _chunk->mesh_data_resource_get_texture(i); if (!tex.is_valid()) continue; @@ -391,11 +391,7 @@ void TerrainPropJob::phase_steps() { mesh_rid = chunk->mesh_rid_get_index(TerrainChunkDefault::MESH_INDEX_PROP, TerrainChunkDefault::MESH_TYPE_INDEX_MESH, i); if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) -#if !GODOT4 VS::get_singleton()->mesh_remove_surface(mesh_rid, 0); -#else - VS::get_singleton()->mesh_clear(mesh_rid); -#endif } } } diff --git a/modules/terraman/world/jobs/terrain_prop_job.h b/modules/terraman/world/jobs/terrain_prop_job.h index 5644de501..87ba3ad81 100644 --- a/modules/terraman/world/jobs/terrain_prop_job.h +++ b/modules/terraman/world/jobs/terrain_prop_job.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_job.h" #include "terrain_mesher_job_step.h" diff --git a/modules/terraman/world/jobs/terrain_terrain_job.cpp b/modules/terraman/world/jobs/terrain_terrain_job.cpp index b7c2e12cd..86460b76f 100644 --- a/modules/terraman/world/jobs/terrain_terrain_job.cpp +++ b/modules/terraman/world/jobs/terrain_terrain_job.cpp @@ -325,11 +325,7 @@ void TerrainTerrainJob::phase_terrain_mesh() { mesh_rid = chunk->mesh_rid_get_index(TerrainChunkDefault::MESH_INDEX_TERRAIN, TerrainChunkDefault::MESH_TYPE_INDEX_MESH, i); if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) -#if !GODOT4 VS::get_singleton()->mesh_remove_surface(mesh_rid, 0); -#else - VS::get_singleton()->mesh_clear(mesh_rid); -#endif } } } @@ -389,11 +385,7 @@ void TerrainTerrainJob::phase_terrain_mesh() { } if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) -#if !GODOT4 VS::get_singleton()->mesh_remove_surface(mesh_rid, 0); -#else - VS::get_singleton()->mesh_clear(mesh_rid); -#endif if (should_return()) { return; diff --git a/modules/terraman/world/jobs/terrain_terrain_job.h b/modules/terraman/world/jobs/terrain_terrain_job.h index 6fcc0be89..78f0b3934 100644 --- a/modules/terraman/world/jobs/terrain_terrain_job.h +++ b/modules/terraman/world/jobs/terrain_terrain_job.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_job.h" #include "terrain_mesher_job_step.h" @@ -33,9 +30,7 @@ SOFTWARE. #include pool_vector_h -include_pool_vector - - class TerrainMesher; +class TerrainMesher; class TerrainTerrainJob : public TerrainJob { GDCLASS(TerrainTerrainJob, TerrainJob); @@ -82,7 +77,7 @@ protected: Ref _mesher; Ref _liquid_mesher; - Vector > _job_steps; + Vector> _job_steps; int _current_job_step; int _current_mesh; diff --git a/modules/terraman/world/terrain_chunk.cpp b/modules/terraman/world/terrain_chunk.cpp index 912c41a87..1bc965d3f 100644 --- a/modules/terraman/world/terrain_chunk.cpp +++ b/modules/terraman/world/terrain_chunk.cpp @@ -543,15 +543,11 @@ PoolByteArray TerrainChunk::channel_get_compressed(const int channel_index) cons int bound = LZ4_compressBound(size); arr.resize(bound); -#if !GODOT4 PoolByteArray::Write w = arr.write(); int ns = LZ4_compress_default(reinterpret_cast(ch), reinterpret_cast(w.ptr()), size, bound); w.release(); -#else - int ns = LZ4_compress_default(reinterpret_cast(ch), reinterpret_cast(arr.ptrw()), size, bound); -#endif arr.resize(ns); return arr; @@ -577,19 +573,12 @@ void TerrainChunk::channel_set_compressed(const int channel_index, const PoolByt int ds = data.size(); -#if !GODOT4 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 - //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 } _FORCE_INLINE_ int TerrainChunk::get_index(const int x, const int z) const { diff --git a/modules/terraman/world/terrain_chunk.h b/modules/terraman/world/terrain_chunk.h index 8fd42940a..66d0feda8 100644 --- a/modules/terraman/world/terrain_chunk.h +++ b/modules/terraman/world/terrain_chunk.h @@ -22,27 +22,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/config/engine.h" -#include "core/io/resource.h" -#include "core/string/ustring.h" -#include "core/variant/array.h" -#else #include "core/array.h" #include "core/engine.h" #include "core/resource.h" #include "core/ustring.h" -#endif #include "../defines.h" #include pool_vector_h -include_pool_vector #include "core/os/mutex.h" #include "core/os/thread.h" @@ -62,13 +49,8 @@ include_pool_vector #include "core/version.h" -#if VERSION_MAJOR >= 4 -#define Texture Texture2D -#endif - -#include "../library/terrain_surface.h" #include "../library/terrain_library.h" - ; //hackfix for a clang format issue +#include "../library/terrain_surface.h" class TerrainJob; class TerrainWorld; diff --git a/modules/terraman/world/terrain_environment_data.cpp b/modules/terraman/world/terrain_environment_data.cpp index 711605806..beacca19d 100644 --- a/modules/terraman/world/terrain_environment_data.cpp +++ b/modules/terraman/world/terrain_environment_data.cpp @@ -87,11 +87,7 @@ TerrainEnvironmentData::~TerrainEnvironmentData() { } void TerrainEnvironmentData::_bind_methods() { -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_setup", PropertyInfo(Variant::OBJECT, "world_environment", PROPERTY_HINT_RESOURCE_TYPE, "WorldEnvironment"), PropertyInfo(Variant::OBJECT, "primary_light", PROPERTY_HINT_RESOURCE_TYPE, "DirectionalLight"), PropertyInfo(Variant::OBJECT, "secondary_light", PROPERTY_HINT_RESOURCE_TYPE, "DirectionalLight"))); -#else - GDVIRTUAL_BIND(_setup, "world_environment", "primary_light", "secondary_light"); -#endif ClassDB::bind_method(D_METHOD("get_environment"), &TerrainEnvironmentData::get_environment); ClassDB::bind_method(D_METHOD("set_environment", "value"), &TerrainEnvironmentData::set_environment); diff --git a/modules/terraman/world/terrain_environment_data.h b/modules/terraman/world/terrain_environment_data.h index 6bfb4472a..096892660 100644 --- a/modules/terraman/world/terrain_environment_data.h +++ b/modules/terraman/world/terrain_environment_data.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/math/color.h" -#else #include "core/color.h" #include "core/resource.h" -#endif #include "../defines.h" @@ -59,10 +49,6 @@ public: void setup(WorldEnvironment *world_environment, DirectionalLight *primary_light, DirectionalLight *secondary_light); void setup_bind(Node *world_environment, Node *primary_light, Node *secondary_light); -#if VERSION_MAJOR >= 4 - GDVIRTUAL3(_setup, WorldEnvironment *, DirectionalLight *, DirectionalLight *); -#endif - TerrainEnvironmentData(); ~TerrainEnvironmentData(); diff --git a/modules/terraman/world/terrain_structure.cpp b/modules/terraman/world/terrain_structure.cpp index 5b187308a..8a226d186 100644 --- a/modules/terraman/world/terrain_structure.cpp +++ b/modules/terraman/world/terrain_structure.cpp @@ -82,11 +82,7 @@ TerrainStructure::~TerrainStructure() { } void TerrainStructure::_bind_methods() { -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_write_to_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); -#else - GDVIRTUAL_BIND(_write_to_chunk, "chunk"); -#endif ClassDB::bind_method(D_METHOD("get_use_aabb"), &TerrainStructure::get_use_aabb); ClassDB::bind_method(D_METHOD("set_use_aabb", "value"), &TerrainStructure::set_use_aabb); diff --git a/modules/terraman/world/terrain_structure.h b/modules/terraman/world/terrain_structure.h index c6ef4fe19..e8edb1c60 100644 --- a/modules/terraman/world/terrain_structure.h +++ b/modules/terraman/world/terrain_structure.h @@ -22,27 +22,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/templates/hash_map.h" -#else #include "core/hash_map.h" #include "core/resource.h" -#endif #include "../defines.h" #include pool_vector_h -include_pool_vector + #include "core/math/aabb.h" #include "terrain_chunk.h" - class TerrainStructure : public Resource { +class TerrainStructure : public Resource { GDCLASS(TerrainStructure, Resource); public: @@ -65,10 +55,6 @@ public: void write_to_chunk(Ref chunk); -#if VERSION_MAJOR >= 4 - GDVIRTUAL1(_write_to_chunk, Ref); -#endif - TerrainStructure(); ~TerrainStructure(); diff --git a/modules/terraman/world/terrain_world.cpp b/modules/terraman/world/terrain_world.cpp index fc06c4c47..6f625944b 100644 --- a/modules/terraman/world/terrain_world.cpp +++ b/modules/terraman/world/terrain_world.cpp @@ -22,8 +22,6 @@ SOFTWARE. #include "terrain_world.h" -#include "core/version.h" - #include "core/message_queue.h" #include "terrain_chunk.h" #include "terrain_structure.h" @@ -400,12 +398,7 @@ Ref TerrainWorld::chunk_create(const int x, const int z) { void TerrainWorld::chunk_setup(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); -#if VERSION_MAJOR < 4 call("_create_chunk", chunk->get_position_x(), chunk->get_position_z(), chunk); -#else - Ref c; - GDVIRTUAL_CALL(_create_chunk, chunk->get_position_x(), chunk->get_position_z(), chunk, c); -#endif } Ref TerrainWorld::_create_chunk(const int x, const int z, Ref chunk) { @@ -983,11 +976,7 @@ void TerrainWorld::_notification(int p_what) { } } -#if VERSION_MAJOR > 3 - if (_is_priority_generation && _generation_queue.is_empty() && _generating.is_empty()) { -#else if (_is_priority_generation && _generation_queue.empty() && _generating.empty()) { -#endif _is_priority_generation = false; CALL(_generation_finished); @@ -1162,11 +1151,7 @@ void TerrainWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("voxel_structures_set"), &TerrainWorld::voxel_structures_set); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "17/17:TerrainStructure", PROPERTY_USAGE_DEFAULT, "TerrainStructure"), "voxel_structures_set", "voxel_structures_get"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_chunk_added", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); -#else - GDVIRTUAL_BIND(_chunk_added, "chunk"); -#endif ClassDB::bind_method(D_METHOD("chunk_add", "chunk", "x", "z"), &TerrainWorld::chunk_add); ClassDB::bind_method(D_METHOD("chunk_has", "x", "z"), &TerrainWorld::chunk_has); @@ -1195,18 +1180,11 @@ void TerrainWorld::_bind_methods() { ADD_SIGNAL(MethodInfo("generation_finished")); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_generation_finished")); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"), "_create_chunk", PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "z"), PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo("_prepare_chunk_for_generation", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"))); -#else - GDVIRTUAL_BIND(_generation_finished); - GDVIRTUAL_BIND(_create_chunk, "chunk", "x", "z", "chunk", "ret"); - GDVIRTUAL_BIND(_prepare_chunk_for_generation, "chunk"); - GDVIRTUAL_BIND(_generate_chunk, "chunk"); -#endif ClassDB::bind_method(D_METHOD("chunk_get_or_create", "x", "z"), &TerrainWorld::chunk_get_or_create); ClassDB::bind_method(D_METHOD("chunk_create", "x", "z"), &TerrainWorld::chunk_create); @@ -1238,27 +1216,19 @@ void TerrainWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("get_chunk_at_world_position", "world_position"), &TerrainWorld::get_chunk_at_world_position); ClassDB::bind_method(D_METHOD("get_or_create_chunk_at_world_position", "world_position"), &TerrainWorld::get_or_create_chunk_at_world_position); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::INT, "ret"), "_get_channel_index_info", PropertyInfo(Variant::INT, "channel_type", PROPERTY_HINT_ENUM, BINDING_STRING_CHANNEL_TYPE_INFO))); -#else - GDVIRTUAL_BIND(_get_channel_index_info, "channel_type", "ret"); -#endif ClassDB::bind_method(D_METHOD("get_channel_index_info", "channel_type"), &TerrainWorld::get_channel_index_info); ClassDB::bind_method(D_METHOD("_get_channel_index_info", "channel_type"), &TerrainWorld::_get_channel_index_info); ClassDB::bind_method(D_METHOD("get_editor_camera"), &TerrainWorld::get_editor_camera); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_set_voxel_with_tool", PropertyInfo(Variant::BOOL, "mode_add"), PropertyInfo(Variant::VECTOR3, "hit_position"), PropertyInfo(Variant::VECTOR3, "hit_normal"), PropertyInfo(Variant::INT, "selected_voxel"), PropertyInfo(Variant::INT, "isolevel"))); -#else - GDVIRTUAL_BIND(_set_voxel_with_tool, "mode_add", "hit_position", "hit_normal", "selected_voxel", "isolevel"); -#endif ClassDB::bind_method(D_METHOD("set_voxel_with_tool", "mode_add", "hit_position", "hit_normal", "selected_voxel", "isolevel"), &TerrainWorld::set_voxel_with_tool); ClassDB::bind_method(D_METHOD("_set_voxel_with_tool", "mode_add", "hit_position", "hit_normal", "selected_voxel", "isolevel"), &TerrainWorld::_set_voxel_with_tool); diff --git a/modules/terraman/world/terrain_world.h b/modules/terraman/world/terrain_world.h index 193da915e..9244a4041 100644 --- a/modules/terraman/world/terrain_world.h +++ b/modules/terraman/world/terrain_world.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/config/engine.h" -#include "core/templates/hash_map.h" -#else #include "core/engine.h" #include "core/hash_map.h" -#endif #include "../defines.h" @@ -196,20 +186,6 @@ public: Spatial *get_editor_camera(); -#if VERSION_MAJOR >= 4 - GDVIRTUAL1(_chunk_added, Ref); - - GDVIRTUAL0(_generation_finished); - - GDVIRTUAL3R(Ref, _create_chunk, int, int, Ref); - GDVIRTUAL1(_prepare_chunk_for_generation, Ref); - GDVIRTUAL1(_generate_chunk, Ref); - - GDVIRTUAL1R(int, _get_channel_index_info, int); - - GDVIRTUAL5(_set_voxel_with_tool, bool, Vector3, Vector3, int, int); -#endif - TerrainWorld(); ~TerrainWorld(); diff --git a/modules/terraman/world/terrain_world_editor.cpp b/modules/terraman/world/terrain_world_editor.cpp index 6e485737d..06e1ebe97 100644 --- a/modules/terraman/world/terrain_world_editor.cpp +++ b/modules/terraman/world/terrain_world_editor.cpp @@ -33,10 +33,10 @@ SOFTWARE. #include "terrain_chunk.h" -#include "../library/terrain_surface.h" #include "../library/terrain_library.h" -#include "servers/physics_server.h" +#include "../library/terrain_surface.h" #include "scene/resources/world.h" +#include "servers/physics_server.h" #include "../defines.h" @@ -44,7 +44,6 @@ SOFTWARE. #include spatial_editor_plugin_h #include camera_h -#if VERSION_MAJOR < 4 bool TerrainWorldEditor::forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { if (!_world || !_world->get_editable()) { return false; @@ -71,39 +70,6 @@ bool TerrainWorldEditor::forward_spatial_input_event(Camera *p_camera, const Ref return false; } -#else -EditorPlugin::AfterGUIInput TerrainWorldEditor::forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { - if (!_world || !_world->get_editable()) { - return EditorPlugin::AFTER_GUI_INPUT_PASS; - } - - Ref mb = p_event; - - if (mb.is_valid()) { - if (mb->is_pressed()) { - Ref lib = _world->get_library(); - - if (!lib.is_valid()) - return EditorPlugin::AFTER_GUI_INPUT_PASS; - - if (mb->get_button_index() == MouseButton::LEFT) { - if (do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true)) { - return EditorPlugin::AFTER_GUI_INPUT_STOP; - } else { - return EditorPlugin::AFTER_GUI_INPUT_PASS; - } - } else { - return EditorPlugin::AFTER_GUI_INPUT_PASS; - } - - //return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true); - } - } - - return EditorPlugin::AFTER_GUI_INPUT_PASS; -} - -#endif bool TerrainWorldEditor::do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click) { if (!spatial_editor || !_world || !_world->is_inside_world()) @@ -366,21 +332,12 @@ void TerrainWorldEditor::_bind_methods() { void TerrainWorldEditorPlugin::_notification(int p_what) { if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { switch ((int)EditorSettings::get_singleton()->get("editors/voxelman/editor_side")) { -#if VERSION_MAJOR <= 3 && VERSION_MINOR < 5 - case 0: { // Left. - SpatialEditor::get_singleton()->get_palette_split()->move_child(voxel_world_editor, 0); - } break; - case 1: { // Right. - SpatialEditor::get_singleton()->get_palette_split()->move_child(voxel_world_editor, 1); - } break; -#else case 0: { // Left. SpatialEditor::get_singleton()->move_control_to_left_panel(voxel_world_editor); } break; case 1: { // Right. SpatialEditor::get_singleton()->move_control_to_right_panel(voxel_world_editor); } break; -#endif } } } diff --git a/modules/terraman/world/terrain_world_editor.h b/modules/terraman/world/terrain_world_editor.h index 5b2060221..3d21b08b7 100644 --- a/modules/terraman/world/terrain_world_editor.h +++ b/modules/terraman/world/terrain_world_editor.h @@ -28,13 +28,6 @@ SOFTWARE. #include "editor/editor_node.h" #include "editor/editor_plugin.h" -#include "../defines.h" - -#if VERSION_MAJOR > 3 -#include "core/math/transform_3d.h" -typedef class Transform3D Transform; -#endif - class TerrainWorld; class SpatialEditorPlugin; @@ -48,11 +41,7 @@ public: }; public: -#if VERSION_MAJOR < 4 bool forward_spatial_input_event(Camera *p_camera, const Ref &p_event); -#else - EditorPlugin::AfterGUIInput forward_spatial_input_event(Camera *p_camera, const Ref &p_event); -#endif void edit(TerrainWorld *p_world); bool do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click); @@ -102,13 +91,8 @@ protected: void _notification(int p_what); public: -#if VERSION_MAJOR < 4 bool forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } virtual bool forward_spatial_gui_input(int p_index, Camera *p_camera, const Ref &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } -#else - EditorPlugin::AfterGUIInput forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } - virtual EditorPlugin::AfterGUIInput forward_spatial_gui_input(int p_index, Camera *p_camera, const Ref &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } -#endif virtual String get_name() const { return "TerrainWorldEditor"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object);