forked from mirror/openmw-tes3mp
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)
This commit is contained in:
parent
b05f780675
commit
0d9dde0fcf
2 changed files with 22 additions and 2 deletions
|
@ -581,8 +581,27 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou
|
||||||
{
|
{
|
||||||
// Use NiMaterialProperty data to create the data
|
// Use NiMaterialProperty data to create the data
|
||||||
const S_MaterialProperty *d = m->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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,6 +132,7 @@ class NIFLoader : Ogre::ManualResourceLoader
|
||||||
int numbers;
|
int numbers;
|
||||||
int stack;
|
int stack;
|
||||||
|
|
||||||
|
std::multimap<std::string,std::string> MaterialMap;
|
||||||
|
|
||||||
// pointer to the ogre mesh which is currently build
|
// pointer to the ogre mesh which is currently build
|
||||||
Ogre::Mesh *mesh;
|
Ogre::Mesh *mesh;
|
||||||
|
|
Loading…
Reference in a new issue