From 0f00761468dcd10322339892af4d483e4c9083a2 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 10 Nov 2019 22:32:36 +0100 Subject: [PATCH] More improvements to the bindings. --- world_generator/data/biome_data.cpp | 54 +++++++++++++++++++++ world_generator/data/biome_data.h | 11 +++++ world_generator/data/dungeon_data.cpp | 54 +++++++++++++++++++++ world_generator/data/dungeon_data.h | 11 +++++ world_generator/data/dungeon_room_data.cpp | 56 +++++++++++++++++++++- world_generator/data/dungeon_room_data.h | 11 +++++ world_generator/data/planet_data.cpp | 56 ++++++++++++++++++++++ world_generator/data/planet_data.h | 11 +++++ world_generator/main/biome.cpp | 9 ++++ world_generator/main/dungeon.cpp | 9 ++++ world_generator/main/dungeon_room.cpp | 10 ++++ world_generator/main/planet.cpp | 9 ++++ 12 files changed, 300 insertions(+), 1 deletion(-) diff --git a/world_generator/data/biome_data.cpp b/world_generator/data/biome_data.cpp index 37a54dc..fae3fd8 100644 --- a/world_generator/data/biome_data.cpp +++ b/world_generator/data/biome_data.cpp @@ -222,6 +222,45 @@ void BiomeData::set_voxel_surfaces(const Vector &voxel_surfaces) { } } +//// Liquid Surfaces //// +Ref BiomeData::get_liquid_voxel_surface(const int index) const { + ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref()); + + return _liquid_voxel_surfaces.get(index); +} +void BiomeData::set_liquid_voxel_surface(const int index, const Ref voxel_surface) { + ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size()); + + _liquid_voxel_surfaces.set(index, voxel_surface); +} +void BiomeData::add_liquid_voxel_surface(const Ref voxel_surface) { + _liquid_voxel_surfaces.push_back(voxel_surface); +} +void BiomeData::remove_liquid_voxel_surface(const int index) { + ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size()); + + _liquid_voxel_surfaces.remove(index); +} +int BiomeData::get_liquid_voxel_surface_count() const { + return _liquid_voxel_surfaces.size(); +} + +Vector BiomeData::get_liquid_voxel_surfaces() { + Vector r; + for (int i = 0; i < _liquid_voxel_surfaces.size(); i++) { + r.push_back(_liquid_voxel_surfaces[i].get_ref_ptr()); + } + return r; +} +void BiomeData::set_liquid_voxel_surfaces(const Vector &voxel_surfaces) { + _liquid_voxel_surfaces.clear(); + for (int i = 0; i < voxel_surfaces.size(); i++) { + Ref voxel_surface = Ref(voxel_surfaces[i]); + + _liquid_voxel_surfaces.push_back(voxel_surface); + } +} + BiomeData::BiomeData() { } @@ -229,6 +268,10 @@ BiomeData::~BiomeData() { _dungeon_datas.clear(); _prop_datas.clear(); _entity_datas.clear(); + + _environment_datas.clear(); + _voxel_surfaces.clear(); + _liquid_voxel_surfaces.clear(); } void BiomeData::_bind_methods() { @@ -298,4 +341,15 @@ void BiomeData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &BiomeData::get_voxel_surfaces); ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &BiomeData::set_voxel_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_voxel_surfaces", "get_voxel_surfaces"); + + //Liquid Surfaces + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &BiomeData::get_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "data"), &BiomeData::set_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("add_liquid_voxel_surface", "voxel_surface"), &BiomeData::add_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("remove_liquid_voxel_surface", "index"), &BiomeData::remove_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface_count"), &BiomeData::get_liquid_voxel_surface_count); + + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &BiomeData::get_liquid_voxel_surfaces); + ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &BiomeData::set_liquid_voxel_surfaces); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces"); } diff --git a/world_generator/data/biome_data.h b/world_generator/data/biome_data.h index 4e6d2a2..ef623f2 100644 --- a/world_generator/data/biome_data.h +++ b/world_generator/data/biome_data.h @@ -76,6 +76,16 @@ public: Vector get_voxel_surfaces(); void set_voxel_surfaces(const Vector &voxel_surfaces); + //Liquid Surfaces + Ref get_liquid_voxel_surface(const int index) const; + void set_liquid_voxel_surface(const int index, const Ref voxel_surface); + void add_liquid_voxel_surface(const Ref voxel_surface); + void remove_liquid_voxel_surface(const int index); + int get_liquid_voxel_surface_count() const; + + Vector get_liquid_voxel_surfaces(); + void set_liquid_voxel_surfaces(const Vector &voxel_surfaces); + BiomeData(); ~BiomeData(); @@ -93,6 +103,7 @@ private: Vector > _entity_datas; Vector > _environment_datas; Vector > _voxel_surfaces; + Vector > _liquid_voxel_surfaces; }; #endif diff --git a/world_generator/data/dungeon_data.cpp b/world_generator/data/dungeon_data.cpp index 62e0d8e..43bd2be 100644 --- a/world_generator/data/dungeon_data.cpp +++ b/world_generator/data/dungeon_data.cpp @@ -303,6 +303,45 @@ void DungeonData::set_voxel_surfaces(const Vector &voxel_surfaces) { } } +//// Liquid Surfaces //// +Ref DungeonData::get_liquid_voxel_surface(const int index) const { + ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref()); + + return _liquid_voxel_surfaces.get(index); +} +void DungeonData::set_liquid_voxel_surface(const int index, const Ref voxel_surface) { + ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size()); + + _liquid_voxel_surfaces.set(index, voxel_surface); +} +void DungeonData::add_liquid_voxel_surface(const Ref voxel_surface) { + _liquid_voxel_surfaces.push_back(voxel_surface); +} +void DungeonData::remove_liquid_voxel_surface(const int index) { + ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size()); + + _liquid_voxel_surfaces.remove(index); +} +int DungeonData::get_liquid_voxel_surface_count() const { + return _liquid_voxel_surfaces.size(); +} + +Vector DungeonData::get_liquid_voxel_surfaces() { + Vector r; + for (int i = 0; i < _liquid_voxel_surfaces.size(); i++) { + r.push_back(_liquid_voxel_surfaces[i].get_ref_ptr()); + } + return r; +} +void DungeonData::set_liquid_voxel_surfaces(const Vector &voxel_surfaces) { + _liquid_voxel_surfaces.clear(); + for (int i = 0; i < voxel_surfaces.size(); i++) { + Ref voxel_surface = Ref(voxel_surfaces[i]); + + _liquid_voxel_surfaces.push_back(voxel_surface); + } +} + //Environments Ref DungeonData::get_environment_data(const int index) const { ERR_FAIL_INDEX_V(index, _environment_datas.size(), Ref()); @@ -362,6 +401,10 @@ DungeonData::~DungeonData() { _dungeon_end_room_datas.clear(); _dungeon_corridor_datas.clear(); _entity_datas.clear(); + + _entity_datas.clear(); + _voxel_surfaces.clear(); + _liquid_voxel_surfaces.clear(); } void DungeonData::_bind_methods() { @@ -480,4 +523,15 @@ void DungeonData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &DungeonData::get_voxel_surfaces); ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &DungeonData::set_voxel_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_voxel_surfaces", "get_voxel_surfaces"); + + //Liquid Surfaces + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &DungeonData::get_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "data"), &DungeonData::set_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("add_liquid_voxel_surface", "voxel_surface"), &DungeonData::add_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("remove_liquid_voxel_surface", "index"), &DungeonData::remove_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface_count"), &DungeonData::get_liquid_voxel_surface_count); + + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &DungeonData::get_liquid_voxel_surfaces); + ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &DungeonData::set_liquid_voxel_surfaces); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces"); } diff --git a/world_generator/data/dungeon_data.h b/world_generator/data/dungeon_data.h index 4f10a92..4bfed80 100644 --- a/world_generator/data/dungeon_data.h +++ b/world_generator/data/dungeon_data.h @@ -116,6 +116,16 @@ public: Vector get_voxel_surfaces(); void set_voxel_surfaces(const Vector &voxel_surfaces); + //Liquid Surfaces + Ref get_liquid_voxel_surface(const int index) const; + void set_liquid_voxel_surface(const int index, const Ref voxel_surface); + void add_liquid_voxel_surface(const Ref voxel_surface); + void remove_liquid_voxel_surface(const int index); + int get_liquid_voxel_surface_count() const; + + Vector get_liquid_voxel_surfaces(); + void set_liquid_voxel_surfaces(const Vector &voxel_surfaces); + DungeonData(); ~DungeonData(); @@ -144,6 +154,7 @@ private: Vector > _dungeon_corridor_datas; Vector > _entity_datas; Vector > _voxel_surfaces; + Vector > _liquid_voxel_surfaces; }; #endif diff --git a/world_generator/data/dungeon_room_data.cpp b/world_generator/data/dungeon_room_data.cpp index c817efa..d889658 100644 --- a/world_generator/data/dungeon_room_data.cpp +++ b/world_generator/data/dungeon_room_data.cpp @@ -207,6 +207,45 @@ void DungeonRoomData::set_voxel_surfaces(const Vector &voxel_surfaces) } } +//// Liquid Surfaces //// +Ref DungeonRoomData::get_liquid_voxel_surface(const int index) const { + ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref()); + + return _liquid_voxel_surfaces.get(index); +} +void DungeonRoomData::set_liquid_voxel_surface(const int index, const Ref voxel_surface) { + ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size()); + + _liquid_voxel_surfaces.set(index, voxel_surface); +} +void DungeonRoomData::add_liquid_voxel_surface(const Ref voxel_surface) { + _liquid_voxel_surfaces.push_back(voxel_surface); +} +void DungeonRoomData::remove_liquid_voxel_surface(const int index) { + ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size()); + + _liquid_voxel_surfaces.remove(index); +} +int DungeonRoomData::get_liquid_voxel_surface_count() const { + return _liquid_voxel_surfaces.size(); +} + +Vector DungeonRoomData::get_liquid_voxel_surfaces() { + Vector r; + for (int i = 0; i < _liquid_voxel_surfaces.size(); i++) { + r.push_back(_liquid_voxel_surfaces[i].get_ref_ptr()); + } + return r; +} +void DungeonRoomData::set_liquid_voxel_surfaces(const Vector &voxel_surfaces) { + _liquid_voxel_surfaces.clear(); + for (int i = 0; i < voxel_surfaces.size(); i++) { + Ref voxel_surface = Ref(voxel_surfaces[i]); + + _liquid_voxel_surfaces.push_back(voxel_surface); + } +} + DungeonRoomData::DungeonRoomData() { _min_sizex = 0; _min_sizey = 0; @@ -217,7 +256,11 @@ DungeonRoomData::DungeonRoomData() { _max_sizez = 0; } DungeonRoomData::~DungeonRoomData() { - + _prop_datas.clear(); + _entity_datas.clear(); + _environment_datas.clear(); + _voxel_surfaces.clear(); + _liquid_voxel_surfaces.clear(); } void DungeonRoomData::_bind_methods() { @@ -294,4 +337,15 @@ void DungeonRoomData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &DungeonRoomData::get_voxel_surfaces); ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &DungeonRoomData::set_voxel_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_voxel_surfaces", "get_voxel_surfaces"); + + //Liquid Surfaces + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &DungeonRoomData::get_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "data"), &DungeonRoomData::set_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("add_liquid_voxel_surface", "voxel_surface"), &DungeonRoomData::add_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("remove_liquid_voxel_surface", "index"), &DungeonRoomData::remove_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface_count"), &DungeonRoomData::get_liquid_voxel_surface_count); + + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &DungeonRoomData::get_liquid_voxel_surfaces); + ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &DungeonRoomData::set_liquid_voxel_surfaces); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces"); } diff --git a/world_generator/data/dungeon_room_data.h b/world_generator/data/dungeon_room_data.h index 08d85e2..421b493 100644 --- a/world_generator/data/dungeon_room_data.h +++ b/world_generator/data/dungeon_room_data.h @@ -77,6 +77,16 @@ public: Vector get_voxel_surfaces(); void set_voxel_surfaces(const Vector &voxel_surfaces); + //Liquid Surfaces + Ref get_liquid_voxel_surface(const int index) const; + void set_liquid_voxel_surface(const int index, const Ref voxel_surface); + void add_liquid_voxel_surface(const Ref voxel_surface); + void remove_liquid_voxel_surface(const int index); + int get_liquid_voxel_surface_count() const; + + Vector get_liquid_voxel_surfaces(); + void set_liquid_voxel_surfaces(const Vector &voxel_surfaces); + DungeonRoomData(); ~DungeonRoomData(); @@ -98,6 +108,7 @@ private: Vector > _entity_datas; Vector > _environment_datas; Vector > _voxel_surfaces; + Vector > _liquid_voxel_surfaces; }; #endif diff --git a/world_generator/data/planet_data.cpp b/world_generator/data/planet_data.cpp index 64b2ada..5719649 100644 --- a/world_generator/data/planet_data.cpp +++ b/world_generator/data/planet_data.cpp @@ -146,11 +146,56 @@ void PlanetData::set_voxel_surfaces(const Vector &voxel_surfaces) { } } +//// Liquid Surfaces //// +Ref PlanetData::get_liquid_voxel_surface(const int index) const { + ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref()); + + return _liquid_voxel_surfaces.get(index); +} +void PlanetData::set_liquid_voxel_surface(const int index, const Ref voxel_surface) { + ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size()); + + _liquid_voxel_surfaces.set(index, voxel_surface); +} +void PlanetData::add_liquid_voxel_surface(const Ref voxel_surface) { + _liquid_voxel_surfaces.push_back(voxel_surface); +} +void PlanetData::remove_liquid_voxel_surface(const int index) { + ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size()); + + _liquid_voxel_surfaces.remove(index); +} +int PlanetData::get_liquid_voxel_surface_count() const { + return _liquid_voxel_surfaces.size(); +} + +Vector PlanetData::get_liquid_voxel_surfaces() { + Vector r; + for (int i = 0; i < _liquid_voxel_surfaces.size(); i++) { + r.push_back(_liquid_voxel_surfaces[i].get_ref_ptr()); + } + return r; +} +void PlanetData::set_liquid_voxel_surfaces(const Vector &voxel_surfaces) { + _liquid_voxel_surfaces.clear(); + for (int i = 0; i < voxel_surfaces.size(); i++) { + Ref voxel_surface = Ref(voxel_surfaces[i]); + + _liquid_voxel_surfaces.push_back(voxel_surface); + } +} + PlanetData::PlanetData() { _id = 0; } PlanetData::~PlanetData() { + _humidity_noise_params.unref(); + _temperature_noise_params.unref(); + _biome_datas.clear(); + _environment_datas.clear(); + _voxel_surfaces.clear(); + _liquid_voxel_surfaces.clear(); } void PlanetData::_bind_methods() { @@ -202,4 +247,15 @@ void PlanetData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &PlanetData::get_voxel_surfaces); ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &PlanetData::set_voxel_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_voxel_surfaces", "get_voxel_surfaces"); + + //Liquid Surfaces + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &PlanetData::get_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "data"), &PlanetData::set_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("add_liquid_voxel_surface", "voxel_surface"), &PlanetData::add_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("remove_liquid_voxel_surface", "index"), &PlanetData::remove_liquid_voxel_surface); + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface_count"), &PlanetData::get_liquid_voxel_surface_count); + + ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &PlanetData::get_liquid_voxel_surfaces); + ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &PlanetData::set_liquid_voxel_surfaces); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces"); } diff --git a/world_generator/data/planet_data.h b/world_generator/data/planet_data.h index 6bfca6a..ef50b46 100644 --- a/world_generator/data/planet_data.h +++ b/world_generator/data/planet_data.h @@ -56,6 +56,16 @@ public: Vector get_voxel_surfaces(); void set_voxel_surfaces(const Vector &voxel_surfaces); + //Liquid Surfaces + Ref get_liquid_voxel_surface(const int index) const; + void set_liquid_voxel_surface(const int index, const Ref voxel_surface); + void add_liquid_voxel_surface(const Ref voxel_surface); + void remove_liquid_voxel_surface(const int index); + int get_liquid_voxel_surface_count() const; + + Vector get_liquid_voxel_surfaces(); + void set_liquid_voxel_surfaces(const Vector &voxel_surfaces); + PlanetData(); ~PlanetData(); @@ -72,6 +82,7 @@ private: Vector > _biome_datas; Vector > _environment_datas; Vector > _voxel_surfaces; + Vector > _liquid_voxel_surfaces; }; #endif diff --git a/world_generator/main/biome.cpp b/world_generator/main/biome.cpp index 63bf258..f953d6a 100644 --- a/world_generator/main/biome.cpp +++ b/world_generator/main/biome.cpp @@ -140,6 +140,14 @@ void Biome::_setup_library(Ref library) { library->add_voxel_surface(s); } } + + for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) { + Ref s = _data->get_liquid_voxel_surface(i); + + if (s.is_valid()) { + library->add_liquid_voxel_surface(s); + } + } } Biome::Biome() { @@ -147,6 +155,7 @@ Biome::Biome() { } Biome::~Biome() { _environment.unref(); + _data.unref(); _prop_datas.clear(); _entity_datas.clear(); _dungeons.clear(); diff --git a/world_generator/main/dungeon.cpp b/world_generator/main/dungeon.cpp index d61754b..9cb8626 100644 --- a/world_generator/main/dungeon.cpp +++ b/world_generator/main/dungeon.cpp @@ -225,6 +225,14 @@ void Dungeon::_setup_library(Ref library) { library->add_voxel_surface(s); } } + + for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) { + Ref s = _data->get_liquid_voxel_surface(i); + + if (s.is_valid()) { + library->add_liquid_voxel_surface(s); + } + } } void Dungeon::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) { @@ -265,6 +273,7 @@ Dungeon::Dungeon() { } Dungeon::~Dungeon() { _environment.unref(); + _data.unref(); _dungeon_rooms.clear(); _dungeon_start_rooms.clear(); _dungeon_end_rooms.clear(); diff --git a/world_generator/main/dungeon_room.cpp b/world_generator/main/dungeon_room.cpp index e67a4af..10b4d77 100644 --- a/world_generator/main/dungeon_room.cpp +++ b/world_generator/main/dungeon_room.cpp @@ -153,6 +153,14 @@ void DungeonRoom::_setup_library(Ref library) { library->add_voxel_surface(s); } } + + for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) { + Ref s = _data->get_liquid_voxel_surface(i); + + if (s.is_valid()) { + library->add_liquid_voxel_surface(s); + } + } } void DungeonRoom::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) { @@ -186,6 +194,8 @@ DungeonRoom::DungeonRoom() { } DungeonRoom::~DungeonRoom() { _environment.unref(); + _data.unref(); + _structure.unref(); _prop_datas.clear(); _entity_datas.clear(); } diff --git a/world_generator/main/planet.cpp b/world_generator/main/planet.cpp index 1244c37..c01cfea 100644 --- a/world_generator/main/planet.cpp +++ b/world_generator/main/planet.cpp @@ -102,6 +102,14 @@ void Planet::_setup_library(Ref library) { library->add_voxel_surface(s); } } + + for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) { + Ref s = _data->get_liquid_voxel_surface(i); + + if (s.is_valid()) { + library->add_liquid_voxel_surface(s); + } + } } void Planet::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) { @@ -127,6 +135,7 @@ Planet::Planet() { } Planet::~Planet() { _environment.unref(); + _data.unref(); _biomes.clear(); _dungeons.clear(); }