mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Make possible and do update textures in node definitions after late texture atlas making
This commit is contained in:
parent
c6fd2986d4
commit
1afed48a2c
@ -225,6 +225,9 @@ Client::Client(
|
||||
else
|
||||
infostream<<"Not building texture atlas."<<std::endl;
|
||||
|
||||
// Update textures
|
||||
m_nodedef->updateTextures(tsrc);
|
||||
|
||||
// NOTE: This should be done only after getting possible dynamic
|
||||
// game definitions from the server, or at least shut down and
|
||||
// restarted when doing so
|
||||
|
@ -164,6 +164,21 @@ public:
|
||||
assert(c <= MAX_CONTENT);
|
||||
return &m_content_features[c];
|
||||
}
|
||||
virtual void updateTextures(ITextureSource *tsrc)
|
||||
{
|
||||
#ifndef SERVER
|
||||
infostream<<"CNodeDefManager::updateTextures(): Updating "
|
||||
<<"textures in node definitions"<<std::endl;
|
||||
for(u16 i=0; i<=MAX_CONTENT; i++)
|
||||
{
|
||||
ContentFeatures *f = &m_content_features[i];
|
||||
for(u16 j=0; j<6; j++)
|
||||
tsrc->updateAP(f->tiles[j].texture);
|
||||
if(f->special_atlas)
|
||||
tsrc->updateAP(*(f->special_atlas));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
ContentFeatures m_content_features[MAX_CONTENT+1];
|
||||
};
|
||||
|
@ -320,6 +320,12 @@ public:
|
||||
// Register node definition
|
||||
virtual void set(content_t c, const ContentFeatures &def)=0;
|
||||
virtual ContentFeatures* getModifiable(content_t c)=0;
|
||||
|
||||
/*
|
||||
Update tile textures to latest return values of TextueSource.
|
||||
Call after updating the texture atlas of a TextureSource.
|
||||
*/
|
||||
virtual void updateTextures(ITextureSource *tsrc)=0;
|
||||
};
|
||||
|
||||
// If textures not actually available (server), tsrc can be NULL
|
||||
|
@ -138,6 +138,7 @@ public:
|
||||
{return AtlasPointer(0);}
|
||||
virtual video::ITexture* getTextureRaw(const std::string &name)
|
||||
{return NULL;}
|
||||
virtual void updateAP(AtlasPointer &ap){};
|
||||
};
|
||||
|
||||
class IWritableTextureSource : public ITextureSource
|
||||
@ -153,8 +154,8 @@ public:
|
||||
{return AtlasPointer(0);}
|
||||
virtual video::ITexture* getTextureRaw(const std::string &name)
|
||||
{return NULL;}
|
||||
virtual void updateAP(AtlasPointer &ap){};
|
||||
|
||||
virtual void updateAP(AtlasPointer &ap)=0;
|
||||
virtual void buildMainAtlas(class IGameDef *gamedef)=0;
|
||||
virtual void processQueue()=0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user