diff --git a/library/terrain_library_merger_pcm.cpp b/library/terrain_library_merger_pcm.cpp index 48ae09b..c5f2219 100644 --- a/library/terrain_library_merger_pcm.cpp +++ b/library/terrain_library_merger_pcm.cpp @@ -83,6 +83,31 @@ void TerrainLibraryMergerPCM::_material_cache_get_key(Ref chunk) { } } + uint8_t *liquid_ch = chunk->channel_get(TerrainChunkDefault::DEFAULT_CHANNEL_LIQUID_TYPE); + + if (liquid_ch) { + for (uint32_t i = 0; i < size; ++i) { + uint8_t v = liquid_ch[i]; + + if (v == 0) { + continue; + } + + int ssize = surfaces.size(); + bool found = false; + for (uint8_t j = 0; j < ssize; ++j) { + if (surfaces[j] == v) { + found = true; + break; + } + } + + if (!found) { + surfaces.push_back(v); + } + } + } + if (surfaces.size() == 0) { chunk->material_cache_key_set(0); chunk->material_cache_key_has_set(false); @@ -207,31 +232,31 @@ void TerrainLibraryMergerPCM::_material_cache_unref(const int key) { void TerrainLibraryMergerPCM::_prop_material_cache_get_key(Ref chunk) { Vector props; -/* -#ifdef PROPS_PRESENT - for (int i = 0; i < chunk->prop_get_count(); ++i) { - Ref prop = chunk->prop_get(i); + /* + #ifdef PROPS_PRESENT + for (int i = 0; i < chunk->prop_get_count(); ++i) { + Ref prop = chunk->prop_get(i); - ERR_CONTINUE(!prop.is_valid()); + ERR_CONTINUE(!prop.is_valid()); - //get pointer's value as uint64 - uint64_t v = make_uint64_t(*prop); + //get pointer's value as uint64 + uint64_t v = make_uint64_t(*prop); - int psize = props.size(); - bool found = false; - for (int j = 0; j < psize; ++j) { - if (props[j] == v) { - found = true; - break; + int psize = props.size(); + bool found = false; + for (int j = 0; j < psize; ++j) { + if (props[j] == v) { + found = true; + break; + } + } + + if (!found) { + props.push_back(v); } } - - if (!found) { - props.push_back(v); - } - } -#endif -*/ + #endif + */ #if MESH_DATA_RESOURCE_PRESENT for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) { @@ -316,17 +341,17 @@ void TerrainLibraryMergerPCM::_prop_material_cache_get_key(Ref chu cache->material_add(nm); } -/* -#ifdef PROPS_PRESENT - for (int i = 0; i < chunk->prop_get_count(); ++i) { - Ref prop = chunk->prop_get(i); + /* + #ifdef PROPS_PRESENT + for (int i = 0; i < chunk->prop_get_count(); ++i) { + Ref prop = chunk->prop_get(i); - ERR_CONTINUE(!prop.is_valid()); + ERR_CONTINUE(!prop.is_valid()); - cache->prop_add_textures(prop); - } -#endif -*/ + cache->prop_add_textures(prop); + } + #endif + */ #if MESH_DATA_RESOURCE_PRESENT for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {