mirror of
https://github.com/Relintai/terraman.git
synced 2025-04-23 21:43:23 +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) {
|
if (surfaces.size() == 0) {
|
||||||
chunk->material_cache_key_set(0);
|
chunk->material_cache_key_set(0);
|
||||||
chunk->material_cache_key_has_set(false);
|
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) {
|
void TerrainLibraryMergerPCM::_prop_material_cache_get_key(Ref<TerrainChunk> chunk) {
|
||||||
Vector<uint64_t> props;
|
Vector<uint64_t> props;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef PROPS_PRESENT
|
#ifdef PROPS_PRESENT
|
||||||
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
||||||
Ref<PropData> prop = chunk->prop_get(i);
|
Ref<PropData> prop = chunk->prop_get(i);
|
||||||
|
|
||||||
ERR_CONTINUE(!prop.is_valid());
|
ERR_CONTINUE(!prop.is_valid());
|
||||||
|
|
||||||
//get pointer's value as uint64
|
//get pointer's value as uint64
|
||||||
uint64_t v = make_uint64_t<PropData *>(*prop);
|
uint64_t v = make_uint64_t<PropData *>(*prop);
|
||||||
|
|
||||||
int psize = props.size();
|
int psize = props.size();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int j = 0; j < psize; ++j) {
|
for (int j = 0; j < psize; ++j) {
|
||||||
if (props[j] == v) {
|
if (props[j] == v) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
props.push_back(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!found) {
|
*/
|
||||||
props.push_back(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if MESH_DATA_RESOURCE_PRESENT
|
#if MESH_DATA_RESOURCE_PRESENT
|
||||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
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);
|
cache->material_add(nm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef PROPS_PRESENT
|
#ifdef PROPS_PRESENT
|
||||||
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
||||||
Ref<PropData> prop = chunk->prop_get(i);
|
Ref<PropData> prop = chunk->prop_get(i);
|
||||||
|
|
||||||
ERR_CONTINUE(!prop.is_valid());
|
ERR_CONTINUE(!prop.is_valid());
|
||||||
|
|
||||||
cache->prop_add_textures(prop);
|
cache->prop_add_textures(prop);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if MESH_DATA_RESOURCE_PRESENT
|
#if MESH_DATA_RESOURCE_PRESENT
|
||||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user