mirror of
https://github.com/Relintai/voxelman.git
synced 2025-04-15 21:06:06 +02:00
More improvements to the bindings.
This commit is contained in:
parent
7075da44eb
commit
0f00761468
@ -222,6 +222,45 @@ void BiomeData::set_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//// Liquid Surfaces ////
|
||||||
|
Ref<VoxelSurface> BiomeData::get_liquid_voxel_surface(const int index) const {
|
||||||
|
ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||||
|
|
||||||
|
return _liquid_voxel_surfaces.get(index);
|
||||||
|
}
|
||||||
|
void BiomeData::set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> 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<VoxelSurface> 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<Variant> BiomeData::get_liquid_voxel_surfaces() {
|
||||||
|
Vector<Variant> 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<Variant> &voxel_surfaces) {
|
||||||
|
_liquid_voxel_surfaces.clear();
|
||||||
|
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||||
|
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||||
|
|
||||||
|
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BiomeData::BiomeData() {
|
BiomeData::BiomeData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -229,6 +268,10 @@ BiomeData::~BiomeData() {
|
|||||||
_dungeon_datas.clear();
|
_dungeon_datas.clear();
|
||||||
_prop_datas.clear();
|
_prop_datas.clear();
|
||||||
_entity_datas.clear();
|
_entity_datas.clear();
|
||||||
|
|
||||||
|
_environment_datas.clear();
|
||||||
|
_voxel_surfaces.clear();
|
||||||
|
_liquid_voxel_surfaces.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BiomeData::_bind_methods() {
|
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("get_voxel_surfaces"), &BiomeData::get_voxel_surfaces);
|
||||||
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &BiomeData::set_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");
|
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");
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,16 @@ public:
|
|||||||
Vector<Variant> get_voxel_surfaces();
|
Vector<Variant> get_voxel_surfaces();
|
||||||
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||||
|
|
||||||
|
//Liquid Surfaces
|
||||||
|
Ref<VoxelSurface> get_liquid_voxel_surface(const int index) const;
|
||||||
|
void set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||||
|
void add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||||
|
void remove_liquid_voxel_surface(const int index);
|
||||||
|
int get_liquid_voxel_surface_count() const;
|
||||||
|
|
||||||
|
Vector<Variant> get_liquid_voxel_surfaces();
|
||||||
|
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||||
|
|
||||||
BiomeData();
|
BiomeData();
|
||||||
~BiomeData();
|
~BiomeData();
|
||||||
|
|
||||||
@ -93,6 +103,7 @@ private:
|
|||||||
Vector<Ref<EntityData> > _entity_datas;
|
Vector<Ref<EntityData> > _entity_datas;
|
||||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||||
|
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -303,6 +303,45 @@ void DungeonData::set_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//// Liquid Surfaces ////
|
||||||
|
Ref<VoxelSurface> DungeonData::get_liquid_voxel_surface(const int index) const {
|
||||||
|
ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||||
|
|
||||||
|
return _liquid_voxel_surfaces.get(index);
|
||||||
|
}
|
||||||
|
void DungeonData::set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> 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<VoxelSurface> 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<Variant> DungeonData::get_liquid_voxel_surfaces() {
|
||||||
|
Vector<Variant> 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<Variant> &voxel_surfaces) {
|
||||||
|
_liquid_voxel_surfaces.clear();
|
||||||
|
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||||
|
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||||
|
|
||||||
|
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Environments
|
//Environments
|
||||||
Ref<EnvironmentData> DungeonData::get_environment_data(const int index) const {
|
Ref<EnvironmentData> DungeonData::get_environment_data(const int index) const {
|
||||||
ERR_FAIL_INDEX_V(index, _environment_datas.size(), Ref<EnvironmentData>());
|
ERR_FAIL_INDEX_V(index, _environment_datas.size(), Ref<EnvironmentData>());
|
||||||
@ -362,6 +401,10 @@ DungeonData::~DungeonData() {
|
|||||||
_dungeon_end_room_datas.clear();
|
_dungeon_end_room_datas.clear();
|
||||||
_dungeon_corridor_datas.clear();
|
_dungeon_corridor_datas.clear();
|
||||||
_entity_datas.clear();
|
_entity_datas.clear();
|
||||||
|
|
||||||
|
_entity_datas.clear();
|
||||||
|
_voxel_surfaces.clear();
|
||||||
|
_liquid_voxel_surfaces.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DungeonData::_bind_methods() {
|
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("get_voxel_surfaces"), &DungeonData::get_voxel_surfaces);
|
||||||
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &DungeonData::set_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");
|
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");
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,16 @@ public:
|
|||||||
Vector<Variant> get_voxel_surfaces();
|
Vector<Variant> get_voxel_surfaces();
|
||||||
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||||
|
|
||||||
|
//Liquid Surfaces
|
||||||
|
Ref<VoxelSurface> get_liquid_voxel_surface(const int index) const;
|
||||||
|
void set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||||
|
void add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||||
|
void remove_liquid_voxel_surface(const int index);
|
||||||
|
int get_liquid_voxel_surface_count() const;
|
||||||
|
|
||||||
|
Vector<Variant> get_liquid_voxel_surfaces();
|
||||||
|
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||||
|
|
||||||
DungeonData();
|
DungeonData();
|
||||||
~DungeonData();
|
~DungeonData();
|
||||||
|
|
||||||
@ -144,6 +154,7 @@ private:
|
|||||||
Vector<Ref<DungeonRoomData> > _dungeon_corridor_datas;
|
Vector<Ref<DungeonRoomData> > _dungeon_corridor_datas;
|
||||||
Vector<Ref<EntityData> > _entity_datas;
|
Vector<Ref<EntityData> > _entity_datas;
|
||||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||||
|
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -207,6 +207,45 @@ void DungeonRoomData::set_voxel_surfaces(const Vector<Variant> &voxel_surfaces)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//// Liquid Surfaces ////
|
||||||
|
Ref<VoxelSurface> DungeonRoomData::get_liquid_voxel_surface(const int index) const {
|
||||||
|
ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||||
|
|
||||||
|
return _liquid_voxel_surfaces.get(index);
|
||||||
|
}
|
||||||
|
void DungeonRoomData::set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> 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<VoxelSurface> 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<Variant> DungeonRoomData::get_liquid_voxel_surfaces() {
|
||||||
|
Vector<Variant> 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<Variant> &voxel_surfaces) {
|
||||||
|
_liquid_voxel_surfaces.clear();
|
||||||
|
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||||
|
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||||
|
|
||||||
|
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DungeonRoomData::DungeonRoomData() {
|
DungeonRoomData::DungeonRoomData() {
|
||||||
_min_sizex = 0;
|
_min_sizex = 0;
|
||||||
_min_sizey = 0;
|
_min_sizey = 0;
|
||||||
@ -217,7 +256,11 @@ DungeonRoomData::DungeonRoomData() {
|
|||||||
_max_sizez = 0;
|
_max_sizez = 0;
|
||||||
}
|
}
|
||||||
DungeonRoomData::~DungeonRoomData() {
|
DungeonRoomData::~DungeonRoomData() {
|
||||||
|
_prop_datas.clear();
|
||||||
|
_entity_datas.clear();
|
||||||
|
_environment_datas.clear();
|
||||||
|
_voxel_surfaces.clear();
|
||||||
|
_liquid_voxel_surfaces.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DungeonRoomData::_bind_methods() {
|
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("get_voxel_surfaces"), &DungeonRoomData::get_voxel_surfaces);
|
||||||
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &DungeonRoomData::set_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");
|
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");
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,16 @@ public:
|
|||||||
Vector<Variant> get_voxel_surfaces();
|
Vector<Variant> get_voxel_surfaces();
|
||||||
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||||
|
|
||||||
|
//Liquid Surfaces
|
||||||
|
Ref<VoxelSurface> get_liquid_voxel_surface(const int index) const;
|
||||||
|
void set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||||
|
void add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||||
|
void remove_liquid_voxel_surface(const int index);
|
||||||
|
int get_liquid_voxel_surface_count() const;
|
||||||
|
|
||||||
|
Vector<Variant> get_liquid_voxel_surfaces();
|
||||||
|
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||||
|
|
||||||
DungeonRoomData();
|
DungeonRoomData();
|
||||||
~DungeonRoomData();
|
~DungeonRoomData();
|
||||||
|
|
||||||
@ -98,6 +108,7 @@ private:
|
|||||||
Vector<Ref<EntityData> > _entity_datas;
|
Vector<Ref<EntityData> > _entity_datas;
|
||||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||||
|
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -146,11 +146,56 @@ void PlanetData::set_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//// Liquid Surfaces ////
|
||||||
|
Ref<VoxelSurface> PlanetData::get_liquid_voxel_surface(const int index) const {
|
||||||
|
ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||||
|
|
||||||
|
return _liquid_voxel_surfaces.get(index);
|
||||||
|
}
|
||||||
|
void PlanetData::set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> 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<VoxelSurface> 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<Variant> PlanetData::get_liquid_voxel_surfaces() {
|
||||||
|
Vector<Variant> 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<Variant> &voxel_surfaces) {
|
||||||
|
_liquid_voxel_surfaces.clear();
|
||||||
|
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||||
|
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||||
|
|
||||||
|
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PlanetData::PlanetData() {
|
PlanetData::PlanetData() {
|
||||||
_id = 0;
|
_id = 0;
|
||||||
}
|
}
|
||||||
PlanetData::~PlanetData() {
|
PlanetData::~PlanetData() {
|
||||||
|
_humidity_noise_params.unref();
|
||||||
|
_temperature_noise_params.unref();
|
||||||
|
|
||||||
_biome_datas.clear();
|
_biome_datas.clear();
|
||||||
|
_environment_datas.clear();
|
||||||
|
_voxel_surfaces.clear();
|
||||||
|
_liquid_voxel_surfaces.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlanetData::_bind_methods() {
|
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("get_voxel_surfaces"), &PlanetData::get_voxel_surfaces);
|
||||||
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &PlanetData::set_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");
|
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");
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,16 @@ public:
|
|||||||
Vector<Variant> get_voxel_surfaces();
|
Vector<Variant> get_voxel_surfaces();
|
||||||
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||||
|
|
||||||
|
//Liquid Surfaces
|
||||||
|
Ref<VoxelSurface> get_liquid_voxel_surface(const int index) const;
|
||||||
|
void set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||||
|
void add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||||
|
void remove_liquid_voxel_surface(const int index);
|
||||||
|
int get_liquid_voxel_surface_count() const;
|
||||||
|
|
||||||
|
Vector<Variant> get_liquid_voxel_surfaces();
|
||||||
|
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||||
|
|
||||||
PlanetData();
|
PlanetData();
|
||||||
~PlanetData();
|
~PlanetData();
|
||||||
|
|
||||||
@ -72,6 +82,7 @@ private:
|
|||||||
Vector<Ref<BiomeData> > _biome_datas;
|
Vector<Ref<BiomeData> > _biome_datas;
|
||||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||||
|
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,6 +140,14 @@ void Biome::_setup_library(Ref<VoxelmanLibrary> library) {
|
|||||||
library->add_voxel_surface(s);
|
library->add_voxel_surface(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) {
|
||||||
|
Ref<VoxelSurface> s = _data->get_liquid_voxel_surface(i);
|
||||||
|
|
||||||
|
if (s.is_valid()) {
|
||||||
|
library->add_liquid_voxel_surface(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Biome::Biome() {
|
Biome::Biome() {
|
||||||
@ -147,6 +155,7 @@ Biome::Biome() {
|
|||||||
}
|
}
|
||||||
Biome::~Biome() {
|
Biome::~Biome() {
|
||||||
_environment.unref();
|
_environment.unref();
|
||||||
|
_data.unref();
|
||||||
_prop_datas.clear();
|
_prop_datas.clear();
|
||||||
_entity_datas.clear();
|
_entity_datas.clear();
|
||||||
_dungeons.clear();
|
_dungeons.clear();
|
||||||
|
@ -225,6 +225,14 @@ void Dungeon::_setup_library(Ref<VoxelmanLibrary> library) {
|
|||||||
library->add_voxel_surface(s);
|
library->add_voxel_surface(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) {
|
||||||
|
Ref<VoxelSurface> 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) {
|
void Dungeon::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||||
@ -265,6 +273,7 @@ Dungeon::Dungeon() {
|
|||||||
}
|
}
|
||||||
Dungeon::~Dungeon() {
|
Dungeon::~Dungeon() {
|
||||||
_environment.unref();
|
_environment.unref();
|
||||||
|
_data.unref();
|
||||||
_dungeon_rooms.clear();
|
_dungeon_rooms.clear();
|
||||||
_dungeon_start_rooms.clear();
|
_dungeon_start_rooms.clear();
|
||||||
_dungeon_end_rooms.clear();
|
_dungeon_end_rooms.clear();
|
||||||
|
@ -153,6 +153,14 @@ void DungeonRoom::_setup_library(Ref<VoxelmanLibrary> library) {
|
|||||||
library->add_voxel_surface(s);
|
library->add_voxel_surface(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) {
|
||||||
|
Ref<VoxelSurface> 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) {
|
void DungeonRoom::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||||
@ -186,6 +194,8 @@ DungeonRoom::DungeonRoom() {
|
|||||||
}
|
}
|
||||||
DungeonRoom::~DungeonRoom() {
|
DungeonRoom::~DungeonRoom() {
|
||||||
_environment.unref();
|
_environment.unref();
|
||||||
|
_data.unref();
|
||||||
|
_structure.unref();
|
||||||
_prop_datas.clear();
|
_prop_datas.clear();
|
||||||
_entity_datas.clear();
|
_entity_datas.clear();
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,14 @@ void Planet::_setup_library(Ref<VoxelmanLibrary> library) {
|
|||||||
library->add_voxel_surface(s);
|
library->add_voxel_surface(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) {
|
||||||
|
Ref<VoxelSurface> 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) {
|
void Planet::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||||
@ -127,6 +135,7 @@ Planet::Planet() {
|
|||||||
}
|
}
|
||||||
Planet::~Planet() {
|
Planet::~Planet() {
|
||||||
_environment.unref();
|
_environment.unref();
|
||||||
|
_data.unref();
|
||||||
_biomes.clear();
|
_biomes.clear();
|
||||||
_dungeons.clear();
|
_dungeons.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user