diff --git a/library/voxelman_library.cpp b/library/voxelman_library.cpp index 013678a..7d6bf19 100644 --- a/library/voxelman_library.cpp +++ b/library/voxelman_library.cpp @@ -38,41 +38,41 @@ void VoxelmanLibrary::set_initialized(const bool value) { } //Materials -Ref VoxelmanLibrary::get_material(const int index) { +Ref VoxelmanLibrary::material_get(const int index) { ERR_FAIL_INDEX_V(index, _materials.size(), Ref(NULL)); return _materials[index]; } -void VoxelmanLibrary::add_material(const Ref &value) { +void VoxelmanLibrary::material_add(const Ref &value) { ERR_FAIL_COND(!value.is_valid()); _materials.push_back(value); } -void VoxelmanLibrary::set_material(const int index, const Ref &value) { +void VoxelmanLibrary::material_set(const int index, const Ref &value) { ERR_FAIL_INDEX(index, _materials.size()); _materials.set(index, value); } -void VoxelmanLibrary::remove_material(const int index) { +void VoxelmanLibrary::material_remove(const int index) { _materials.remove(index); } -int VoxelmanLibrary::get_num_materials() const { +int VoxelmanLibrary::material_get_num() const { return _materials.size(); } -void VoxelmanLibrary::clear_materials() { +void VoxelmanLibrary::materials_clear() { _materials.clear(); } -Vector VoxelmanLibrary::get_materials() { +Vector VoxelmanLibrary::materials_get() { VARIANT_ARRAY_GET(_materials); } -void VoxelmanLibrary::set_materials(const Vector &materials) { +void VoxelmanLibrary::materials_set(const Vector &materials) { _materials.clear(); for (int i = 0; i < materials.size(); i++) { @@ -83,41 +83,41 @@ void VoxelmanLibrary::set_materials(const Vector &materials) { } //Liquid Materials -Ref VoxelmanLibrary::get_liquid_material(const int index) { +Ref VoxelmanLibrary::liquid_material_get(const int index) { ERR_FAIL_INDEX_V(index, _liquid_materials.size(), Ref(NULL)); return _liquid_materials[index]; } -void VoxelmanLibrary::add_liquid_material(const Ref &value) { +void VoxelmanLibrary::liquid_material_add(const Ref &value) { ERR_FAIL_COND(!value.is_valid()); _liquid_materials.push_back(value); } -void VoxelmanLibrary::set_liquid_material(const int index, const Ref &value) { +void VoxelmanLibrary::liquid_material_set(const int index, const Ref &value) { ERR_FAIL_INDEX(index, _liquid_materials.size()); _liquid_materials.set(index, value); } -void VoxelmanLibrary::remove_liquid_material(const int index) { +void VoxelmanLibrary::liquid_material_remove(const int index) { _liquid_materials.remove(index); } -int VoxelmanLibrary::get_num_liquid_materials() const { +int VoxelmanLibrary::liquid_material_get_num() const { return _liquid_materials.size(); } -void VoxelmanLibrary::clear_liquid_materials() { +void VoxelmanLibrary::liquid_materials_clear() { _liquid_materials.clear(); } -Vector VoxelmanLibrary::get_liquid_materials() { +Vector VoxelmanLibrary::liquid_materials_get() { VARIANT_ARRAY_GET(_liquid_materials); } -void VoxelmanLibrary::set_liquid_materials(const Vector &materials) { +void VoxelmanLibrary::liquid_materials_set(const Vector &materials) { _liquid_materials.clear(); for (int i = 0; i < materials.size(); i++) { @@ -128,92 +128,92 @@ void VoxelmanLibrary::set_liquid_materials(const Vector &materials) { } //Prop Materials -Ref VoxelmanLibrary::get_prop_material(const int index) { +Ref VoxelmanLibrary::prop_material_get(const int index) { ERR_FAIL_INDEX_V(index, _prop_materials.size(), Ref(NULL)); return _prop_materials[index]; } -void VoxelmanLibrary::add_prop_material(const Ref &value) { +void VoxelmanLibrary::prop_material_add(const Ref &value) { ERR_FAIL_COND(!value.is_valid()); _prop_materials.push_back(value); } -void VoxelmanLibrary::set_prop_material(const int index, const Ref &value) { +void VoxelmanLibrary::prop_material_set(const int index, const Ref &value) { ERR_FAIL_INDEX(index, _prop_materials.size()); _prop_materials.set(index, value); } -void VoxelmanLibrary::remove_prop_material(const int index) { +void VoxelmanLibrary::prop_material_remove(const int index) { _prop_materials.remove(index); } -int VoxelmanLibrary::get_num_prop_materials() const { +int VoxelmanLibrary::prop_material_get_num() const { return _prop_materials.size(); } -void VoxelmanLibrary::clear_prop_materials() { +void VoxelmanLibrary::prop_materials_clear() { _prop_materials.clear(); } -Vector VoxelmanLibrary::get_prop_materials() { +Vector VoxelmanLibrary::prop_materials_get() { VARIANT_ARRAY_GET(_prop_materials); } -void VoxelmanLibrary::set_prop_materials(const Vector &materials) { +void VoxelmanLibrary::prop_materials_set(const Vector &materials) { VARIANT_ARRAY_SET(materials, _prop_materials, Material); } //Surfaces -Ref VoxelmanLibrary::get_voxel_surface(const int index) { +Ref VoxelmanLibrary::voxel_surface_get(const int index) { return Ref(); } -void VoxelmanLibrary::add_voxel_surface(Ref value) { +void VoxelmanLibrary::voxel_surface_add(Ref value) { } -void VoxelmanLibrary::set_voxel_surface(int index, Ref value) { +void VoxelmanLibrary::voxel_surface_set(int index, Ref value) { } -void VoxelmanLibrary::remove_surface(const int index) { +void VoxelmanLibrary::voxel_surface_remove(const int index) { } -int VoxelmanLibrary::get_num_surfaces() const { +int VoxelmanLibrary::voxel_surface_get_num() const { return 0; } -void VoxelmanLibrary::clear_surfaces() { +void VoxelmanLibrary::voxel_surfaces_clear() { } -Ref VoxelmanLibrary::get_scene(const int id) { +Ref VoxelmanLibrary::scene_get(const int id) { return Ref(); } -void VoxelmanLibrary::add_scene(Ref value) { +void VoxelmanLibrary::scene_add(Ref value) { } -void VoxelmanLibrary::set_scene(int id, Ref value) { +void VoxelmanLibrary::scene_set(int id, Ref value) { } -void VoxelmanLibrary::remove_scene(const int id) { +void VoxelmanLibrary::scene_remove(const int id) { } -int VoxelmanLibrary::get_num_scenes() const { +int VoxelmanLibrary::scene_get_num() const { return 0; } -void VoxelmanLibrary::clear_scenes() { +void VoxelmanLibrary::scenes_clear() { } #ifdef PROPS_PRESENT -Ref VoxelmanLibrary::get_prop(const int id) { +Ref VoxelmanLibrary::prop_get(const int id) { return Ref(); } -void VoxelmanLibrary::add_prop(Ref value) { +void VoxelmanLibrary::prop_add(Ref value) { } -bool VoxelmanLibrary::has_prop(const Ref &value) const { +bool VoxelmanLibrary::prop_has(const Ref &value) const { return false; } -void VoxelmanLibrary::set_prop(int id, Ref value) { +void VoxelmanLibrary::prop_set(int id, Ref value) { } -void VoxelmanLibrary::remove_prop(const int id) { +void VoxelmanLibrary::prop_remove(const int id) { } -int VoxelmanLibrary::get_num_props() const { +int VoxelmanLibrary::prop_get_num() const { return 0; } -void VoxelmanLibrary::clear_props() { +void VoxelmanLibrary::props_clear() { } Rect2 VoxelmanLibrary::get_prop_uv_rect(const Ref &texture) { @@ -248,54 +248,61 @@ void VoxelmanLibrary::_bind_methods() { BIND_VMETHOD(MethodInfo("_setup_material_albedo", PropertyInfo(Variant::INT, "material_index"), PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"))); - ClassDB::bind_method(D_METHOD("get_material", "index"), &VoxelmanLibrary::get_material); - ClassDB::bind_method(D_METHOD("add_material", "value"), &VoxelmanLibrary::add_material); - ClassDB::bind_method(D_METHOD("set_material", "index", "value"), &VoxelmanLibrary::set_material); - ClassDB::bind_method(D_METHOD("remove_material", "index"), &VoxelmanLibrary::remove_material); - ClassDB::bind_method(D_METHOD("get_num_materials"), &VoxelmanLibrary::get_num_materials); - ClassDB::bind_method(D_METHOD("clear_materials"), &VoxelmanLibrary::clear_materials); + ClassDB::bind_method(D_METHOD("material_get", "index"), &VoxelmanLibrary::material_get); + ClassDB::bind_method(D_METHOD("material_add", "value"), &VoxelmanLibrary::material_add); + ClassDB::bind_method(D_METHOD("material_set", "index", "value"), &VoxelmanLibrary::material_set); + ClassDB::bind_method(D_METHOD("material_remove", "index"), &VoxelmanLibrary::material_remove); + ClassDB::bind_method(D_METHOD("material_get_num"), &VoxelmanLibrary::material_get_num); + ClassDB::bind_method(D_METHOD("materials_clear"), &VoxelmanLibrary::materials_clear); - ClassDB::bind_method(D_METHOD("get_materials"), &VoxelmanLibrary::get_materials); - ClassDB::bind_method(D_METHOD("set_materials"), &VoxelmanLibrary::set_materials); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "set_materials", "get_materials"); + ClassDB::bind_method(D_METHOD("materials_get"), &VoxelmanLibrary::materials_get); + ClassDB::bind_method(D_METHOD("materials_set"), &VoxelmanLibrary::materials_set); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); - ClassDB::bind_method(D_METHOD("get_liquid_material", "index"), &VoxelmanLibrary::get_liquid_material); - ClassDB::bind_method(D_METHOD("add_liquid_material", "value"), &VoxelmanLibrary::add_liquid_material); - ClassDB::bind_method(D_METHOD("set_liquid_material", "index", "value"), &VoxelmanLibrary::set_liquid_material); - ClassDB::bind_method(D_METHOD("remove_liquid_material", "index"), &VoxelmanLibrary::remove_liquid_material); - ClassDB::bind_method(D_METHOD("get_num_liquid_materials"), &VoxelmanLibrary::get_num_liquid_materials); - ClassDB::bind_method(D_METHOD("clear_liquid_materials"), &VoxelmanLibrary::clear_liquid_materials); + ClassDB::bind_method(D_METHOD("liquid_material_get", "index"), &VoxelmanLibrary::liquid_material_get); + ClassDB::bind_method(D_METHOD("liquid_material_add", "value"), &VoxelmanLibrary::liquid_material_add); + ClassDB::bind_method(D_METHOD("liquid_material_set", "index", "value"), &VoxelmanLibrary::liquid_material_set); + ClassDB::bind_method(D_METHOD("liquid_material_remove", "index"), &VoxelmanLibrary::liquid_material_remove); + ClassDB::bind_method(D_METHOD("liquid_material_get_num"), &VoxelmanLibrary::liquid_material_get_num); + ClassDB::bind_method(D_METHOD("liquid_materials_clear"), &VoxelmanLibrary::liquid_materials_clear); - ClassDB::bind_method(D_METHOD("get_liquid_materials"), &VoxelmanLibrary::get_liquid_materials); - ClassDB::bind_method(D_METHOD("set_liquid_materials"), &VoxelmanLibrary::set_liquid_materials); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "set_liquid_materials", "get_liquid_materials"); + ClassDB::bind_method(D_METHOD("liquid_materials_get"), &VoxelmanLibrary::liquid_materials_get); + ClassDB::bind_method(D_METHOD("liquid_materials_set"), &VoxelmanLibrary::liquid_materials_set); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "liquid_materials_set", "liquid_materials_get"); - ClassDB::bind_method(D_METHOD("get_prop_material", "index"), &VoxelmanLibrary::get_prop_material); - ClassDB::bind_method(D_METHOD("add_prop_material", "value"), &VoxelmanLibrary::add_prop_material); - ClassDB::bind_method(D_METHOD("set_prop_material", "index", "value"), &VoxelmanLibrary::set_prop_material); - ClassDB::bind_method(D_METHOD("remove_prop_material", "index"), &VoxelmanLibrary::remove_prop_material); - ClassDB::bind_method(D_METHOD("get_num_prop_materials"), &VoxelmanLibrary::get_num_prop_materials); - ClassDB::bind_method(D_METHOD("clear_prop_materials"), &VoxelmanLibrary::clear_prop_materials); + ClassDB::bind_method(D_METHOD("prop_material_get", "index"), &VoxelmanLibrary::prop_material_get); + ClassDB::bind_method(D_METHOD("prop_material_add", "value"), &VoxelmanLibrary::prop_material_add); + ClassDB::bind_method(D_METHOD("prop_material_set", "index", "value"), &VoxelmanLibrary::prop_material_set); + ClassDB::bind_method(D_METHOD("prop_material_remove", "index"), &VoxelmanLibrary::prop_material_remove); + ClassDB::bind_method(D_METHOD("prop_material_get_num"), &VoxelmanLibrary::prop_material_get_num); + ClassDB::bind_method(D_METHOD("prop_materials_clear"), &VoxelmanLibrary::prop_materials_clear); - ClassDB::bind_method(D_METHOD("get_prop_materials"), &VoxelmanLibrary::get_prop_materials); - ClassDB::bind_method(D_METHOD("set_prop_materials"), &VoxelmanLibrary::set_prop_materials); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "set_prop_materials", "get_prop_materials"); + ClassDB::bind_method(D_METHOD("prop_materials_get"), &VoxelmanLibrary::prop_materials_get); + ClassDB::bind_method(D_METHOD("prop_materials_set"), &VoxelmanLibrary::prop_materials_set); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "prop_materials_set", "prop_materials_get"); - ClassDB::bind_method(D_METHOD("get_voxel_surface", "index"), &VoxelmanLibrary::get_voxel_surface); - ClassDB::bind_method(D_METHOD("add_voxel_surface", "value"), &VoxelmanLibrary::add_voxel_surface); - ClassDB::bind_method(D_METHOD("set_voxel_surface", "index", "surface"), &VoxelmanLibrary::set_voxel_surface); - ClassDB::bind_method(D_METHOD("remove_surface", "index"), &VoxelmanLibrary::remove_surface); - ClassDB::bind_method(D_METHOD("get_num_surfaces"), &VoxelmanLibrary::get_num_surfaces); - ClassDB::bind_method(D_METHOD("clear_surfaces"), &VoxelmanLibrary::clear_surfaces); + ClassDB::bind_method(D_METHOD("voxel_surface_get", "index"), &VoxelmanLibrary::voxel_surface_get); + ClassDB::bind_method(D_METHOD("voxel_surface_add", "value"), &VoxelmanLibrary::voxel_surface_add); + ClassDB::bind_method(D_METHOD("voxel_surface_set", "index", "surface"), &VoxelmanLibrary::voxel_surface_set); + ClassDB::bind_method(D_METHOD("voxel_surface_remove", "index"), &VoxelmanLibrary::voxel_surface_remove); + ClassDB::bind_method(D_METHOD("voxel_surface_get_num"), &VoxelmanLibrary::voxel_surface_get_num); + ClassDB::bind_method(D_METHOD("voxel_surfaces_clear"), &VoxelmanLibrary::voxel_surfaces_clear); + + ClassDB::bind_method(D_METHOD("scene_get", "index"), &VoxelmanLibrary::scene_get); + ClassDB::bind_method(D_METHOD("scene_add", "value"), &VoxelmanLibrary::scene_add); + ClassDB::bind_method(D_METHOD("scene_set", "index", "value"), &VoxelmanLibrary::scene_set); + ClassDB::bind_method(D_METHOD("scene_remove", "index"), &VoxelmanLibrary::scene_remove); + ClassDB::bind_method(D_METHOD("scene_get_num"), &VoxelmanLibrary::scene_get_num); + ClassDB::bind_method(D_METHOD("scenes_clear"), &VoxelmanLibrary::scenes_clear); #ifdef PROPS_PRESENT - ClassDB::bind_method(D_METHOD("get_prop", "id"), &VoxelmanLibrary::get_prop); - ClassDB::bind_method(D_METHOD("add_prop", "value"), &VoxelmanLibrary::add_prop); - ClassDB::bind_method(D_METHOD("has_prop", "prop"), &VoxelmanLibrary::has_prop); - ClassDB::bind_method(D_METHOD("set_prop", "id", "surface"), &VoxelmanLibrary::set_prop); - ClassDB::bind_method(D_METHOD("remove_prop", "id"), &VoxelmanLibrary::remove_prop); - ClassDB::bind_method(D_METHOD("get_num_props"), &VoxelmanLibrary::get_num_props); - ClassDB::bind_method(D_METHOD("clear_props"), &VoxelmanLibrary::clear_props); + ClassDB::bind_method(D_METHOD("prop_get", "id"), &VoxelmanLibrary::prop_get); + ClassDB::bind_method(D_METHOD("prop_add", "value"), &VoxelmanLibrary::prop_add); + ClassDB::bind_method(D_METHOD("prop_has", "prop"), &VoxelmanLibrary::prop_has); + ClassDB::bind_method(D_METHOD("prop_set", "id", "surface"), &VoxelmanLibrary::prop_set); + ClassDB::bind_method(D_METHOD("prop_remove", "id"), &VoxelmanLibrary::prop_remove); + ClassDB::bind_method(D_METHOD("prop_get_num"), &VoxelmanLibrary::prop_get_num); + ClassDB::bind_method(D_METHOD("props_clear"), &VoxelmanLibrary::props_clear); #endif ClassDB::bind_method(D_METHOD("refresh_rects"), &VoxelmanLibrary::refresh_rects); diff --git a/library/voxelman_library.h b/library/voxelman_library.h index 5e74c68..4c42a2e 100644 --- a/library/voxelman_library.h +++ b/library/voxelman_library.h @@ -57,58 +57,58 @@ public: bool get_initialized() const; void set_initialized(const bool value); - Ref get_material(const int index); - void add_material(const Ref &value); - void set_material(const int index, const Ref &value); - void remove_material(const int index); - int get_num_materials() const; - void clear_materials(); + Ref material_get(const int index); + void material_add(const Ref &value); + void material_set(const int index, const Ref &value); + void material_remove(const int index); + int material_get_num() const; + void materials_clear(); - Vector get_materials(); - void set_materials(const Vector &materials); + Vector materials_get(); + void materials_set(const Vector &materials); - Ref get_liquid_material(const int index); - void add_liquid_material(const Ref &value); - void set_liquid_material(const int index, const Ref &value); - void remove_liquid_material(const int index); - int get_num_liquid_materials() const; - void clear_liquid_materials(); + Ref liquid_material_get(const int index); + void liquid_material_add(const Ref &value); + void liquid_material_set(const int index, const Ref &value); + void liquid_material_remove(const int index); + int liquid_material_get_num() const; + void liquid_materials_clear(); - Vector get_liquid_materials(); - void set_liquid_materials(const Vector &materials); + Vector liquid_materials_get(); + void liquid_materials_set(const Vector &materials); - Ref get_prop_material(const int index); - void add_prop_material(const Ref &value); - void set_prop_material(const int index, const Ref &value); - void remove_prop_material(const int index); - int get_num_prop_materials() const; - void clear_prop_materials(); + Ref prop_material_get(const int index); + void prop_material_add(const Ref &value); + void prop_material_set(const int index, const Ref &value); + void prop_material_remove(const int index); + int prop_material_get_num() const; + void prop_materials_clear(); - Vector get_prop_materials(); - void set_prop_materials(const Vector &materials); + Vector prop_materials_get(); + void prop_materials_set(const Vector &materials); - virtual Ref get_voxel_surface(const int index); - virtual void add_voxel_surface(Ref value); - virtual void set_voxel_surface(const int index, Ref value); - virtual void remove_surface(const int index); - virtual int get_num_surfaces() const; - virtual void clear_surfaces(); + virtual Ref voxel_surface_get(const int index); + virtual void voxel_surface_add(Ref value); + virtual void voxel_surface_set(const int index, Ref value); + virtual void voxel_surface_remove(const int index); + virtual int voxel_surface_get_num() const; + virtual void voxel_surfaces_clear(); - virtual Ref get_scene(const int id); - virtual void add_scene(Ref value); - virtual void set_scene(const int id, Ref value); - virtual void remove_scene(const int id); - virtual int get_num_scenes() const; - virtual void clear_scenes(); + virtual Ref scene_get(const int id); + virtual void scene_add(Ref value); + virtual void scene_set(const int id, Ref value); + virtual void scene_remove(const int id); + virtual int scene_get_num() const; + virtual void scenes_clear(); #ifdef PROPS_PRESENT - virtual Ref get_prop(const int id); - virtual void add_prop(Ref value); - virtual bool has_prop(const Ref &value) const; - virtual void set_prop(const int id, Ref value); - virtual void remove_prop(const int id); - virtual int get_num_props() const; - virtual void clear_props(); + virtual Ref prop_get(const int id); + virtual void prop_add(Ref value); + virtual bool prop_has(const Ref &value) const; + virtual void prop_set(const int id, Ref value); + virtual void prop_remove(const int id); + virtual int prop_get_num() const; + virtual void props_clear(); virtual Rect2 get_prop_uv_rect(const Ref &texture); #endif @@ -125,9 +125,9 @@ protected: private: bool _initialized; - Vector> _materials; - Vector> _liquid_materials; - Vector> _prop_materials; + Vector > _materials; + Vector > _liquid_materials; + Vector > _prop_materials; }; #endif // VOXEL_LIBRARY_H diff --git a/library/voxelman_library_merger.cpp b/library/voxelman_library_merger.cpp index 36b5037..7cfa18e 100644 --- a/library/voxelman_library_merger.cpp +++ b/library/voxelman_library_merger.cpp @@ -78,13 +78,13 @@ void VoxelmanLibraryMerger::set_margin(const int margin) { } //Surfaces -Ref VoxelmanLibraryMerger::get_voxel_surface(const int index) { +Ref VoxelmanLibraryMerger::voxel_surface_get(const int index) { ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref(NULL)); return _voxel_surfaces[index]; } -void VoxelmanLibraryMerger::add_voxel_surface(Ref value) { +void VoxelmanLibraryMerger::voxel_surface_add(Ref value) { ERR_FAIL_COND(!value.is_valid()); value->set_library(Ref(this)); @@ -93,7 +93,7 @@ void VoxelmanLibraryMerger::add_voxel_surface(Ref value) { _voxel_surfaces.push_back(value); } -void VoxelmanLibraryMerger::set_voxel_surface(const int index, Ref value) { +void VoxelmanLibraryMerger::voxel_surface_set(const int index, Ref value) { ERR_FAIL_COND(index < 0); if (_voxel_surfaces.size() < index) { @@ -111,15 +111,15 @@ void VoxelmanLibraryMerger::set_voxel_surface(const int index, Ref } } -void VoxelmanLibraryMerger::remove_surface(const int index) { +void VoxelmanLibraryMerger::voxel_surface_remove(const int index) { _voxel_surfaces.remove(index); } -int VoxelmanLibraryMerger::get_num_surfaces() const { +int VoxelmanLibraryMerger::voxel_surface_get_num() const { return _voxel_surfaces.size(); } -void VoxelmanLibraryMerger::clear_surfaces() { +void VoxelmanLibraryMerger::voxel_surfaces_clear() { _packer->clear(); for (int i = 0; i < _voxel_surfaces.size(); i++) { @@ -302,13 +302,13 @@ void VoxelmanLibraryMerger::_setup_material_albedo(const int material_index, con switch (material_index) { case MATERIAL_INDEX_VOXELS: - count = get_num_materials(); + count = material_get_num(); break; case MATERIAL_INDEX_LIQUID: - count = get_num_liquid_materials(); + count = liquid_material_get_num(); break; case MATERIAL_INDEX_PROP: - count = get_num_prop_materials(); + count = prop_material_get_num(); break; } @@ -316,13 +316,13 @@ void VoxelmanLibraryMerger::_setup_material_albedo(const int material_index, con switch (material_index) { case MATERIAL_INDEX_VOXELS: - mat = get_material(i); + mat = material_get(i); break; case MATERIAL_INDEX_LIQUID: - mat = get_liquid_material(i); + mat = liquid_material_get(i); break; case MATERIAL_INDEX_PROP: - mat = get_prop_material(i); + mat = prop_material_get(i); break; } @@ -337,13 +337,13 @@ void VoxelmanLibraryMerger::_setup_material_albedo(const int material_index, con switch (material_index) { case MATERIAL_INDEX_VOXELS: - shmat = get_material(i); + shmat = material_get(i); break; case MATERIAL_INDEX_LIQUID: - shmat = get_liquid_material(i); + shmat = liquid_material_get(i); break; case MATERIAL_INDEX_PROP: - shmat = get_prop_material(i); + shmat = prop_material_get(i); break; } diff --git a/library/voxelman_library_merger.h b/library/voxelman_library_merger.h index d730c00..73636b2 100644 --- a/library/voxelman_library_merger.h +++ b/library/voxelman_library_merger.h @@ -55,12 +55,12 @@ public: int get_margin() const; void set_margin(const int margin); - Ref get_voxel_surface(const int index); - void add_voxel_surface(Ref value); - void set_voxel_surface(const int index, Ref value); - void remove_surface(const int index); - int get_num_surfaces() const; - void clear_surfaces(); + Ref voxel_surface_get(const int index); + void voxel_surface_add(Ref value); + void voxel_surface_set(const int index, Ref value); + void voxel_surface_remove(const int index); + int voxel_surface_get_num() const; + void voxel_surfaces_clear(); Vector get_voxel_surfaces(); void set_voxel_surfaces(const Vector &surfaces); diff --git a/library/voxelman_library_simple.cpp b/library/voxelman_library_simple.cpp index 30041b6..7b9a32c 100644 --- a/library/voxelman_library_simple.cpp +++ b/library/voxelman_library_simple.cpp @@ -43,13 +43,13 @@ void VoxelmanLibrarySimple::set_atlas_rows(int s) { } //Surfaces -Ref VoxelmanLibrarySimple::get_voxel_surface(const int index) { +Ref VoxelmanLibrarySimple::voxel_surface_get(const int index) { ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref(NULL)); return _voxel_surfaces[index]; } -void VoxelmanLibrarySimple::add_voxel_surface(Ref value) { +void VoxelmanLibrarySimple::voxel_surface_add(Ref value) { ERR_FAIL_COND(!value.is_valid()); value->set_library(Ref(this)); @@ -58,7 +58,7 @@ void VoxelmanLibrarySimple::add_voxel_surface(Ref value) { _voxel_surfaces.push_back(value); } -void VoxelmanLibrarySimple::set_voxel_surface(const int index, Ref value) { +void VoxelmanLibrarySimple::voxel_surface_set(const int index, Ref value) { ERR_FAIL_COND(index < 0); if (_voxel_surfaces.size() < index) { @@ -76,15 +76,15 @@ void VoxelmanLibrarySimple::set_voxel_surface(const int index, Ref } } -void VoxelmanLibrarySimple::remove_surface(const int index) { +void VoxelmanLibrarySimple::voxel_surface_remove(const int index) { _voxel_surfaces.remove(index); } -int VoxelmanLibrarySimple::get_num_surfaces() const { +int VoxelmanLibrarySimple::voxel_surface_get_num() const { return _voxel_surfaces.size(); } -void VoxelmanLibrarySimple::clear_surfaces() { +void VoxelmanLibrarySimple::voxel_surfaces_clear() { _voxel_surfaces.clear(); } diff --git a/library/voxelman_library_simple.h b/library/voxelman_library_simple.h index ac300af..20b6be2 100644 --- a/library/voxelman_library_simple.h +++ b/library/voxelman_library_simple.h @@ -44,12 +44,12 @@ public: int get_atlas_rows() const; void set_atlas_rows(int s); - Ref get_voxel_surface(const int index); - void add_voxel_surface(Ref value); - void set_voxel_surface(const int index, Ref value); - void remove_surface(const int index); - int get_num_surfaces() const; - void clear_surfaces(); + Ref voxel_surface_get(const int index); + void voxel_surface_add(Ref value); + void voxel_surface_set(const int index, Ref value); + void voxel_surface_remove(const int index); + int voxel_surface_get_num() const; + void voxel_surfaces_clear(); Vector get_voxel_surfaces(); void set_voxel_surfaces(const Vector &surfaces); diff --git a/meshers/blocky/voxel_mesher_blocky.cpp b/meshers/blocky/voxel_mesher_blocky.cpp index 21c8ab9..4ca2a60 100644 --- a/meshers/blocky/voxel_mesher_blocky.cpp +++ b/meshers/blocky/voxel_mesher_blocky.cpp @@ -76,8 +76,8 @@ void VoxelMesherBlocky::_add_chunk(Ref p_chunk) { } Vector liquids; - for (int i = 0; i < _library->get_num_surfaces(); ++i) { - Ref surface = _library->get_voxel_surface(i); + for (int i = 0; i < _library->voxel_surface_get_num(); ++i) { + Ref surface = _library->voxel_surface_get(i); if (!surface.is_valid()) continue; @@ -106,7 +106,7 @@ void VoxelMesherBlocky::_add_chunk(Ref p_chunk) { if (liquids.find(type) != -1) continue; - Ref surface = _library->get_voxel_surface(type - 1); + Ref surface = _library->voxel_surface_get(type - 1); if (!surface.is_valid()) continue; diff --git a/meshers/blocky/voxel_mesher_liquid_blocky.cpp b/meshers/blocky/voxel_mesher_liquid_blocky.cpp index a20857a..af5558d 100644 --- a/meshers/blocky/voxel_mesher_liquid_blocky.cpp +++ b/meshers/blocky/voxel_mesher_liquid_blocky.cpp @@ -68,8 +68,8 @@ void VoxelMesherLiquidBlocky::_add_chunk(Ref p_chunk) { } Vector liquids; - for (int i = 0; i < _library->get_num_surfaces(); ++i) { - Ref surface = _library->get_voxel_surface(i); + for (int i = 0; i < _library->voxel_surface_get_num(); ++i) { + Ref surface = _library->voxel_surface_get(i); if (!surface.is_valid()) continue; @@ -98,7 +98,7 @@ void VoxelMesherLiquidBlocky::_add_chunk(Ref p_chunk) { if (liquids.find(type) == -1) continue; - Ref surface = _library->get_voxel_surface(type - 1); + Ref surface = _library->voxel_surface_get(type - 1); if (!surface.is_valid()) continue; diff --git a/meshers/cubic/voxel_mesher_cubic.cpp b/meshers/cubic/voxel_mesher_cubic.cpp index b5ff6dc..09fe058 100644 --- a/meshers/cubic/voxel_mesher_cubic.cpp +++ b/meshers/cubic/voxel_mesher_cubic.cpp @@ -70,7 +70,7 @@ void VoxelMesherCubic::_add_chunk(Ref p_chunk) { uint8_t type = cube_points->get_face_type(face) - 1; - Ref surface = _library->get_voxel_surface(type); + Ref surface = _library->voxel_surface_get(type); if (!surface.is_valid()) continue; diff --git a/meshers/marching_cubes/voxel_mesher_marching_cubes.cpp b/meshers/marching_cubes/voxel_mesher_marching_cubes.cpp index 49be401..33d9f38 100644 --- a/meshers/marching_cubes/voxel_mesher_marching_cubes.cpp +++ b/meshers/marching_cubes/voxel_mesher_marching_cubes.cpp @@ -307,8 +307,8 @@ void VoxelMesherMarchingCubes::_add_chunk(Ref p_chunk) { } } - Ref surface1 = _library->get_voxel_surface(type_id1 - 1); - Ref surface2 = _library->get_voxel_surface(type_id2 - 1); + Ref surface1 = _library->voxel_surface_get(type_id1 - 1); + Ref surface2 = _library->voxel_surface_get(type_id2 - 1); for (int i = 0; i < vertex_count; ++i) { int fv = get_regular_vertex_data_first_vertex(case_code, i); diff --git a/meshers/voxel_mesher.cpp b/meshers/voxel_mesher.cpp index 103cf2a..c394bad 100644 --- a/meshers/voxel_mesher.cpp +++ b/meshers/voxel_mesher.cpp @@ -291,7 +291,7 @@ void VoxelMesher::build_mesh_into(RID mesh) { VS::get_singleton()->mesh_add_surface_from_arrays(mesh, VisualServer::PRIMITIVE_TRIANGLES, arr); if (_material.is_valid()) - VS::get_singleton()->mesh_surface_set_material(mesh, 0, _library->get_material(0)->get_rid()); + VS::get_singleton()->mesh_surface_set_material(mesh, 0, _library->material_get(0)->get_rid()); } void VoxelMesher::generate_normals(bool p_flip) { diff --git a/world/jobs/voxel_prop_job.cpp b/world/jobs/voxel_prop_job.cpp index 998e6cf..1cefcc7 100644 --- a/world/jobs/voxel_prop_job.cpp +++ b/world/jobs/voxel_prop_job.cpp @@ -226,8 +226,8 @@ void VoxelPropJob::phase_prop() { VS::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_prop_material(0).is_valid()) - VS::get_singleton()->mesh_surface_set_material(mesh_rid, 0, chunk->get_library()->get_prop_material(0)->get_rid()); + if (chunk->get_library()->prop_material_get(0).is_valid()) + VS::get_singleton()->mesh_surface_set_material(mesh_rid, 0, chunk->get_library()->prop_material_get(0)->get_rid()); if (should_return()) { return; @@ -243,8 +243,8 @@ void VoxelPropJob::phase_prop() { VisualServer::get_singleton()->mesh_add_surface_from_arrays(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 1), VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_prop_material(1).is_valid()) - VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 1), 0, chunk->get_library()->get_prop_material(1)->get_rid()); + if (chunk->get_library()->prop_material_get(1).is_valid()) + VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 1), 0, chunk->get_library()->prop_material_get(1)->get_rid()); } if (should_return()) { @@ -259,8 +259,8 @@ void VoxelPropJob::phase_prop() { VisualServer::get_singleton()->mesh_add_surface_from_arrays(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 2), VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr2); - if (chunk->get_library()->get_prop_material(2).is_valid()) - VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 2), 0, chunk->get_library()->get_prop_material(2)->get_rid()); + if (chunk->get_library()->prop_material_get(2).is_valid()) + VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 2), 0, chunk->get_library()->prop_material_get(2)->get_rid()); } if (should_return()) { return; @@ -269,8 +269,8 @@ void VoxelPropJob::phase_prop() { // if (should_do()) { if (chunk->get_lod_num() >= 3) { - Ref mat = chunk->get_library()->get_prop_material(0); - Ref spmat = chunk->get_library()->get_prop_material(0); + Ref mat = chunk->get_library()->prop_material_get(0); + Ref spmat = chunk->get_library()->prop_material_get(0); Ref tex; if (mat.is_valid()) { @@ -285,8 +285,8 @@ void VoxelPropJob::phase_prop() { VisualServer::get_singleton()->mesh_add_surface_from_arrays(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 3), VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_prop_material(3).is_valid()) - VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 3), 0, chunk->get_library()->get_prop_material(3)->get_rid()); + if (chunk->get_library()->prop_material_get(3).is_valid()) + VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_PROP, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 3), 0, chunk->get_library()->prop_material_get(3)->get_rid()); } } @@ -306,10 +306,10 @@ void VoxelPropJob::phase_prop() { chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, i), VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_material(i).is_valid()) + if (chunk->get_library()->prop_material_get(i).is_valid()) VisualServer::get_singleton()->mesh_surface_set_material( chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, i), 0, - chunk->get_library()->get_material(i)->get_rid()); + chunk->get_library()->prop_material_get(i)->get_rid()); } } diff --git a/world/jobs/voxel_terrarin_job.cpp b/world/jobs/voxel_terrarin_job.cpp index 2a3b3bf..3b760dd 100644 --- a/world/jobs/voxel_terrarin_job.cpp +++ b/world/jobs/voxel_terrarin_job.cpp @@ -310,11 +310,11 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { if (!mesher.is_valid()) { mesher = m; - mesher->set_material(_chunk->get_library()->get_material(0)); + mesher->set_material(_chunk->get_library()->material_get(0)); continue; } - mesher->set_material(_chunk->get_library()->get_material(0)); + mesher->set_material(_chunk->get_library()->material_get(0)); mesher->add_mesher(m); } @@ -338,11 +338,11 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { if (!liquid_mesher.is_valid()) { liquid_mesher = m; - liquid_mesher->set_material(_chunk->get_library()->get_material(0)); + liquid_mesher->set_material(_chunk->get_library()->material_get(0)); continue; } - liquid_mesher->set_material(_chunk->get_library()->get_material(0)); + liquid_mesher->set_material(_chunk->get_library()->material_get(0)); liquid_mesher->add_mesher(m); } @@ -405,8 +405,8 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { if (should_do()) { VS::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_material(0).is_valid()) - VS::get_singleton()->mesh_surface_set_material(mesh_rid, 0, chunk->get_library()->get_material(0)->get_rid()); + if (chunk->get_library()->material_get(0).is_valid()) + VS::get_singleton()->mesh_surface_set_material(mesh_rid, 0, chunk->get_library()->material_get(0)->get_rid()); if (should_return()) { return; @@ -421,8 +421,8 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { VisualServer::get_singleton()->mesh_add_surface_from_arrays(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 1), VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_material(1).is_valid()) - VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 1), 0, chunk->get_library()->get_material(1)->get_rid()); + if (chunk->get_library()->material_get(1).is_valid()) + VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 1), 0, chunk->get_library()->material_get(1)->get_rid()); } if (should_return()) { return; @@ -436,8 +436,8 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { VisualServer::get_singleton()->mesh_add_surface_from_arrays(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 2), VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr2); - if (chunk->get_library()->get_material(2).is_valid()) - VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 2), 0, chunk->get_library()->get_material(2)->get_rid()); + if (chunk->get_library()->material_get(2).is_valid()) + VisualServer::get_singleton()->mesh_surface_set_material(chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 2), 0, chunk->get_library()->material_get(2)->get_rid()); } if (should_return()) { @@ -447,8 +447,8 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { if (should_do()) { if (chunk->get_lod_num() >= 3) { - Ref mat = chunk->get_library()->get_material(0); - Ref spmat = chunk->get_library()->get_material(0); + Ref mat = chunk->get_library()->material_get(0); + Ref spmat = chunk->get_library()->material_get(0); Ref tex; if (mat.is_valid()) { @@ -465,10 +465,10 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 3), VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_material(3).is_valid()) + if (chunk->get_library()->material_get(3).is_valid()) VisualServer::get_singleton()->mesh_surface_set_material( chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, 3), 0, - chunk->get_library()->get_material(3)->get_rid()); + chunk->get_library()->material_get(3)->get_rid()); } } @@ -493,10 +493,10 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, i), VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_material(i).is_valid()) + if (chunk->get_library()->material_get(i).is_valid()) VisualServer::get_singleton()->mesh_surface_set_material( chunk->mesh_rid_get_index(VoxelChunkDefault::MESH_INDEX_TERRARIN, VoxelChunkDefault::MESH_TYPE_INDEX_MESH, i), 0, - chunk->get_library()->get_material(i)->get_rid()); + chunk->get_library()->material_get(i)->get_rid()); } } @@ -541,8 +541,8 @@ void VoxelTerrarinJob::phase_terrarin_mesh() { // if (should_do()) { VS::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr); - if (chunk->get_library()->get_liquid_material(0).is_valid()) - VS::get_singleton()->mesh_surface_set_material(mesh_rid, 0, chunk->get_library()->get_liquid_material(0)->get_rid()); + if (chunk->get_library()->liquid_material_get(0).is_valid()) + VS::get_singleton()->mesh_surface_set_material(mesh_rid, 0, chunk->get_library()->liquid_material_get(0)->get_rid()); // if (should_return()) { // return; diff --git a/world/voxel_world_editor.cpp b/world/voxel_world_editor.cpp index 9ae62f4..44e20e7 100644 --- a/world/voxel_world_editor.cpp +++ b/world/voxel_world_editor.cpp @@ -148,8 +148,8 @@ void VoxelWorldEditor::edit(VoxelWorld *p_world) { library->refresh_rects(); bool f = false; - for (int i = 0; i < library->get_num_surfaces(); ++i) { - Ref surface = library->get_voxel_surface(i); + for (int i = 0; i < library->voxel_surface_get_num(); ++i) { + Ref surface = library->voxel_surface_get(i); if (!surface.is_valid()) continue;