A bit more work on props.

This commit is contained in:
Relintai 2020-06-23 19:32:37 +02:00
parent 7aa0edf98e
commit 78be4a6666
2 changed files with 18 additions and 17 deletions

View File

@ -136,6 +136,11 @@ void VoxelChunkDefault::set_current_lod_level(const int value) {
RID rid = get_mesh_rid_index(MESH_INDEX_TERRARIN, MESH_TYPE_INDEX_MESH_INSTANCE, i);
if (rid != RID())
VisualServer::get_singleton()->instance_set_visible(rid, vis);
rid = get_mesh_rid_index(MESH_INDEX_PROP, MESH_TYPE_INDEX_MESH_INSTANCE, i);
if (rid != RID())
VisualServer::get_singleton()->instance_set_visible(rid, vis);
}
@ -852,6 +857,11 @@ void VoxelChunkDefault::_visibility_changed(bool visible) {
rid = get_mesh_rid_index(MESH_INDEX_LIQUID, MESH_TYPE_INDEX_MESH_INSTANCE, i);
if (rid != RID())
VisualServer::get_singleton()->instance_set_visible(rid, false);
rid = get_mesh_rid_index(MESH_INDEX_PROP, MESH_TYPE_INDEX_MESH_INSTANCE, i);
if (rid != RID())
VisualServer::get_singleton()->instance_set_visible(rid, false);
}
@ -1138,7 +1148,10 @@ void VoxelChunkDefault::_build_phase(int phase) {
}
next_phase();
return;
}
case BUILD_PHASE_PROP_SETUP: {
next_phase();
return;
}
case BUILD_PHASE_TERRARIN_MESH_SETUP: {
@ -1470,20 +1483,6 @@ void VoxelChunkDefault::_build_phase(int phase) {
return;
}
for (int i = 0; i < _prop_meshers.size(); ++i) {
Ref<VoxelMesher> mesher = _prop_meshers.get(i);
ERR_CONTINUE(!mesher.is_valid());
//add all
//mesher->add_chunk(this);
for (int i = 0; i < _props.size(); ++i) {
Ref<VoxelChunkPropData> d = _props.get(i);
//add to mesher
}
}
Ref<VoxelMesher> mesher;
for (int i = 0; i < _meshers.size(); ++i) {
Ref<VoxelMesher> m = _meshers.get(i);
@ -1492,11 +1491,11 @@ void VoxelChunkDefault::_build_phase(int phase) {
if (!mesher.is_valid()) {
mesher = m;
mesher->set_material(get_library()->get_material(0));
// mesher->set_material(get_library()->get_material(0));
continue;
}
mesher->set_material(get_library()->get_material(0));
// mesher->set_material(get_library()->get_material(0));
mesher->add_mesher(m);
}
@ -1836,6 +1835,7 @@ void VoxelChunkDefault::_bind_methods() {
BIND_CONSTANT(BUILD_PHASE_DONE);
BIND_CONSTANT(BUILD_PHASE_SETUP);
BIND_CONSTANT(BUILD_PHASE_PROP_SETUP);
BIND_CONSTANT(BUILD_PHASE_TERRARIN_MESH_SETUP);
BIND_CONSTANT(BUILD_PHASE_COLLIDER);
BIND_CONSTANT(BUILD_PHASE_TERRARIN_MESH);

View File

@ -72,6 +72,7 @@ public:
enum {
BUILD_PHASE_DONE = 0,
BUILD_PHASE_SETUP,
BUILD_PHASE_PROP_SETUP,
BUILD_PHASE_TERRARIN_MESH_SETUP,
BUILD_PHASE_COLLIDER,
BUILD_PHASE_LIGHTS,