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