mirror of
https://github.com/Relintai/voxelman.git
synced 2025-04-09 20:42:38 +02:00
Same treatment to props related methods in VoxelChunk.
This commit is contained in:
parent
2dec05f80f
commit
8124f19c5d
@ -668,7 +668,7 @@ void VoxelChunk::clear_baked_lights() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if PROPS_PRESENT
|
#if PROPS_PRESENT
|
||||||
void VoxelChunk::add_prop(const Transform &tarnsform, const Ref<PropData> &prop) {
|
void VoxelChunk::prop_add(const Transform &tarnsform, const Ref<PropData> &prop) {
|
||||||
ERR_FAIL_COND(!prop.is_valid());
|
ERR_FAIL_COND(!prop.is_valid());
|
||||||
|
|
||||||
PropDataStore s;
|
PropDataStore s;
|
||||||
@ -677,25 +677,25 @@ void VoxelChunk::add_prop(const Transform &tarnsform, const Ref<PropData> &prop)
|
|||||||
|
|
||||||
_props.push_back(s);
|
_props.push_back(s);
|
||||||
}
|
}
|
||||||
Ref<PropData> VoxelChunk::get_prop(int index) {
|
Ref<PropData> VoxelChunk::prop_get(int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
|
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
|
||||||
|
|
||||||
return _props.get(index).prop;
|
return _props.get(index).prop;
|
||||||
}
|
}
|
||||||
Transform VoxelChunk::get_prop_tarnsform(const int index) {
|
Transform VoxelChunk::prop_get_tarnsform(const int index) {
|
||||||
ERR_FAIL_INDEX_V(index, _props.size(), Transform());
|
ERR_FAIL_INDEX_V(index, _props.size(), Transform());
|
||||||
|
|
||||||
return _props.get(index).transform;
|
return _props.get(index).transform;
|
||||||
}
|
}
|
||||||
int VoxelChunk::get_prop_count() const {
|
int VoxelChunk::prop_get_count() const {
|
||||||
return _props.size();
|
return _props.size();
|
||||||
}
|
}
|
||||||
void VoxelChunk::remove_prop(const int index) {
|
void VoxelChunk::prop_remove(const int index) {
|
||||||
ERR_FAIL_INDEX(index, _props.size());
|
ERR_FAIL_INDEX(index, _props.size());
|
||||||
|
|
||||||
_props.remove(index);
|
_props.remove(index);
|
||||||
}
|
}
|
||||||
void VoxelChunk::clear_props() {
|
void VoxelChunk::props_clear() {
|
||||||
_props.clear();
|
_props.clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1032,7 +1032,7 @@ VoxelChunk::~VoxelChunk() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if PROPS_PRESENT
|
#if PROPS_PRESENT
|
||||||
clear_props();
|
props_clear();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MESH_DATA_RESOURCE_PRESENT
|
#if MESH_DATA_RESOURCE_PRESENT
|
||||||
@ -1377,11 +1377,11 @@ void VoxelChunk::_bind_methods() {
|
|||||||
//Meshes
|
//Meshes
|
||||||
|
|
||||||
#if PROPS_PRESENT
|
#if PROPS_PRESENT
|
||||||
ClassDB::bind_method(D_METHOD("add_prop", "prop"), &VoxelChunk::add_prop);
|
ClassDB::bind_method(D_METHOD("prop_add", "prop"), &VoxelChunk::prop_add);
|
||||||
ClassDB::bind_method(D_METHOD("get_prop", "index"), &VoxelChunk::get_prop);
|
ClassDB::bind_method(D_METHOD("prop_get", "index"), &VoxelChunk::prop_get);
|
||||||
ClassDB::bind_method(D_METHOD("get_prop_count"), &VoxelChunk::get_prop_count);
|
ClassDB::bind_method(D_METHOD("prop_get_count"), &VoxelChunk::prop_get_count);
|
||||||
ClassDB::bind_method(D_METHOD("remove_prop", "index"), &VoxelChunk::remove_prop);
|
ClassDB::bind_method(D_METHOD("prop_remove", "index"), &VoxelChunk::prop_remove);
|
||||||
ClassDB::bind_method(D_METHOD("clear_props"), &VoxelChunk::clear_props);
|
ClassDB::bind_method(D_METHOD("props_clear"), &VoxelChunk::props_clear);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MESH_DATA_RESOURCE_PRESENT
|
#if MESH_DATA_RESOURCE_PRESENT
|
||||||
|
@ -211,12 +211,12 @@ public:
|
|||||||
void clear_baked_lights();
|
void clear_baked_lights();
|
||||||
|
|
||||||
#if PROPS_PRESENT
|
#if PROPS_PRESENT
|
||||||
void add_prop(const Transform &tarnsform, const Ref<PropData> &prop);
|
void prop_add(const Transform &tarnsform, const Ref<PropData> &prop);
|
||||||
Ref<PropData> get_prop(const int index);
|
Ref<PropData> prop_get(const int index);
|
||||||
Transform get_prop_tarnsform(const int index);
|
Transform prop_get_tarnsform(const int index);
|
||||||
int get_prop_count() const;
|
int prop_get_count() const;
|
||||||
void remove_prop(const int index);
|
void prop_remove(const int index);
|
||||||
void clear_props();
|
void props_clear();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MESH_DATA_RESOURCE_PRESENT
|
#if MESH_DATA_RESOURCE_PRESENT
|
||||||
|
@ -550,7 +550,7 @@ void VoxelWorld::add_prop(Transform tarnsform, const Ref<PropData> &prop, const
|
|||||||
wp = tarnsform.xform(wp);
|
wp = tarnsform.xform(wp);
|
||||||
Ref<VoxelChunk> chunk = get_or_create_chunk_at_world_position(wp);
|
Ref<VoxelChunk> chunk = get_or_create_chunk_at_world_position(wp);
|
||||||
|
|
||||||
chunk->add_prop(tarnsform, prop);
|
chunk->prop_add(tarnsform, prop);
|
||||||
|
|
||||||
int count = prop->get_prop_count();
|
int count = prop->get_prop_count();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user