mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-12 10:15:12 +01:00
Same treatment to methods in VoxelManLibrary.
This commit is contained in:
parent
37346845b4
commit
9a151ffc6c
@ -38,41 +38,41 @@ void VoxelmanLibrary::set_initialized(const bool value) {
|
||||
}
|
||||
|
||||
//Materials
|
||||
Ref<Material> VoxelmanLibrary::get_material(const int index) {
|
||||
Ref<Material> VoxelmanLibrary::material_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _materials.size(), Ref<VoxelSurface>(NULL));
|
||||
|
||||
return _materials[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::add_material(const Ref<Material> &value) {
|
||||
void VoxelmanLibrary::material_add(const Ref<Material> &value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
_materials.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::set_material(const int index, const Ref<Material> &value) {
|
||||
void VoxelmanLibrary::material_set(const int index, const Ref<Material> &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<Variant> VoxelmanLibrary::get_materials() {
|
||||
Vector<Variant> VoxelmanLibrary::materials_get() {
|
||||
VARIANT_ARRAY_GET(_materials);
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::set_materials(const Vector<Variant> &materials) {
|
||||
void VoxelmanLibrary::materials_set(const Vector<Variant> &materials) {
|
||||
_materials.clear();
|
||||
|
||||
for (int i = 0; i < materials.size(); i++) {
|
||||
@ -83,41 +83,41 @@ void VoxelmanLibrary::set_materials(const Vector<Variant> &materials) {
|
||||
}
|
||||
|
||||
//Liquid Materials
|
||||
Ref<Material> VoxelmanLibrary::get_liquid_material(const int index) {
|
||||
Ref<Material> VoxelmanLibrary::liquid_material_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _liquid_materials.size(), Ref<VoxelSurface>(NULL));
|
||||
|
||||
return _liquid_materials[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::add_liquid_material(const Ref<Material> &value) {
|
||||
void VoxelmanLibrary::liquid_material_add(const Ref<Material> &value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
_liquid_materials.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::set_liquid_material(const int index, const Ref<Material> &value) {
|
||||
void VoxelmanLibrary::liquid_material_set(const int index, const Ref<Material> &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<Variant> VoxelmanLibrary::get_liquid_materials() {
|
||||
Vector<Variant> VoxelmanLibrary::liquid_materials_get() {
|
||||
VARIANT_ARRAY_GET(_liquid_materials);
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::set_liquid_materials(const Vector<Variant> &materials) {
|
||||
void VoxelmanLibrary::liquid_materials_set(const Vector<Variant> &materials) {
|
||||
_liquid_materials.clear();
|
||||
|
||||
for (int i = 0; i < materials.size(); i++) {
|
||||
@ -128,92 +128,92 @@ void VoxelmanLibrary::set_liquid_materials(const Vector<Variant> &materials) {
|
||||
}
|
||||
|
||||
//Prop Materials
|
||||
Ref<Material> VoxelmanLibrary::get_prop_material(const int index) {
|
||||
Ref<Material> VoxelmanLibrary::prop_material_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _prop_materials.size(), Ref<VoxelSurface>(NULL));
|
||||
|
||||
return _prop_materials[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::add_prop_material(const Ref<Material> &value) {
|
||||
void VoxelmanLibrary::prop_material_add(const Ref<Material> &value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
_prop_materials.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::set_prop_material(const int index, const Ref<Material> &value) {
|
||||
void VoxelmanLibrary::prop_material_set(const int index, const Ref<Material> &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<Variant> VoxelmanLibrary::get_prop_materials() {
|
||||
Vector<Variant> VoxelmanLibrary::prop_materials_get() {
|
||||
VARIANT_ARRAY_GET(_prop_materials);
|
||||
}
|
||||
|
||||
void VoxelmanLibrary::set_prop_materials(const Vector<Variant> &materials) {
|
||||
void VoxelmanLibrary::prop_materials_set(const Vector<Variant> &materials) {
|
||||
VARIANT_ARRAY_SET(materials, _prop_materials, Material);
|
||||
}
|
||||
|
||||
//Surfaces
|
||||
Ref<VoxelSurface> VoxelmanLibrary::get_voxel_surface(const int index) {
|
||||
Ref<VoxelSurface> VoxelmanLibrary::voxel_surface_get(const int index) {
|
||||
return Ref<VoxelSurface>();
|
||||
}
|
||||
void VoxelmanLibrary::add_voxel_surface(Ref<VoxelSurface> value) {
|
||||
void VoxelmanLibrary::voxel_surface_add(Ref<VoxelSurface> value) {
|
||||
}
|
||||
void VoxelmanLibrary::set_voxel_surface(int index, Ref<VoxelSurface> value) {
|
||||
void VoxelmanLibrary::voxel_surface_set(int index, Ref<VoxelSurface> 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<PackedScene> VoxelmanLibrary::get_scene(const int id) {
|
||||
Ref<PackedScene> VoxelmanLibrary::scene_get(const int id) {
|
||||
return Ref<PackedScene>();
|
||||
}
|
||||
void VoxelmanLibrary::add_scene(Ref<PackedScene> value) {
|
||||
void VoxelmanLibrary::scene_add(Ref<PackedScene> value) {
|
||||
}
|
||||
void VoxelmanLibrary::set_scene(int id, Ref<PackedScene> value) {
|
||||
void VoxelmanLibrary::scene_set(int id, Ref<PackedScene> 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<PropData> VoxelmanLibrary::get_prop(const int id) {
|
||||
Ref<PropData> VoxelmanLibrary::prop_get(const int id) {
|
||||
return Ref<PropData>();
|
||||
}
|
||||
void VoxelmanLibrary::add_prop(Ref<PropData> value) {
|
||||
void VoxelmanLibrary::prop_add(Ref<PropData> value) {
|
||||
}
|
||||
bool VoxelmanLibrary::has_prop(const Ref<PropData> &value) const {
|
||||
bool VoxelmanLibrary::prop_has(const Ref<PropData> &value) const {
|
||||
return false;
|
||||
}
|
||||
void VoxelmanLibrary::set_prop(int id, Ref<PropData> value) {
|
||||
void VoxelmanLibrary::prop_set(int id, Ref<PropData> 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> &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);
|
||||
|
@ -57,58 +57,58 @@ public:
|
||||
bool get_initialized() const;
|
||||
void set_initialized(const bool value);
|
||||
|
||||
Ref<Material> get_material(const int index);
|
||||
void add_material(const Ref<Material> &value);
|
||||
void set_material(const int index, const Ref<Material> &value);
|
||||
void remove_material(const int index);
|
||||
int get_num_materials() const;
|
||||
void clear_materials();
|
||||
Ref<Material> material_get(const int index);
|
||||
void material_add(const Ref<Material> &value);
|
||||
void material_set(const int index, const Ref<Material> &value);
|
||||
void material_remove(const int index);
|
||||
int material_get_num() const;
|
||||
void materials_clear();
|
||||
|
||||
Vector<Variant> get_materials();
|
||||
void set_materials(const Vector<Variant> &materials);
|
||||
Vector<Variant> materials_get();
|
||||
void materials_set(const Vector<Variant> &materials);
|
||||
|
||||
Ref<Material> get_liquid_material(const int index);
|
||||
void add_liquid_material(const Ref<Material> &value);
|
||||
void set_liquid_material(const int index, const Ref<Material> &value);
|
||||
void remove_liquid_material(const int index);
|
||||
int get_num_liquid_materials() const;
|
||||
void clear_liquid_materials();
|
||||
Ref<Material> liquid_material_get(const int index);
|
||||
void liquid_material_add(const Ref<Material> &value);
|
||||
void liquid_material_set(const int index, const Ref<Material> &value);
|
||||
void liquid_material_remove(const int index);
|
||||
int liquid_material_get_num() const;
|
||||
void liquid_materials_clear();
|
||||
|
||||
Vector<Variant> get_liquid_materials();
|
||||
void set_liquid_materials(const Vector<Variant> &materials);
|
||||
Vector<Variant> liquid_materials_get();
|
||||
void liquid_materials_set(const Vector<Variant> &materials);
|
||||
|
||||
Ref<Material> get_prop_material(const int index);
|
||||
void add_prop_material(const Ref<Material> &value);
|
||||
void set_prop_material(const int index, const Ref<Material> &value);
|
||||
void remove_prop_material(const int index);
|
||||
int get_num_prop_materials() const;
|
||||
void clear_prop_materials();
|
||||
Ref<Material> prop_material_get(const int index);
|
||||
void prop_material_add(const Ref<Material> &value);
|
||||
void prop_material_set(const int index, const Ref<Material> &value);
|
||||
void prop_material_remove(const int index);
|
||||
int prop_material_get_num() const;
|
||||
void prop_materials_clear();
|
||||
|
||||
Vector<Variant> get_prop_materials();
|
||||
void set_prop_materials(const Vector<Variant> &materials);
|
||||
Vector<Variant> prop_materials_get();
|
||||
void prop_materials_set(const Vector<Variant> &materials);
|
||||
|
||||
virtual Ref<VoxelSurface> get_voxel_surface(const int index);
|
||||
virtual void add_voxel_surface(Ref<VoxelSurface> value);
|
||||
virtual void set_voxel_surface(const int index, Ref<VoxelSurface> value);
|
||||
virtual void remove_surface(const int index);
|
||||
virtual int get_num_surfaces() const;
|
||||
virtual void clear_surfaces();
|
||||
virtual Ref<VoxelSurface> voxel_surface_get(const int index);
|
||||
virtual void voxel_surface_add(Ref<VoxelSurface> value);
|
||||
virtual void voxel_surface_set(const int index, Ref<VoxelSurface> value);
|
||||
virtual void voxel_surface_remove(const int index);
|
||||
virtual int voxel_surface_get_num() const;
|
||||
virtual void voxel_surfaces_clear();
|
||||
|
||||
virtual Ref<PackedScene> get_scene(const int id);
|
||||
virtual void add_scene(Ref<PackedScene> value);
|
||||
virtual void set_scene(const int id, Ref<PackedScene> value);
|
||||
virtual void remove_scene(const int id);
|
||||
virtual int get_num_scenes() const;
|
||||
virtual void clear_scenes();
|
||||
virtual Ref<PackedScene> scene_get(const int id);
|
||||
virtual void scene_add(Ref<PackedScene> value);
|
||||
virtual void scene_set(const int id, Ref<PackedScene> value);
|
||||
virtual void scene_remove(const int id);
|
||||
virtual int scene_get_num() const;
|
||||
virtual void scenes_clear();
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
virtual Ref<PropData> get_prop(const int id);
|
||||
virtual void add_prop(Ref<PropData> value);
|
||||
virtual bool has_prop(const Ref<PropData> &value) const;
|
||||
virtual void set_prop(const int id, Ref<PropData> value);
|
||||
virtual void remove_prop(const int id);
|
||||
virtual int get_num_props() const;
|
||||
virtual void clear_props();
|
||||
virtual Ref<PropData> prop_get(const int id);
|
||||
virtual void prop_add(Ref<PropData> value);
|
||||
virtual bool prop_has(const Ref<PropData> &value) const;
|
||||
virtual void prop_set(const int id, Ref<PropData> 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> &texture);
|
||||
#endif
|
||||
@ -125,9 +125,9 @@ protected:
|
||||
|
||||
private:
|
||||
bool _initialized;
|
||||
Vector<Ref<Material>> _materials;
|
||||
Vector<Ref<Material>> _liquid_materials;
|
||||
Vector<Ref<Material>> _prop_materials;
|
||||
Vector<Ref<Material> > _materials;
|
||||
Vector<Ref<Material> > _liquid_materials;
|
||||
Vector<Ref<Material> > _prop_materials;
|
||||
};
|
||||
|
||||
#endif // VOXEL_LIBRARY_H
|
||||
|
@ -78,13 +78,13 @@ void VoxelmanLibraryMerger::set_margin(const int margin) {
|
||||
}
|
||||
|
||||
//Surfaces
|
||||
Ref<VoxelSurface> VoxelmanLibraryMerger::get_voxel_surface(const int index) {
|
||||
Ref<VoxelSurface> VoxelmanLibraryMerger::voxel_surface_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>(NULL));
|
||||
|
||||
return _voxel_surfaces[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibraryMerger::add_voxel_surface(Ref<VoxelSurface> value) {
|
||||
void VoxelmanLibraryMerger::voxel_surface_add(Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
value->set_library(Ref<VoxelmanLibraryMerger>(this));
|
||||
@ -93,7 +93,7 @@ void VoxelmanLibraryMerger::add_voxel_surface(Ref<VoxelSurface> value) {
|
||||
_voxel_surfaces.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibraryMerger::set_voxel_surface(const int index, Ref<VoxelSurface> value) {
|
||||
void VoxelmanLibraryMerger::voxel_surface_set(const int index, Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(index < 0);
|
||||
|
||||
if (_voxel_surfaces.size() < index) {
|
||||
@ -111,15 +111,15 @@ void VoxelmanLibraryMerger::set_voxel_surface(const int index, Ref<VoxelSurface>
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -55,12 +55,12 @@ public:
|
||||
int get_margin() const;
|
||||
void set_margin(const int margin);
|
||||
|
||||
Ref<VoxelSurface> get_voxel_surface(const int index);
|
||||
void add_voxel_surface(Ref<VoxelSurface> value);
|
||||
void set_voxel_surface(const int index, Ref<VoxelSurface> value);
|
||||
void remove_surface(const int index);
|
||||
int get_num_surfaces() const;
|
||||
void clear_surfaces();
|
||||
Ref<VoxelSurface> voxel_surface_get(const int index);
|
||||
void voxel_surface_add(Ref<VoxelSurface> value);
|
||||
void voxel_surface_set(const int index, Ref<VoxelSurface> value);
|
||||
void voxel_surface_remove(const int index);
|
||||
int voxel_surface_get_num() const;
|
||||
void voxel_surfaces_clear();
|
||||
|
||||
Vector<Variant> get_voxel_surfaces();
|
||||
void set_voxel_surfaces(const Vector<Variant> &surfaces);
|
||||
|
@ -43,13 +43,13 @@ void VoxelmanLibrarySimple::set_atlas_rows(int s) {
|
||||
}
|
||||
|
||||
//Surfaces
|
||||
Ref<VoxelSurface> VoxelmanLibrarySimple::get_voxel_surface(const int index) {
|
||||
Ref<VoxelSurface> VoxelmanLibrarySimple::voxel_surface_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>(NULL));
|
||||
|
||||
return _voxel_surfaces[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibrarySimple::add_voxel_surface(Ref<VoxelSurface> value) {
|
||||
void VoxelmanLibrarySimple::voxel_surface_add(Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
value->set_library(Ref<VoxelmanLibrarySimple>(this));
|
||||
@ -58,7 +58,7 @@ void VoxelmanLibrarySimple::add_voxel_surface(Ref<VoxelSurface> value) {
|
||||
_voxel_surfaces.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibrarySimple::set_voxel_surface(const int index, Ref<VoxelSurface> value) {
|
||||
void VoxelmanLibrarySimple::voxel_surface_set(const int index, Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(index < 0);
|
||||
|
||||
if (_voxel_surfaces.size() < index) {
|
||||
@ -76,15 +76,15 @@ void VoxelmanLibrarySimple::set_voxel_surface(const int index, Ref<VoxelSurface>
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -44,12 +44,12 @@ public:
|
||||
int get_atlas_rows() const;
|
||||
void set_atlas_rows(int s);
|
||||
|
||||
Ref<VoxelSurface> get_voxel_surface(const int index);
|
||||
void add_voxel_surface(Ref<VoxelSurface> value);
|
||||
void set_voxel_surface(const int index, Ref<VoxelSurface> value);
|
||||
void remove_surface(const int index);
|
||||
int get_num_surfaces() const;
|
||||
void clear_surfaces();
|
||||
Ref<VoxelSurface> voxel_surface_get(const int index);
|
||||
void voxel_surface_add(Ref<VoxelSurface> value);
|
||||
void voxel_surface_set(const int index, Ref<VoxelSurface> value);
|
||||
void voxel_surface_remove(const int index);
|
||||
int voxel_surface_get_num() const;
|
||||
void voxel_surfaces_clear();
|
||||
|
||||
Vector<Variant> get_voxel_surfaces();
|
||||
void set_voxel_surfaces(const Vector<Variant> &surfaces);
|
||||
|
@ -76,8 +76,8 @@ void VoxelMesherBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
||||
}
|
||||
|
||||
Vector<uint8_t> liquids;
|
||||
for (int i = 0; i < _library->get_num_surfaces(); ++i) {
|
||||
Ref<VoxelSurface> surface = _library->get_voxel_surface(i);
|
||||
for (int i = 0; i < _library->voxel_surface_get_num(); ++i) {
|
||||
Ref<VoxelSurface> surface = _library->voxel_surface_get(i);
|
||||
|
||||
if (!surface.is_valid())
|
||||
continue;
|
||||
@ -106,7 +106,7 @@ void VoxelMesherBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
||||
if (liquids.find(type) != -1)
|
||||
continue;
|
||||
|
||||
Ref<VoxelSurface> surface = _library->get_voxel_surface(type - 1);
|
||||
Ref<VoxelSurface> surface = _library->voxel_surface_get(type - 1);
|
||||
|
||||
if (!surface.is_valid())
|
||||
continue;
|
||||
|
@ -68,8 +68,8 @@ void VoxelMesherLiquidBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
||||
}
|
||||
|
||||
Vector<uint8_t> liquids;
|
||||
for (int i = 0; i < _library->get_num_surfaces(); ++i) {
|
||||
Ref<VoxelSurface> surface = _library->get_voxel_surface(i);
|
||||
for (int i = 0; i < _library->voxel_surface_get_num(); ++i) {
|
||||
Ref<VoxelSurface> surface = _library->voxel_surface_get(i);
|
||||
|
||||
if (!surface.is_valid())
|
||||
continue;
|
||||
@ -98,7 +98,7 @@ void VoxelMesherLiquidBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
||||
if (liquids.find(type) == -1)
|
||||
continue;
|
||||
|
||||
Ref<VoxelSurface> surface = _library->get_voxel_surface(type - 1);
|
||||
Ref<VoxelSurface> surface = _library->voxel_surface_get(type - 1);
|
||||
|
||||
if (!surface.is_valid())
|
||||
continue;
|
||||
|
@ -70,7 +70,7 @@ void VoxelMesherCubic::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
||||
|
||||
uint8_t type = cube_points->get_face_type(face) - 1;
|
||||
|
||||
Ref<VoxelSurface> surface = _library->get_voxel_surface(type);
|
||||
Ref<VoxelSurface> surface = _library->voxel_surface_get(type);
|
||||
|
||||
if (!surface.is_valid())
|
||||
continue;
|
||||
|
@ -307,8 +307,8 @@ void VoxelMesherMarchingCubes::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
||||
}
|
||||
}
|
||||
|
||||
Ref<VoxelSurface> surface1 = _library->get_voxel_surface(type_id1 - 1);
|
||||
Ref<VoxelSurface> surface2 = _library->get_voxel_surface(type_id2 - 1);
|
||||
Ref<VoxelSurface> surface1 = _library->voxel_surface_get(type_id1 - 1);
|
||||
Ref<VoxelSurface> 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);
|
||||
|
@ -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) {
|
||||
|
@ -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<ShaderMaterial> mat = chunk->get_library()->get_prop_material(0);
|
||||
Ref<SpatialMaterial> spmat = chunk->get_library()->get_prop_material(0);
|
||||
Ref<ShaderMaterial> mat = chunk->get_library()->prop_material_get(0);
|
||||
Ref<SpatialMaterial> spmat = chunk->get_library()->prop_material_get(0);
|
||||
Ref<Texture> 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<ShaderMaterial> mat = chunk->get_library()->get_material(0);
|
||||
Ref<SpatialMaterial> spmat = chunk->get_library()->get_material(0);
|
||||
Ref<ShaderMaterial> mat = chunk->get_library()->material_get(0);
|
||||
Ref<SpatialMaterial> spmat = chunk->get_library()->material_get(0);
|
||||
Ref<Texture> 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;
|
||||
|
@ -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<VoxelSurface> surface = library->get_voxel_surface(i);
|
||||
for (int i = 0; i < library->voxel_surface_get_num(); ++i) {
|
||||
Ref<VoxelSurface> surface = library->voxel_surface_get(i);
|
||||
|
||||
if (!surface.is_valid())
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user