forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'chris/transparency-fixes'
This commit is contained in:
commit
3961fb36d4
5 changed files with 37 additions and 27 deletions
|
@ -31,20 +31,18 @@ ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
|
||||||
Ogre::Entity *ent = mEntityList.mEntities[i];
|
Ogre::Entity *ent = mEntityList.mEntities[i];
|
||||||
|
|
||||||
bool transparent = false;
|
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::MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
|
||||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||||
while (techIt.hasMoreElements() && !transparent)
|
while(!transparent && techIt.hasMoreElements())
|
||||||
{
|
{
|
||||||
Ogre::Technique* tech = techIt.getNext();
|
Ogre::Technique* tech = techIt.getNext();
|
||||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||||
while (passIt.hasMoreElements() && !transparent)
|
while(!transparent && passIt.hasMoreElements())
|
||||||
{
|
{
|
||||||
Ogre::Pass* pass = passIt.getNext();
|
Ogre::Pass* pass = passIt.getNext();
|
||||||
|
transparent = pass->isTransparent();
|
||||||
if (pass->getDepthWriteEnabled() == false)
|
|
||||||
transparent = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,20 +32,18 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr)
|
||||||
ent->setVisibilityFlags(RV_Actors);
|
ent->setVisibilityFlags(RV_Actors);
|
||||||
|
|
||||||
bool transparent = false;
|
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::MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
|
||||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||||
while (techIt.hasMoreElements() && !transparent)
|
while(!transparent && techIt.hasMoreElements())
|
||||||
{
|
{
|
||||||
Ogre::Technique* tech = techIt.getNext();
|
Ogre::Technique* tech = techIt.getNext();
|
||||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||||
while (passIt.hasMoreElements() && !transparent)
|
while(!transparent && passIt.hasMoreElements())
|
||||||
{
|
{
|
||||||
Ogre::Pass* pass = passIt.getNext();
|
Ogre::Pass* pass = passIt.getNext();
|
||||||
|
transparent = pass->isTransparent();
|
||||||
if (pass->getDepthWriteEnabled() == false)
|
|
||||||
transparent = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,19 +107,18 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
||||||
base->setVisibilityFlags(mVisibilityFlags);
|
base->setVisibilityFlags(mVisibilityFlags);
|
||||||
|
|
||||||
bool transparent = false;
|
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::MaterialPtr mat = base->getSubEntity(j)->getMaterial();
|
||||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||||
while (techIt.hasMoreElements())
|
while(!transparent && techIt.hasMoreElements())
|
||||||
{
|
{
|
||||||
Ogre::Technique* tech = techIt.getNext();
|
Ogre::Technique* tech = techIt.getNext();
|
||||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||||
while (passIt.hasMoreElements())
|
while(!transparent && passIt.hasMoreElements())
|
||||||
{
|
{
|
||||||
Ogre::Pass* pass = passIt.getNext();
|
Ogre::Pass* pass = passIt.getNext();
|
||||||
if (pass->getDepthWriteEnabled() == false)
|
transparent = pass->isTransparent();
|
||||||
transparent = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -322,8 +321,26 @@ NifOgre::EntityList NpcAnimation::insertBoundedPart(const std::string &mesh, int
|
||||||
std::vector<Ogre::Entity*> &parts = entities.mEntities;
|
std::vector<Ogre::Entity*> &parts = entities.mEntities;
|
||||||
for(size_t i = 0;i < parts.size();i++)
|
for(size_t i = 0;i < parts.size();i++)
|
||||||
{
|
{
|
||||||
parts[i]->setVisibilityFlags(mVisibilityFlags);
|
|
||||||
parts[i]->getUserObjectBindings().setUserAny(Ogre::Any(group));
|
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)
|
if(entities.mSkelBase)
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,23 +130,21 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool
|
||||||
mBounds[ptr.getCell()].merge(bounds);
|
mBounds[ptr.getCell()].merge(bounds);
|
||||||
|
|
||||||
bool transparent = false;
|
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];
|
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::MaterialPtr mat = ent->getSubEntity(i)->getMaterial();
|
||||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||||
while (techIt.hasMoreElements())
|
while(!transparent && techIt.hasMoreElements())
|
||||||
{
|
{
|
||||||
Ogre::Technique* tech = techIt.getNext();
|
Ogre::Technique* tech = techIt.getNext();
|
||||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||||
while (passIt.hasMoreElements())
|
while(!transparent && passIt.hasMoreElements())
|
||||||
{
|
{
|
||||||
Ogre::Pass* pass = passIt.getNext();
|
Ogre::Pass* pass = passIt.getNext();
|
||||||
|
transparent = pass->isTransparent();
|
||||||
if (pass->getDepthWriteEnabled() == false)
|
|
||||||
transparent = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -710,8 +710,6 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String
|
||||||
blend_mode += getBlendFactor((alphaFlags>>1)&0xf);
|
blend_mode += getBlendFactor((alphaFlags>>1)&0xf);
|
||||||
blend_mode += " ";
|
blend_mode += " ";
|
||||||
blend_mode += getBlendFactor((alphaFlags>>5)&0xf);
|
blend_mode += getBlendFactor((alphaFlags>>5)&0xf);
|
||||||
|
|
||||||
instance->setProperty("depth_write", sh::makeProperty(new sh::StringValue("off")));
|
|
||||||
instance->setProperty("scene_blend", sh::makeProperty(new sh::StringValue(blend_mode)));
|
instance->setProperty("scene_blend", sh::makeProperty(new sh::StringValue(blend_mode)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -729,6 +727,7 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String
|
||||||
instance->setProperty("transparent_sorting", sh::makeProperty(new sh::StringValue(((alphaFlags>>13)&1) ?
|
instance->setProperty("transparent_sorting", sh::makeProperty(new sh::StringValue(((alphaFlags>>13)&1) ?
|
||||||
"off" : "on")));
|
"off" : "on")));
|
||||||
|
|
||||||
|
sh::Factory::getInstance()._ensureMaterial(matname, "Default");
|
||||||
return matname;
|
return matname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue