mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Add caching of generated textures as image
This commit is contained in:
parent
9cb78f2dc5
commit
486fb7cc4d
3 changed files with 86 additions and 20 deletions
|
@ -761,10 +761,6 @@ static bool isWorldAligned(AlignStyle style, WorldAlignMode mode, NodeDrawType d
|
|||
void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc,
|
||||
scene::IMeshManipulator *meshmanip, Client *client, const TextureSettings &tsettings)
|
||||
{
|
||||
// minimap pixel color - the average color of a texture
|
||||
if (tsettings.enable_minimap && !tiledef[0].name.empty())
|
||||
minimap_color = tsrc->getTextureAverageColor(tiledef[0].name);
|
||||
|
||||
// Figure out the actual tiles to use
|
||||
TileDef tdef[6];
|
||||
for (u32 j = 0; j < 6; j++) {
|
||||
|
@ -909,6 +905,10 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
|
|||
|
||||
u32 overlay_shader = shdsrc->getShader("nodes_shader", overlay_material, drawtype);
|
||||
|
||||
// minimap pixel color = average color of top tile
|
||||
if (tsettings.enable_minimap && !tdef[0].name.empty() && drawtype != NDT_AIRLIKE)
|
||||
minimap_color = tsrc->getTextureAverageColor(tdef[0].name);
|
||||
|
||||
// Tiles (fill in f->tiles[])
|
||||
bool any_polygon_offset = false;
|
||||
for (u16 j = 0; j < 6; j++) {
|
||||
|
@ -1457,13 +1457,16 @@ void NodeDefManager::updateTextures(IGameDef *gamedef, void *progress_callback_a
|
|||
TextureSettings tsettings;
|
||||
tsettings.readSettings();
|
||||
|
||||
u32 size = m_content_features.size();
|
||||
tsrc->setImageCaching(true);
|
||||
|
||||
u32 size = m_content_features.size();
|
||||
for (u32 i = 0; i < size; i++) {
|
||||
ContentFeatures *f = &(m_content_features[i]);
|
||||
f->updateTextures(tsrc, shdsrc, meshmanip, client, tsettings);
|
||||
client->showUpdateProgressTexture(progress_callback_args, i, size);
|
||||
}
|
||||
|
||||
tsrc->setImageCaching(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue