Silence many of the annoying warnings that are printed when loading the overworld
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10757 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
973a7cd4bb
commit
e346b44ba1
@ -860,7 +860,8 @@ void IrrDriver::removeCameraSceneNode(scene::ICameraSceneNode *camera)
|
|||||||
*/
|
*/
|
||||||
video::ITexture *IrrDriver::getTexture(const std::string &filename,
|
video::ITexture *IrrDriver::getTexture(const std::string &filename,
|
||||||
bool is_premul,
|
bool is_premul,
|
||||||
bool is_prediv)
|
bool is_prediv,
|
||||||
|
bool complain_if_not_found)
|
||||||
{
|
{
|
||||||
video::ITexture* out;
|
video::ITexture* out;
|
||||||
if(!is_premul && !is_prediv)
|
if(!is_premul && !is_prediv)
|
||||||
@ -923,13 +924,12 @@ video::ITexture *IrrDriver::getTexture(const std::string &filename,
|
|||||||
out = m_video_driver->addTexture(filename.c_str(), img, NULL);
|
out = m_video_driver->addTexture(filename.c_str(), img, NULL);
|
||||||
} // if is_premul or is_prediv
|
} // if is_premul or is_prediv
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
if (out == NULL)
|
if (complain_if_not_found && out == NULL)
|
||||||
{
|
{
|
||||||
printf("[IrrDriver] Texture '%s' not found; Put a breakpoint at line %s:%i to debug!\n",
|
printf("[IrrDriver] Texture '%s' not found; Put a breakpoint at line %s:%i to debug!\n",
|
||||||
filename.c_str(), __FILE__, __LINE__);
|
filename.c_str(), __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
} // getTexture
|
} // getTexture
|
||||||
|
@ -144,7 +144,8 @@ public:
|
|||||||
void setAmbientLight(const video::SColor &light);
|
void setAmbientLight(const video::SColor &light);
|
||||||
video::ITexture *getTexture(const std::string &filename,
|
video::ITexture *getTexture(const std::string &filename,
|
||||||
bool is_premul=false,
|
bool is_premul=false,
|
||||||
bool is_prediv=false);
|
bool is_prediv=false,
|
||||||
|
bool complain_if_not_found=true);
|
||||||
void grabAllTextures(const scene::IMesh *mesh);
|
void grabAllTextures(const scene::IMesh *mesh);
|
||||||
void dropAllTextures(const scene::IMesh *mesh);
|
void dropAllTextures(const scene::IMesh *mesh);
|
||||||
scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL,
|
scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL,
|
||||||
|
@ -471,11 +471,12 @@ Material::Material(const XMLNode *node, int index)
|
|||||||
* \param index Unique index in material_manager.
|
* \param index Unique index in material_manager.
|
||||||
* \param is_full_path If the fname contains the full path.
|
* \param is_full_path If the fname contains the full path.
|
||||||
*/
|
*/
|
||||||
Material::Material(const std::string& fname, int index, bool is_full_path)
|
Material::Material(const std::string& fname, int index, bool is_full_path,
|
||||||
|
bool complain_if_not_found)
|
||||||
{
|
{
|
||||||
m_texname = fname;
|
m_texname = fname;
|
||||||
init(index);
|
init(index);
|
||||||
install(is_full_path);
|
install(is_full_path, complain_if_not_found);
|
||||||
} // Material
|
} // Material
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -537,19 +538,22 @@ void Material::init(unsigned int index)
|
|||||||
} // init
|
} // init
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Material::install(bool is_full_path)
|
void Material::install(bool is_full_path, bool complain_if_not_found)
|
||||||
{
|
{
|
||||||
const std::string &full_path = is_full_path
|
const std::string &full_path = is_full_path
|
||||||
? m_texname
|
? m_texname
|
||||||
: file_manager->getTextureFile(m_texname);
|
: file_manager->getTextureFile(m_texname);
|
||||||
|
|
||||||
if (full_path.size() == 0)
|
if (complain_if_not_found && full_path.size() == 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[Material] WARNING, cannot find texture '%s'\n", m_texname.c_str());
|
fprintf(stderr, "[Material] WARNING, cannot find texture '%s'\n", m_texname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_texture = irr_driver->getTexture(full_path,
|
m_texture = irr_driver->getTexture(full_path,
|
||||||
isPreMul(), isPreDiv());
|
isPreMul(),
|
||||||
|
isPreDiv(),
|
||||||
|
complain_if_not_found);
|
||||||
|
|
||||||
if (m_texture == NULL) return;
|
if (m_texture == NULL) return;
|
||||||
|
|
||||||
|
@ -210,14 +210,15 @@ private:
|
|||||||
std::map<scene::IMeshBuffer*, BubbleEffectProvider*> m_bubble_provider;
|
std::map<scene::IMeshBuffer*, BubbleEffectProvider*> m_bubble_provider;
|
||||||
|
|
||||||
void init (unsigned int index);
|
void init (unsigned int index);
|
||||||
void install (bool is_full_path=false);
|
void install (bool is_full_path=false, bool complain_if_not_found=true);
|
||||||
void initCustomSFX(const XMLNode *sfx);
|
void initCustomSFX(const XMLNode *sfx);
|
||||||
void initParticlesEffect(const XMLNode *node);
|
void initParticlesEffect(const XMLNode *node);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Material(const XMLNode *node, int index);
|
Material(const XMLNode *node, int index);
|
||||||
Material(const std::string& fname, int index,
|
Material(const std::string& fname, int index,
|
||||||
bool is_full_path=false);
|
bool is_full_path=false,
|
||||||
|
bool complain_if_not_found=true);
|
||||||
~Material ();
|
~Material ();
|
||||||
|
|
||||||
void setSFXSpeed(SFXBase *sfx, float speed) const;
|
void setSFXSpeed(SFXBase *sfx, float speed) const;
|
||||||
|
@ -265,7 +265,8 @@ void MaterialManager::popTempMaterial()
|
|||||||
*/
|
*/
|
||||||
Material *MaterialManager::getMaterial(const std::string& fname,
|
Material *MaterialManager::getMaterial(const std::string& fname,
|
||||||
bool is_full_path,
|
bool is_full_path,
|
||||||
bool make_permanent)
|
bool make_permanent,
|
||||||
|
bool complain_if_not_found)
|
||||||
{
|
{
|
||||||
if(fname=="")
|
if(fname=="")
|
||||||
{
|
{
|
||||||
@ -287,7 +288,7 @@ Material *MaterialManager::getMaterial(const std::string& fname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the new material
|
// Add the new material
|
||||||
Material* m=new Material(fname, m_materials.size(), is_full_path);
|
Material* m=new Material(fname, m_materials.size(), is_full_path, complain_if_not_found);
|
||||||
m_materials.push_back(m);
|
m_materials.push_back(m);
|
||||||
if(make_permanent)
|
if(make_permanent)
|
||||||
{
|
{
|
||||||
|
@ -62,8 +62,10 @@ public:
|
|||||||
void setAllUntexturedMaterialFlags(scene::IMeshBuffer *mb) const;
|
void setAllUntexturedMaterialFlags(scene::IMeshBuffer *mb) const;
|
||||||
|
|
||||||
int addEntity (Material *m);
|
int addEntity (Material *m);
|
||||||
Material *getMaterial (const std::string& t, bool is_full_path=false,
|
Material *getMaterial (const std::string& t,
|
||||||
bool make_permanent=false);
|
bool is_full_path=false,
|
||||||
|
bool make_permanent=false,
|
||||||
|
bool complain_if_not_found=true);
|
||||||
void addSharedMaterial(const std::string& filename);
|
void addSharedMaterial(const std::string& filename);
|
||||||
bool pushTempMaterial (const std::string& filename);
|
bool pushTempMaterial (const std::string& filename);
|
||||||
bool pushTempMaterial (const XMLNode *root, const std::string& filename);
|
bool pushTempMaterial (const XMLNode *root, const std::string& filename);
|
||||||
|
@ -539,7 +539,12 @@ void Track::convertTrackToBullet(scene::ISceneNode *node)
|
|||||||
if(t)
|
if(t)
|
||||||
{
|
{
|
||||||
std::string image = std::string(core::stringc(t->getName()).c_str());
|
std::string image = std::string(core::stringc(t->getName()).c_str());
|
||||||
material=material_manager->getMaterial(StringUtils::getBasename(image));
|
|
||||||
|
// the third boolean argument is false because at this point we're
|
||||||
|
// dealing physics, so it's useless to warn about missing textures,
|
||||||
|
// we'd just get duplicate/useless warnings
|
||||||
|
material=material_manager->getMaterial(StringUtils::getBasename(image),
|
||||||
|
false, false, false);
|
||||||
// Special gfx meshes will not be stored as a normal physics body,
|
// Special gfx meshes will not be stored as a normal physics body,
|
||||||
// but converted to a collision body only, so that ray tests
|
// but converted to a collision body only, so that ray tests
|
||||||
// against them can be done.
|
// against them can be done.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user