mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-20 10:47:19 +01:00
VoxelPropJob now works.
This commit is contained in:
parent
989e82b332
commit
3add3daef4
@ -43,13 +43,6 @@ void VoxelPropJob::set_prop_mesher(const Ref<VoxelMesher> &mesher) {
|
||||
_prop_mesher = mesher;
|
||||
}
|
||||
|
||||
void VoxelPropJob::phase_reset() {
|
||||
if (get_prop_mesher().is_valid()) {
|
||||
get_prop_mesher()->reset();
|
||||
get_prop_mesher()->set_library(_chunk->get_library());
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelPropJob::phase_physics_process() {
|
||||
Ref<VoxelChunkDefault> chunk = _chunk;
|
||||
|
||||
@ -320,24 +313,57 @@ void VoxelPropJob::phase_prop() {
|
||||
}
|
||||
}
|
||||
|
||||
//next_phase()
|
||||
#endif
|
||||
|
||||
set_complete(true); //So threadpool knows it's done
|
||||
next_job();
|
||||
}
|
||||
|
||||
void VoxelPropJob::_execute() {
|
||||
void VoxelPropJob::_physics_process(float delta) {
|
||||
if (_phase == 0)
|
||||
phase_physics_process();
|
||||
}
|
||||
|
||||
void VoxelPropJob::_execute_phase() {
|
||||
ERR_FAIL_COND(!_chunk.is_valid());
|
||||
|
||||
Ref<VoxelmanLibrary> library = _chunk->get_library();
|
||||
|
||||
ERR_FAIL_COND(!library.is_valid());
|
||||
|
||||
next_job();
|
||||
Ref<VoxelChunkDefault> chunk = _chunk;
|
||||
|
||||
//phase_prop();
|
||||
if (!chunk.is_valid()
|
||||
//#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
|| chunk->get_mesh_data_resource_count() == 0
|
||||
//#endif
|
||||
) {
|
||||
set_complete(true);
|
||||
next_job();
|
||||
return;
|
||||
}
|
||||
|
||||
//finish
|
||||
if (_phase == 1) {
|
||||
phase_prop();
|
||||
} else if (_phase > 1) {
|
||||
set_complete(true); //So threadpool knows it's done
|
||||
next_job();
|
||||
ERR_FAIL_MSG("VoxelPropJob: _phase is too high!");
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelPropJob::_reset() {
|
||||
VoxelJob::_reset();
|
||||
|
||||
_build_done = false;
|
||||
_phase = 0;
|
||||
|
||||
if (get_prop_mesher().is_valid()) {
|
||||
get_prop_mesher()->reset();
|
||||
get_prop_mesher()->set_library(_chunk->get_library());
|
||||
}
|
||||
|
||||
set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
||||
}
|
||||
|
||||
VoxelPropJob::VoxelPropJob() {
|
||||
@ -350,4 +376,6 @@ void VoxelPropJob::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_prop_mesher"), &VoxelPropJob::get_prop_mesher);
|
||||
ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &VoxelPropJob::set_prop_mesher);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_mesher", PROPERTY_HINT_RESOURCE_TYPE, "VoxelMesher", 0), "set_prop_mesher", "get_prop_mesher");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_physics_process", "delta"), &VoxelPropJob::_physics_process);
|
||||
}
|
||||
|
@ -34,11 +34,12 @@ public:
|
||||
Ref<VoxelMesher> get_prop_mesher() const;
|
||||
void set_prop_mesher(const Ref<VoxelMesher> &mesher);
|
||||
|
||||
void phase_reset();
|
||||
void phase_physics_process();
|
||||
void phase_prop();
|
||||
|
||||
void _execute();
|
||||
void _physics_process(float delta);
|
||||
void _execute_phase();
|
||||
void _reset();
|
||||
|
||||
VoxelPropJob();
|
||||
~VoxelPropJob();
|
||||
|
@ -568,10 +568,7 @@ void VoxelTerrarinJob::phase_terrarin_mesh() {
|
||||
}
|
||||
|
||||
void VoxelTerrarinJob::phase_finalize() {
|
||||
//add vs meshes to chunk
|
||||
|
||||
set_complete(true); //So threadpool knows it's done
|
||||
//set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
||||
|
||||
next_job();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user