Check whether the chunk has a material cache key set instead of checking whether the library supports caching in the terrain job.

This commit is contained in:
Relintai 2021-08-02 23:06:22 +02:00
parent a813a60cf7
commit 06ade87fac

View File

@ -100,20 +100,8 @@ void TerraTerrarinJob::phase_library_setup() {
if (lib->supports_caching()) { if (lib->supports_caching()) {
lib->material_cache_get_key(_chunk); lib->material_cache_get_key(_chunk);
//if (_liquid_mesher.is_valid()) {
// _liquid_mesher->set_terrain_material_key(_terrarin_material_key);
//}
} }
//if (lib->supports_caching()) {
// _terrain_material_key = lib->material_cached_get_key(_chunk);
//if (_liquid_mesher.is_valid()) {
// _liquid_mesher->set_terrain_material_key(_terrarin_material_key);
//}
//}
next_phase(); next_phase();
} }
@ -479,7 +467,7 @@ void TerraTerrarinJob::step_type_normal() {
Ref<Material> lmat; Ref<Material> lmat;
if (chunk->get_library()->supports_caching()) { if (chunk->material_cache_key_has()) {
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
} else { } else {
lmat = chunk->get_library()->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_lod_get(_current_mesh);
@ -520,7 +508,7 @@ void TerraTerrarinJob::step_type_normal_lod() {
Ref<Material> lmat; Ref<Material> lmat;
if (chunk->get_library()->supports_caching()) { if (chunk->material_cache_key_has()) {
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
} else { } else {
lmat = chunk->get_library()->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_lod_get(_current_mesh);
@ -544,7 +532,7 @@ void TerraTerrarinJob::step_type_drop_uv2() {
Ref<Material> lmat; Ref<Material> lmat;
if (chunk->get_library()->supports_caching()) { if (chunk->material_cache_key_has()) {
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
} else { } else {
lmat = chunk->get_library()->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_lod_get(_current_mesh);
@ -568,7 +556,7 @@ void TerraTerrarinJob::step_type_merge_verts() {
Ref<Material> lmat; Ref<Material> lmat;
if (chunk->get_library()->supports_caching()) { if (chunk->material_cache_key_has()) {
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
} else { } else {
lmat = chunk->get_library()->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_lod_get(_current_mesh);
@ -604,7 +592,7 @@ void TerraTerrarinJob::step_type_bake_texture() {
Ref<Material> lmat; Ref<Material> lmat;
if (chunk->get_library()->supports_caching()) { if (chunk->material_cache_key_has()) {
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
} else { } else {
lmat = chunk->get_library()->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_lod_get(_current_mesh);
@ -639,7 +627,7 @@ void TerraTerrarinJob::step_type_simplify_mesh() {
Ref<Material> lmat; Ref<Material> lmat;
if (chunk->get_library()->supports_caching()) { if (chunk->material_cache_key_has()) {
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
} else { } else {
lmat = chunk->get_library()->material_lod_get(_current_mesh); lmat = chunk->get_library()->material_lod_get(_current_mesh);