forked from mirror/openmw-tes3mp
Fix transparency checks
This commit is contained in:
parent
166d529c50
commit
238a8feb18
4 changed files with 36 additions and 22 deletions
|
@ -31,19 +31,18 @@ ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
|
|||
Ogre::Entity *ent = mEntityList.mEntities[i];
|
||||
|
||||
bool transparent = false;
|
||||
for (unsigned int j=0;j < ent->getNumSubEntities() && !transparent; ++j)
|
||||
for(unsigned int j=0;!transparent && j < ent->getNumSubEntities(); ++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
|
||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||
while (techIt.hasMoreElements() && !transparent)
|
||||
while(!transparent && techIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Technique* tech = techIt.getNext();
|
||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||
while (passIt.hasMoreElements() && !transparent)
|
||||
while(!transparent && passIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Pass* pass = passIt.getNext();
|
||||
if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO)
|
||||
transparent = true;
|
||||
transparent = pass->isTransparent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,19 +32,18 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr)
|
|||
ent->setVisibilityFlags(RV_Actors);
|
||||
|
||||
bool transparent = false;
|
||||
for (unsigned int j=0;j < ent->getNumSubEntities() && !transparent; ++j)
|
||||
for(unsigned int j=0;!transparent && j < ent->getNumSubEntities(); ++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
|
||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||
while (techIt.hasMoreElements() && !transparent)
|
||||
while(!transparent && techIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Technique* tech = techIt.getNext();
|
||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||
while (passIt.hasMoreElements() && !transparent)
|
||||
while(!transparent && passIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Pass* pass = passIt.getNext();
|
||||
if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO)
|
||||
transparent = true;
|
||||
transparent = pass->isTransparent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,19 +107,18 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
|||
base->setVisibilityFlags(mVisibilityFlags);
|
||||
|
||||
bool transparent = false;
|
||||
for(unsigned int j=0;j < base->getNumSubEntities();++j)
|
||||
for(unsigned int j=0;!transparent && j < base->getNumSubEntities();++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = base->getSubEntity(j)->getMaterial();
|
||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||
while (techIt.hasMoreElements())
|
||||
while(!transparent && techIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Technique* tech = techIt.getNext();
|
||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||
while (passIt.hasMoreElements())
|
||||
while(!transparent && passIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Pass* pass = passIt.getNext();
|
||||
if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO)
|
||||
transparent = true;
|
||||
transparent = pass->isTransparent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,8 +321,26 @@ NifOgre::EntityList NpcAnimation::insertBoundedPart(const std::string &mesh, int
|
|||
std::vector<Ogre::Entity*> &parts = entities.mEntities;
|
||||
for(size_t i = 0;i < parts.size();i++)
|
||||
{
|
||||
parts[i]->setVisibilityFlags(mVisibilityFlags);
|
||||
parts[i]->getUserObjectBindings().setUserAny(Ogre::Any(group));
|
||||
parts[i]->setVisibilityFlags(mVisibilityFlags);
|
||||
|
||||
bool transparent = false;
|
||||
for(unsigned int j=0;!transparent && j < parts[i]->getNumSubEntities();++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = parts[i]->getSubEntity(j)->getMaterial();
|
||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||
while(!transparent && techIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Technique* tech = techIt.getNext();
|
||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||
while(!transparent && passIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Pass* pass = passIt.getNext();
|
||||
transparent = pass->isTransparent();
|
||||
}
|
||||
}
|
||||
}
|
||||
parts[i]->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
if(entities.mSkelBase)
|
||||
{
|
||||
|
|
|
@ -134,22 +134,21 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool
|
|||
mBounds[ptr.getCell()].merge(bounds);
|
||||
|
||||
bool transparent = false;
|
||||
for(size_t i = 0;i < entities.mEntities.size();i++)
|
||||
for(size_t i = 0;!transparent && i < entities.mEntities.size();i++)
|
||||
{
|
||||
Ogre::Entity *ent = entities.mEntities[i];
|
||||
for (unsigned int i=0; i<ent->getNumSubEntities(); ++i)
|
||||
for(unsigned int i=0;!transparent && i < ent->getNumSubEntities(); ++i)
|
||||
{
|
||||
Ogre::MaterialPtr mat = ent->getSubEntity(i)->getMaterial();
|
||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||
while (techIt.hasMoreElements())
|
||||
while(!transparent && techIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Technique* tech = techIt.getNext();
|
||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||
while (passIt.hasMoreElements())
|
||||
while(!transparent && passIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Pass* pass = passIt.getNext();
|
||||
if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO)
|
||||
transparent = true;
|
||||
transparent = pass->isTransparent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue