mirror of
https://github.com/Relintai/terraman.git
synced 2025-04-25 21:45:00 +02:00
Also add the liquids to the material cache key hash.
This commit is contained in:
parent
9eb61941f5
commit
9c580fce42
@ -83,6 +83,31 @@ void TerrainLibraryMergerPCM::_material_cache_get_key(Ref<TerrainChunk> 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<TerrainChunk> chunk) {
|
||||
Vector<uint64_t> props;
|
||||
|
||||
/*
|
||||
#ifdef PROPS_PRESENT
|
||||
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
||||
Ref<PropData> prop = chunk->prop_get(i);
|
||||
/*
|
||||
#ifdef PROPS_PRESENT
|
||||
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
||||
Ref<PropData> 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<PropData *>(*prop);
|
||||
//get pointer's value as uint64
|
||||
uint64_t v = make_uint64_t<PropData *>(*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<TerrainChunk> chu
|
||||
cache->material_add(nm);
|
||||
}
|
||||
|
||||
/*
|
||||
#ifdef PROPS_PRESENT
|
||||
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
||||
Ref<PropData> prop = chunk->prop_get(i);
|
||||
/*
|
||||
#ifdef PROPS_PRESENT
|
||||
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
||||
Ref<PropData> 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user