diff options
author | est31 <MTest31@outlook.com> | 2015-03-15 07:25:22 +0100 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2015-03-15 22:01:52 +1000 |
commit | e4f7c92cff0badd6c40b47bd90b1fc1b35456a1a (patch) | |
tree | d080116bc042d87283ed4c3d6e5cec9977cfd141 /src/nodedef.cpp | |
parent | 2bc0165652ec9244081f7c0db28c8d9c81b5d308 (diff) | |
download | minetest-e4f7c92cff0badd6c40b47bd90b1fc1b35456a1a.tar.gz minetest-e4f7c92cff0badd6c40b47bd90b1fc1b35456a1a.tar.bz2 minetest-e4f7c92cff0badd6c40b47bd90b1fc1b35456a1a.zip |
Finer progress bar updates when initializing nodes
The bar is only drawn when the user will notice a change, which prevents time overheads that this commit would cause, resulting from useless draws.
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r-- | src/nodedef.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp index a0dcf6b71..4aee1b1c6 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -398,7 +398,9 @@ public: virtual content_t set(const std::string &name, const ContentFeatures &def); virtual content_t allocateDummy(const std::string &name); virtual void updateAliases(IItemDefManager *idef); - virtual void updateTextures(IGameDef *gamedef); + virtual void updateTextures(IGameDef *gamedef, + /*argument: */void (*progress_callback)(void *progress_args, u32 progress, u32 max_progress), + /*argument: */void *progress_callback_args); void serialize(std::ostream &os, u16 protocol_version); void deSerialize(std::istream &is); @@ -715,7 +717,9 @@ void CNodeDefManager::updateAliases(IItemDefManager *idef) } -void CNodeDefManager::updateTextures(IGameDef *gamedef) +void CNodeDefManager::updateTextures(IGameDef *gamedef, + void (*progress_callback)(void *progress_args, u32 progress, u32 max_progress), + void *progress_callback_args) { #ifndef SERVER infostream << "CNodeDefManager::updateTextures(): Updating " @@ -738,7 +742,9 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef) bool use_normal_texture = enable_shaders && (enable_bumpmapping || enable_parallax_occlusion); - for (u32 i = 0; i < m_content_features.size(); i++) { + u32 size = m_content_features.size(); + + for (u32 i = 0; i < size; i++) { ContentFeatures *f = &m_content_features[i]; // Figure out the actual tiles to use @@ -911,6 +917,8 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef) recalculateBoundingBox(f->mesh_ptr[0]); meshmanip->recalculateNormals(f->mesh_ptr[0], true, false); } + + progress_callback(progress_callback_args, i, size); } #endif } |