mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Transparency should be evaluated per subentity, not per NIF
This commit is contained in:
parent
cab5315a8e
commit
ca707aa65f
4 changed files with 24 additions and 79 deletions
|
@ -30,24 +30,13 @@ ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
|
|||
{
|
||||
Ogre::Entity *ent = mEntityList.mEntities[i];
|
||||
|
||||
bool transparent = false;
|
||||
for(unsigned int j=0;!transparent && j < ent->getNumSubEntities(); ++j)
|
||||
for(unsigned int j=0; j < ent->getNumSubEntities(); ++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = ent->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();
|
||||
}
|
||||
}
|
||||
Ogre::SubEntity* subEnt = ent->getSubEntity(j);
|
||||
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
|
||||
ent->setVisibilityFlags(RV_Misc);
|
||||
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
setAnimationSource(mesh);
|
||||
}
|
||||
|
|
|
@ -31,24 +31,12 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr)
|
|||
Ogre::Entity *ent = mEntityList.mEntities[i];
|
||||
ent->setVisibilityFlags(RV_Actors);
|
||||
|
||||
bool transparent = false;
|
||||
for(unsigned int j=0;!transparent && j < ent->getNumSubEntities(); ++j)
|
||||
for(unsigned int j=0; j < ent->getNumSubEntities(); ++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = ent->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();
|
||||
Ogre::SubEntity* subEnt = ent->getSubEntity(j);
|
||||
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
|
||||
std::vector<std::string> names;
|
||||
if((ref->mBase->mFlags&ESM::Creature::Biped))
|
||||
|
|
|
@ -107,24 +107,12 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
|||
if (mVisibilityFlags != 0)
|
||||
base->setVisibilityFlags(mVisibilityFlags);
|
||||
|
||||
bool transparent = false;
|
||||
for(unsigned int j=0;!transparent && j < base->getNumSubEntities();++j)
|
||||
for(unsigned int j=0; j < base->getNumSubEntities(); ++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = base->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();
|
||||
Ogre::SubEntity* subEnt = base->getSubEntity(j);
|
||||
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
base->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
|
||||
std::vector<std::string> skelnames(1, smodel);
|
||||
if(!mNpc->isMale() && !isBeast)
|
||||
|
@ -326,24 +314,12 @@ NifOgre::EntityList NpcAnimation::insertBoundedPart(const std::string &mesh, int
|
|||
if (mVisibilityFlags != 0)
|
||||
parts[i]->setVisibilityFlags(mVisibilityFlags);
|
||||
|
||||
bool transparent = false;
|
||||
for(unsigned int j=0;!transparent && j < parts[i]->getNumSubEntities();++j)
|
||||
for(unsigned int j=0; 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();
|
||||
Ogre::SubEntity* subEnt = parts[i]->getSubEntity(j);
|
||||
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
parts[i]->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
if(entities.mSkelBase)
|
||||
{
|
||||
Ogre::AnimationStateSet *aset = entities.mSkelBase->getAllAnimationStates();
|
||||
|
|
|
@ -129,36 +129,28 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool
|
|||
mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL;
|
||||
mBounds[ptr.getCell()].merge(bounds);
|
||||
|
||||
bool transparent = false;
|
||||
for(size_t i = 0;!transparent && i < entities.mEntities.size();i++)
|
||||
bool anyTransparency = false;
|
||||
for(size_t i = 0;!anyTransparency && i < entities.mEntities.size();i++)
|
||||
{
|
||||
Ogre::Entity *ent = entities.mEntities[i];
|
||||
for(unsigned int i=0;!transparent && i < ent->getNumSubEntities(); ++i)
|
||||
for(unsigned int i=0;!anyTransparency && i < ent->getNumSubEntities(); ++i)
|
||||
{
|
||||
Ogre::MaterialPtr mat = ent->getSubEntity(i)->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();
|
||||
}
|
||||
}
|
||||
anyTransparency = ent->getSubEntity(i)->getMaterial()->isTransparent();
|
||||
}
|
||||
}
|
||||
|
||||
if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") || transparent)
|
||||
if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") || anyTransparency)
|
||||
{
|
||||
for(size_t i = 0;i < entities.mEntities.size();i++)
|
||||
{
|
||||
Ogre::Entity *ent = entities.mEntities[i];
|
||||
|
||||
for(unsigned int i=0; i < ent->getNumSubEntities(); ++i)
|
||||
{
|
||||
Ogre::SubEntity* subEnt = ent->getSubEntity(i);
|
||||
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0);
|
||||
ent->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc);
|
||||
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -203,7 +195,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool
|
|||
|
||||
sg->setCastShadows(true);
|
||||
|
||||
sg->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
sg->setRenderQueueGroup(RQG_Main);
|
||||
|
||||
std::vector<Ogre::Entity*>::reverse_iterator iter = entities.mEntities.rbegin();
|
||||
while(iter != entities.mEntities.rend())
|
||||
|
|
Loading…
Reference in a new issue