mirror of
https://github.com/Relintai/props.git
synced 2025-02-10 16:30:06 +01:00
Fixed more issues. Now meshes actually get built.
This commit is contained in:
parent
36663e46ae
commit
6e5836a859
@ -393,6 +393,10 @@ void PropInstanceMerger::_init_materials() {
|
||||
}
|
||||
|
||||
void PropInstanceMerger::_build() {
|
||||
if (_building) {
|
||||
return;
|
||||
}
|
||||
|
||||
set_building(true);
|
||||
_build_queued = false;
|
||||
|
||||
@ -444,11 +448,16 @@ void PropInstanceMerger::_build() {
|
||||
|
||||
prop_preprocess(Transform(), _prop_data);
|
||||
|
||||
/*
|
||||
|
||||
Don't submit here, as it starts in physics process mode
|
||||
|
||||
#if THREAD_POOL_PRESENT
|
||||
ThreadPool::get_singleton()->add_job(_job);
|
||||
#else
|
||||
_job->execute();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void PropInstanceMerger::_build_finished() {
|
||||
@ -544,7 +553,7 @@ PropInstanceMerger::PropInstanceMerger() {
|
||||
_first_lod_distance_squared = 20;
|
||||
_lod_reduction_distance_squared = 10;
|
||||
|
||||
//todo this should probably be in a virtual method, lik in Terraman or Voxelman
|
||||
//todo this should probably be in a virtual method, like in Terraman or Voxelman
|
||||
_job = Ref<PropInstancePropJob>(memnew(PropInstancePropJob()));
|
||||
_job->set_prop_instace(this);
|
||||
|
||||
@ -576,7 +585,7 @@ void PropInstanceMerger::_notification(int p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
if (_prop_data.is_valid()) {
|
||||
_job->prop_instance_enter_tree();
|
||||
build();
|
||||
call_deferred("build");
|
||||
}
|
||||
|
||||
break;
|
||||
@ -592,7 +601,6 @@ void PropInstanceMerger::_notification(int p_what) {
|
||||
break;
|
||||
}
|
||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||
//todo turn this on and off properly
|
||||
|
||||
if (_building) {
|
||||
if (!_job.is_valid()) {
|
||||
@ -615,7 +623,6 @@ void PropInstanceMerger::_notification(int p_what) {
|
||||
break;
|
||||
}
|
||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||
//todo turn this on and off properly
|
||||
|
||||
if (_building) {
|
||||
if (!_job.is_valid()) {
|
||||
|
@ -195,6 +195,7 @@ void PropInstancePropJob::phase_prop() {
|
||||
if (should_do()) {
|
||||
if (_prop_mesh_datas.size() == 0) {
|
||||
//reset_meshes();
|
||||
reset_stages();
|
||||
set_complete(true); //So threadpool knows it's done
|
||||
return;
|
||||
}
|
||||
@ -211,10 +212,10 @@ void PropInstancePropJob::phase_prop() {
|
||||
|
||||
Rect2 uvr = _material_cache->texture_get_uv_rect(tex);
|
||||
|
||||
get_prop_mesher()->add_mesh_data_resource_transform(mesh, t, uvr);
|
||||
_prop_mesher->add_mesh_data_resource_transform(mesh, t, uvr);
|
||||
}
|
||||
|
||||
if (get_prop_mesher()->get_vertex_count() == 0) {
|
||||
if (_prop_mesher->get_vertex_count() == 0) {
|
||||
//reset_meshes();
|
||||
|
||||
reset_stages();
|
||||
@ -281,16 +282,6 @@ void PropInstancePropJob::phase_prop() {
|
||||
}
|
||||
*/
|
||||
|
||||
if (get_prop_mesher()->get_vertex_count() != 0) {
|
||||
if (should_do()) {
|
||||
temp_mesh_arr = get_prop_mesher()->build_mesh();
|
||||
|
||||
if (should_return()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
reset_stages();
|
||||
@ -336,12 +327,16 @@ void PropInstancePropJob::_reset() {
|
||||
_build_done = false;
|
||||
_phase = 0;
|
||||
|
||||
_current_job_step = 0;
|
||||
|
||||
reset_stages();
|
||||
|
||||
if (get_prop_mesher().is_valid()) {
|
||||
get_prop_mesher()->reset();
|
||||
if (_prop_mesher.is_valid()) {
|
||||
_prop_mesher->reset();
|
||||
}
|
||||
|
||||
_prop_mesh_datas.clear();
|
||||
|
||||
set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
||||
}
|
||||
|
||||
@ -710,9 +705,11 @@ PropInstancePropJob::PropInstancePropJob() {
|
||||
|
||||
_prop_instace = NULL;
|
||||
|
||||
_current_job_step = 0;
|
||||
|
||||
//todo allocate this in a virtual method
|
||||
_prop_mesher.instance();
|
||||
_prop_mesher->set_build_flags(PropMesher::BUILD_FLAG_USE_LIGHTING | PropMesher::BUILD_FLAG_USE_AO | PropMesher::BUILD_FLAG_USE_RAO | PropMesher::BUILD_FLAG_GENERATE_AO | PropMesher::BUILD_FLAG_AUTO_GENERATE_RAO | PropMesher::BUILD_FLAG_BAKE_LIGHTS);
|
||||
//_prop_mesher->set_build_flags(PropMesher::BUILD_FLAG_USE_LIGHTING | PropMesher::BUILD_FLAG_USE_AO | PropMesher::BUILD_FLAG_USE_RAO | PropMesher::BUILD_FLAG_GENERATE_AO | PropMesher::BUILD_FLAG_AUTO_GENERATE_RAO | PropMesher::BUILD_FLAG_BAKE_LIGHTS);
|
||||
}
|
||||
|
||||
PropInstancePropJob::~PropInstancePropJob() {
|
||||
|
Loading…
Reference in New Issue
Block a user