Store the texture's rid to the chunk.

This commit is contained in:
Relintai 2022-02-24 10:00:42 +01:00
parent d47a87934b
commit 1767f09088

View File

@ -82,6 +82,8 @@ void Terrain2DTerrain2DJob::phase_library_setup() {
Ref<Terrain2DMaterialCache> cache = lib->material_cache_get(_chunk->material_cache_key_get());
if (!cache.is_valid()) {
//todo library texture get
next_phase();
return;
}
@ -92,6 +94,16 @@ void Terrain2DTerrain2DJob::phase_library_setup() {
//Let's just wait
OS::get_singleton()->delay_usec(100);
}
Ref<Terrain2DChunkDefault> cd = _chunk;
if (cd.is_valid()) {
Ref<Texture> tex = cache->texture_get_merged();
if (tex.is_valid()) {
cd->mesh_rid_set(Terrain2DChunkDefault::MESH_INDEX_TERRAIN, Terrain2DChunkDefault::MESH_TYPE_INDEX_TEXTURE_RID, tex->get_rid());
}
}
}
}