experimental: each material with the same texture is loaded only once. Problem: it doesn't take into account other material properties (which seems to be always the same anyway)

pull/21/head
gugus 14 years ago
parent b05f780675
commit 0d9dde0fcf

@ -581,8 +581,27 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou
{
// Use NiMaterialProperty data to create the data
const S_MaterialProperty *d = m->data;
createMaterial(material, d->ambient, d->diffuse, d->specular, d->emissive,
d->glossiness, d->alpha, alphaFlags, alphaTest, texName);
std::multimap<std::string,std::string>::iterator itr = MaterialMap.find(texName);
std::multimap<std::string,std::string>::iterator lastElement;
lastElement = MaterialMap.upper_bound(texName);
if (itr != MaterialMap.end())
{
for ( ; itr != lastElement; ++itr)
{
//std::cout << "OK!";
//MaterialPtr mat = MaterialManager::getSingleton().getByName(itr->second,recourceGroup);
material = itr->second;
//if( mat->getA
}
}
else
{
//std::cout << "new";
createMaterial(material, d->ambient, d->diffuse, d->specular, d->emissive,
d->glossiness, d->alpha, alphaFlags, alphaTest, texName);
MaterialMap.insert(std::make_pair(texName,material));
}
}
else
{

@ -132,6 +132,7 @@ class NIFLoader : Ogre::ManualResourceLoader
int numbers;
int stack;
std::multimap<std::string,std::string> MaterialMap;
// pointer to the ogre mesh which is currently build
Ogre::Mesh *mesh;

Loading…
Cancel
Save