I have obj wth mtl file:
listing mtl:
Code: Select all
...
newmtl material1
Ka 0.6 0.6 0.6
Kd 0.6 0.6 0.6
Ks 0.9 0.9 0.9
d 1.0
Ns 0.0
illum 2
map_Kd br.tga
bump br_bump.tga
#
newmtl material2
Ka 0.6 0.6 0.6
Kd 0.6 0.6 0.6
Ks 0.9 0.9 0.9
d 1.0
Ns 0.0
illum 2
map_Kd br.tga
bump br_bump.tga
...
Code: Select all
...
SceneManager->getVideoDriver()->makeNormalMapTexture(texture, bumpiness);
...
Engine read first material "material1", and do makeNormalMapTexture for "br_bump.tga"... and read second material "material2" AND do makeNormalMapTexture for "br_bump.tga" AGAIN - it's break texture..
Fix (dirty, but worked):
ITexture.h
Code: Select all
...
//! constructor
ITexture(const io::path& name) : Name(name)
{
Name.make_lower();
bumped=false; //fix
}
...
protected:
io::path Name;
public:
bool bumped; //fix
};
....
Code: Select all
...
void CNullDriver::makeNormalMapTexture(video::ITexture* texture, f32 amplitude) const
{
if (texture->bumped)
return;
....
texture->regenerateMipMapLevels();
texture->bumped = true;
}
....