mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-12 15:01:09 +01:00
Optional module dependencies are actually optional now.
This commit is contained in:
parent
8b78f8e91d
commit
a4fc573f85
17
SCsub
17
SCsub
@ -4,20 +4,27 @@ Import('env')
|
||||
|
||||
module_env = env.Clone()
|
||||
|
||||
has_texture_packer = False
|
||||
if os.path.isdir('../texture_packer'):
|
||||
module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT'])
|
||||
has_texture_packer = True
|
||||
|
||||
if os.path.isdir('../mesh_data_resource'):
|
||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||
|
||||
if os.path.isdir('../props'):
|
||||
module_env.Append(CPPDEFINES=['PROPS_PRESENT'])
|
||||
|
||||
sources = [
|
||||
|
||||
"register_types.cpp",
|
||||
|
||||
"library/voxelman_library.cpp",
|
||||
"library/voxelman_library_simple.cpp",
|
||||
"library/voxelman_library_merger.cpp",
|
||||
|
||||
|
||||
"library/voxel_surface.cpp",
|
||||
"library/voxel_surface_simple.cpp",
|
||||
"library/voxel_surface_merger.cpp",
|
||||
|
||||
"data/voxel_light.cpp",
|
||||
|
||||
@ -46,7 +53,6 @@ sources = [
|
||||
"meshers/cubic_mesher/voxel_mesher_cubic.cpp",
|
||||
"meshers/cubic_mesher/voxel_cube_points.cpp",
|
||||
|
||||
|
||||
"level_generator/voxelman_level_generator.cpp",
|
||||
|
||||
"areas/world_area.cpp",
|
||||
@ -56,6 +62,11 @@ sources = [
|
||||
"thirdparty/lz4/lz4.c"
|
||||
]
|
||||
|
||||
if has_texture_packer:
|
||||
sources.append("library/voxelman_library_merger.cpp")
|
||||
sources.append("library/voxel_surface_merger.cpp")
|
||||
|
||||
|
||||
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
||||
# Shared lib compilation
|
||||
module_env.Append(CCFLAGS=['-fPIC'])
|
||||
|
@ -50,13 +50,6 @@ void VoxelSurface::set_rect(const VoxelSurfaceSides side, const Rect2 rect) {
|
||||
_rects[side] = rect;
|
||||
}
|
||||
|
||||
Ref<GroundClutter> VoxelSurface::get_clutter() {
|
||||
return _clutter;
|
||||
}
|
||||
void VoxelSurface::set_clutter(Ref<GroundClutter> clutter) {
|
||||
_clutter = clutter;
|
||||
}
|
||||
|
||||
Ref<VoxelmanLibrary> VoxelSurface::get_library() const {
|
||||
return Ref<VoxelmanLibrary>(_library);
|
||||
}
|
||||
@ -124,10 +117,6 @@ void VoxelSurface::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_transparent"), &VoxelSurface::is_transparent);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent"), "set_transparent", "is_transparent");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_clutter"), &VoxelSurface::get_clutter);
|
||||
ClassDB::bind_method(D_METHOD("set_clutter"), &VoxelSurface::set_clutter);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "clutter", PROPERTY_HINT_RESOURCE_TYPE, "GroundClutter"), "set_clutter", "get_clutter");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_rect", "side"), &VoxelSurface::get_rect);
|
||||
ClassDB::bind_method(D_METHOD("set_rect", "side", "rect"), &VoxelSurface::set_rect);
|
||||
|
||||
|
@ -30,11 +30,9 @@ SOFTWARE.
|
||||
#include "core/vector.h"
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
#include "../../props/clutter/ground_clutter.h"
|
||||
#include "voxelman_library.h"
|
||||
|
||||
class VoxelmanLibrary;
|
||||
class GroundClutter;
|
||||
|
||||
class VoxelSurface : public Resource {
|
||||
GDCLASS(VoxelSurface, Resource)
|
||||
@ -78,9 +76,6 @@ public:
|
||||
Rect2 get_rect(const VoxelSurfaceSides side) const;
|
||||
void set_rect(const VoxelSurfaceSides side, const Rect2 rect);
|
||||
|
||||
Ref<GroundClutter> get_clutter();
|
||||
void set_clutter(Ref<GroundClutter> clutter);
|
||||
|
||||
Ref<VoxelmanLibrary> get_library() const;
|
||||
void set_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
@ -101,7 +96,6 @@ protected:
|
||||
int _mesher_index;
|
||||
bool _is_transparent;
|
||||
Rect2 _rects[VOXEL_SIDES_COUNT];
|
||||
Ref<GroundClutter> _clutter;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(VoxelSurface::VoxelSurfaceSides);
|
||||
|
@ -408,6 +408,7 @@ void VoxelMesher::add_chunk_liquid(Ref<VoxelChunk> chunk) {
|
||||
call("_add_chunk_liquid", chunk);
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
void VoxelMesher::add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position, const Vector3 rotation, const Vector3 scale, const Rect2 uv_rect) {
|
||||
Transform transform = Transform(Basis(rotation).scaled(scale), position);
|
||||
|
||||
@ -536,6 +537,7 @@ void VoxelMesher::add_mesh_data_resource_transform(Ref<MeshDataResource> mesh, c
|
||||
add_indices(ic + index);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void VoxelMesher::add_mesher(const Ref<VoxelMesher> &mesher) {
|
||||
call("_add_mesher", mesher);
|
||||
@ -964,8 +966,10 @@ void VoxelMesher::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("add_chunk", "chunk"), &VoxelMesher::add_chunk);
|
||||
ClassDB::bind_method(D_METHOD("add_chunk_liquid", "chunk"), &VoxelMesher::add_chunk_liquid);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource", "mesh", "position", "rotation", "scale", "uv_rect"), &VoxelMesher::add_mesh_data_resource, DEFVAL(Rect2(0, 0, 1, 1)), DEFVAL(Vector3(1.0, 1.0, 1.0)), DEFVAL(Vector3()), DEFVAL(Vector3()));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform", "mesh", "transform", "uv_rect"), &VoxelMesher::add_mesh_data_resource_transform, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
#endif
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_add_mesher", PropertyInfo(Variant::OBJECT, "mesher", PROPERTY_HINT_RESOURCE_TYPE, "VoxelMesher")));
|
||||
ClassDB::bind_method(D_METHOD("add_mesher", "mesher"), &VoxelMesher::add_mesher);
|
||||
|
@ -38,7 +38,10 @@ SOFTWARE.
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
#include "../library/voxelman_library.h"
|
||||
|
||||
const double PI_2 = 3.141592653589793238463 / 2;
|
||||
@ -114,8 +117,10 @@ public:
|
||||
|
||||
void add_chunk_liquid(Ref<VoxelChunk> chunk);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
void add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position = Vector3(0, 0, 0), const Vector3 rotation = Vector3(0, 0, 0), const Vector3 scale = Vector3(1.0, 1.0, 1.0), const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform(Ref<MeshDataResource> mesh, const Transform transform, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
#endif
|
||||
|
||||
void add_mesher(const Ref<VoxelMesher> &mesher);
|
||||
void _add_mesher(const Ref<VoxelMesher> &mesher);
|
||||
|
@ -23,13 +23,16 @@ SOFTWARE.
|
||||
#include "register_types.h"
|
||||
|
||||
#include "library/voxel_surface.h"
|
||||
#include "library/voxel_surface_merger.h"
|
||||
#include "library/voxel_surface_simple.h"
|
||||
|
||||
#include "library/voxelman_library.h"
|
||||
#include "library/voxelman_library_merger.h"
|
||||
#include "library/voxelman_library_simple.h"
|
||||
|
||||
#ifdef TEXTURE_PACKER_PRESENT
|
||||
#include "library/voxel_surface_merger.h"
|
||||
#include "library/voxelman_library_merger.h"
|
||||
#endif
|
||||
|
||||
#include "data/voxel_light.h"
|
||||
#include "meshers/transvoxel_uv_mesher/transvoxel_cell_data.h"
|
||||
#include "meshers/transvoxel_uv_mesher/voxel_mesher_uv_transvoxel.h"
|
||||
@ -65,11 +68,14 @@ void register_voxelman_types() {
|
||||
|
||||
ClassDB::register_class<VoxelSurface>();
|
||||
ClassDB::register_class<VoxelSurfaceSimple>();
|
||||
ClassDB::register_class<VoxelSurfaceMerger>();
|
||||
|
||||
ClassDB::register_class<VoxelmanLibrary>();
|
||||
ClassDB::register_class<VoxelmanLibrarySimple>();
|
||||
|
||||
#ifdef TEXTURE_PACKER_PRESENT
|
||||
ClassDB::register_class<VoxelSurfaceMerger>();
|
||||
ClassDB::register_class<VoxelmanLibraryMerger>();
|
||||
#endif
|
||||
|
||||
ClassDB::register_class<VoxelLight>();
|
||||
|
||||
|
@ -52,7 +52,6 @@ SOFTWARE.
|
||||
#include "../../library/voxel_surface.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
#include "../../../mesh_data_resource/mesh_data_resource.h"
|
||||
#include "../voxel_chunk_prop_data.h"
|
||||
|
||||
class VoxelWorld;
|
||||
|
@ -50,8 +50,6 @@ SOFTWARE.
|
||||
#include "../library/voxel_surface.h"
|
||||
#include "../library/voxelman_library.h"
|
||||
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
|
||||
#include "voxel_chunk_prop_data.h"
|
||||
|
||||
class VoxelWorld;
|
||||
|
Loading…
Reference in New Issue
Block a user