From 9bd800489580680d4b778d78cc7b2449092caefd Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 6 Feb 2021 11:49:29 +0100 Subject: [PATCH] Fix compile for 4.0. --- README.md | 2 +- defines.h | 2 +- fast_quadratic_mesh_simplifier.h | 8 +++++++- mesh_merger.h | 12 ++++++++++-- mesh_utils.h | 6 ++++++ register_types.cpp | 7 +++++++ simplify.h | 10 +++++++++- 7 files changed, 41 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 33c4cd7..df1e96a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is a c++ engine module for the Godot engine, containing my mesh merging utilities. -It supports both godot 3.2 and 4.0 (master). Note that since 4.0 is still in very early stages I only +It supports both godot 3.2 and 4.0 (master [last tested commit](https://github.com/godotengine/godot/commit/b7e10141197fdd9b0dbc4cfa7890329510d36540)). Note that since 4.0 is still in very early stages I only check whether it works from time to time. # Pre-built binaries diff --git a/defines.h b/defines.h index 22db1f9..7255650 100644 --- a/defines.h +++ b/defines.h @@ -18,7 +18,7 @@ #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/vector.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 \ diff --git a/fast_quadratic_mesh_simplifier.h b/fast_quadratic_mesh_simplifier.h index 437d907..ebd4cd9 100644 --- a/fast_quadratic_mesh_simplifier.h +++ b/fast_quadratic_mesh_simplifier.h @@ -25,9 +25,15 @@ SOFTWARE. */ -#include "core/reference.h" +#include "core/version.h" +#if VERSION_MAJOR > 3 +#include "core/object/reference.h" +#include "core/variant/array.h" +#else +#include "core/reference.h" #include "core/array.h" +#endif #include "simplify.h" diff --git a/mesh_merger.h b/mesh_merger.h index a164a67..8c8de75 100644 --- a/mesh_merger.h +++ b/mesh_merger.h @@ -25,7 +25,17 @@ SOFTWARE. #ifndef MESH_MERGER_H #define MESH_MERGER_H +#include "core/version.h" + +#if VERSION_MAJOR > 3 +#include "core/object/reference.h" +#include "core/templates/vector.h" +#include "core/math/color.h" +#else #include "core/reference.h" +#include "core/vector.h" +#include "core/color.h" +#endif #include "defines.h" @@ -34,11 +44,9 @@ include_pool_vector #include mesh_instance_h -#include "core/color.h" #include "core/math/rect2.h" #include "core/math/vector2.h" #include "core/math/vector3.h" -#include "core/vector.h" #include "scene/main/node.h" #include "scene/resources/material.h" #include "scene/resources/mesh.h" diff --git a/mesh_utils.h b/mesh_utils.h index 2f9a7b6..75b4f92 100644 --- a/mesh_utils.h +++ b/mesh_utils.h @@ -23,7 +23,13 @@ SOFTWARE. #ifndef MESH_UTILS_H #define MESH_UTILS_H +#include "core/version.h" + +#if VERSION_MAJOR > 3 +#include "core/object/object.h" +#else #include "core/object.h" +#endif #include "scene/resources/texture.h" diff --git a/register_types.cpp b/register_types.cpp index 2bfc690..5b3a301 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -24,7 +24,14 @@ SOFTWARE. #include "register_types.h" +#include "core/version.h" + +#if VERSION_MAJOR > 3 +#include "core/config/engine.h" +#else #include "core/engine.h" +#endif + #include "fast_quadratic_mesh_simplifier.h" #include "mesh_merger.h" #include "mesh_utils.h" diff --git a/simplify.h b/simplify.h index 6aedfa9..75b0d2f 100644 --- a/simplify.h +++ b/simplify.h @@ -14,10 +14,18 @@ // // 5/2016: Chris Rorden created minimal version for OSX/Linux/Windows compile +#include "core/version.h" + +#if VERSION_MAJOR > 3 +#include "core/string/ustring.h" +#include "core/variant/array.h" +#else +#include "core/ustring.h" #include "core/array.h" +#endif + #include "core/math/vector2.h" #include "core/math/vector3.h" -#include "core/ustring.h" #include "scene/resources/mesh.h" #include //FLT_EPSILON, DBL_EPSILON