mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Support multiple meshes for creatures
This commit is contained in:
parent
6047dc6a0c
commit
0a4a141f2e
@ -23,7 +23,6 @@ Animation::Animation(OEngine::Render::OgreRenderer& _rend)
|
||||
, mShapeIndexI()
|
||||
, mTransformations(NULL)
|
||||
, mTextmappings(NULL)
|
||||
, mBase(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef _GAME_RENDER_ANIMATION_H
|
||||
#define _GAME_RENDER_ANIMATION_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
#include <components/nif/node.hpp>
|
||||
@ -37,7 +39,7 @@ protected:
|
||||
|
||||
std::vector<Nif::NiKeyframeData>* mTransformations;
|
||||
std::map<std::string,float>* mTextmappings;
|
||||
Ogre::Entity* mBase;
|
||||
std::vector<Ogre::Entity*> mBase;
|
||||
void handleAnimationTransforms();
|
||||
bool timeIndex( float time, const std::vector<float> & times, int & i, int & j, float & x );
|
||||
|
||||
|
@ -26,32 +26,35 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, OEngine::Render::O
|
||||
{
|
||||
std::string mesh = "meshes\\" + ref->base->model;
|
||||
|
||||
// FIXME: There can be more than one!
|
||||
NifOgre::MeshPairList meshes = NifOgre::NIFLoader::load(mesh);
|
||||
mBase = mRend.getScene()->createEntity(meshes[0].first->getName());
|
||||
mBase->setVisibilityFlags(RV_Actors);
|
||||
|
||||
bool transparent = false;
|
||||
for (unsigned int i=0; i < mBase->getNumSubEntities(); ++i)
|
||||
for(size_t i = 0;i < meshes.size();i++)
|
||||
{
|
||||
Ogre::MaterialPtr mat = mBase->getSubEntity(i)->getMaterial();
|
||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||
while (techIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Technique* tech = techIt.getNext();
|
||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||
while (passIt.hasMoreElements())
|
||||
{
|
||||
Ogre::Pass* pass = passIt.getNext();
|
||||
mBase.push_back(mRend.getScene()->createEntity(meshes[i].first->getName()));
|
||||
Ogre::Entity *base = mBase.back();
|
||||
base->setVisibilityFlags(RV_Actors);
|
||||
|
||||
if (pass->getDepthWriteEnabled() == false)
|
||||
transparent = true;
|
||||
bool transparent = false;
|
||||
for (unsigned int j=0;j < base->getNumSubEntities() && !transparent; ++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = base->getSubEntity(j)->getMaterial();
|
||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||
while (techIt.hasMoreElements() && !transparent)
|
||||
{
|
||||
Ogre::Technique* tech = techIt.getNext();
|
||||
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
|
||||
while (passIt.hasMoreElements() && !transparent)
|
||||
{
|
||||
Ogre::Pass* pass = passIt.getNext();
|
||||
|
||||
if (pass->getDepthWriteEnabled() == false)
|
||||
transparent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mBase->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
base->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
|
||||
mInsert->attachObject(mBase);
|
||||
mInsert->attachObject(base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ private:
|
||||
Ogre::Entity* head;
|
||||
|
||||
Ogre::SceneNode* mInsert;
|
||||
Ogre::Entity *mBase; // FIXME: Temporary!
|
||||
bool isBeast;
|
||||
bool isFemale;
|
||||
std::string headModel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user