Skip to content

Commit

Permalink
Fix compile for 4.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Relintai committed Feb 6, 2021
1 parent fd464c0 commit 547aeaa
Show file tree
Hide file tree
Showing 27 changed files with 217 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is an engine module! Which means that you will need to compile it into Godo

You can find a demonstration project here: https://github.com/Relintai/the_tower

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.

## Optional Dependencies
Expand Down
10 changes: 9 additions & 1 deletion areas/world_area.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ SOFTWARE.
#ifndef WORLD_AREA_H
#define WORLD_AREA_H

#include "core/version.h"

#if VERSION_MAJOR > 3
#include "core/object/reference.h"
#include "core/string/ustring.h"
#else
#include "core/reference.h"
#include "core/ustring.h"
#endif

#include "core/math/aabb.h"
#include "core/ustring.h"

#include "scene/resources/texture.h"

class WorldArea : public Reference {
Expand Down
10 changes: 9 additions & 1 deletion data/voxel_light.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ SOFTWARE.
#ifndef VOXEL_LIGHT_H
#define VOXEL_LIGHT_H

#include "core/color.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

class VoxelLight : public Reference {
GDCLASS(VoxelLight, Reference);
Expand Down
2 changes: 1 addition & 1 deletion defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 6 additions & 0 deletions level_generator/voxelman_level_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ SOFTWARE.
#ifndef VOXELMAN_LEVEL_GENERATOR_H
#define VOXELMAN_LEVEL_GENERATOR_H

#include "core/version.h"

#if VERSION_MAJOR > 3
#include "core/io/resource.h"
#else
#include "core/resource.h"
#endif

class VoxelChunk;

Expand Down
13 changes: 11 additions & 2 deletions library/voxel_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ SOFTWARE.
#ifndef VOXEL_SURFACE_H
#define VOXEL_SURFACE_H

#include "core/resource.h"

#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/resource.h"
#include "core/vector.h"
#include "core/color.h"
#endif

#include "core/math/rect2.h"
#include "core/vector.h"
#include "scene/resources/material.h"

#include "voxelman_library.h"
Expand Down
9 changes: 8 additions & 1 deletion library/voxelman_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ SOFTWARE.
#ifndef VOXELMAN_LIBRARY_H
#define VOXELMAN_LIBRARY_H

#include "core/math/rect2.h"
#include "core/version.h"

#if VERSION_MAJOR > 3
#include "core/io/resource.h"
#else
#include "core/resource.h"
#endif

#include "core/math/rect2.h"
#include "scene/resources/material.h"

#include "../data/voxel_light.h"
Expand Down
12 changes: 10 additions & 2 deletions library/voxelman_library_merger.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ SOFTWARE.
#ifndef VOXELMAN_LIBRARY_MERGER_H
#define VOXELMAN_LIBRARY_MERGER_H

#include "voxelman_library.h"
#include "core/version.h"

#include "core/map.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 "voxelman_library.h"

#include "scene/resources/material.h"

#include "../data/voxel_light.h"
Expand Down
9 changes: 8 additions & 1 deletion library/voxelman_library_simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ SOFTWARE.
#ifndef VOXELMAN_LIBRARY_SIMPLE_H
#define VOXELMAN_LIBRARY_SIMPLE_H

#include "voxelman_library.h"
#include "core/version.h"

#if VERSION_MAJOR > 3
#include "core/io/resource.h"
#else
#include "core/resource.h"
#endif

#include "voxelman_library.h"

#include "scene/resources/material.h"

#include "../data/voxel_light.h"
Expand Down
7 changes: 7 additions & 0 deletions meshers/blocky/voxel_mesher_blocky.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ SOFTWARE.
#ifndef VOXEL_MESHER_BLOCKY_H
#define VOXEL_MESHER_BLOCKY_H

#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"

Expand Down
7 changes: 7 additions & 0 deletions meshers/blocky/voxel_mesher_liquid_blocky.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ SOFTWARE.
#ifndef VOXEL_MESHER_LIQUID_BLOCKY_H
#define VOXEL_MESHER_LIQUID_BLOCKY_H

#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"

Expand Down
7 changes: 7 additions & 0 deletions meshers/cubic/voxel_cube_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ SOFTWARE.
#ifndef SUB_VOXEL_POINTS_H
#define SUB_VOXEL_POINTS_H

#include "core/version.h"

#if VERSION_MAJOR > 3
#include "core/object/reference.h"
#include "core/templates/vector.h"
#else
#include "core/reference.h"
#include "core/vector.h"
#endif

class VoxelChunk;
class SubVoxelFacePointsHelper;
Expand Down
7 changes: 7 additions & 0 deletions meshers/cubic/voxel_mesher_cubic.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ SOFTWARE.
#ifndef VOXEL_MESHER_CUBIC_H
#define VOXEL_MESHER_CUBIC_H

#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"

Expand Down
7 changes: 7 additions & 0 deletions meshers/default/voxel_mesher_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ SOFTWARE.
#ifndef VOXEL_MESHER_DEFAULT_H
#define VOXEL_MESHER_DEFAULT_H

#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"

Expand Down
6 changes: 6 additions & 0 deletions meshers/marching_cubes/marching_cubes_cell_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ SOFTWARE.
#ifndef MARCHING_CUBES_CELL_DATA_H
#define MARCHING_CUBES_CELL_DATA_H

#include "core/version.h"

#if VERSION_MAJOR > 3
#include "core/object/reference.h"
#else
#include "core/reference.h"
#endif

#include "marching_cubes_tables.h"

Expand Down
12 changes: 10 additions & 2 deletions meshers/marching_cubes/voxel_mesher_marching_cubes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,20 @@ 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/variant/array.h"
#include "core/variant/dictionary.h"
#else
#include "core/array.h"
#include "core/dictionary.h"
#endif

#include "voxel_mesher_marching_cubes.h"

#include "../../world/default/voxel_chunk_default.h"
#include "../../world/voxel_chunk.h"
#include "core/array.h"
#include "core/dictionary.h"

#include "../../world/jobs/voxel_job.h"

Expand Down
9 changes: 8 additions & 1 deletion meshers/marching_cubes/voxel_mesher_marching_cubes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ SOFTWARE.
#ifndef VOXEL_MESHER_MARCHING_CUBES_H
#define VOXEL_MESHER_MARCHING_CUBES_H

#include "../default/voxel_mesher_default.h"
#include "core/version.h"

#if VERSION_MAJOR > 3
#include "core/object/reference.h"
#else
#include "core/reference.h"
#endif

#include "../default/voxel_mesher_default.h"

#include "marching_cubes_cell_data.h"

Expand Down
12 changes: 10 additions & 2 deletions meshers/voxel_mesher.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ SOFTWARE.
#ifndef VOXEL_TOOLS_H
#define VOXEL_TOOLS_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"

Expand All @@ -32,11 +42,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"
Expand Down
10 changes: 9 additions & 1 deletion world/block_voxel_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@ SOFTWARE.
#ifndef BLOCK_VOXEL_STRUCTURE_H
#define BLOCK_VOXEL_STRUCTURE_H

#include "core/version.h"

#if VERSION_MAJOR > 3
#include "core/templates/vector.h"
#else
#include "core/vector.h"
#endif

#include "voxel_structure.h"

#include "../defines.h"

#include pool_vector_h
include_pool_vector
#include "core/vector.h"

#include "voxel_chunk.h"
;

Expand Down
9 changes: 9 additions & 0 deletions world/default/voxel_chunk_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,13 @@ RID VoxelChunkDefault::mesh_rid_get(const int mesh_index, const int mesh_type_in

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;
}
Expand All @@ -141,7 +146,11 @@ void VoxelChunkDefault::mesh_rid_set(const int mesh_index, const int mesh_type_i

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;
Expand Down
21 changes: 13 additions & 8 deletions world/default/voxel_chunk_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,31 @@ SOFTWARE.
#ifndef VOXEL_CHUNK_DEFAULT_H
#define VOXEL_CHUNK_DEFAULT_H

#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 "../voxel_chunk.h"

#include "../../defines.h"

#include "core/engine.h"
#include "core/os/mutex.h"
#include "core/os/thread.h"
#include "core/os/thread_safe.h"
#include "core/ustring.h"

#include "core/array.h"

#include "scene/resources/packed_scene.h"

#include "../voxel_world.h"

#include "../../data/voxel_light.h"

#include "../../meshers/voxel_mesher.h"

#include "../../library/voxel_surface.h"
#include "../../library/voxelman_library.h"

Expand Down
Loading

0 comments on commit 547aeaa

Please sign in to comment.