mirror of
https://github.com/Relintai/voxelman.git
synced 2025-04-15 21:06:06 +02:00
Now chunks will generate the collider in the spawned thread. Also a few smaller tweaks.
This commit is contained in:
parent
f63a8910dc
commit
4a535207e0
@ -1016,10 +1016,10 @@ void VoxelChunkDefault::_build_phase(int phase) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_is_build_threaded) {
|
//if (_is_build_threaded) {
|
||||||
set_active_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
// set_active_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (!has_meshes(MESH_INDEX_TERRARIN, MESH_TYPE_INDEX_BODY)) {
|
if (!has_meshes(MESH_INDEX_TERRARIN, MESH_TYPE_INDEX_BODY)) {
|
||||||
create_colliders(MESH_INDEX_TERRARIN);
|
create_colliders(MESH_INDEX_TERRARIN);
|
||||||
@ -1039,15 +1039,17 @@ void VoxelChunkDefault::_build_phase(int phase) {
|
|||||||
|
|
||||||
ERR_CONTINUE(!mesher.is_valid());
|
ERR_CONTINUE(!mesher.is_valid());
|
||||||
|
|
||||||
mesher->bake_colors(this);
|
mesher->set_library(_library);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < _meshers.size(); ++i) {
|
if ((_build_flags & VoxelChunkDefault::BUILD_FLAG_USE_LIGHTING) != 0) {
|
||||||
Ref<VoxelMesher> mesher = _meshers.get(i);
|
for (int i = 0; i < _meshers.size(); ++i) {
|
||||||
|
Ref<VoxelMesher> mesher = _meshers.get(i);
|
||||||
|
|
||||||
ERR_CONTINUE(!mesher.is_valid());
|
ERR_CONTINUE(!mesher.is_valid());
|
||||||
|
|
||||||
mesher->set_library(_library);
|
mesher->bake_colors(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<VoxelMesher> mesher;
|
Ref<VoxelMesher> mesher;
|
||||||
@ -1081,7 +1083,11 @@ void VoxelChunkDefault::_build_phase(int phase) {
|
|||||||
Array temp_mesh_arr = mesher->build_mesh();
|
Array temp_mesh_arr = mesher->build_mesh();
|
||||||
|
|
||||||
if (mesh_rid == RID()) {
|
if (mesh_rid == RID()) {
|
||||||
create_meshes(MESH_INDEX_TERRARIN, _lod_num + 1);
|
if ((_build_flags & BUILD_FLAG_CREATE_LODS) != 0)
|
||||||
|
create_meshes(MESH_INDEX_TERRARIN, _lod_num + 1);
|
||||||
|
else
|
||||||
|
create_meshes(MESH_INDEX_TERRARIN, 1);
|
||||||
|
|
||||||
mesh_rid = get_mesh_rid_index(MESH_INDEX_TERRARIN, MESH_TYPE_INDEX_MESH, 0);
|
mesh_rid = get_mesh_rid_index(MESH_INDEX_TERRARIN, MESH_TYPE_INDEX_MESH, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,8 +385,9 @@ void VoxelWorld::set_chunks(const Vector<Variant> &chunks) {
|
|||||||
if (!chunk.is_valid())
|
if (!chunk.is_valid())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (_chunks_vector.find(chunk) != -1)
|
if (_chunks_vector.find(chunk) != -1) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
add_chunk(chunk, chunk->get_position_x(), chunk->get_position_y(), chunk->get_position_z());
|
add_chunk(chunk, chunk->get_position_x(), chunk->get_position_y(), chunk->get_position_z());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user