Renamed'lazy' loading in material (which is used to not load font

textures sinze they are not all needed) to 'dont_load' - so that
'lazy' can be used for lazy loading (i.e. on demand, but still
by the material, not by an external object) of textures.
This commit is contained in:
hiker 2015-09-18 09:51:52 +10:00
parent b3e2924df0
commit 125bc1fc8f
3 changed files with 27 additions and 26 deletions

View File

@ -1,22 +1,22 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<materials> <materials>
<!-- Fonts --> <!-- Fonts -->
<material name="title_font.png" shader="unlit" lazy-load="Y"/> <material name="title_font.png" shader="unlit" dont-load="Y"/>
<material name="title_font_2.png" shader="unlit" lazy-load="Y"/> <material name="title_font_2.png" shader="unlit" dont-load="Y"/>
<material name="sigmar0.png" shader="unlit" lazy-load="Y"/> <material name="sigmar0.png" shader="unlit" dont-load="Y"/>
<material name="comix.png" shader="unlit" lazy-load="Y"/> <material name="comix.png" shader="unlit" dont-load="Y"/>
<material name="LayneHansom0.png" shader="unlit" lazy-load="Y"/> <material name="LayneHansom0.png" shader="unlit" dont-load="Y"/>
<material name="Mplus2p_JP0.png" shader="unlit" lazy-load="Y"/> <material name="Mplus2p_JP0.png" shader="unlit" dont-load="Y"/>
<material name="rasheeq0.png" shader="unlit" lazy-load="Y"/> <material name="rasheeq0.png" shader="unlit" dont-load="Y"/>
<material name="rasheeq3.png" shader="unlit" lazy-load="Y"/> <material name="rasheeq3.png" shader="unlit" dont-load="Y"/>
<material name="rasheeq4.png" shader="unlit" lazy-load="Y"/> <material name="rasheeq4.png" shader="unlit" dont-load="Y"/>
<material name="wqyMicroHei0.png" shader="unlit" lazy-load="Y"/> <material name="wqyMicroHei0.png" shader="unlit" dont-load="Y"/>
<material name="wqyMicroHei1.png" shader="unlit" lazy-load="Y"/> <material name="wqyMicroHei1.png" shader="unlit" dont-load="Y"/>
<material name="wqyMicroHei2.png" shader="unlit" lazy-load="Y"/> <material name="wqyMicroHei2.png" shader="unlit" dont-load="Y"/>
<material name="wqyMicroHei3.png" shader="unlit" lazy-load="Y"/> <material name="wqyMicroHei3.png" shader="unlit" dont-load="Y"/>
<material name="wqyMicroHei4.png" shader="unlit" lazy-load="Y"/> <material name="wqyMicroHei4.png" shader="unlit" dont-load="Y"/>
<material name="wqyMicroHei5.png" shader="unlit" lazy-load="Y"/> <material name="wqyMicroHei5.png" shader="unlit" dont-load="Y"/>
<material name="AR_PL_SungtiL_GB0.png" shader="unlit" lazy-load="Y"/> <material name="AR_PL_SungtiL_GB0.png" shader="unlit" dont-load="Y"/>
<material name="LayneHansomBigDigits.png" shader="unlit" lazy-load="Y"/> <material name="LayneHansomBigDigits.png" shader="unlit" dont-load="Y"/>
</materials> </materials>

View File

@ -73,7 +73,7 @@ Material::Material(const XMLNode *node, bool deprecated)
m_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str(); m_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str();
init(); init();
node->get("lazy-load", &m_lazy_load); node->get("dont-load", &m_dont_load_texture);
bool b = false; bool b = false;
node->get("clampu", &b); if (b) m_clamp_tex |= UCLAMP; //blender 2.4 style node->get("clampu", &b); if (b) m_clamp_tex |= UCLAMP; //blender 2.4 style
@ -420,7 +420,7 @@ Material::Material(const std::string& fname, bool is_full_path,
*/ */
void Material::init() void Material::init()
{ {
m_lazy_load = false; m_dont_load_texture = false;
m_texture = NULL; m_texture = NULL;
m_clamp_tex = 0; m_clamp_tex = 0;
m_shader_type = SHADERTYPE_SOLID; m_shader_type = SHADERTYPE_SOLID;
@ -465,8 +465,8 @@ void Material::init()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Material::install(bool is_full_path, bool complain_if_not_found) void Material::install(bool is_full_path, bool complain_if_not_found)
{ {
// Don't load a texture that is lazily loaded. // Don't load a texture that are not supposed to be loaded automatically
if(m_lazy_load) return; if(m_dont_load_texture) return;
const std::string &full_path = is_full_path const std::string &full_path = is_full_path
? m_texname ? m_texname
@ -477,6 +477,7 @@ void Material::install(bool is_full_path, bool complain_if_not_found)
Log::error("material", "Cannot find texture '%s'.", m_texname.c_str()); Log::error("material", "Cannot find texture '%s'.", m_texname.c_str());
m_texture = NULL; m_texture = NULL;
} }
else else
{ {
m_texture = irr_driver->getTexture(full_path, m_texture = irr_driver->getTexture(full_path,

View File

@ -91,7 +91,7 @@ private:
* at load time, it must be loaded elsewhere. This is used to store * at load time, it must be loaded elsewhere. This is used to store
* material settings for font textures, without loading fonts for * material settings for font textures, without loading fonts for
* languages that might not be needed at all. */ * languages that might not be needed at all. */
bool m_lazy_load; bool m_dont_load_texture;
/** Name of a special sfx to play when a kart is on this terrain, or /** Name of a special sfx to play when a kart is on this terrain, or
* "" if no special sfx exists. */ * "" if no special sfx exists. */
@ -267,10 +267,10 @@ public:
/** Returns the ITexture associated with this material. */ /** Returns the ITexture associated with this material. */
video::ITexture *getTexture() const video::ITexture *getTexture() const
{ {
// Note that atm lazy load means that the textures are not loaded // Note that dont load means that the textures are not loaded
// via the material. So getTexture should only get called for non // via the material. So getTexture should only get called for
// lazily loaded textures (used atm for font textures. // automatically loaded textures (used atm for font textures).
assert(!m_lazy_load); assert(!m_dont_load_texture);
return m_texture; return m_texture;
} // getTexture } // getTexture
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------